Exposing a soundcard on a KVM host to a guest

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

Added: 2013-05-27T18:16:26

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'/>
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
 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'
guest # rpm -qa | egrep 'alsa|virt'
The volume levels are all set decently and QEMU_AUDIO_DRV is set to alsa.

Any ideas?

posted by Calum on 2013-05-27T18:20 under

Add a comment

Your IP:
Please enter 9072630 here: