Playing a 5.1 channel sound in the Raspberry Pi's built-in sound chip analogue output is not doable unless the 5.1 channel sound is downmix to 2 channel. This instructable will show how to downmix 5.1 channel sound to 2.0 channel sound. After completing this instructable, you might be interested to check out "Play Dolby Digital 5.1 Audio on Raspberry Pi" instructable.
This instructable will cover the following:
- How to create a virtual device that downmix 5.1 channel sound to 2.0
- How to install Advanced Linux Sound Architecture (ALSA) utilities
- Use ALSA utilities to test sound card and sound device
This instructables will NOT cover the following
- Open Sound System (OSS)
My Raspberry Pi:
- Raspberry Pi 2
- Rasbian 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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Test Sound Card and Speakers Are Working
Complete the Test Sound Card and Speakers instructable.
Step 2: Provide Instructions to ALSA to Create a Virtual Device
Use a ALSA plugin called "route"."Route plugin converts channels and applies volume during the conversion"
Use vi or any text editor.
Enter the lines as shown in the screenshot.
Save the file.
Step 3: Check That ALSA Created the Custom Virtual Device
ALSA will read "home" directory for .asoundrc and create the virtual device that was defined in the previous step.
The above program will display the custom virtual device as:
Virtual device that downmixes 5.1 channel to 2.0 channel
Step 4: Test the Virtual Device
I have uploaded a sample sound file that has 6 channels (5.1) to test the virtual device that was created in the previous step.
Download the 51sound.wav
aplay -D 51to20 51sound.wav
The front 2 speaker should say the following:
Speaker RIGHT: "FRONT RIGHT"
Speaker LEFT: "FRONT LEFT"
Speaker RIGHT and Speaker LEFT together: "CENTER"
Speaker RIGHT and Speaker LEFT together: Some words that I cannot make out
Speaker RIGHT: "REAR RIGHT"
Speaker LEFT: "REAR LEFT"