Return to

Need Help Getting Sound From QEMU


Hello, so I’ve tried following this guide and option two on this guide. But I can’t get it to work, the only thing that I can barely hear is a high pitched noise. Any help would be greatly appreciated! :smiley:


Please post your Libvirt XML.

I’m fighting my config at the moment to get this to work, but hopefully we can come to a solution.


This is what I have for the audio

<qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
<qemu:env name='QEMU_PA_SAMPLES' value='1024'/>
<qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='150'/>
<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>


Have you configured your qemu.conf?

Is the audio device driver in the VM installed?


I added

vnc_allow_host_audio = 1
nographics_allow_host_audio = 1

to it and yes, the ac97 driver is installed.


Have you checked to make sure that libvirt is showing up as a source in PA?

I’m running out of ideas here. Everything looks configured properly to me.


Erm, how do I check that?


there’s a program called pavucontrol that I use:

I’m on KDE, but it’ll look something similar to this. You’ll want libvirt to show up in this list. Changing "Show: " from “applications” to “all streams” might help.

You should be able to install it through your package manager.


Is it supposed to say AudioIPC Server?


AudioIPC Server can be a number of things. I get that when FireFox/Chrome is open.


Is it supposed to say libvirt there? Because I don’t have anything that says libvirt.


Sounds like you aren’t getting libvirt to connect to your user’s PulseAudio server.

You’ve done all the config properly, to my knowledge, so I really don’t know where to go from here.

It’s late here, so I’m going to sleep on this and if I come up with something tomorrow, I’ll definitely update you. Hopefully someone else has an idea.


Alright, thanks! I think it might be a permission issue or something then.


It’s possible. You might be able to see a hint in your libvirt or pulseaudio logs.


I personally have had more success in using the ALSA pulse audio compatibility layer, the PulseAudio code in Qemu seems to suffer from quite a few buffering issues the ALSA code does not.


Also note that the ac97 is useless in Windows 10 unless you can sign the ac97 drivers or are happy to run with driver signing enforcement disabled (testing mode). If you’re planning to play online games, anti cheat such as PunkBuster and BattlEye will refuse to operate in “testing mode”.


Well I figured out that the sound does work if I view the VM with virt manager. But it doesn’t work when I view the VM with looking glass, same with alsa. For the driver signing thing, I turned on “testing mode” just to install the driver then I turned it off afterwards, works fine and windows didn’t complain. Any ideas why it’s not going through looking glass but it’s fine through virt manager?


When you use virt manager your sound is coming through the Spice audio device. Looking Glass does not, nor will ever support audio streaming. You need to remove the spice audio device and get windows to use a emulated device at which point you will have sound continually, with or without the libvirt client.


Wait, I’m confused, is the spice audio device the sound ac97 in virt manager? I thought the sound could be passed through the spice client that looking glass makes.


Sorry yes, I have confused things. Spice is indeed taking the audio from the AC97 device, but qemu is only providing it for spice’s usage, it is not outputting directly to PulseAudio or ALSA, if it were you would see qemu in the pavucontrol application, and you would hear it’s audio all the time. You need to find out why Qemu is not using pulse or alsa directly.


Ah I see, shouldn’t this

<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>

make it output directly to Pulse Audio? If so, then I’d guess QEMU can’t access it or something? How would I give QEMU permission to be able to use it?