FAQ028
From the ALSA wiki
| The FAQs have been reorganized. The new location of this question is Playing stereo on surround sound setup (Howto) |
Can I play stereo files over all speakers of my 4.0, 5.1 or 7.1 surround-sound setup?
Yes, you need to edit your .asoundrc file for this to work. I quote Takashi's email from the alsa-user mailing list:
On 28 Jan 2004 Florian Schmidt wrote: Hi, as far as i understand it, the copy plugin does nothing but copy its input to its output. I wonder if it would be easily possible to extend this plugin to copy to multiple slave PCMs. This way it would be (easily?) possible to "distribute" a stereo signal to 4 or even 6 channels. The route and plug plugins already can do that, for example...
pcm.ch40dup {
type route
slave.pcm surround40
slave.channels 4
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}
pcm.ch51dup {
type route
slave.pcm surround51
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
}
and you can play two channel WAV using...
aplay -Dch40dup 2ch-stereo.wav aplay -Dch51dup 2ch-stereo.wav
for 4.0 and 5.1 surrounds, respectively. Of course, this is just a copy of the left/right samples and no Dolby Prologic effect is included ;)
On 28 Jan 2004 TakashiIwai wrote more about this issue: Route (and plug) plugin already can do that. for example, in your question, multiple slave PCMs are assumed. In such a case, combine the multiple PCMs via the multi plugin at first, then use the route plugin over it.
To use the ch40dup or ch51dup devices with XMMS go to Preferences (Ctrl+P), choose the ALSA output plugin in the Output Plugin box, choose Configure and fill in the device of your choice at Audio device (it won't be in the list).
Hello. I've been having problems with the line-input capture. I'd like to take this stereo input and send it over my surround setup on my sounblaster live 5.1. MPlayer and XMMS already play in surround without a script like the above one, but the line in does not. Do I need to use a script like the one above in order to sort this out? Cheers
oni@section9.co.uk
Instead of worrying about the ttable thing, you can also just use thise code in your .asoundrc:
pcm.duplicate {
type plug
slave.pcm "surround51"
slave.channels 6
route_policy duplicate
}
You just have to adjust the channels to the number of channels you have. Then just choose the duplicate plug in your audio player, and there you are. You can even set the slave as a dmixer, so you can have software mixing at the same time as you are 'expanding' a stereo file to all your speakers, like e.g. this:
pcm.dmixs51 {
type dmix
ipc_key 1024
slave {
pcm "hw:0,1"
rate 48000
channels 6
period_time 0
period_size 1024
buffer_time 0
buffer_size 4096
}
}
pcm.duplicate {
type plug
slave.pcm "dmixs51"
slave.channels 6
route_policy duplicate
}
Note that in this case, I use the pcm "hw:0,1", this may be "hw:0,0" for your soundcard (mine is a CMI8378).
Sebastian Brocks mail@sebastian-brocks.de
If you use duplicate instead of the ttable routing then your center (and LFE) channel will be a copy of one of the input channels. Using ttable (as above) you can mix the left and right channels to get a more correct center.
One can use:
mplayer -af pan=2:1:0:0:0 file.ogg # left mplayer -af pan=2:0:0:0:1 file.ogg # right
to test how the left and right channels are mixed.

