PulseAudio audio crackling? Fix it in 5 minutes
Audio crackling in PulseAudio is usually a buffer timing issue. The quick fix is to tweak the timer-scheduling and default-fragments. I'll show you how.
Quick answer (for the impatient)
Open /etc/pulse/default.pa as root, find the line load-module module-udev-detect and change it to load-module module-udev-detect tsched=0. Then run pulseaudio -k to restart PulseAudio. If it works, you're done.
Why this happens
Audio crackling or distortion in PulseAudio is almost always a buffer underrun. That means your computer isn't feeding audio data to the sound card fast enough. Think of it like a car engine that stalls because it's not getting enough gas.
PulseAudio uses timer-based scheduling by default. On many machines, this causes the audio buffer to be too small or the timing to be off. The result? Pop, crackle, hiss. It's especially common on systems with older hardware, USB audio devices, or when you're doing something CPU-heavy like compiling code or playing a game.
I've seen this on Ubuntu 22.04, Fedora 38, and Linux Mint 21. The fix is the same across all of them.
Fix step-by-step
- Open a terminal. Run
sudo nano /etc/pulse/default.pa - Find the line that says
load-module module-udev-detect. It's usually near the top. - Change it to:
load-module module-udev-detect tsched=0 - Save the file (Ctrl+O, then Enter), then exit (Ctrl+X).
- Now restart PulseAudio:
pulseaudio -k - Check if the crackling is gone. Play a song or a video test.
That's it. The tsched=0 parameter disables timer-based scheduling. PulseAudio will fall back to interrupt-based audio, which is more reliable on most hardware.
If that doesn't fix it
Sometimes the crackling is caused by a too-small buffer. Let's try increasing the fragment size.
- Open
/etc/pulse/daemon.confwithsudo nano /etc/pulse/daemon.conf - Find or add these lines (they might be commented out with a semicolon):
default-fragments = 8
default-fragment-size-msec = 25
Save, exit, then restart PulseAudio again with pulseaudio -k. If you don't have those lines, just add them at the end.
These values give a bigger buffer. The audio card gets more time to process data before the next chunk arrives. I use 8 fragments of 25ms on my old ThinkPad, and it works perfectly.
Alternative fix: change ALSA buffer
If PulseAudio tweaks don't help, the issue might be deeper in ALSA (the layer below PulseAudio).
- Create or edit
~/.asoundrc:nano ~/.asoundrc - Add this:
defaults.pcm.dma_buffer_size 16384
defaults.pcm.period_size 2048
defaults.pcm.periods 4
Save, exit, and restart PulseAudio. This increases the ALSA DMA buffer. It's a bit more technical, but it works when nothing else does.
Prevention tip
Once you fix the crackling, it usually stays fixed. But if you update PulseAudio or your kernel, the settings might get overwritten. I keep a backup of my /etc/pulse/default.pa file just in case.
Also, if you're using a USB headset or external DAC, try plugging it into a different USB port. USB 2.0 ports are sometimes more stable than 3.0 for audio. I learned that the hard way with a Focusrite Scarlett.
"I spent hours trying to fix crackling audio. The tsched=0 trick took 30 seconds. Do that first." — Reddit user, r/linuxaudio
That's it. Audio crackling in PulseAudio is annoying, but the fix is simple. If you still have problems after these steps, check if your system has a known issue with your specific sound card. For example, Realtek ALC892 on some motherboards needs a kernel parameter snd-hda-intel model=auto. But that's rare. 90% of the time, the tsched=0 fix works.
Was this solution helpful?