Audio under QEMU on Ubuntu

I was trying to set up a virtual machine running Windows XP on my Ubuntu Linux desktop under QEMU/KVM to play Starcraft when I ran into a problem. Even after installing an AC97 sound card in the virtual machine and ensuring that Windows had the right driver installed, I wasn’t getting any sound.

It turns out that this is due to a known issue, but it took a surprising amount of log-file-reading and web searching to find it.

When you set up a VM through virt-manager, the default is to connect to it through VNC. Specifically, virt-manager uses gtk-vnc. gtk-vnc does not support tunneling of audio.

Workaround: delete the VNC graphics device on the VM details pane and add an SDL one instead. This solution has shortcomings of its own, but this will get you sound.

It looks like this was identified as a bug by RedHat a while ago, but it’s not clear what progress has been made on it. Given that recent development on virt-manager has added the option to use SPICE instead of VNC, I would hypothesize that VNC will simply be deprecated in the not-too-distant future. Until then, though…switch to SDL if you need audio.