Smoother recording on VirtualBox

For a number of years now I've been using NaturallySpeaking speech recognition via a virtualized Windows environment on Ubuntu. Speech recognition gurus will recommend using an external USB sound card so as to avoid any electrical interference common with soundcards within the computer case. This is fine for the most part, except that VirtualBox's performance with USB sound devices can be a little choppy unless one uses a low-latency (i.e., real-time) kernel. However, Ubuntu only seems to release such kernels every other release.

Luckily, I recently discovered that one can use USB microphones within VirtualBox as emulated hardware devices -- by making use of the VBOX_ALSA_DAC_DEV and VBOX_ALSA_ADC_DEV environmental variables. That is, instead of letting VirtualBox see the microphone as a USB device, you let Linux keep hold of it as a USB device, and it offers an emulated sound card to VirtualBox. This seems to avoid any audio problems in recording/playback, and means I am no longer dependent upon non-generic kernels.

I have posted a small Python script that sets these variables given a particular USB microphone that you want to use, and also sets the microphone volume level, since that is often set at zero in the Linux context.

Comments !

blogroll

social