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
  • del.icio.us
  • Facebook
  • Reddit
  • StumbleUpon
  • E-mail this story to a friend!

If you're new here, you can subscribe to automaticable's RSS feed by clicking here. Or, you can get post updates through your email. Thanks for visiting!

18 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 :(.

Leave a Reply