5.1 Surround Sound output on Ubuntu Linux

My desktop computer has built-in optical audio output, also known as a TOSLINK connection, or S/PDIF, which allows compressed/digital surround audio output via Dolby Digital and DTS. While this works moderately well in Windows (once the audio settings are properly configured, and an application outputs explicitly in in the compressed format), I’ve had much difficulty getting this to work consistently on Linux, Ubuntu in my case. While I’ve had some success in the past, doing things like compiling Alsa a52 passthrough plugins and such, it seems every upgrade of Ubuntu requires a new (or complicated) way of getting it to work properly. I finally managed to get it working again on Ubuntu 15.04, and it was thankfully quite simple to do.

The first thing to do is add the a52 support. Although in the past this had to be compiled manually, I found a handy library hidden in the repositories that has this done. To install it, run the command:

sudo apt-get install libasound2-plugins-extra

In an earlier version of Ubuntu, I recall this being all that was required to get it working. Currently, one extra step is required, which I discovered in another blog post. This entails adding a file to the home directory:

vi ~/.asoundrc

and the contents of the file are as follows:

pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  }
  type rate
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
    rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  }
}

After this, all that was required was restarting pulseaudio:

pulseaudio -k

The service then restarts itself. The Digital Surround 5.1 option is then present in the Pulse Audio Volume Control configuration settings. Immediately, upon playing a video with VLC player that has surround sound, I could hear the difference.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s