Unable to attach USB sound device to guest

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Unable to attach USB sound device to guest

Post by Radiohead57 »

Greetings from a noob to this forum.

I am using a Mac OS X 10.10.5 host (mid-2012 MacBook Pro) and Windows XP, Linux (Skywave Linux 3.0.2), and OS X 10.6.8 guests. For all guests my external USB sound "card," an ASUS Xonar U7, is grayed out and unavailable in my list of USB devices in the pulldown Virtualbox Devices menu. Occasionally (and apparently randomly) it is not grayed out, but when I then attempt to attach it I get an error "Failed to attach device ASUS Xonar U7 (0110) to the virtual machine <virtual machine name>".

I have a need to use higher sample rates for audio input to support software-defined radio applications in the VMs. The drivers supplied with Virtualbox seem to be limited to 41000 or 48000 Hz, and I suspect the way to accomplish this would be to attach the USB sound device directly to the VM.

I feel like I'm missing something basic here, but was unable to find anything specific to this issue in the Virtualbox documentation.

Thanks in advance for any assistance.
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Re: Unable to attach USB sound device to guest

Post by Radiohead57 »

Oh, and I'm using the current Virtualbox version 5.2.16.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Unable to attach USB sound device to guest

Post by mpack »

USB devices can't be shared, so if the host (or another VM) is using it then the VM can't. And vice versa.

To use it from a VM you'd have to create a USB filter, and plug the USB device in while the VM is running and has the focus.
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Re: Unable to attach USB sound device to guest

Post by Radiohead57 »

Thank you mpack; that worked. :D

However, it confused the heck out of my OS X 10.6.8 machine :( :

I went into Audio MIDI Setup in the guest to set the sampling rates, and it started to launch but hung. I had to force-quit Audio MIDI Setup and shut down the guest from its Apple pull-down; on the console I could see several processes still running that were being killed. On the next boot I was able to run Audio MIDI setup OK, but the software-defined receiver application (SDRDX) hung, and I had to force-quit it. I shutdown the guest again (from the Apple pull-down menu), and again still-running processes were being killed. The following boot attempt hung indefinitely on PCI configuration. Waited 2 hours or so (mowed my lawn) and it was still hung there, so I concluded I broke my guest. Luckily I had saved an earlier copy of the .vdi, so it wasn't as much of a disaster as it could have been.

I had run both of those applications several times on the guest without issues, so it does seem to correlate with having the USB sound device attached.

More than you wanted to know, I'm sure! But you did successfully answer my question, and I do appreciate it!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Unable to attach USB sound device to guest

Post by mpack »

I should perhaps clarify: while USB devices can't have two masters, a single master can provide a shared API. That is how multiple apps on your host PC can all produce sound at the same time. That is also how a VM would generally produce sound - by using the host OS sound API, not by owning the physical sound device directly. Similar logic applies to other host hardware which may be connected to USB such as keyboard, mouse, SD card reader, etc.
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Re: Unable to attach USB sound device to guest

Post by Radiohead57 »

I understand (but not as well as you do!).

I'm thinking processing the high-rate sampled audio was just too much for the Snow Leopard guest (?).

So I'm back to considering the "standard" audio driver solution provided with Virtualbox.

Problem is, with this approach I have no audio into the guest from the Line In port of the U7 sound device, the host microphone, or any other incoming audio source from the host into the Snow Leopard guest. No problem with those signals on the host, also no problem with the audio output from the guest to the host, through the U7, and out the speakers. I have no problem getting the sampled audio from the line input into my Windows XP or Linux guests, either. I have Audio Input enabled in the Settings for the guest, and am using the CoreAudio drivers and the Intel HD Audio controller. (I've tried the other available driver/controller combinations and they either kill all audio or are no better).

Any ideas? If you prefer I'll start a new thread for this question. (If so, would it be better to do so in this forum or the Mac OS X guests forum?)

Even if I can get the incoming audio to function, which I'd like to do, I give up the possibility of any sampling rate above 44100 Hz, right?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Unable to attach USB sound device to guest

Post by mpack »

I'll let others comment on the practicalities of using audio in an OS X guest. I simply don't use anything beyond basic audio output in my guests.

On audio sampling, I haven't checked the source code, but I don't see how any VM can practically resample already digital audio since it has no actual physical hardware to do it, so I'd guess that the sample rate is determined by the host.
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Re: Unable to attach USB sound device to guest

Post by Radiohead57 »

OK, thanks for your help. I'll start a new topic under "Mac OS X guests" with a subject line descriptive of the new question.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Any and all
Contact:

Re: Unable to attach USB sound device to guest

Post by michaln »

You might have some luck with xHCI (so-called USB3) emulation... but Snow Leopard is too old for that. If you have a high-speed USB 2.0 audio interface, it just won't work with the other emulations (OHCI, EHCI).
Radiohead57
Posts: 9
Joined: 24. Jul 2018, 15:18

Re: Unable to attach USB sound device to guest

Post by Radiohead57 »

Thanks for the information. I've been using EHCI. Looks like connecting directly to the USB device isn't going to be an option for a Snow Leopard guest, then.
Post Reply