For the past days I've been trying to get a x64 Windows 8.1 VM's audio mixed with the host audio with mixed success.

The solution which kind of works for me right now is using Spice for audio, and the ICH6 as setting for the sound card, but because of a known bug in Spice which I could only find reported for Fedora and Red Hat, the audio is pretty bad and the only partial workaround is to put <playback compression='off'/> in my VM domain config. What I mean by partial is that the sound quality becomes somewhat usable but there are still glitches in the audio as some users also pointed out in the bug reports above.

I have also tried using VNC instead of Spice but the client does not come with sound support. Following this bug report I understood that audio can be sent through the regular backends if the VNC client does not support it by changing the user and group the VM runs under to my current user and adding a VNC setting in the /etc/libvirt/qemu.conf like so:

vnc_allow_host_audio = 1
user = "yourusernamehere"
group = "yourusernamehere"

but also making my user part of the kvm & libvirtd groups and furthermore adding this line in /etc/default/libvirt-bin:

export QEMU_AUDIO_DRV=pa

Doing this gave me the desired effect and the guest audio would run smoothly but the host audio would not work until I would have closed the guest. Looking at the host processes I noticed that libvirt spawned another Pulseaudio instance under my current user (effectively having 2 Pulseaudio instances) instead of using the instance that was already available.

After a bit more Googling I found that pulseaudio can share it's audio with other users if the module-native-protocol-tcp was enabled. Unfortunately this is where I stopped finding useful information. Every article I found explaining how to enable this suggests running Pulseaudio in system mode which, obviously, is a security issue, but would also make my pulse audio widgets in Plasma5 not work as expected. I have managed to track down this article for Fedora 12 explaining that it is possible to run Pulseaudio as an unprivileged user (aka. my current user) but I don't understand how I can share audio with myself.

Does someone know how I can use Pulse so I can share audio with my VM or provide another solution for mixing sound from the guest and host without glitchy audio?

2 Answers 2


Okay, after a lot of trial and error I finally managed to get it working as it should, without any hiccups.

Some of the following steps might not be required in order to make it work, but it did work for me after making them. If someone wants to modify the answer and get rid of the unnecessary steps then please do it.

Besides what I said above when using VNC (changing the settings in qemu.conf & libvirt-bin and making sure my user was part of the required groups) I also made sure my user was part of the pulse & pulse-access groups.

I copied everything from /etc/pulse in .pulse my home directory:

cd ~
mkdir .pulse
cp /etc/pulse/* .pulse/

In ~/.pulse/client.conf I commented/modified the following lines:

enable-shm = yes
auto-connect-localhost = yes
auto-connect-display = yes

In ~/.pulse/daemon.conf

daemonize = yes
allow-module-loading = yes
use-pid-file = yes
enable-shm = yes

Also I installed paprefs (apt-get install paprefs) and checked:

  • Make discoverable PulseAudio network sound devices available locally
  • Enable network access to local sound devices
  • Don't require authnetication
  • Enable Multicast/RTP reciever
  • Add virtual output device for simultaneous output on all local sound cards

After you made all the changes you can reboot you computer or just logout/login and restart libvirt-bin and everything should work perfectly when you start a VM.

PS: If the audio from the VM is crackling then make sure the VM has the same sample rate and bit depth as the host and it should work.

Update: It became apparent to me that the audio can still have issues in the guest (carckling sound) because libvirt may not be able to load the pulse config, from what i saw in the domain logfile(/var/log/libvirt/qemu/yourdomain.log). You can disable the profile temporarily or just add:

@{HOME}/.pulse/** rw,

in /etc/apparmor.d/abstractions/libvirt-qemu and reload the apparmor profiles with:

sudo invoke-rc.d apparmor reload

Note: I configured libvirt to run as my current user in /etc/libvirt/qemu.conf for security reasons.

  • 1
    What was the sound device that you added to your VM's config? Jan 25, 2020 at 2:26

This is a bit old, but maybe will save time for somebody walking around this. What worked for me was to configure unix socket and use global pulseaudio config instead of TCP connection module-native-protocol-tcp specified for user as most of the online guides suggest.

I think the pulseaudio was not picking up the individual user, for whatever reason. So I ended up editing pulseaudio config in /etc.

I edited /etc/pulse/default.pa with line:

load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/system-pulseaudio.socket

In /etc/pulse/client.conf I added line:

default-server = unix:/tmp/system-pulseaudio.socket
  • What does auth-anonymous=1 do? Where can I find out more on this in the man pages?
    – MrWm
    Jul 27, 2021 at 22:54
  • @MrWm i assume it turns off some kind of auth in pulseaudio, not much concern since i don't let it open any port to outside
    – Ludo
    Aug 23, 2021 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .