Ubuntu Linux 100% digital audio ( pulseaudio AC3 passthrough with a52 encoding )

For a long time, my Ubuntu machine could only play AC3 passthrough sound or Desktop sounds separately. If I was watching a DVD, and accidentally made a desktop sound effect the DVD AC3 audio would stop, and the desktop sound would play, then I would have to pause and play the DVD to get AC3 running again.

Finally, with the release of Pulseaudio 0.9.22, Ubuntu has finally given us the chance to play AC3 Pass Through, and PCM audio mixed seamlessly into a single digital AC3 stream ( something windows users have always taken for granted ).

Here are some details on how it works:

The first file that needs to be configured is /etc/asound.conf . It should look 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
  }
}

Next, you have to ensure you have some dependencies pre-installed:

sudo apt-get build-dep libasound2-plugins
sudo apt-get install libavcodec-dev libavformat-dev

You must also download and compile the asound2 source code. The reason for this is, the version of asound2 that ships with Ubuntu is missing some of the required libraries:

mkdir ~/tmp
cd ~/tmp
apt-get source libasound2-plugins

Now, you must build the plugins:

cd alsa-plugins-*
./configure
make

Once the plugins are built, you have to copy them to the /usr/lib/alsa-lib folder:

cd a52/.libs
sudo cp libasound_module_pcm_a52.la libasound_module_pcm_a52.so /usr/lib/alsa-lib/

Now, restart alsa, and pulseaudio:

sudo alsa reload
killall pulseaudio

Once completed,Pulseaudio will automatically probe it and provide you the option of selecting a 5.1 Digitial Output profile. You can use pavucontrol’s Configuration tab to pick your profile (or gnome-volume-control or the Speaker Setup tab in KDE).

Any applications which don’t have a sound setting for pulseaudio can use the sound device ‘pulse’ to connect to pulseaudio. Some applications require other configurations to get them to work. For example, to get XBMC to play ac3 passthrough, you actually have to set it to use the ‘Analogue’ profile instead of ‘Digital’ ( but keep the speakers set to 5.1 configuration ).

Bookmark the permalink.

Comments are closed.