Linux surround sound with PulseAudio (mini-HOWTO)


For traditional ALSA surround sound, go here.


Last modified: Fri Sep 26 21:49:21 2008
Author: Uday Kumar Reddy <udayreddy@gmail.com>
Polish translation by Olga Babenko
Indonesian translation by Jordan Silaen


Creative Commons License

This work is licensed under a Creative Commons NonCommercial Sampling Plus 1.0 License.


PulseAudio seems to be the new wave in desktop Linux audio with several new distributions like Fedora Core thrusting it on users by making it the default pcm and ctl device. This has also made newbies and intermediate users clueless on how to tackle issues they have been used to when dealing with ALSA directly.


Unfortunately, getting surround sound working is not without trouble. None of the documentation, HOWTOs, tips, forum posts that I have looked at give a complete solution -- they may not work for most of the cards. The missing information and the problem seems to be the inability to correctly set and report volumes for various channels (center, rear, LFE) coupled by the misleading display of the pulseaudio volume meter and volume control utilities. The following simple steps will hopefully solve the problem.


  1. In case you do not have pulse configured for multiple channels, you should do that first -- this is already covered on various HOWTOs on the web and the official pulse documentation. I will anyway repeat them. Edit /etc/pulse/daemon.conf around line #66 to increase the number of channels to 6 (for 5.1 audio), or to 8 (for 7.1), and so on. Restart pulseaudio after this edit.
    # vi /etc/pulse/daemon.conf
    
    ...
    default-sample-channels = 6
    ...
    
    $ pulseaudio -k
    $ pulseaudio -D
    
    
  2. Now comes the tricky issue. Even with the above change, you may still find audio output on only the front channels. This is contrary to what 'pavumeter' or 'pavucontrol' would show. The center, rear, and LFE channels are most probably muted or set to 0. The following is the misleading display.

    pavumeter

    pavucontrol

    The problem can be circumvented by using alsamixer that will set the volumes correctly. Run it as follows:
    $ alsamixer -c 0
    
    Use left/right arrow keys to move to the correct tower, and 'm' to toggle mute, and up/down to increase/decrease channel volumes. Unmute the "Surround", "Center" and "LFE". I usually set LFE and surround to 100%, center to 75%, and PCM to 40%. You do not have to restart pulseaudio for the above to take effect. NOTE: Just running 'alsamixer' as suggested here will not help. To automate all of the above, edit /etc/rc.local and introduce these lines:
    # vi /etc/rc.local
    ...
    echo Setting 5.1 Channel volumes... 
    amixer -c 0 -q set Master 100% unmute  
    amixer -c 0 -q set PCM 40% unmute  
    amixer -c 0 -q set Surround 100% unmute  
    amixer -c 0 -q set Center 81% unmute  
    amixer -c 0 -q set LFE 100% unmute  
    amixer -c 0 -q set "Surround Jack Mode" "Shared"  
    amixer -c 0 -q set "Mic select" "Mic2"   
    amixer -c 0 -q set "Mic" 65% unmute  
    amixer -c 0 -q set "Channel mode" "6ch"   
    amixer -c 0 -q set "Center/LFE Down mix" mute   
    amixer -c 0 -q set "Duplicate Front" mute   
                

With the above, you will have output on all speakers.


Comments, questions, and feedback by email are welcome.

References

  1. PulseAudio wiki FAQ - surround sound card
  2. Ubuntu forum post - Surround sound in PulseAudio

Up to my home page