Severe Pipewire popping and cracking
submitted 5 months ago by cammelspit@lemm.ee
Hey, so I am losing my mind here. I can NOT get rid of this severe popping and crackling I get on all audio on all sources and all outputs. I am running pipewire as the audio system but I just cant get it to stop. I have already altered my pipewire.conf as seems to be the only thing the internet at large will ever recommend, it has ZERO effect. as an example...
default.clock.quantum = 4096
default.clock.min-quantum = 4096
default.clock.max-quantum = 8192
I have used values starting at 16 and doubled it every time and tested it up to some pretty massive values, 8192 so far and nothing. Below is the output of pw-top just so you know I am not joking as to the values I have tried.
ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
R 56 4096 48000 55.0us 11.1us 0.00 0.00 0 S16LE 2 48000 alsa_output.pci
R 61 3600 48000 22.9us 19.5us 0.00 0.00 0 F32LE 2 48000 + Firefox
Ive tried dozens of different value, I've tried different rates, nothing. I have already posted on Reddit, that didn't help because as soon as I tried the values and that didn't work, no one ever responded again.
For completeness, I am running in a VM but it's a unique situation. I am running an Arch guest on a Slackware host. I have a dedicated GPU passed through properly and it does indeed have multi-function enabled. I am running an AMD 7950X with half the cores dedicated to the gaming VM and the other half left for the host as it pulls double duty as a storage, container, and virtualization host. I have 64GB of DDR5 and it is running at 6000 with even matching the XMP profile. The system is under very little load during testing but it makes zero difference what the load is anyway.
As a sanity check I spun up a Windows VM with identical settings except for the TPM stuff and it ran fine. I used to run pop_OS for a short time and I don't recall this ever being an issue there but it's been a while. However, if it were doing it there, I would have noticed.
I predominantly use this setup in my living room as a gaming centric VM that also pulls double duty as a Media center type thing so the audio issues are a deal breaker. I do this since this just happens to be where my server and the desk shelf are located, in the living room, so it makes sense to use this kind of setup. 9x out of 10 I am using the HDMI output of the nVidia 3070 TI but I do use a USB DAC and I have tested it. I also have tested Bluetooth output which seems ALMOST unaffected but laggy by almost a second or more so essentially unusable so I stick with the USB DAC instead if I need to use headphones. I could have sworn I head the pops just quietly when Bluetooth audio was playing but I could have been imagining it.
Please help, I am at my wits end, google, Arch wiki, driver updates, downgrades, betas, different kernels, I have tried everything I can possibly think of and nothing works.
Any help you guys can provide would be purely awesome. I have been using Arch now for maybe 5-6 months now and I am getting used to it and starting to really love what it is but this audio issues has been a thorn in my side the whole time and I am about ready to start distro hopping to try and find something that doesn't have this issue. Please, help!
Thanks!
That sounds like timer related. I would guess Windows just bloats up the buffer a lot to make it work, or you've enabled some Hyper-V enhancements that makes Windows happy.
You can also switch to interrupt scheduled audio instead of timer scheduled. Also, how about direct ALSA like aplay direct to your hardware? That's a good sanity check because that rules out PipeWire entirely. You could also see if PulseAudio handles it okay, then we can compare what PA and PW does different.
Post your VM config maybe? Works fine for me with whatever virt-manager added by default. I do have cores pinned and high priority so it doesn't cause latency spikes in the VM, the worst thing that can happen for audio is latency spikes and bad timers.
Whelp, it plays a 48000Hz sine wave through aplay just fine... I used sox to generate it. I'll be frank, I am not entirely sure how else to test the audio system aside from just playing something. I believe pipewire being chosen as the default audio subsystem means pulse audio itself inst even needed or installed by arch install since pipewire has inbuilt compatibility with it, right? If this is the case, then I do not have pulse audio installed separately.
I would post my VM config but for some reason it's not working? Ill try a pastebin...
Yeah, PipeWire is the replacement, but you can still remove PipeWire and install PulseAudio again for testing. It's just not default anymore.
Here it is...
https://pastebin.com/M4LiUL5T
Looks pretty close to mine, especially timers. I don't know, something's weird. I use cache=none for my disks but I don't think writethrough would cause the VM to lag, only disk IO.
Sorry for the late reply, I spent some time in a hospital and haven't been back for more than a couple of days. Anyways, I disabled pipewire, masked the services because they kept auto enabling themselves, installed and started pulseaudio and pulseaudio-alsa and audio is now 100% pop and crackle free. I know pulseaudio doesn't have as good latency but for me it seems to work great. I am running a bunch of Ai image generation with stable diffusion in the background right now to load up my system/VM and running plex at the same time and the audio seems stable and pop free. So this proves the VM itself and my settings for it are not the issue and it is something with pipewire itself. At least it focuses the troubleshooting... ¯\_(ツ)_/¯
Probably worth a bug report on PipeWire for it then, that way they can fix it for everyone. It's not the first time audio in VMs has been wonky with PipeWire, I've had issues previously, it got reported and promptly fixed.
Very good point, I will do so indeed and post the link to the issue here when I do. Thanks for the assist.
Currently I am playing round with the clock and timer settings hoping to get this working as close to 'real time' as possible.
Try setting the rate to 44100 and only that, no double rate support; most games try to output at that rate and don't deal well with being upsampled to 48000.
Funny you mentioned that, I was just doing that exact thing for the third time about 3 minutes before I posted this. I guess I must have forgotten to clarify that it had been tried. Thanks for the tip.
When I debugged my crackling sound I followed various advice that said to enable 44100 in addition to 48000 and it fixed nothing. Then I disabled 48000 and it worked because the auto-switching refused to work. (And of course the other computer runs the same games just fine on 48000 because things can't ever be simple.)
That's why I mentioned it.
I appreciate your input. Thankfully I did verify the rate changes were actually being applied. I could play around a bit more and see what I can pull off, fully disabling 48000 suppord I dont believe I have ever done so I will give it a go. At this point, anything is worth doing :D.