Anyone have luck with high-end audio quality with VFIO?

Hi there!

I recently got a medium-high end DAC/AMP as I’m a beginner audiophile. Without any tweaking, it made things sound a little bit better, but not a whole lot. As I started to tweak, I messed around with the sampling rate in Linux and it made my system sound even better! After enjoying some music, I decided to load up my windows 10 guest with passthrough stuff to play some games.

It’s important to note that I have PulseAudio grabbing the sound from my guest, so I can hear the host audio and guest audio through the same source at the same time.

All of a sudden, I have audio crackling in my guest.

For the record, I’ve had this problem before and I’ve already configured the MSI Interrupt stuff to fix it. My audio has been really good for months.

After some research and messing around with my XML file for about an hour, I decided to revert my Linux audio settings to what they had been before this mess. That fixed the crackling. Also, yes I did mess with the sampling rate in windows to make sure it matched Linux.

So, this isn’t the worst problem, things technically work fine. I just wanted to know if there was anyone else who has been in the same spot as me who has been able to upgrade their sound in the VM, or if for some reason it isn’t possible.

Thanks all!

Linux audio is probably one of the few areas where it’s just a real pain.

I don’t really have a fix other than to suggest that you consider another dac/amp and pass it to the guest.

I have the MayFlower Electronics ARC and had similar issues as you, but did not find any solutions. Mainly replying to get any useful information that may come.

Right now… I ended up just hooking the USB up to my KVM. Not great though as I don’t get host sounds for notifications and such.

I gave up on on the audio a long time ago. I ended up passing through a separate sound card and have both cards connected to a passive mixer so that both guest and host can play audio at the same time from the same speaker set.

USB/PCI audio device passthrough is a better bet. Even with audio device passthrough there is some crackling in the begging. I don’t understand.
Also bluetooth audio is a good option.

Sorry, I don’t want to hijack your post, but I just managed to setup passing the guest audio to the host pulseaudio a week ago and have some cracking. I did not really know what to search for and it seems you mention something here I need to do. Do you have a link with instructions how to do that by any chance?

@Mirad: Cracking in the sound can come from the host utilizing the cores the guest runs on. I was able to mitigate any sound issues using the vfio-isolate program. Threads by the developer are here and here. If you want to try it out as well and need help setting it up feel free to ping me!

@anon89476829 Thanks for sharing! That didn’t help with my crackling, but cpu isolation was something I had been meaning to do anyway and that program made it easier lol. Even after isolating the cpus, after cranking up the bitrate in both Linux and windows, I still had crackling.

The bitrate thing you asked about is using this and then going into the sound settings in windows to change the bitrate there to match.

@Windforce A passive mixer isn’t a bad idea, I might try that if I can’t figure out some software solution.

If your dac/amp has other digital inputs why not get something like a usb to spdif converter and pass that through and just switch inputs on the dac?
Or if your onboard soundcard has digital outputs use that. There should be adapters from toslink to coax if you need that. Maybe a pcie card…

To hear sounds from your host maybe switch it to the speakers in your monitor?

Living with roommates makes it valuable to have both my host and guest sounds coming through the same audio source (headphones for myself/speakers for showing them something). I’ve tried having them go through different audio devices and while it does work well, having them both go through the same device at the same time is heavily preferred.

@Mirad, don’t know if you’re still working on this but hopefully this is helpful…

I was having the same issue for forever, I believe it has to do with SPICE and the compression it does to the audio (if that’s how you’re getting it to pulseaudio).

If you have nice audio equipment ( I have a Topping D10 and a pair of Stax) I just suggest bypassing SPICE all together for audio and using Scream audio instead: https://github.com/duncanthrax/scream

Pretty easy to setup, think some distros have it in their repo too (definitely in AUR on Arch). It passes uncompressed audio down the virtual network, with basically no lag and you can set any level of quality you want in Windows (it shows as it’s own source)
You pick it up on the linux side as it’s own source as well so you can play with both sides until you swear you can hear the difference in power cables. :wink:

It can cause you issues using it the normal network way if you have more than one virtual network connected to your VM (it cant seem to pick any but the primary one I think). However, there is now a IVSHMEM method that will work around that too (only suggested as a backup method).

I’ve pumped 7.1 high bitrate, high sample rate through it with no issues.

PS: if you get into equalizing or just playing with the audio, check out PulseEffects (you can fall down a crazy rabbit hole)

I am using a pass-through NIC adapter for network, but on the same subnet as my host NIC. Will it work?

For audio, the best result would be a usb dac passed through to the vm.
I used to do that using a tempotec hd dac(sabre chipset) and now I do the same thing with my ifi zen dac v2 , the only difference is that I no longer pass the usb device, now i passthrough the usb controller and that makes everything much better less clunky.

The cheapest usb dac will do more for you than 30+ hourse of pulseaudio/pipewire configs …or at least that’s my experience

1 Like

I’m personally using Apple USB-C audio adapters both for my host and VMs. My host has crackling with the built-in audio and the Apple adapter has none. Some audio people highly rate these, and they are only $9!