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:
|
|
remove the # (commments) of course
then in pipewire-pulse.conf, find stream.properties and edit this line to the following value:
|
|
now find pulse.properties and edit these lines to the following values:
|
|
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:
|
|
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.