[vfio-users] Distorted sound in guest with Pulseaudio

ajs124 redhat at ajs124.de
Wed Aug 26 17:57:38 UTC 2015


Hey,

a workaround/hack I use for this is doing pulseaudio over TCP to localhost.

I don't have the details of my setup with me at the moment, but iirc you have to export PULSE_SERVER and maybe enable the module, depending on your distro.

There are tutorials out there for doing it over the LAN, you simply have to replace the server/client with localhost.

On Wed, 26 Aug 2015 17:45:21 +0000
Garrett Powell <garretttracypowell at gmail.com> wrote:

> I can only hear sound in the guest (Windows 10) if there are no
> applications running in the host that use pulseaudio (Skype, Tox, etc.).
> Even then, the sound is incredibly distorted with a lot of static. I'm
> using an external USB DAC. Here's my QEMU launch script:
> 
> #!/bin/bash
> synergys --daemon --config /etc/synergy.conf
> export QEMU_AUDIO_DRV=pa
> qemu-system-x86_64 \
> -enable-kvm \
> -m 10240 \
> -cpu host,kvm=off \
> -smp sockets=1,cores=4,threads=2 \
> -vga none \
> -nographic \
> -soundhw hda \
> -name Windows10-VM \
> -drive
> if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> \
> -drive
> if=pflash,format=raw,file=/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd
> \
> -device vfio-pci,host=03:00.0 \
> -device vfio-pci,host=03:00.1 \
> -device virtio-scsi-pci,id=scsi \
> -drive
> file=/home/garrett/VMs/Windows10/windows.img,id=disk,format=raw,if=none
> -device scsi-hd,drive=disk \
> -drive file=/home/garrett/VMs/Windows10/windows.iso,id=isocd,if=none
> -device scsi-cd,drive=isocd \
> -drive file=/home/garrett/VMs/Windows10/virtio-win.iso,id=virtiocd,if=none
> -device ide-cd,bus=ide.1,drive=virtiocd \
> -drive file=/mnt/storage/win-storage.img,id=storage,format=raw,if=none
> -device scsi-hd,drive=storage \
> -boot menu=on
> pkill synergys
> 
> This is some of the output I get whenever I run the script:
> 
> pulseaudio: pa_context_connect() failed
> pulseaudio: Reason: Connection refused
> pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio
> driver
> ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
> alsa: Could not initialize ADC
> alsa: Failed to open `default':
> alsa: Reason: No such file or directory
> 
> Thinking that running the script as root might be the source of the issue,
> I tried running pulseaudio in system-wide daemon mode. Audio in the host
> still works, and I'm getting the same distortion in the guest. This is some
> of the output I get now:
> 
> pulseaudio: Wrong context state
> pulseaudio: Reason: Access denied
> pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio
> driver
> ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
> alsa: Could not initialize ADC
> alsa: Failed to open `default':
> alsa: Reason: No such file or directory
> 
> I've tried setting QEMU_AUDIO_DRV=alsa and I get the same results/output
> minus the pulseaudio stuff. I'm clueless at this point.
> 
> Thanks,
> Garrett




More information about the vfio-users mailing list