Pulseaudio Windows 10
After the Windows 10 Fall Creators Update, WSL is out of beta and the installation is much easier. Setting Up PulseAudio on Windows. Setting up PulseAudio on Windows is quite straightforward: Download the pre-built binary package from the PulseAudio website. Apr 11, 2016 Download PulseAudio for Windows and extract This should be the 1.1 version from the PulseAudio site. You can also use the compiled 5.0 version from the x2go project which should be much the same, but I haven't tested this. Once this is done you can extract it where you want, I extracted mine to C: Program Files pulse.
In this post, I compare several options of how to get the sound output from an KVM virtual machine guest, back into the host. I will compare spice server, pulse audio and a hardware solution.
The Host runs an Asus Xonar DGX 5.1 PCIE sound card.
In any case – harmonize sample rates of host and guest system
A common issue with sound passthrough between guest and host is lagging or chopped up sound playback. In order to fix this make sure the host and the guest use the same default playback sample rate.
Setting default sample rate in Linux
open /etc/libvirt/qemu.conf via
sudo nano /etc/libvirt/qemu.conf
and uncomment the line
Pulseaudio Windows 10 Safe Mode
replace your username with example
open /etc/pulse/daemon.conf
and find/add/uncomment the lines and set these values:
afterwards restart the pulse audio service via
pulseaudio -k
or reboot.
Setting default sample rate in Windows
Pulseaudio Equalizer Windows 10
Set the frequency of your windows sound to 44100 Hz
Option 1 – use Spice Server
(+)
Easy to set up(+)
Very good for first setup of the VM OS.(-)
Needs VM window open in order to work(-)
a little more delay than direct pulse audio version(-)
Adds an extra display to the VM.
This one is pretty straight forward, open the info page of the VM on virt-manager and add a spice server.
Adding the spice server adds actually several devices to the VM config, one for example is a display.
In order to hear sound, I have to open the VM while it is running (I hope the sentence make sense 🙂 ). Basically it is double clicking on the running VM in the virt-manager list.
Option 2 – use Pulse Audio
(+)
Less sound delay than the spice server version(+)
Less overhead once running(+)
Nicer Integration(-)
Complicated to get it working(-)
Lots of users complain about bad sound quality
Pulse Audio with QEMU 4.2 (and above)
Edit the virtual machine config viavirsh edit <your vm name>
e.g. virsh edit windows10
Make sure the very first line of the file does read:
Instead of
Check at the bottom of your config if a line <qemu:commandline>
exists. If yes make sure to add these options:
In case <qemu:commandline>
is missing, find the line which ends with </devices>
and add the following block afterwards:
The 1000 in
represents your user-id, 1000 is the default (one user) Id.
Attention!
Make sure <devices>
and <qemu:commandline>
have the same indent.
Remark!
The <qemu:commandline>
part can hold further options, simply append the sound options if others were already present.
Open the apparmor libvirt abstractions file via
sudo nano /etc/apparmor.d/abstractions/libvirt-qemu
Append the following lines
/etc/pulse/client.conf.d/ r,
/etc/pulse/client.conf.d/* r,
/run/user/1000/pulse/native rw,
/home/your-username/.config/pulse/* r,
/home/
your-username
/.config/pulse/cookie k,
Replace your-username
with your username.
→ reboot your system.
Settings in Virt-manager
Make sure no further audio devices are added by virt-manager – remove all audio devices from the virtual hardware details bar (left side in VM info view).
Troubleshooting
If you have no sound at all, run pax11publish
and check if a server with name /run/user/1000/pulse/native
is available.
Pulse Audio with QEMU 4.1 (and below)
Edit the virtual machine config viavirsh edit <your vm name>
e.g. virsh edit windows10
Make sure the very first line of the file does read:
instead of
Check at the bottom of your config if a line <qemu:commandline>
exists. If yes make sure to add these options:
In case <qemu:commandline>
is missing, find the line which ends with </devices>
and add the following block afterwards:
The 1000 in /run/user/1000/pulse/native
represents your user-id. 1000 is the default (one user) user id.
Attention!
After adding the enlightments, I had no internet on one Windows 10 guest (also not every time).
After some digging, I found a reddit post with the proposed “solution” to change the model type of the network bridge interface in the libvirt config from “virtio” to “virtio-net-pci”.
Remark!
Lorem Ipsum!
Settings in Virt-manager
As said before, add a sound “ich6” device to your VM.
Attention!
Do not use 6ch/9ch audio devices in Windows 10 1903 virtual machines. It creates awful stuttering and performance loss. Use ac97 audio devices instead.
Troubleshooting
If the sound distortions occur, make sure host and guest run at the same sample rate. You can also play around with QEMU_PA_SAMPLES
and QEMU_AUDIO_TIMER_PERIOD
values (see the reddit post(s) from the sources for further information).
Option 3 – use Hardware
(+)
Very easy(-)
Costs money
I haven’t tried this, but it should be easily possible to add a USB sound card to the guest and run the output back into your host sound card via a real audio wire (connecting guest line-out with host line-in).
Updates:
- 2020.06.24 …. added information for QEMU version 4.2
- 2018.02.17 …. initial creation