Starting about a month ago, I started getting lots of crackling audio in games. Not sure what the issue is. It tends to be with loud noises, almost sounds like clipping.
Anyone else had this?
Edit: Fixed by installing realtime-privileges (arch) and adding my user to the realtime group
Usually crackling is buffer underruns. The sound hardware exhausts the buffered sound before the software can fill the buffer again.
Larger buffer or less stuff slowing down whatever’s filling the buffer. I’m typing this with one hand while I eat pizza, but give me a few minutes and I’ll give you some suggestions.
EDIT: Okay, took me a few hours instead of a few minutes.
The PULSE_LATENCY_MSEC reference in another comment is a way to increase buffer size at the Pulseaudio level if the program in question is’re using pulseaudio (probably yes, as I think that WINE always goes through PulseAudio today).
You can set this persistently and systemwide for PulseAudio in
/etc/pulse/daemon.conf
with thedefault-fragments
anddefault-fragment-size-msec
.For PipeWire, the newer system, you can set this at a per-user level using
pw-metadata
like so:https://wiki.debian.org/PipeWire
I don’t know how the two typically interact today, unfortunately — most Linux audio systems to date have had some form of emulation of each other, which somewhat complicates matters. When I play back audio from
mpv
today using the PipeWire audio output plugin, I see a stream both inpavucontrol
, which is PulseAudio’s mixer, and inpw-top
, which is a PipeWire tool. Same thing happened with all of PulseAudio and ALSA and with ALSA and OSS in the past.