alsa-config: Consider increasing period-size for vm (virtual machine)
Hello!
In commit 37bd3921 @gkiagia added some overrides for virtual machines, to solve issues with cracking/stuttering audio in virtual machines. Here are the overrides:
-- These properties override node defaults when running in a virtual machine.
-- The rules below still override those.
["vm.node.defaults"] = {
["api.alsa.period-size"] = 256,
["api.alsa.headroom"] = 8192,
},
However, Pipewire has a wiki on this very topic at https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Troubleshooting#stuttering-audio-in-virtual-machine, and it suggests the following values:
["api.alsa.period-size"] = 1024,
["api.alsa.headroom"] = 8192,
So what is the "best" value for period-size in a VM, 256
or 1024
? I don't have the answer but I can bring one data point.
A bit of background first: I'm a maintainer of Kali Linux, and a few months ago we switched to pipewire as the default audio server. Hence I pay special attention to bug reports related to audio these days. I must also mention that Kali is a distro that is widely used in VM by Windows or Mac users.
So lately I had a bug report about cracking noise while running Kali in VMware. It seems that user already had its system setup to headroom=8192, period-size=256
, according to https://bugs.kali.org/view.php?id=8339#c18451. And yet the sound was cracking. Changing the period-size to 1024
fixed it, it seems.
Would that make sense to increase from 256 to 1024? Or can it be counter-productive in other cases?
Thanks!