Score:0

Audio crackles when I run VirtualBox

cn flag

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!

Emanuele avatar
cn flag
I think I found the problem... looks like if I change the output sink from my onboard audio to HDMI, that's when crackling happens. I should close the question with an explanation...
Score:0
cn flag

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:

avoid-resampling = true

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:

resample-method = speex-float-10 # highest float quality (from 1 to 10), a bit more CPU usage
; avoid-resampling = false # this option is disabled

Now it doesn't seem to happen anymore.

Ps. this is a decent audio quality guide on Linux

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.