Featured image of post Fix Pipewire audio crackling/popping while running Wine or CPU intensive programs.

Fix Pipewire audio crackling/popping while running Wine or CPU intensive programs.

Weird issue with Pipewire I encounter every time I'm doing a lot on my system or just running a basic Wine program. Figured others might run into it and decided to post about it here.

Last updated on Feb 22, 2025 15:12 CET

The Issue

For some odd reason, no matter what distro I use, every time I’m doing something mildly CPU intensive or any Wine program, if I have any audio playing in the background, it’s going to start crackling and make popping sounds constantly.

It is a problem I dealt with for so long, and any fix or solution I found and tried didn’t work at all. It is basically my main reason why I always switch back to using Windows because the issue wasn’t there. That is until recently when I came across this Reddit comment on a post where someone has the same issue as me, and when I tried what the commenter said to do, it worked!

I don’t know why these settings aren’t the default on Pipewire or on many other mainstream desktop Linux distros. There probably is a legitimate reason why they aren’t the default, but I honestly don’t want to know because of how dumb the development of modern Linux desktop components (Wayland, Pipewire, GNOME, KDE etc.) is, and I really don’t wanna write a separate blogpost where I rant about it because I’ll definitely get something wrong, but the tl;dr, desktop Linux is dumb and slow in my opinion.

Solution 1

ā„¹ļø This portion was rewritten on Feb 22nd because upon testing this on both Ubuntu and Fedora, it breaks audio completely. I don’t know why.

šŸ”Š Applying this will introduce some minor latency to your audio (4-5ms).

Copy these two configuration files from /usr/share/pipewire/1 into ~/.config/pipewire (create directory if it doesn’t exist):

  • pipewire.conf
  • pipewire-pulse.conf

in pipewire.conf, find the context.properties section and edit these lines to the following values:

1
2
default.clock.quantum       = 1024
default.clock.min-quantum   = 1024

remove the # (commments) of course

then in pipewire-pulse.conf, find stream.properties and edit this line to the following value:

1
  resample.quality = 10

now find pulse.properties and edit these lines to the following values:

1
2
3
4
  pulse.min.req          = 1024/48000
  pulse.default.req      = 1024/48000
  pulse.min.frag         = 256/48000
  pulse.min.quantum      = 256/48000

Afterwards, restart Pipewire or re-login to apply the changes and try to replicate the problem.

If you don’t notice any difference, feel free to to adjust pulse.min.frag and pulse.min.quantum ā€˜256’ values to whatever works for you.

āš ļø If your system becomes unstable/unusable after applying these changes, try to open a terminal or login into a TTY (CTRL + ALT + F2/F3/F4…), delete the configs (rm -r ~/.config/pipewire) and restart.

Solution 2 (best for VMs probably)

If the above method didn’t work, you might have more luck with a solution to fix stuttering audio in VMs on Pipewire’s Troubleshooting wiki page, although I think at some point that was implemented directly into Pipewire since I haven’t noticed any stuttering audio no matter what VM software I use.

In any case, here’s how to apply the fix:

Either in /etc/wireplumber or ~/.config/wireplumber (create directories if they don’t exist), create a folder called wireplumber.conf.d.

Inside that folder, create a config file called 50-alsa-config.conf and paste the following into the file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
monitor.alsa.rules = [
  {
    matches = [
      # This matches the value of the 'node.name' property of the node.
      {
        node.name = "~alsa_output.*"
      }
    ]
    actions = {
      # Apply all the desired node specific settings here.
      update-props = {
        api.alsa.period-size   = 1024
        api.alsa.headroom      = 8192
      }
    }
  }
]

Afterwards, restart Wireplumber or re-login to apply the changes and try to replicate the problem.

Very VM specific fix

If you are fixing audio in a VM, also disable Firefox’s text-to-speech feature by going into the about:config page and changing the following values to false:

  • reader.parse-on-load.enabled
  • media.webspeech.synth.enabled

Conclusion

I seriously don’t understand why the first solution isn’t already all set by default. It could be just my weird early 2010’s ā€œā€œā€œgamingā€ā€ā€ motherboard’s audio hardware or even because I’m using an NVIDIA card but whatever. At least I found a solution to that super annoying problem, and I hope it solves your problem too!

please send me an email if you encounter an oddity in the guide or you hit some weird and arbitrary roadblock.


  1. Directory location may vary from distro to distro. Visit pkgs.org and find your distro. ā†©ļøŽ

Maintained on EndeavourOS. Greetings from šŸ‡·šŸ‡ø
Built with Hugo
Theme Stack designed by Jimmy
Contact me via e-mail!

Feed of cool peeps:
OMG HAIIIIIII :33333333