Recently I'm having an issue for which audio crackles when I run VirtualBox in Ubuntu 20.04.
If I then execute pulseaudio -k
it does fix it (upon restarting programs), but still this workaround is not great.
Sometimes (much rarely though) this also happens without opening VirtualBox, just by watching a video on Firefox.
I currently have the HWE kernel 5.8.0-59-generic #66~20.04.1-Ubuntu
and my audio system is the onboard analog device as following (aplay --list-device
):
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
And this is what reported by lspci -v
:
10:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller
Subsystem: ASRock Incorporation Starship/Matisse HD Audio Controller
Flags: bus master, fast devsel, latency 0, IRQ 135
Memory at fcb00000 (32-bit, non-prefetchable) [size=32K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
Not sure what to do next? How could I debug/investigate this further?
Thanks!
The issue was also easily triggered when changing the output (and/or input) sink in the Sound menu (from integrated audio to HDMI).
I managed to make it less frequent by having pulseaudio avoiding resampling, by amending the
/etc/pulse/daemon.conf
:And seems to be happening less.
On a related note, I searched around and looks like the default resampling algorithm that pulseaudio uses is low on CPU usage but is so bad that introduces crackling, so another way to sort out this issue would be to use a better resampling algorithm (as explained here and here).
After this search, I tried instead this solution (i.e. keep resampling enabled but with a better resampler) thus changing the
/etc/pulse/daemon.conf
config once more:Now it doesn't seem to happen anymore.
Ps. this is a decent audio quality guide on Linux