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?