Introduction: Play Dolby Digital 5.1 Audio on Raspberry Pi

About: Systems Administrator and Software Programmer.

Introduction

Playing a sound file encoded in Dolby Digital 5.1 is doable with Raspberry Pi 2's quad-core processor that runs at 900MHz. In this instructable, a media player called MPLAYER will be used to decode sound encoded in Dolby Digital 5.1 and send the 6 channels of audio to an ALSA Virtual Device. The ALSA Virtual Device downmixes the 6 channels of audio into 2 channels as the Raspberry Pi's build-in sound chip support only stereo (2 channels: LEFT and RIGHT).

Scope

This instructable will cover the following:

  • Play Dolby Digital 5.1 Audio and send 6 channels to ALSA Virtual Device that downmix es 5.1 channel sound to 2.0
  • Create a virtual device that downmix 5.1 channel sound to 2.0
  • Install Advanced Linux Sound Architecture (ALSA) utilities
  • Use ALSA utilities to test sound card and sound device

This instructables will NOT cover the following

  • PulseAudio
  • Open Sound System (OSS)

Specifications

My Raspberry Pi:

  • Raspberry Pi 2 model
  • Raspbian based on Debian Version 8.0 (a.k.a Jessie)
  • Advanced Linux Sound Architecture Driver Version k4.1.10-v7+
  • Pulse Audio and OSS are NOT installed
  • 2 speakers connected to Raspberry Pi's audio/video 3.5mm socket.

Dolby Digital 5.1 Logo is the trademark of Dolby Laboratories.

Step 1: Test That Raspberry Pi's Built-in Sound Card and the Speakers Work

Step 2: Create a ALSA Virtual Device That Downmixes 5.1 Channel Audio to 2.0 Channel

Step 3: Install MPLAYER Software

Open terminal:

sudo apt-get update
sudo apt-cache show mplayer2

Read the description of mplayer.

sudo apt-get install mplayer2

Step 4: Test ALSA Virtual Device Downmixes 6 Channel to 2 Channel Audio

The MPLAYER is expected to decode sound stream in encoded in Dolby Digital 5.1 and send 6 channels to ALSA Virtual Device. Alsa Virtual Device will downmix the 6 channel of audio to 2 channels.

Download the media file (dolbyaurora.vob) that I have upladed.

Open terminal:

Change directory to where the media file (dolbyaurora.vob) was saved.

mplayer --ac=a52 --channels=6 -ao alsa:device=51to20 dolbyaurora.vob

You should see the video as shown in the screenshot and more importantly hear the audio.