Japantown (Taken with instagram)
This guest post was submitted by Sara Michael, a Baltimore-based writer and editor.
I was 12 when my mom died of pancreatic cancer. That was more...
Ernst Haeckel.
Desmonema.
Kunstformen der Natur.
1 post tagged surround sound
Surround sound in Linux is a funny beast. Getting it to work on your specific sound card and with you specific application can provide a healthy challenge for even the most 1337 h4x0r. Sometimes you plug in a sound card and everything works. But more often than not, something smells: channel counts are off, some applications use the card improperly, or the OS defaults the card spec to “stereo duplex”. This article is a summary of some techniques for the interfacing with your sound card and getting it to play surround sound.



Once upon a time, a multichannel sound card was quite an expensive addition to your kit. Today there are a number of very inexpensive USB devices on the market that provide pretty decent multichannel outputs. These units are typically marketed as 5.1 surround sound cards for movies or games.
From this point forward, we are focused mostly on cards in the $50 price range with a USB interface. In general with sound cards, you get what you pay for. Buying a $60 sound card is generally going to sound a lot better than a $20 sound card. As much as you might expect name brands to charge a premium for the same product, I have not necessarily found this to be true. This market is pretty highly commoditized with sound quality improvements generally increasing the price of a card.
The good news is that at this point I am pretty sure that most USB 5.1 cards on the market work well with most of the popular flavors of Linux. The bad news is that some require considerable configuration in order to work, with others literally just plug and play (as you can tell by the length of this article).
The following are some cards that I have experimented with and gotten to output in true multichannel with various degrees of difficulty.
The best luck I had was with the Creative X-Fi which I very literally plugged in and it worked. This was true for both Ubuntu Linux and a pre-compiled version of Angstrom Linux for the Beagleboard. The Terratec and the GWC took some experimentation, but after writing the correct configuration file for ALSA, they work great. More on that in the next section.
This is by no means a comprehensive list. I fully endorse experimenting with other cheap cards on the market - eBay is littered with them. Chances are good that you will find something that works.
To properly configure your sound card, you need to know how to talk to it. A command line utility is available called aplay, that among other things, will reveal some information about the sound card(s). Using the -l flag, aplay gives you something like the following.
Here we are told that I have 2 sound cards, starting the count at 0: the internal card and the USB card, in this case the Terratec Aureon.
Each of the cards also have “devices”. These devices typically correspond to available input and output groups on the card. You may also notice here that there is only one device listed for the Terratec. This is not completely true. The Terratec Aureon actually has a number of other devices including an optical i/o and analog in, none of which appear on this listing. This discrepancy is because on some cards digital out (and other devices) is already — or even exclusively — defined as an alias. See aplay -L for available playback device aliases.
Now that’s more like it. Here we see aliases (the top line of each listing before the indent) pointing to the expected features of each of the cards. Ultimately if this listing does not reflect what you think your card features, you card is likely incompatible.
Both listings are important in determining how to talk to you card.
If you are using Linux with an installation of Gnome or some other desktop environment, configuring the sound card can be relatively simple.
On Ubuntu for instance, there is a panel under Preferences -> Sound where you can change the configuration of the sound card to explicitly “5.1 output”. This will solve most problems with GUI based applications.
If however you are trying to use a command line utility like the excellent MPlayer, then you will need to start hacking at ALSA a bit. While this can be a little confusing for the uninitiated, its not that hard. Essentially you will be writing a file called ‘.asoundrc’ with a configuration that ALSA can work with.
There are a lot of configuration files out there that profess to properly configure a card for surround, but upon closer inspection, they are mapping stereo channels to 6 surround channels. This post does not concern itself with stereo duplication across a multichannel interface and I will make some attempts to clarify configurations.
There are a number of different ways that you can address your sound card and its devices from applications. This differs somewhat between the application you are using, the audio drivers, and whether you are addressing them via aliases or directly as card/device numbers. Armed with the knowledge gained in the previous section about our card, we can start to test multichannel playback.
For this section, reference this page.
References and links
http://www.halfgaar.net/surround-sound-in-linux
http://www.alsa-project.org/main/index.php/Asoundrc
http://alsa.opensrc.org/index.php/Asoundrc
http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
http://alsa.opensrc.org/index.php/DigitalOut
Loading posts...