|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Wednesday, 21 February 2001||Author: Brian Richardson|
|Published to: enhance_articles_hardware/Hardware Articles||Page: 1/1 - [Printable]|
Fiddling With USB Audio And Linux
Many Linux users aren't aware that the 2.4 kernel adds support for a number of interesting devices, as reported by Brian Richardson. Brian describes what he did with Linux and a set of Microsoft USB speakers. You should find it intriguing.
|Page 1 of 1|
For years, only Microsoft Windows users could truly benefit from the wide assortment of USB devices on the market. The average Linux user probably thinks that USB devices are keyboards, mice, joysticks and webcams, perhaps nothing to get too excited about. What many people may not know is that the 2.4 kernel adds support for more interesting devices, like USB Audio. This article describes my experience with Linux and a set of Microsoft USB speakers.
Most users are not familiar with the concept of USB Audio, and many experienced computer users will squirm at the thought of using USB in place of their "standard" ISA or PCI sound card. What would compel a user to replace tried and true sound hardware with these strange speakers?
USB Audio devices adhere to the USB audio class specification. The USB device performs all of the digital-to-analog (D/A) conversion usually associated with a "standard" sound card. USB Audio devices receive simple packets that contain the binary information required to recreate 16-bit stereo sound.
Most USB Audio devices look like speakers with a USB plug in place of an audio jack. One speaker will have the speaker's controls: volume, treble/bass, mute and perhaps a power button. Except for the USB hardware, USB Audio speakers look just like the average set of computer speakers.
USB Audio is very consumer oriented ... the ultimate form of Plug and Play. Anybody who has ever worked technical support can understand the perils of walking an average "home computer user" through any hardware installation. Computer manufacturers worship any technology that can be installed without the user actually having to open their computer case, because it greatly reduces the amount of technical support the company has to provide to its customers. As long as the operating system has good USB support, installation is a snap for any level of user.
Assuming the operating system supports USB Audio, installation involves plugging a small rectangle into another small rectangle, pretty darn brainless. Easy to install and they sound good. The audio stays digital all the way down the USB cable, which cuts down on the noise found in an analog signal.
This works great for an emerging market in the Linux world: embedded systems. If you want to build an Internet appliance with an option for MP3 playback, use a USB Audio device. There's no extra hardware required on the mainboard, so the appliance stays small ... and the end-user installation is painless.
USB Audio devices do have a few disadvantages compared to a traditional sound card.
USB Audio is best suited for the "end user" who wants to add digital audio to a computer without the need for tools or open expansion slots. Embedded Linux systems can also utilize USB Audio, since it does not require any sound hardware on the system board (keeps the design small).
The "hardcore gamer" will fare better with a good PCI sound with surround sound outputs, keeping every last CPU cycle to render the violent demise of their latest victims. But USB Audio may appeal to users who fear screwdrivers, or wish to add digital audio to a system devoid of expansion capabilities.
Support for USB Audio in the 2.4 kernel provides a painless end-user install experience, assuming the kernel is properly configured. Let's review the steps required to enable USB Audio in the 2.4 kernel.
Properly enabling USB Audio requires compiling the 2.4 kernel. If you're unfamiliar with compiling the kernel, take a look at Linux.com's 2.4 kernel article for assistance.
There are four main items to be enabled in the kernel configuration menu:
Sound card support: To enable USB Audio support 'Sound card support'
must be enabled in the kernel. This is necessary to allow your USB Audio device
to look like a sound card to Linux.
After compiling and installing the new kernel, it's time to test the sound. First, mount the Preliminary USB Device Filesystem so you can check and see if the device was detected (only valid if 'Preliminary USB Device Filesystem' was selected in kernel configuration). As root, type the following command:
mount -t usbdevfs none /proc/bus/usb
This creates the directory /proc/bus/usb, which describes your USB configuration.
All detected USB devices are listed in the file /proc/bus/usb/devices (the output is a bit of a kludge, so read this helpful document to translate the format). Your USB Audio device should show up here. If it doesn't, check the kernel configuration ... or make sure the device is plugged in (sorry, but I had to ask).
Sidenote: USB Audio devices generally appear to me a single device with multiple functions, otherwise known as a 'composite device.' One device is USB Audio compliment, and the rest are typically 'Human Interface Devices' (HID): volume control, tone, mute button, etc. Linux properly supports the USB Audio device, but doesn't recognize the buttons properly. . . yet.
The USB device drivers currently loaded are listed in the file /proc/bus/usb/drivers. Make sure the 'audio' driver is present. If you compiled 'USB Audio support' as a module, you might need to load the 'audio.o' module.
If your device was detected and the USB Audio driver is loaded, it's time to make some noise. You can start your favorite MP3 player, or just cat a file to the audio device. Your audio device will be mapped to /dev/audio or /dev/dsp. One warning: the volume of USB Audio isn't controllable by software in most Linux applications. Make sure your speaker volume isn't set to Super Mofo Loud before testing the device. (Trust me, I learned this from a painful experience involving a subwoofer and the 'Sounds of Slashdot' MP3 file.)
As far as hardware installations go, USB Audio is one of the most painless Linux experiences I've ever had. My Microsoft speakers worked the first time they were plugged in (louder than planned, but functional). For more information concerning USB under Linux, check out the Linux USB Project and the Linux-USB Device Overview.
Brian Richardson enjoys the fact that Microsoft's USB hardware works so well on his Linux computer. He wonders how long it will take Microsoft to ditch that whole "software business" and focus their energies on being a Linux hardware vendor
|Page 1 of 1|