You are not logged in.

#1 2015-10-17 17:25:10

Bladesy
Member
Registered: 2015-08-31
Posts: 26

QEMU/KVM sound not working

Hello all, I'm having a problem with QEMU/KVM, as my win10 virtual machine isn't giving me any sound at all, even though it gets a "speakers" device when I set my soundhw to hda.
My current launching script is the following:

#!/bin/bash

sudo vfio-bind 0000:01:00.0 0000:01:00.1
xrandr --output HDMI1 --off
sudo synergys -f &
cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd
QEMU_ALSA_DAC_PERIOD_SIZE=1024 QEMU_AUDIO_DRV=alsa
qemu-system-x86_64 \
  -soundhw hda \
  -net nic -net user,smb=/home/bladesy/ \
  -enable-kvm \
  -m 6104 \
  -cpu host,kvm=off \
  -vga none \
  -device vfio-pci,host=01:00.0,multifunction=on \
  -device vfio-pci,host=01:00.1 \
  -drive if=pflash,format=raw,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
  -device virtio-scsi-pci,id=scsi \
  -drive file=/mnt/hdd/windows/win10.raw,id=disk,format=raw,if=none, -device scsi-hd,drive=disk \
/mnt/hdd/windows/win10.raw
sudo /home/bladesy/.screenlayout/screens.sh
sudo kill $(pidof synergys) 

 
My .asoundrc file in my home folder:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

And the nature of the error messages I receive regarding alsa:

ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory

The error message seems to repeat over and over - every time a sound in the win10 machine occurs.
Does anyone have any idea what's going on?
I should also note that my sound in arch still works while the win10 machine is up.
Thanks in advance.

Offline

#2 2015-10-22 18:15:40

Bladesy
Member
Registered: 2015-08-31
Posts: 26

Re: QEMU/KVM sound not working

I hoped to use a usb headset in the mean time for a temporary fix - but when I use the headset, the sound quality is much, much lower.
The headset is passed through into the virtual machine when it starts, so I assumed it would work as well as passing in a keyboard or a mouse.
Would this relate to the alsa problem I'm getting?

Offline

#3 2015-10-24 14:22:21

Bladesy
Member
Registered: 2015-08-31
Posts: 26

Re: QEMU/KVM sound not working

To give an update, I've attempted to use pulseaudio instead, and so my launching script for my virtual machine is now the following:

#!/bin/bash

sudo vfio-bind 0000:01:00.0 0000:01:00.1
xrandr --output HDMI1 --off
sudo synergys -f &
pulseaudio &
cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd
QEMU_PA_SAMPLES=128 QEMU_AUDIO_DRV=pa
qemu-system-x86_64 \
  -soundhw hda \
  -net nic -net user,smb=/home/bladesy/ \
  -enable-kvm \
  -m 6104 \
  -cpu host,kvm=off \
  -vga none \
  -usb -usbdevice host:045e:00cb \
  -device vfio-pci,host=01:00.0,multifunction=on \
  -device vfio-pci,host=01:00.1 \
  -drive if=pflash,format=raw,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
  -device virtio-scsi-pci,id=scsi \
  -drive file=/mnt/hdd/windows/win10.raw,id=disk,format=raw,if=none, -device scsi-hd,drive=disk \
/mnt/hdd/windows/win10.raw
sudo /home/bladesy/.screenlayout/screens.sh
sudo kill $(pidof synergys)
sudo kill $(pidof pulseaudio)

After trying this, the sound is working - but unfortunately, it is extremely low quality and laggy.
I can't understand why, because I'm actually able to run games in the virtual machine - could there possibly be a problem due to overclocking? Because I noticed that in the bios for the virtual machine, it states that the processor is only 2.0GHz and that I only have 3Gb of ram. Inside the virtual machine, it also displays the CPU wrong, stating that I'm running at 3.5GHz (my base clock) when I'm really running at 4.2GHz. Am I heading down the right track here, or is this normal?
I should also note that everything in arch works perfectly while I'm using the virtual machine.

Offline

#4 2015-10-24 15:11:53

extreme9
Member
Registered: 2015-05-17
Posts: 4

Re: QEMU/KVM sound not working

Hi,
i had the same problems with laggy sound with pulseaudio and soundhw hda.

The problem was the pa sample buffer size (QEMU_PA_SAMPLES=128). Try 4096 which is default btw so you dont need to override this if it works.

Offline

#5 2015-10-24 16:00:40

Bladesy
Member
Registered: 2015-08-31
Posts: 26

Re: QEMU/KVM sound not working

Thanks for your reply, but it seems that no matter how low the sample size or how high, I still get the exact same awful quality.

Offline

Board footer

Powered by FluxBB