Configure audio devices on VirtualBox

I recently installed a new Debian guest on a FreeBSD host with VirtualBox. On this VM I need to be able to play/record sound from my laptop (Skype). To do so I configure the guest with an Intel HDA soundcard using the OSS audio driver. However I want to use the internal mic (/dev/dsp1.0) which is different than the default unit (/dev/dsp). So I had basically two options. Either I could record my voice but could not hear anything or I could hear everything but could not record my voice.

But there is a solution! I digged in the VirtualBox source code, and there are actually some options for the OSS driver (and other audio drivers as well). The two options of interests are:

  • DACDev: Path to the DAC (output/playback) device.
  • ADCDev: Path to the ADC (input/record) device.

You can use VBoxManage to configure these options. Assuming that the name of the VM is MyVM with an Intel HDA card and the OSS driver, use this command:

$ VBoxManage setextradata MyVM "VBoxInternal/Devices/hda/0/LUN#0/Config/Audio/OSS/ADCDev" /dev/dsp1.0

You can also directly edit the vbox file for this VM:

MyVM.vbox:

<ExtraData>
  ...
  <ExtraDataItem name="VBoxInternal/Devices/hda/0/LUN#0/Config/Audio/OSS/ADCDev" value="/dev/dsp1.0"/>
</ExtraData>

Note if when starting the VM you receive the message The attached driver configuration is missing the 'Driver' attribute (VERR_PDM_CFG_MISSING_DRIVER_NAME). This is probably because the sound device you selected for this VM is not the same as specified in the extra data. The above example is for Intel HD Audio (hda). If you need ICH AC97, replace hda by ichac97 in the example above.

2 thoughts on “Configure audio devices on VirtualBox

  1. Does this still work? I’ve digged through the source code of VirtualBox 5.2.18, but cannot find any references for “DACDev” or “ADCDev” whatsoever..

    Greetings from Munich,
    Armin

    • Indeed the options were removed in VirtualBox 5.0.0. This was a major rewrite in C++ and apparently they removed some stuff in the process 🙁

      But apart from the missing options, the OSS driver still seems able to use two different devices for input and ouput. It should not be that hard to allow the devices to be specified instead of the hardcoded value. Using environment variables, for instance, this would be a piece of cake.

Leave a Reply to Armin Gruner Cancel reply

Your email address will not be published. Required fields are marked *

÷ three = three