5.1toStereo asoundrc Profile

From Gravity
Jump to: navigation, search


Last Updated by Kevin Ponto 5/24/2009

In linux, audio channels can be remixed via the file .asoundrc found in the user's home directory.

To check your routing, run the program speaker-test. For 6 channels, run

speaker-test -c 6 -t wav

it is important to pay attention to which speakers map to which outputs. For example, on our system, the output is

Playback device is default
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 16 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
 0 - Front Left
 4 - Center
 1 - Front Right
 3 - Rear Right
 2 - Rear Left
 5 - LFE

In this case, by default we would only be able to hear stereo output from the front right and left speakers, outputs 0 and 1 accordingly. What would we like to do would be to map the rear-channels to the right and left sides accordingly and split the center and lfe channels between the two speakers accordingly. This can be done via the .asoundrc, in this case as follows

#5.1 to stereo downmix
pcm.!default {
	slave.pcm front
	slave.channels 2
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.0 1
	ttable.3.1 1
	ttable.4.0 0.5
	ttable.4.1 0.5
	ttable.5.0 0.5
	ttable.5.1 0.5

the syntax for each entry is as follows

	ttable.X.Y Z

where X is the input speaker
      Y is the output speaker
      Z is the volume scalar

following the above markup, the rear speakers (2 and 3) are redirected to speakers the front speakers (0 and 1). The center and LFE channels are included twice, redirected to front speakers, each at 50%

Now when we rerun speaker-test we should be able to hear all 6 outputs accordingly.


For applications which use openalsoft, a file must also be changed to point to this new configuration which we have created. This is done by creating a new file, .alsoftrc in the user's home directory which contains these lines

format = AL_FORMAT_51CHN16 # AL_FORMAT_QUAD16 # or AL_FORMAT_51CHN16 for 5.1

device =  default # surround51 # surround40 #, or hw:0,0 for a hardware voice

as you can see, some parameters have been commented, but the important part is to point device at the default configuration

Personal tools