How to set up surround 5.1 audio in Linux with Alsa
The main problem I had with the sound setup in linux was getting it to work so that i can use all my speakers. After a few hours of searching the web and trial and error I finally figured out how to do it. I have put together this tutorial hoping to help other people in a similar situation.
The goal of this tutorial is to play stereo sounds on all 6 channels of your audio card. All you need to do is to write the routing information in your ~/.asoundrc file. Here is my setup with every block explained
pcm.sndcard{
type hw
card 0
device 1
channels 6
}
Here i am setting an “alias” for my sound card. if you have morre sound cards in your system, specify the default card by replacing “card 0″.
pcm.dmix6 {
type dmix
ipc_key 1024
ipc_key_add_uid false
ipc_perm 0660
slave {
pcm sndcard
rate 48000
channels 6
period_time 0
period_size 512
buffer_time 0
buffer_size 10240
}
}
This is a dmix, its purpose is to mix sounds that are played simultaneously.
pcm.ch51dup {
type route
slave.pcm softvol
slave.channels 6
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
ttable.0.4 0.5
ttable.1.4 0.5
ttable.0.5 0.5
ttable.1.5 0.5
}
Here is the actual routing where the stereo sound is converted into a 6 channel sound.
pcm.softvol {
type softvol
slave {
pcm “dmix6″
}
control {
name “softMaster”
card 0
count 2
}
}
This is an optional mixer slider controlling the volume on all the channels at once.
pcm.duplex {
type asym
playback.pcm “ch51dup”
capture.pcm “hw:0″
}pcm.!default {
type plug
slave.pcm “duplex”
}
And finaly the output and input of the sound card are combined in the same virtual device which is set as the default device.
Don’t forget to restart all the applications that use the sound card (and your mixer program if you installed the optional mixer slider) and enjoy the music.
For aditional and more detailed information check out the sites bellow
|
del.icio.us |
July 25th, 2007 at 11:47 am
My 5.1 Creative sound card “just works” with all channels for me.
July 25th, 2007 at 12:49 pm
I have a Realtek ac97 on board sound card and by default it only works with 2 channels if i play a stereo sound although if i watch a 5.1 movie it works on all the channels
July 25th, 2007 at 1:37 pm
My 7.1 Creative just works will all channels for me in PCLinuxOS. Not so in a few other distros.
July 28th, 2007 at 3:22 am
Here is an adaptation for 7.1
August 2nd, 2007 at 7:54 pm
Hello.
I have sound system 4.0 consist of two stereo pairs: JetBalance jb381 and Microlab Solo1 connected to my sound card Creative Live! 7.1 24bit (ca0106).
Could you publish .asoundrc file for my configuration, please?
At that moment my sound system can play in stereo surround 4.0, but not multithreading OR can play only in one stereo pair with multithreading, BUT NOT together (multithreading and 4.0).
You are my last hope. Please, help.
P.S. Sorry for my English.
August 18th, 2007 at 3:33 pm
Here for 4.0
October 14th, 2007 at 7:45 pm
Thanks
November 19th, 2008 at 1:31 pm
And how about Creative X-Fi Xtreme Audio PCI. Does it also makes surround 5.1?