Monday, August 25, 2008

How to Enable Surround Sound in Ubuntu Linux

Update (04/21/10): The information in this original post is no longer applicable since Ubuntu switched to the PulseAudio sound infrastructure. I'm leaving it all here for reference, but here's how to do it now:

Step 1: open up a terminal (Applications > Accessories > Terminal or Alt+F2 and type 'gnome-terminal' into the command applet)

Step 2: at the command prompt, type alsamixer

Your prompt should change to something like this:

Step 3: Scroll all the way to the right (using the arrow keys) until you reach a section labeled "Channel." It will most likely say "2ch" over it. Press the 'up' arrow key until it says 6ch (for 5.1 surround) or 8ch (for 7.1 surround).

Exit the alsamixer program by pressing ctrl+C. You should be all set. You may have to go into your Sound Preferences and change either the 'Profile' setting on the 'Hardware' tab or fiddle with the devices in the 'Output' tab. I didn't have to do this, but you might.

If you have any problems, leave me a note in the comments and I'll try to help.

Update (10/08/08): I was using Gutsy when I wrote this post, but I have since upgraded to Intrepid Ibex (8.10) and it still works for me. YMMV

I've been hard at work lately trying to get my motherboard's (an Asus M2V-MX SE socket AM2) 6-channel surround sound working with Linux and it's been a surprisingly stubborn pain in my ass. However, I finally succeeded this past weekend and decided to document my process here for others to hopefully benefit from.

The first complication I ran into when trying to get surround sound working is that my mobo does not have the normal multichannel output jacks. That is, instead of having the blue, orange, and black plugs that are in most multichannel setups, it instead just has what appears to be standard blue, pink, and green jacks that are usually used for stereo output, mic-input, and line-in, respectively.

What is poorly documented, though, is that the pink and green jacks can double as the orange and black plugs when enabled by software. It's a stupid way of doing things, IMHO, but low-end mobo manufacturers apparently do it to save costs.

Anyway, in Windows, enabling this hidden functionality was accomplished using the Realtek Sound Manager program that was installed with my sound driver. However, as with damn-near all driver utilities, it does not have a Linux equivalent.

Instead, open the Alsa-mixer GUI by double-clicking on the speaker icon in the upper-right of the screen (a.k.a., the Volume Control applet):

Then select 'Preferences' from the 'Edit' pull-down menu:

From here, you'll want to scroll down a bit and check the 'Channel Mode' box, and you'll probably want to check the 'Surround,' 'Front,' 'LFE,' and 'Center' boxes as well:

When you go back to the main applet, click on the 'Options' tab, which should now have an option to choose the number of channels:

Select '6ch' for a 5.1 setup or '8ch' in a 7.1 setup. This should unlock the hidden functionality of those pink and green jacks. On my system, the pink jack converts to the orange function and the green converts to the black function, but YMMV.

You could stop here, but I suggest doing one more step to make sure everything is configured properly. Open up a terminal and type:
speaker-test -Dplug:surround51 -c6 -twav
This will make a creepy disembodied voice play through each channel in succession so you can be sure your speakers are plugged into the right jacks.

Btw, this command is for a 5.1 / 6-channel surround card. A 7.1 system will use this command instead:
speaker-test -Dplug:surround71 -c8 -twav
For some people (like me), the system automatically duplicates the front channels' sound to the back channels for listening to stereo sources, such as mp3s, normal non-DVD video files, etc. Other people, however, will need to do a bit more to make this happen. If you're one of these people, open up a terminal and type:
gedit ~/.asoundrc
Whether this file is blank or already has some stuff in it, just skip down to the bottom and copypasta this in (courtesy of the Gentoo wiki):
pcm.!dmix {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
channels 6
period_size 512
buffer_size 1024
pcm.!default {
type plug
slave.pcm "dmix"
slave.channels 6
route_policy duplicate
You may have to change "hw:0,0" to something else, depending on your sound card's location. When you restart, surround signals will still work like before, but stereo signals should be duplicated. If, on the other hand, you have no sound or your sound is weird, just reopen the ~/.asoundrc file and delete the part you added (or try one of the other configurations from the aforementioned Gentoo wiki). No big deal.

Let me know in the comments if this works for you or not or if you have any questions.


Anonymous said...

was just curious as to how you got the 'channel chooser' option cause when i open it up i don't have that option

Hunter K. said...

Once you get into the 'preferences,' it should be one of the options with a checkbox beside it.

I just opened a virtual machine of Hardy (I still use Gutsy) and I see that it's not in the list anymore. I'm not sure if that's due to it being a virtual machine (and therefore not having the correct driver for surround sound) or because Hardy switched to Pulse Audio to handle all of the audio mixing.

Regardless, I would suggest clicking on *all* of the checkboxes and then check the 'options' tab to see if one of them enabled the 'channels' selector. If so, you can then go back and figure out which one was responsible and if not, you can try to figure something else out.

If it still doesn't work, leave another comment and I'll try to help

Brandon Jones said...

enabled all and its still not there, i've been struggling for about a year now trying to get full sound out of the m2v, and i guess since the change now i won't be able to:/

Hunter K. said...


man, that really sucks. Have you checked out this thread on the ubuntu forums?

It appears that pulse audio defaults to 2-channel, but it's just a matter of editing a config file to get full surround (hopefully).

If that doesn't help (or if you've already tried it unsuccessfully), check back here in a couple of weeks after the first Intrepid release candidate drops (I'll be switching to it then on my main machine) and we'll see what we can do. Someone mentioned in that thread that a point-and-click fix may be on the way soon, but until then...

I guess this is the kind of thing we have to deal with when we buy bargain mobos, eh? :(

Brandon Jones said...

Made the changes but no success, still just the two front speakers have sound. I guess I just have to deal with it. I don't understand why this problem still exists though, seeing as how this is not a fairly dated motherboard, there should already be built in drivers for it, especially since the old drivers are available as a free download from Only problem there is that it relies on an old configuration of alsa, 2006 version, which is deprecated so i can't install it.

Brandon Jones said...

Intrepid has been out a bit now and still no 5.1 sound from the m2v onboard sound card. I guess it's safe to assume that getting it working has been abandoned.

Hunter K. said...

Hey Brandon, I switched over to Intrepid a while back and the steps I outlined in the post worked fine for me. That's really strange that you're having a different experience.

If you type: lspci | grep Audio

is this the output you get?

20:01.0 Audio device: VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) (rev 10)

Brandon Jones said...

When I ran the command I got:

80:01.0 Audio device: VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) (rev 10)

But I still have no option in the preferences for channel mode or for the center, sub etc.

Hunter K. said...

hmmm. that's the right hardware, so the correct driver should be available in the kernel by default. Are you using a stock kernel (i.e., did you compile your own?) and did you do a fresh install of Intrepid?

Brandon Jones said...

Fresh install of intrepid and I didn't compile my own because every time I try to compile my own stuff it either fails to compile, or I break something :P

Hunter K. said...

lol, yeah, I know the feeling. I gave up on custom kernels a while back, too. Big PIA if you ask me.

I'm not sure what else to try since I can't reproduce the problem on my machine. If you're on a fresh install with a stock kernel, you should be able to see those options from the original post. I'm guessing your stereo audio works fine, right?

I'll see if I can find the config file for my audio settings and maybe you can just copy/paste it in place of yours to get things going. I'll post it here in the comments later this afternoon if I can track it down.

Brandon Jones said...

Alright that would probably help. All I have done since installing intrepid is update and install a few programs and plugins intrepid and I didn't compile my own s but none that would affect sound.

Hunter K. said...

hey Brandon, your ~/.asoundrc.asoundconf file should look like this:

!defaults.pcm.card VT82xx
defaults.ctl.card VT82xx
defaults.pcm.device 0
defaults.pcm.subdevice -1
defaults.pcm.nonblock 1
defaults.pcm.ipc_key 5678293
defaults.pcm.ipc_gid audio
defaults.pcm.ipc_perm 0660
defaults.pcm.dmix.max_periods 0
defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.format S16_LE
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
defaults.pcm.dsnoop.card defaults.pcm.card
defaults.pcm.dsnoop.device defaults.pcm.device
defaults.pcm.front.card defaults.pcm.card
defaults.pcm.front.device defaults.pcm.device
defaults.pcm.rear.card defaults.pcm.card
defaults.pcm.rear.device defaults.pcm.device
defaults.pcm.center_lfe.card defaults.pcm.card
defaults.pcm.center_lfe.device defaults.pcm.device
defaults.pcm.side.card defaults.pcm.card
defaults.pcm.side.device defaults.pcm.device
defaults.pcm.surround40.card defaults.pcm.card
defaults.pcm.surround40.device defaults.pcm.device
defaults.pcm.surround41.card defaults.pcm.card
defaults.pcm.surround41.device defaults.pcm.device
defaults.pcm.surround50.card defaults.pcm.card
defaults.pcm.surround50.device defaults.pcm.device
defaults.pcm.surround51.card defaults.pcm.card
defaults.pcm.surround51.device defaults.pcm.device
defaults.pcm.surround71.card defaults.pcm.card
defaults.pcm.surround71.device defaults.pcm.device
defaults.pcm.iec958.card defaults.pcm.card
defaults.pcm.iec958.device defaults.pcm.device
defaults.pcm.modem.card defaults.pcm.card
defaults.pcm.modem.device defaults.pcm.device
defaults.rawmidi.card 0
defaults.rawmidi.device 0
defaults.rawmidi.subdevice -1
defaults.hwdep.card 0
defaults.hwdep.device 0
defaults.timer.class 2
defaults.timer.sclass 0
defaults.timer.card 0
defaults.timer.device 0
defaults.timer.subdevice 0
defaults.namehint.showall off
defaults.namehint.basic on
defaults.namehint.extended off

There's some stuff at the beginning of the file about how you should edit ~/.asoundrc if you need to make manual changes, so keep that in mind.

Brandon Jones said...

Weird, I don't even have that file. I am using The alsa mixer driver though.

Hunter K. said...

Interesting... You could try dropping that file into your home folder and logging out and back in to see if it does anything worthwhile.

That's the only sound configuration file I'm at all familiar with, but if you come up with anything else, let me know and we can compare yours with mine. If we're working with the exact same mobo, I can't see any reason why we couldn't get your surround sound up and running eventually.

Also, have you tried the alsa-mixer command in the terminal? I'm not sure if it's any different from the GUI sound control, but you might give it a look-see if you haven't already.

Brandon Jones said...

Says alsa-mixer command not found

Hunter K. said...

hmmm. I'm not sure how to proceed... have you seen this thread?

The OP seems to have a problem similar to yours, and they have a couple of good potential solutions in there.

I recommend trying those, and feel free to ask here if you have any questions about anything in the thread. I'll help any way I can.

Declan said...

Hey there, the instructions work for me, and playing the test sound, works on all the speakers......with the exception of the subwoofer.

Any ideas on getting that to work? Thanks again.

Hunter K. said...

Ok, just to rule out the simplest possibilities: is your LFE channel also activated? I left it out of my instructions on accident (now corrected), but that's the channel that controls the subwoofer. It could be muted or turned down really low or something. Also, have you double-checked to make sure the subwoofer is plugged into the proper channel (physically) and all that? I don't want to insult your intelligence, obviously, I just want to cover all the bases before we start digging into anything more complicated, especially since the other channels are working fine. :-)

Brandon said...

Alright after not having it work for so long I have decided at giving it one more shot. I'm wondering if there is a way to have the system recheck and reconfigure the configuration automatically. Because one thing I have noticed is on a windows it detects when I have the jacks input. This led me to wonder if maybe the reason its not working correctly is because I never install with my speakers connected to the desktop, so I'm thinking it's autodetecting only two channels.

Analytics Tracking Footer