Exposing a soundcard on a KVM host to a guest

Tags: linux, audio, music, kvm, virtualisation,

Added: 2013-05-27T00:00

Exposing a soundcard on a KVM host to a guest

I'm having some trouble at the moment.

I've got a KVM host, which has a soundcard in it, and I'm trying to expose it to a guest.

host # lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)
I can play music through it on the host (which proves the soundcard is working), but I want to keep the host as minimal as possible.
It's configured for the guest in /etc/libvirt/qemu/host.xml:
    <sound model='es1370'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </sound>
And it appears in the guest:
guest # lspci | grep media
00:0a.0 Multimedia audio controller: Ensoniq ES1370 [AudioPCI]
However - when I play music in the guest, it doesn't work.
guest # mplayer Some Track.mp3 MPlayer SVN-r31628-4.4.6 (C) 2000-2010 MPlayer Team

Playing Some Track.mp3.
Audio only file format detected.
Clip info:
 Title: Track
 Artist: Artist
 Album: Album
 Year: 2000
 Comment: 
 Track: 1
 Genre: Unknown
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.80% (ratio: 12000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   2.9 (02.9) of 705.0 (11:45.0)  1.2%                                                                                                                                                      

MPlayer interrupted by signal 2 in module: play_audio
A:   2.9 (02.9) of 705.0 (11:45.0)  1.2%                                                                                                                                                      
Exiting... (Quit)
host # rpm -qa | egrep 'alsa|virt'
libvirt-python-0.10.2-18.el6_4.5.x86_64
alsa-utils-1.0.22-5.el6.x86_64
libvirt-0.10.2-18.el6_4.5.x86_64
alsa-plugins-pulseaudio-1.0.21-3.el6.x86_64
alsa-lib-1.0.22-3.el6.x86_64
python-virtinst-0.600.0-15.el6.noarch
libvirt-client-0.10.2-18.el6_4.5.x86_64
guest # rpm -qa | egrep 'alsa|virt'
alsa-lib-1.0.22-3.el6.x86_64
alsa-utils-1.0.22-5.el6.x86_64
alsa-plugins-oss-1.0.21-3.el6.x86_64
The volume levels are all set decently and QEMU_AUDIO_DRV is set to alsa.

Any ideas?
Add a comment

Your IP:
Please enter 7463366 here: