Audio dropouts and stutter

Hi guys,

After using qubes for 3 weeks I am still facing issues with audio. After deep analysis, digging into pipewire, changing configurations, I am currently out of ideas what goes wrong. The only thing I have is this weird log of the pipewire service:

It fills constantly which kind of reflects the sound dropouts I am hearing (every second). My assumption is that the complete sound data cannot be sent via pipewire to my audiovm (sys-usb) and that is why I am facing this issue. The weird thing is also that this does not always happen. Sometimes the sound works and I have no issues, but most of the time it is not working correclty.

My configuration is quite simple:

  • sys-usb=audiovm
  • bluetooth headset paired with sys-usb
  • vms set to use sys-usb as audiovm

I have additionally tested the sound directly in sys-usb, and there it is clean and crisp, so it has to be an issue on the way from other vms to sys-usb.

Anybody able to help? Maybe this is a known issue? My research unfortunately did not reveal any discussion that pointed to a solution.

Thanks!

PS: I am using a Novacustom v54 which is a certified machine, so hopefully it is not hardware related.

sys-usb: 2 CPUs, 2GB RAM
vm1: 16GB RAM, 8 CPUs
vm2: 16GB RAM, 8 CPUs

PPS: I tried to restart vms and sys-usb multiple times, no change. I restarted pipewire on dom0 also, no change. What I have not done is to restart the complete machine as this would be the last thing I’d like to have as a solution :slight_smile:

1 Like

Hi,

What kind of changes did you make to sys-usb to use it as an audiovm?

Does it only happen with your Bluetooth headphones, or if you use the laptop speakers it happens too?

Hi,

when using the speakers there are no dropouts, but the sound is also kind of “stuttery” and not clean, as it should be.

The only changes I did to sys-usb was to

  • enable services: audiovm, blueman, bluetooth
  • assign bluetooth device

Have I missed something?

Thanks for your quick answer!

Ah, one thing I forgot: I added the required policy entries in dom0 as described here: Audio qube

1 Like

It looks like your audio output device does not support 44.1 GHz + 16bit audio. Unfortunately, this is an existing problem and there is no solution, since it essentially rests on the Qubes OS core itself. There is an issue on github with high-res audio support, but it does not have priority.

The only solution I found for myself (I tried increasing buffers, changing drivers and black magic) is to change headphones

I doubt about this, otherwise it would not happen on both the bluetooth device and the builtin speakers? (if that’s the same issue encountered by OP)

Thanks guys for your answers!

I also don’t think it is related to the headphones as today, after closing the lid of the laptop yesterday, the sound works again. This is what I also wrote above, that sometimes it works. The service status does not show any Overrun messages. So it seems there is a buffer or something else that overflows at some point and starting there the sound gets choppy. It would be fine for me to know which part of which qube I have to restart to get rid of this if it happens…

Maybe try to pin P cores only to sys-usb, if this does not help, pin P cores too on the qube producing sound.

I’ve had audio stutter/delay/dropouts on qubes in my audiovm (sys-audio) as well. I’ve fixed them by doing the following steps:

  1. Increasing the credit2 scheduling priority for sys-audio a LOT, to 4096 (default is 256)
  2. Increasing the credit2 sched prio for audio playing/recording qubes to at least 512
  3. Implementing Dynamic, window focus-based CPU pinning to free up CPU used by background qubes (sys-audio isn’t pinned to E-cores)
  4. Implementing Qubes-QoS: prioritise VMs' network traffic to prioritise traffic of audio playing/recording qubes
1 Like

@Atrate thanks for these steps. I will try to follow them one by one when the dropouts start to happen again. I would really like to know which steps are really required. But from my gut feeling it is most likely related to traffic or buffers as it does not happen when QubesOS is waking up from sleep, but only after a particular amount of time.

@solene will go with Atrate’s steps first as the P cores pinning seems to be quite invasive as it requires the grub config to be changed.

@solene sorry, missed that Atrate’s steps also include the CPU pinning guide :slight_smile: Nevermind, will try the steps one by one.

General question: how is this CPU pinning concept different from what I can do in the UI for a VM? Which Cores (P/E) are assigned when changing the number of VCPUs for a VM?

The issue here is that recent Intel CPUs have an heterogeneous typology, there are 2 kind of cores: performance and efficient. The efficient one use less power, so it’s good for battery but they are bad at crunching data, performance core are the opposite. In turns out that Xen is not aware of this, so it does not know how to handle it and spread CPU time across cores without caring about the typology at all, which leads to non optimal power usage and non optimal performance.

I made a performance benchmark a while ago with P cores only, E cores only and letting Xen handle. Hybrid CPU: benchmarking performance when pinning to specific cores

1 Like

As for pinning cores harf I’m agains it. Soft Affinity should be enough (I have 1 vcpu in sys-audio with soft affinity to e-cores and have no audio problem with i5-1245U)

But I have other idea.
Had op checked if his sys-usb have enough memory and don’t use swap?

I agree, it should work but that this is to debug to see if this help.

OP said the qube has 2 GB, seems good enough for an audiovm?

I have separate sys-audio (1 vcpu, 900 MB) and sys-usb (2 vcpu, 800 MB)

top will tell the truth

@solene thanks for the explanation!

I have checked sys-usb top command while the sound cracks, and the whole qube is basically idle (2-5% pipewire). From a memory perspective round about 1GB is used out of 2GB. So I don’t think the resources are the problem. Also as mentioned above, today in the morning, after waking up the laptop, everything is fine. I bet that today in the evening I will face the same issue again. It seems that something gets bloated over time, but what and where…

1 Like

I’ve had some dom0 memory trouble once. It impaired video playback.
No matter how many memory I assigned to dom0 (I’ve tryed 16GB) every few seconds it spiked.
I’ve seen it with conky memory graph, othervise I was in no knowledge of that.
There is simple conky config at github for dom0 - can you try it and se if you have dom0 memory spikes?

PS: it would be nice to se sys-usb memory graph to, but I don’t know how to do it now and can’t test it as Im away from home

Thanks for the hint, will try it when issue reappears. How did you solve the memory spikes?