May 28

How-to: Enable Surround Sound on Ubuntu Hardy

Tag: film, how-to, linux, music, ubuntuScott Wegner @ 6:36 pm

By default, Ubuntu Hardy Heron uses PulseAudio for audio mixing, which disables surround sound by default. I just bought new 5.1-channel speakers, but I was only heard sound coming from the front two. Disappointed, I went searching for the answer in the forums. If you want surround sound on your Linux setup, keep reading below..

Like I said above, Ubuntu now uses PulseAudio by default, so it dictates the kind of output you’ll be getting from your sound card. Luckily, PulseAudio makes it very easy to enable surround via a simple configuration file. I followed instructions here for editing via the command-line, but using a GUI should be just as easy.

  • Press Alt-F2 to open a “Run” dialog, and type “gksudo nautilus“. This will give us a file-browser with administrator privileges.

    Warning: With this file browser we have access to do almost anything to our system. Follow these instructions carefully, or things could get bad!

  • In the file browser, click on the “File System” icon on the right. Then navigate into the “etc” folder, and then “pulse”. This is the folder where our configuration file lives.
  • Make a backup of “daemon.conf”. Do this by selecting the file, copy it, and then paste it in the same directory. Right click the new copy and rename it “daemon.conf.bak”. This is just in case things go wrong– it’ll be easy to revert back to the original settings.
  • Now we’re going on edit the settings file. Double-click on “daemon.conf” to open it in a text editor. Remember that we have administrator privileges, so be very careful of the changes you make!
  • Find the following line in the file, it should be towards the bottom:

    ; default-sample-channels = 2

    First, remove the “;” character to “uncomment” the line. Then change the value from 2 to either 6, for 5.1 surround sound, or 8 for 7.1 surround. For example:

    default-sample-channels = 6

  • Save the file and exit the text editor and file browser. This is important so we don’t accidentally make more changes with administrator access.

That’s it for the hard part. For the changes to take effect, you will need to restart your computer. Afterwards, there is a simple command that you can use to test your surround sound. Press Alt-F2 to start the “Run” dialog, and enter the command:
speaker-test -Dplug:surround51 -c6 -l1 -twav
or to test 7.1 surround:
speaker-test -Dplug:surround71 -c8 -l1 -twav

This will play a sound from each speaker telling what channel it is set to. You should hear audio out of each one. If you don’t then you may have some of the channels disabled. Check them with the volume manager:

  • Right click on the volume meter in the panel and press “Open Volume Control”.
  • Make sure the “ALSA” mixer is selected. Go to File, Change Device, and select the one that contains “Alsa Mixer”.
  • By default, many of the channels are hidden. Select Edit, Preferences. Make sure you have at least the following selected: Master, Front, Surround, Center, and LFE (and Side if using 7.1 sound)
  • Now, make sure none of the channels are muted under the “Playback” tab. If they are, un-mute them.

    Then use the test command above to try again.

At this point you should have surround sound working via the test command. However, some applications may also need to be setup to use surround sound. Rhythmbox should play music using surround by default. However, Totem Movie Player needs to be configured for it. To do so:

  • Open Totem Movie Player from the Applications menu under Sound and Video, Movie Player.
  • Select Edit, Preferences, and click on the “Audio” tab
  • Set the “Audio output type” to your surround-sound preference. For example. 5.1-channel.

Other applications or webpages that use Flash may not use surround sound correctly. You can test if an application is using surround sound using the PulseAudio volume meter. To do so, press Alt-F2 to open the “Run..” dialog, and enter the command “pavumeter“. You should see sound in each channel.

I’ve been very happy with my surround sound so far. What experiences have you had? Did these instructions work for you? Are there any other applications you’ve found that don’t work with surround sound? Post in the comments.

Share:
  • Digg
  • Facebook
  • Reddit
  • StumbleUpon
  • email
  • Twitter

52 Responses to “How-to: Enable Surround Sound on Ubuntu Hardy”

  1. Alvaro Brange C. says:

    I wrote -before read this blog- one related article in my blog. “Enabling surround sound in ubuntu” in web:
    http://brange.wordpress.com/2008/06/09/enabling-surround-sound-in-ubuntu/

    Thank you for information.
    Regards

  2. Jon says:

    Hey, thanks for the info. I had the same surround sound problem.

  3. Ajibola says:

    Thanks a lot man !!. Such a simple step made sound come out from all of my 5.1 speakers ! you rock !!. But one question though, when i used the command you gave to test my surround sound, the sound came out of my laptop speakers though rhythmbox and totem both played sound from all of my 5.1 speakers.

  4. Scott Wegner says:

    Hi Ajibola,

    There’s a few things you can check out:
    First of all, make sure that all of your “Sound” settings from the System > Preferences menu is set to “Autodetect”; this should correctly select pulseaudio as the default.
    If that doesn’t work out, you may have an advanced configuration that I didn’t consider here. The forum article here has a lot more detail and user responses, which may point you in the right direction. Let me know if you find something useful there, and I’ll update this post!

  5. Locky says:

    Simply Brilliant … for sooo long I’ve been trying to get 5.1 working on Ubuntu distros

    Your detailed and easy to follow instructions (and pulseAudio) had my box booming in no time at all.

    Thankyou very much

  6. John says:

    Excellent. Had the same problem as described, resolved with this exposé. Thanks a lot!

  7. PaK says:

    WoW! i finnaly use all of my 5.1 system ! thankyou *_*

  8. Wilmar says:

    Don’t work for me, i’m use Ubuntu 8.04 – Hardy Heron, in a motherboard Intel DG33. The line (66 in my file) “; default-sample-channels = 2″ in the file daemon.conf is modified by “default-sample-channels = 6″, but pavumeter still showing only two channels. Suggestions?

  9. Dominik says:

    Sweeeeeet!

    I’ve recently installed Ubuntu 8.04, and being a noob I’ve been ripping my hair out trying to get things going….. You saved me a lot of hair!

    thanks a million

  10. nilendra says:

    Thanks a lot for the post. I was trying for this from few hour but until i get this post i was not able to fix my 5in1 surround speakers work. Now its working and cool.

  11. Jason says:

    Very cool!!! now I have 5.1 sound in ubuntu. 10 out of 10 set of instructions. thanks

  12. wexa says:

    Thanks a lot. You are the king.

  13. np says:

    I’ve been trying to get my 7.1 setup to work in Ubuntu but it usually involved some crude hack in asoundrc. Thanks for the instructions! I finally have full surround in Ubuntu ^^

  14. pssst … » Upgrading from Windows XP to Ubuntu says:

    [...] [Update - finally found this - brilliant] http://www.automaticable.com/2008-05-28/how-to-enable-surround-sound-on-ubuntu-hardy/. [...]

  15. somudrog says:

    Thanks! These instructions worked for me, except for two problems: 1) no sound from LFE in speaker test, and 2) master volume control from keyboard no longer works, which it once did when I only had sound from the front 2 speakers.

  16. drz4007 says:

    You saved me man!!! Thanx a lot and keep up the good work!!! (This works also in Ubuntu 8.10)

  17. mxxx says:

    cheers mate, worked perfectly. works in ibex, too.

  18. Scipione says:

    Thanks man, now my surround works too, the only bad think is that I don’t have the same sound quality in linux like in win xp :( , I think is something about sound driver, pulse audio never compares to original Creative’s SB driver :( .

  19. Tom says:

    thx mate, thx a lot, great howto :-)

  20. Lisa says:

    Thank you *so* much–this works fine in Intrepid, too! I had surround sound in Hardy, but only 2-channel worked after I upgraded to Intrepid this morning. I remembered having to mess with something to get 5.1 working when I first installed Hardy, but forgot what I’d done. Whatever it was, it wasn’t anywhere near as simple as this! :)

  21. Matt says:

    Thanks for the workaround, work perfectly on my Intrepid installation and Soundblaster Audigy ZS

  22. Uriah says:

    I have been fighting audio problems in Ubuntu Hardy for days. I even did a complete reinstall to correct all the mistakes I made following others’ how-tos! In five minutes (including reboot), your instructions solved all of my issues! Got you bookmarked now!

    Will subscribe to your email updates, too!

    Thank you ever so much!

    Yesterday’s a memory; tomorrow’s a dream; LIVE TODAY!

  23. Paul says:

    Don’t work for me, i’m use Ubuntu 8.04 – Hardy Heron, in a motherboard Intel DG31pr. The line (66 in my file) “; default-sample-channels = 2″ in the file daemon.conf is modified by “default-sample-channels = 4″, but pavumeter still showing only two channels. Suggestions?

  24. Scott Wegner says:

    @Paul: Did you restart your computer? This step is important, because PulseAudio will only read the new settings after it restarts.

  25. Halil İbrahim says:

    Ubuntu 8.10 kullanıcısı olarak sorunumu bu makale ile çözdüm.
    Teşekkürler…

  26. mnwr says:

    Thank you mate. I also have same problem. But your How to is awesome!

  27. mukesh says:

    i installed ubuntue hardy heron .bt does not get sound in laptop. i have y410 model of lenovo ply help me

  28. Borellus says:

    Nice one mate. I shall try this with my laptop.

  29. Asad says:

    Dude, you rock! Thanks a lot. Totally fixed my problem :) .

  30. Baasha says:

    Your how-to worked great except for one thing. I set up for 5.1 and when I run the twav file I get sound from front left, front right, rear right, and rear center. The sound for rear left comes out the rear right speaker. I can’t find any logical reason why this should be. Any ideas? BTW, I am running Hardy (8.04).

  31. Scott Wegner says:

    @Baasha: Hmmm, have you checked that all of the cords are plugged into the correct ports, whether it be at the back of your computer and at the hub of your speakers? Aside from that, I’m not familiar with any issues. You may want to look through the thread here:

    http://ubuntuforums.org/showthread.php?t=795525

    It contains feedback from many users, and might have a mention of your problem.

  32. MrJones says:

    Thank you very much! works perfectly with Linux Mint/Ubuntu and Terratec 5.1 Fun

  33. Mahesh says:

    its not working i’ve tried for many times my front speakers only working kindly suggest the same…

  34. kal says:

    THANK YOU!!!

    ONLY with you intrucciont it worked! I have a REaltek and creative 5.1. And just changing the daemon.conf file it worked!!! thank you thank you!!

  35. Ronin says:

    THANKS! I have Logitech x-530 5.1 and a Realtek AC’97 the central speaker don’t work. please help me! Thanks

  36. Haplo says:

    Hi, first thanks for the guide!

    I have done all that and I hear all my speakers with the speaker-test command… But neither rhythmbox or the media player play in 5.1!!!! (Even after I set the media player to 5.1 surround… rhythmbox doesn’t have any setting.

    Do you have any suggestion as to what else could I change?

    Thanks in advance!

  37. Locky says:

    Haplo – you will need to go in to each audio / video application and set the output to ‘Surround’ or 5.1 … should be in the ‘Edit / Preferences/ …’ menu item(s)

    Locky

  38. Vimal says:

    Hi.
    I am getting only stereo output on my Creative X-Fi sound card which supports 7.1 surround.
    I followed the instructions but it’s still not getting any surround.
    The default output is ALSA(OSS).
    Thanks in advance for your help!

  39. Haplo says:

    @Locky
    Thank you for the advice but, as I’ve said, Rhythmbox doesn’t have any setting to choose surround sound. Movie Player does, but even if selected I only hear 2.0.

    The speaker-test command does works and I hear soundcheck from every speaker.

    Any other think I could do to make this work?

    Thanks again!

  40. Haplo says:

    Fixed!!!

    I enabled the REALTEK audio card (never used it, I use my audigy) and logged in, then several mixers appeared that hadn’t before… Selected the Multichannel Playback ALSA one, from creative, and done!

    Thanks anyway :)

  41. Lizard_Chile says:

    Thanks man…. 5.1 work’s with the TEST speaker-test -Dplug:surround51 -c6 -l1 -twav

    mp3 and sounds works..

    but i have problems with DVD movies Avis, etc

    UBUNTU 9 going into balck SCREEN and freez…
    Any one knows how can i fix that problem?

  42. Jppdk says:

    This is a great guide, no doubt and everything went as per plan until the “speaker-test -Dplug:surround51 -c6 -l1 -twav”. The correct channel sound came out of the correct speakers. But Rhythmbox and VLC Player which I used could not figure out which channel was which. Front left came from the rear speaker, back left was muted and LFE was booming even when I kept the LFE volume in ALSA Mixer to zero… any ideas?

  43. ernesto says:

    Thank you for the post. This guide works on ubuntu jaunty (9.04) as well :D

    The pavumeter is not installed by default in jaunty. If I install it via apt-get will I get any problems/conflicts will puslse and alsa mixer? I read somewhere installing pulse causes problems with alsa.

  44. Sachin says:

    Hi Buddy,
    Thnx fr this guide, I tried all these things but still I am getting sound only from front speakers & centre one. I hav Dell-studio laptop with 3 sockets for sound one for mic & other 2 for speakers. I use 5.1 in windows successfully with this arrangement. I hav installed ubuntu 9 under Windows. When I run test command, its testing sound only from front left & front right speakers, but while playing music I can hear music from two front speakers & centre also. When I opened volume control & then preferences, there its showing only 3 required options as Master, Front, Surround & its not showing other required options as Centre & LFE & not also line In Oputput. Please give me some suggetions as I am very new to linux.

  45. antonio1 says:

    hmmm, I can see line in as output, but thatś what I want because my output speaker is broken, and I need to have a sound through line-in. Do you know what else I have to change. More than this pavumeter dont work for me!

  46. antonio1 says:

    I can not see line in as output, this is what I wanted to say.

  47. pred says:

    Works great, thanks for putting this up!

  48. GIRISH says:

    how to enable 2.1 surround in ubuntu? I set default-sample-channels = 3. but doesn’t work. help me.please….

  49. Helo1200 says:

    I know this is a bit late considering the date this was posted but i have a bit of a problem with my system. I recently bought a Logitech x-530 5.1 surround set and Ive done every single thing you said on the how to but i still cant get the proper sound. Btw, i have Ubuntu 9.10 and i have a 7.1 surround sound

  50. Baasha says:

    I have the same Logitech 5.1 speaker system and have the same problem. I have a suspicion that the speakers have nothing to do with it though, as I was able to get 5.1 sound in Ubuntu Hardy with no problem. But now that a lot of people have moved on to Ubuntu 9.10 (Karmic) we can no longer enjoy 5.1. Perhaps it is time to start a new thread about enabling 5.1 in Ubuntu 9.10, if such a thing is possible. I have read some comments in other forums that Pulse Audio is completely broken in 9.10. Is this true Scott?

  51. k0p1lu says:

    hy it works….but i got a problem after rebot have the setings but no more suround:( and nothing works…i tryed to make again the same thing but nope…don’t work can u help me pls?:D

  52. Nikos says:

    Just open Sound preferences and under the hardware tab, select the 4.x or 5.x profile for your sound card. It should work. Ubuntu has come a long way since Hardy Heron (where I used to fiddle with Alsamixer for hours, argghh)to make surround available.

Leave a Reply