noise/crackling sound with kvm usb audio passthrough

freebeerz

Renowned Member
Aug 5, 2015
11
2
68
I have one of these usb audio adapters http://www.amazon.co.uk/gp/product/B00IRVQ0F8/ based on a C-Media chipset (idVendor=0d8c, idProduct=0139)

When I pass it to a VM (linux or windows) I get terrible audio crackling/noise issues. To make sure it wasn't a hardware problem I installed alsa on the proxmox host itself and I get no issues there, e.g. playing an mp3 on the command line.

The motherboard/cpu on this system don't support PCI passthrough so that's not an option (and even if it did I'd rather passthrough individual usb devices rather than the whole usb host chipset)

Is that a common issue with usb audio passthrough? Is anyone doing this kind of setup without any noise? Would another usb audio chipset fare better?

Thanks!
 
Rather old thread but still actual. Got exactly the same Problem. Any solution?
 
Never resolved the issue.
As a workaround, I use pulseaudio on the proxmox host and redirect all VMs sound to a local mixer.
For windows VMs, I use the AC97 emulation (add "args: -soundhw ac97" in the VM config file) and for linux I use the hda driver.

The AC97 driver is difficult to install on Windows 10 (or at least it was back then, maybe they have drivers for it now) but the sound is usually not choppy.
I have to say the whole setup is rather unstable. I have frequent lock ups and glitches (I have to reboot at least once a month), both on windows and linux. It's extremely difficult to troubleshoot issues too...
 
Never resolved the issue.
As a workaround, I use pulseaudio on the proxmox host and redirect all VMs sound to a local mixer.
For windows VMs, I use the AC97 emulation (add "args: -soundhw ac97" in the VM config file) and for linux I use the hda driver.

The AC97 driver is difficult to install on Windows 10 (or at least it was back then, maybe they have drivers for it now) but the sound is usually not choppy.
I have to say the whole setup is rather unstable. I have frequent lock ups and glitches (I have to reboot at least once a month), both on windows and linux. It's extremely difficult to troubleshoot issues too...
Would you mind providing a link for instructions used for AC97 passthrough, I was trying this very function (entirely without success) even just the basic terminal commands you used and specific config files altered would be great. Thanks in anticipation!!
 
I don't remember exactly what I did but my notes from back then only say:

ALSA with pulseaudio should be configured by default and used for -soundhw=AC97 for example:
edit /etc/pve/qemu-server/VMID.conf (replace VMID with VM number):
args: -soundhw ac97

I think the hard bit was to run pulseaudio as root so that proxmox could use it.
I followed a tutorial for pulseaudio headless setup, I don't have the link but here are my notes:

- install:
apt-get install alsa-utils pulseaudio
# to broadcast the audio service:
# apt-get install pulseaudio-module-zeroconf avahi

- /etc/systemd/system/pulseaudio.service:
[Unit]
Description=PulseAudio Daemon

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateTmp=true
ExecStart=/usr/bin/pulseaudio --system --realtime --disallow-exit --no-cpu-limit
# more secure with: --disallow-module-loading

- /etc/pulse/system.conf:
# load-module module-zeroconf-publish
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;10.0.0.0/24

- /etc/pulse/daemon.conf: (optional settings):
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
default-sample-channels = 2
default-sample-channels = 4
default-channel-map = front-left,front-right

- start service:
systemctl enable pulseaudio.service
systemctl start pulseaudio.service

- allow users to access it (e.g. root):
adduser root pulse-access

- check it works:
pactl info # using unix socket: /var/run/pulse/native
PULSE_SERVER=127.0.0.1 pactl info # using tcp (can set default in /etc/pulse/client.conf)

- unmute/volume (note: easier with alsamixer from 'alsa-utils')
# man pulse-cli-syntax
pactl list cards
pactl set-sink-mute 0 0 # <sink_id> <0|1>
pactl set-sink-volume 0 65536 # 100%

- play something
paplay /usr/share/sounds/alsa/Noise.wav

- more examples: https://wiki.archlinux.org/index.php/PulseAudio/Examples

setup ALSA to pulseaudio for apps that only support ALSA (should be default)
============================================================================
- it should be the default already, check with:
aplay -L

- if not default, edit /etc/asound.conf:
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
 
I don't remember exactly what I did but my notes from back then only say:

ALSA with pulseaudio should be configured by default and used for -soundhw=AC97 for example:
edit /etc/pve/qemu-server/VMID.conf (replace VMID with VM number):
args: -soundhw ac97

I think the hard bit was to run pulseaudio as root so that proxmox could use it.
I followed a tutorial for pulseaudio headless setup, I don't have the link but here are my notes:

- install:
apt-get install alsa-utils pulseaudio
# to broadcast the audio service:
# apt-get install pulseaudio-module-zeroconf avahi

- /etc/systemd/system/pulseaudio.service:
[Unit]
Description=PulseAudio Daemon

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateTmp=true
ExecStart=/usr/bin/pulseaudio --system --realtime --disallow-exit --no-cpu-limit
# more secure with: --disallow-module-loading

- /etc/pulse/system.conf:
# load-module module-zeroconf-publish
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;10.0.0.0/24

- /etc/pulse/daemon.conf: (optional settings):
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
default-sample-channels = 2
default-sample-channels = 4
default-channel-map = front-left,front-right

- start service:
systemctl enable pulseaudio.service
systemctl start pulseaudio.service

- allow users to access it (e.g. root):
adduser root pulse-access

- check it works:
pactl info # using unix socket: /var/run/pulse/native
PULSE_SERVER=127.0.0.1 pactl info # using tcp (can set default in /etc/pulse/client.conf)

- unmute/volume (note: easier with alsamixer from 'alsa-utils')
# man pulse-cli-syntax
pactl list cards
pactl set-sink-mute 0 0 # <sink_id> <0|1>
pactl set-sink-volume 0 65536 # 100%

- play something
paplay /usr/share/sounds/alsa/Noise.wav

- more examples: https://wiki.archlinux.org/index.php/PulseAudio/Examples

setup ALSA to pulseaudio for apps that only support ALSA (should be default)
============================================================================
- it should be the default already, check with:
aplay -L

- if not default, edit /etc/asound.conf:
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
Thanks, that will be immensely useful, copy pasta, add to 'useful posts' folder, save and close!
 
Rather old thread but still actual. Got exactly the same Problem. Any solution?

Use usbip when virtual machines are involved.

This problem with usbredir is still unresolved with qemu 7.2.1 and 8.0.0-rc3, verified on Linux 5.15.106 and 6.1.23.
However, the usbip infrastructure of the Linux kernel works well for the same purpose.

Another approach is to redirect the remote usb sound card to the host, and use qemu's virtual sound hardware in the guest. Both usbredir and usbip work well when no virtual machine is involved. This might be a simpler solution if security is not an issue.
 
Last edited:
Hey,

to disturb this subject, I come to you with a question: what Virtualized OS running into your(s) audio problem VM?

I've the sames problems like you with my Debian12, but only on usb passtrough audio device. With the integrated nvidia audio card passthrough, i've no problems.

Now, i've tried with Kubuntu 24.04, ans the problem is just not here from scratch.
I've never noticed that, but twice success with this Kubuntu and with a Xubuntu 24.04 too.

Hope this can help You.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!