Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

 
confusedpenguin
Gerbil Team Leader
Topic Author
Posts: 228
Joined: Tue Nov 15, 2011 12:50 am
Location: Potato State

Sound playback in virtualbox

Fri Jul 06, 2018 5:28 pm

I'd like to know how a virtual machine accesses the sound hardware. I have virtualbox set up to run Intel HD Audio and am running Linux Mint as the guest OS. Is there any resampling or downgrading of the audio quality by the time it reaches my speakers from the virtual machine? How do virtual machines access the physical sound hardware? The physical hardware is a Sound Blaster ZxR.
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Sound playback in virtualbox

Fri Jul 06, 2018 6:33 pm

VirtualBox emulates a generic soundcard, which the guest OS talks to as if it is a physical soundcard. The emulated soundcard's output gets fed to the host OS's audio stack; VirtualBox is just another audio application from the host OS's standpoint.

I'm not sure how much (if any) resampling is done; one would assume there isn't any if the real and emulated soundcards' sampling rates match, but who knows. You can expect some occasional clicks and stutters, since interrupt latency in the guest OS is gonna suck, and soundcards (whether real or emulated) are generally sensitive to interrupt latency. Overall audio latency will be worse than native audio, since you've got the latency of both audio stacks (guest and host) added together. You've also got an additional software mixer in the signal path, so there's more potential for fidelity degradation due to roundoff errors, even if there's no resampling; setting the volume in the guest to maximum and controlling the volume solely with the host OS's audio mixer ought to mitigate this.

In a nutshell, don't expect a particularly high fidelity experience if you play audio inside a VM.

It is probably worth trying connecting a USB soundcard/DAC directly to the guest OS (via the Devices menu), and allowing the VM to drive it directly. No idea if this is actually better than emulation in practice, as I have not tried it.
Nostalgia isn't what it used to be.
 
confusedpenguin
Gerbil Team Leader
Topic Author
Posts: 228
Joined: Tue Nov 15, 2011 12:50 am
Location: Potato State

Re: Sound playback in virtualbox

Fri Jul 06, 2018 10:16 pm

Perhaps that is something the people at Oracle would know. It would be nice if there was an easy way to tell. I've always had a habit of changing the pulseaudio settings and settle the resample method to src-sinc-best-quality. It definitely makes a huge difference when running Linux as the native operating system. I would assume it would be a pure direct path with an external DAC if the guest OS was allowed direct access to the USB ports. I've started doing some of my web surfing in a virtual machine to protect my windows installation from viruses and malware. AFAIK a virtual machine is probably the best sandbox environment for web surfing. Blasting an occasion song on YouTube is why I started wondering about the audio output quality of a guest OS.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On