# [SOLVED] QEMU guest sound support

## umka69

Hello!

I'm working on sound support in a guest system.

The host is Gentoo amd64, the guest is Windows x64.

Here is my start script. Audio support is not working here - the guest can not see audio device.

```
rolan@home ~ $ cat start.sh

#!/bin/sh

exec qemu-system-x86_64 \

        -enable-kvm -cpu host -smp 4  -m 6G \

        -device intel-hda, -soundhw hda \

        -vga std \

        -boot d \

        -drive file="/dev/repo/microsoft-desktop",if=virtio \

        -monitor stdio -name "Windows 10 x64" \

        -k en-us \

        -vnc :0,password \

        "$@"
```

Runnig...

```
rolan@home ~ $ sudo start.sh

QEMU 2.4.0 monitor - type 'help' for more information

(qemu) ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.29/work/alsa-lib-1.0.29/src/pcm/pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave

sdl: SDL_OpenAudio failed

sdl: Reason: No available audio device

sdl: SDL_OpenAudio failed

sdl: Reason: No available audio device

audio: Failed to create voice `dac'

audio: Failed to create voice `adc'

(qemu)
```

Host sound works good (mplayer runs without errors), but the speaker-test runs with an error:

```
rolan@home ~ $ speaker-test -t wav -c 2

speaker-test 1.0.29

Playback device is default

Stream parameters are 48000Hz, S16_LE, 2 channels

WAV file(s)

ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.29/work/alsa-lib-1.0.29/src/pcm/pcm_hw.c:1693:(_snd_pcm_hw_open) Invalid value for card

Playback open error: -19,No such file or directory
```

Can you advice something please?   :Crying or Very sad:   A have tried a lot of combinations of arguments and kerner drivres.

Where it comes from?

----------

## umka69

I've got it.   :Cool: 

At first it used not to have all necessary use flags. Here is the full story.

Than I missed that sudo command means root user environment, so all user configuration are not available.

The solution is to copy all alsa user configuration to root.

```
rolan@home ~ $ cat .asoundrc

defaults.pcm.card 1

defaults.pcm.device 0

rolan@home ~ $ sudo cp .asoundrc /root/
```

----------

