Ubuntu 12.10 and s/pdif or iec958 or optical audio output

I’ve given up on cable and satellite TV. For my needs a combination of MythTV, Hulu, and [Amazon Prime] are sufficient.

So, essentially my “TV” is an Ubuntu box. Recently that box died and I replaced it with a new one that featured an optical audio output or TOSLINK or S/PDIF.

Everything basically worked … except for 5.1 surround sound. All I kept getting was stereo.

Getting it to work as 5.1 surround was not too actually hard, once I pieced all the details together.

Here is the step by step.

First we install the ”a52” module:

sudo apt-get install libasound2-plugins-extra
sudo apt-get install liba52-0.7.4

(technically I think only one of the above is needed, but it’s working now).

Then create an /etc/asound.conf with the following contents:

# /etc/asound.conf
# alsa plugin a52
# speaker-test -c 6 -l 1 -D pcm.a52:[CARD]
pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  type rate
  slave {
    pcm {
      type a52
      bitrate 640 # 448 is max for most
      channels 6
      card $CARD
  rate 48000

Now, kill the pulseaudio server and the reload the alsa modules:

killall pulseaudio
sudo /sbin/alsa force-reload

Last you will need to install the pulse audio control:

sudo apt-get install pavucontrol

This last one is critical since the gnome volume control doesn’t permit you to see and set the Digital 5.1 output. So once it is installed run pavucontrol from the terminal or via the menus. Click on the ”Configuration” tab and select ”Digital Surround 5.1 ….”

And then you should be able to see volume sliders in the ”Output” tab:

Last word of warning: the gnome sound settings will allow you to goof it up by allowing you to select something other than the ”Digital Surround 5.1 ….” setting, but not to select it. You’ll have to stick with pavucontrol for that one.



Leave a Reply

Your email address will not be published. Required fields are marked *