All pastes #1388084 Raw Edit

brebs

public text v1 · immutable
#1388084 ·published 2009-04-10 16:06 UTC
rendered paste body
# This is ~/.asoundrc

# Debugging:  http://hg.alsa-project.org/alsa/raw-file/tip/alsa-info.sh

# http://www.sabi.co.uk/Notes/linuxSoundALSA.html
# echo 128 > /proc/asound/card0/pcm0p/sub0/prealloc
# to allocate 128kbyte for playback, substream #0, stream #0 on the card #0

# Wiki article:  http://gentoo-wiki.com/HOWTO_Compile_Kernel_with_ALSA

# Soundcard recommendation:  http://forums.gentoo.org/viewtopic-p-4192284.html#4192284

# OSS info:
# http://wiki.archlinux.org/index.php/OSS

# Dunno whether this makes any difference.
# http://www.alsa-project.org/alsa-doc/doc-php/template.php?company=Creative+Labs&card=Sound+Blaster+Live+5.1.&chip=emu10k1&module=emu10k1

# http://www.alsa-project.org/alsa-doc/doc-php/template.php?company=VIA&card=.&chip=VIA82C686%2C+VIA8233%2C+VIA8233A%2C+VIA8235&module=via82xx
# http://alsa.opensrc.org/index.php/Dmix
# Simple dmix setup:  http://www.thepenguin.org.uk/alsa/

# http://www.halfgaar.net/surround-sound-in-linux
# speaker-test -D surround51 -c 6 -t wav
# speaker-test -D doom -c 6 -t sine -r 44100
# speaker-test -D plug:dmix6 -c 6 -t wav

# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
# http://www.volkerschatz.com/noise/alsa.html


# This makes native ALSA apps default to using dmix.
#pcm.!default {
#	type plug
#	slave.pcm "duplex"
#}

# Pulse Audio will eventually take over, to replace dmix.
# http://www.pulseaudio.org/wiki/PerfectSetup
# http://wiki.archlinux.org/index.php/PulseAudio
# Pulseaudio skipping:  http://ubuntuforums.org/showthread.php?p=4928900
# Surround sound in Pulse:  http://ubuntuforums.org/showthread.php?t=795525

#pcm.!default {
#	type pulse
#}

#pcm.pulse {
#    type pulse
#}

#ctl.pulse {
#    type pulse
#}

# Works with aplay, but not speaker-test
# Default soundcard:  http://alsa.opensrc.org/index.php?title=FAQ026
#pcm.!default {
#    type pulse
#}
#ctl.!default {
#    type pulse
#}



# From http://forums.gentoo.org/viewtopic-t-501671.html
# Rubbish, don't use
#pcm.!default {
#        type softvol
#        slave.pcm plughw
#        control.name PCM
#}

# From http://home.cfl.rr.com/infofiles/asoundrc.examples.html
# Stops wine warning: err:alsa:ALSA_CheckSetVolume Could not find 'PCM Playback Volume' element
#pcm.!default {
#	type softvol
#	slave.pcm "hw:0,0"
#		control {
#		name "PCM Playback Volume"
#		card 0
#	}
#}


#pcm.emu10k1 {
#	type hw
#	card 0
#        slave.pcm surround51
#        slave.channels 6
#}




# Bluetooth via bluez

# hcitool name 00:18:13:f1:b5:9d
# HBH-PV705

pcm.bluetoothraw {
	type bluetooth
	# hcitool scan, then enter in lower-case.
	device 00:18:13:f1:b5:9d

	# Jabra BT530
	# hcitool cc 00:1D:82:70:0F:A1
	#


	# Supported profiles are: auto, hifi and voice
	profile "voice"
}

# gmplayer -ao alsa:device=bluetooth movie.avi
pcm.bluetooth {
	type plug
	slave {
		pcm bluetoothraw
	}
	#hint {
	#	# From http://www.technetra.com/2008/11/22/pairing-stubborn-bluetooth-devices-in-fedora-10-ubuntu-ibex/
	#	show on
	#	description "Bluetooth audio device"
	#}
}

pcm.bluetooth-resample {
    # Resample device, from http://article.gmane.org/gmane.linux.bluez.devel/13648
    type plug
    slave {
        pcm "bluetooth"
        rate 8000
        format S16_LE
        channels 1
    }
}


pcm.headset {
	type bluetooth
}

ctl.headset {
	type bluetooth
}



pcm.emu10k1 {
	type hw
	card 0
}

ctl.emu10k1 {
	type hw
	card 0
}





# Software mixing using dmix, 6 channels.
# Doom3 needs rate 44100 rather than 48000
#      format S32_LE


# hda-intel might benefit from:  defaults.pcm.dmix_max_periods -1
# https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3253

#Set default sound card
# Useful so that all settings can be changed to a different card here.
#pcm.snd_card {
#     type hw
#     card 0
#     device 0
#}

pcm.jack {
    type jack
    playback_ports {
        0 alsa_pcm:playback_1
        1 alsa_pcm:playback_2
    }
    capture_ports {
        0 alsa_pcm:capture_1
        1 alsa_pcm:capture_2
    }
}

# Allow mixing of multiple output streams to this device
# jackd -R -d alsa -r 44100
#pcm.doom {
#	type plug
#	slave { pcm "jack" }
#}


# Bah, can only get 2 channels to work with speaker-test
pcm.works {
     type dmix
     ipc_key 134  # Must be unique
     ipc_perm 0660 # Sound for everybody in your group!
     slave.pcm "snd_card"
     slave {
          # This stuff provides some fixes for latency issues.
          # buffer_size should be set for your audio chipset.
          period_time 0
          period_size 1024
          buffer_size 16384
          channels 6
          rate 44100
     }

     bindings {
          0 0
          1 1
          2 2
          3 3
          4 4
          5 5
     }
}



# This is what we want as our default device
# a fully duplex (read/write) audio device.
#pcm.duplex {
#     type asym
#     playback.pcm "output"
#}
#     capture.pcm "input"

###################
# CONVERSION PLUG #
###################
# Setting the default pcm device allows the conversion
# rate to be selected on the fly.
# duplex mode allows any alsa enabled app to read/write
# to the dmix plug (Fixes a problem with wine).
#pcm.!default {
#     type plug
#     slave.pcm "duplex"
#}

# Apparently this is wrong (breaks mplayer for me opening the device)
#ctl.!default {
#     type plug
#     slave.pcm "snd_card"
#}

########
# AOSS #
########
# OSS dsp0 device (OSS needs only output support, duplex will break some stuff)
#pcm.dsp0 {
#     type plug
#     slave.pcm "output"
#}

# OSS control for dsp0 (needed?...this might not be useful)
#ctl.dsp0 {
#     type plug
#     slave.pcm "snd_card"
#}

####
#### As of November 2005 with the following packages:
#### >=mozilla-firefox-1.0.7-r2, netscape-flash-7.0.25,
#### alsa-oss-1.0.8-r1 and alsa-oss-1.0.10_rc3
####
#### I have been experiencing crashes related to firefox when rendering flash.
#### I used "aoss firefox" to start the browser.
#### Commenting out the below ctl.mixer0 and using the above ctl.dsp0 allows
#### firefox to render flash without crashing (and yes the aoss mixing works)
#### However aoss Skype does not work properly without mixer0 under some configurations.
####
# OSS control for dsp0 (default old OSS is mixer0)
#ctl.mixer0 {
#     type plug
#     slave.pcm "snd_card"
#}

# For audacious: audio device: ch51dup
# speaker-test -D ch51dup -c 2 -t wav
# alsamixer settings for audigy:
#	surround: 0 (for proper surround sound in doom3)
#	side & pcm side: 0
#	Others: 70 or 100
# Use 0.5 in ttable lines rather than 1, to stop crackling.
# ttable.1.4 is centre speaker.
pcm.ch51dup {
	slave.pcm surround51
	slave.channels 6
	type route

	# Front and rear
	ttable.0.0 0.5
	ttable.1.1 0.5
	ttable.2.2 0.5
	ttable.3.3 0.5

	# Center and LFE
	ttable.4.4 1
	ttable.5.5 1

	# Front left/right to center
	# Imbalanced because is to the left of the monitor!
	ttable.0.4 0.8
	ttable.1.4 0.2

	# Front left/right to rear
	ttable.0.2 0.5
	ttable.1.3 0.5
}


# Testing dmix to 48k, versus Audigy's internal remix to 48k.
# Can't tell any difference. Not worth the CPU time.
# http://forums.gentoo.org/viewtopic-t-576072.html
# Audacious uses 14% of the CPU with "samplerate_best"!
# Audacious uses 2-3% of the CPU with "samplerate"!
# Seems to skip occasionally, though, with some songs.
# See http://www.hydrogenaudio.org/forums/index.php?showtopic=47591&st=50
# Had to recompile alsa-plugins in Arch, for it to use libsamplerate.
# Choices: samplerate_best samplerate_medium samplerate_order samplerate_linear
# From http://blog.flameeyes.eu/articles/2007/02/01/a-little-hint-for-alsa-hda-users
#defaults.pcm.rate_converter "samplerate_best"

#defaults.pcm.rate_converter "samplerate"
# Need to recompile alsa-lib to include samplerate support, I think:
# http://www.hydrogenaudio.org/forums/index.php?showtopic=47591&st=50

# dmix by default only supports 2 channels at 48000
# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
pcm.dmix51dup {
	type plug
	slave {
		# To send to rear speakers also
		pcm ch51dup
		# Without rear speakers
		#pcm "hw:0,0"
		# For Audigy4 - crackles slightly with rate 96000
		#rate 96000
		rate 48000
		# For snd-hda-intel
		#rate 44100

		# http://alsa.opensrc.org/index.php/Playing_stereo_on_surround_sound_setup_%28Howto%29
		#period_time 0
		#period_size 1024
		#buffer_time 0
		#buffer_size 4096
	}
}





# Channels are wrong way round in doom! This fixes them.
# http://www.linuxforen.de/forums/archive/index.php/t-206470.html
# http://forums.seriouszone.com/showthread.php?t=49869&page=10
# http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
# For Audigy 4
# Weird, doom3 has crappy sound if I add an alsa rate converter.
pcm.doom {
	slave.pcm surround51
	slave.channels 6
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.4 1
	ttable.3.5 1
	ttable.4.2 1
	ttable.5.3 1
}


# From http://osdir.com/ml/lib.openal.devel/2005-06/msg00000.html
# Forces its output rate to be 48000. Has sound delay and crackles, though.
#pcm.doom {
#	type rate
#	slave.pcm doom-good
#	slave.rate 48000
#}





# aplay -D playvyniltest chan-id.wav
pcm.playvyniltest {
	type plug
	slave.pcm "vyniltest"
}

# Posted at http://64.233.183.104/search?q=cache:_zQy9QbX2mkJ:forums.gentoo.org/viewtopic-t-578294.html+vinyl+paulbredbury&hl=en&ct=clnk&cd=1&gl=uk&lr=lang_en
# listplugins | grep -A 1 -i vynil
# analyseplugin vynil_1905
# Use via playvyniltest
pcm.vyniltest {
	type ladspa
	slave.pcm default
	plugins {
		0 {
			# id 1905  # VyNil (Vinyl Effect) (1905/vynil)
			label vynil
			input {
				# "Year" input, control, 1900 to 1990, default 1990
				# "RPM" input, control, 33 to 78, default 33
				# "Surface warping" input, control, 0 to 1, default 0
				# "Crackle" input, control, 0 to 1, default 0
				# "Wear" input, control, 0 to 1, default 0
				controls [ 1900 33 0.5 0.5 0.5 ]
			}
		}
	}
}




# http://alsa.opensrc.org/SurroundSound
# http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
# Fedora:  yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
# Arch Linux:  pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
# speaker-test -D upmix_20to51 -c 2 -t wav
# listplugins
# analyseplugin cmt
# http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
# http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
pcm.lowpass_21to21 {
	type ladspa
	slave.pcm upmix_21to51
	# Set the path to ladspa, to fix this error:
	# Playback open error: -2,No such file or directory
	path "/usr/lib/ladspa"
	channels 3
	plugins {
		0 {
			id 1098  # Identity (Audio) (1098/identity_audio)
			policy duplicate
			input.bindings.0 "Input";
			output.bindings.0 "Output";
		}

		1 {
			id 1052  # High-pass filter
			policy none
			input.bindings.0 "Input";
			output.bindings.0 "Output";
			input {
				controls [ 300 ]
			}
		}

		2 {
			id 1052  # High-pass filter
			policy none
			input.bindings.1 "Input";
			output.bindings.1 "Output";
			input {
				controls [ 300 ]
			}
		}

		3 {
			id 1051  # Low-pass filter.
			policy none
			input.bindings.2 "Input";
			output.bindings.2 "Output";
			input {
				controls [ 300 ]
			}
		}

		# From http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
		# Can be used instead of 1-3 above.
#		1 {
#			id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
#			policy none
#			input.bindings.2 "Input";
#			output.bindings.2 "Output";
#			input {
#				controls [ 300 2 ]
#			}
#		}
	}
}


# speaker-test -D upmix_20to51 -c 2 -t wav
# In audacious:  upmix_20to51
pcm.upmix_20to51 {
	type plug
	slave.pcm "lowpass_21to21"
	slave.channels 3
	ttable {
		0.0     1       # left channel
		1.1     1       # right channel
		0.2     0.5     # mix left and right ...
		1.2     0.5     # ... channel for subwoofer
	}

	# slave.rate 48000 makes CPU utilization 20% instead of 3%
	# Can't hear the difference with Audigy4 anyway.
	# slave.rate 44100 is 3%, so that proves audacious outputs 44100
	#slave.rate 48000
	#converter "samplerate"
	#slave.rate_converter "samplerate_best"
}


# Lunar Linux:  lin alsa-plugins libsamplerate
pcm.headphones {
	type rate
	slave {
		#pcm "default"
		pcm "hw:0"
		rate 48000
	}
	converter "samplerate_medium"
}


# In audacious:  upmix_20to51_resample
# aplay -D upmix_20to51_resample ~/alsa/samplerate-test/udial.wav
pcm.upmix_20to51_resample {
	type rate
	slave {
		pcm upmix_20to51
		#format S32_LE
		# Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
		rate 48000
	}
	# Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
	# 8% CPU with samplerate_medium - good choice
	converter "samplerate_medium"
	#converter "samplerate_linear"
}

pcm.upmix_21to51 {
	type plug
	# For ice1724:
	#slave.pcm surround51-ice
	# For Audigy:
	slave.pcm surround51
	# For P5K ADI:
	#slave.pcm surround51-adi
	# Trying to pipe through Pulse Audio, to stop the clicks between songs.
	# Can't get Pulse Audio to work like this.
	#slave.pcm pulse
	# Don't need to specify the number of channels.
	slave.channels 6
	ttable {
		0.0     1       # front left
		1.1     1       # front right
		0.2     1       # rear left
		1.3     1       # rear right

		# Front left/right to center.
		# Imbalanced because is to the left of the monitor!
		# Would normally be 0.5 each.
		0.4     0.3
		1.4     0.7

		# Subwoofer, more powerful to compensate for bass-removal from other speakers.
		2.5     2
    }
}




pcm.equalizer_play {
	type rate
	slave {
		pcm plug:equalizer
		#format S32_LE
		# Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
		rate 48000
	}
	# Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
	# 8% CPU with samplerate_medium - good choice
	converter "samplerate_medium"
	#converter "samplerate_linear"
}

# Equalizer:  http://ubuntuforums.org/showthread.php?t=789578
# To try:  http://www.thedigitalmachine.net/alsaequal.html
# http://gentoo-wiki.com/HOWTO_Set_up_a_system-wide_equaliser_with_ALSA_and_LADSPA
# http://wiki.archlinux.org/index.php/ALSA#System-Wide_Equalizer
# speaker-test -D plug:equalizer -c 2 -t wav
pcm.equalizer {
	type ladspa

	# Is for stereo.
	#channels 2

	# The output from the EQ can either go direct to a hardware device
	# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go
	# to the software mixer shown here.
	#slave.pcm "hw:0,0"
	#slave.pcm "default"
	#slave.pcm plug:upmix_20to51
	#slave.pcm upmix_20to51
	slave.pcm "plug:surround51"
	#slave.pcm "plug:dmix"

	# Sometimes you may need to specify the path to the plugins,
	# especially if you've just installed them.  Once you've logged
	# out/restarted this shouldn't be necessary, but if you get errors
	# about being unable to find plugins, try uncommenting this.
	path "/usr/lib/ladspa"

	plugins [
		{
			#label mbeq
			#id 1197
			#input {
			#	# this setting is here by example, edit to your own taste
			#	# bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,
			#	# 50000hz, 10000hz, 20000hz
			#	# range: -70 to 30
			#	controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]

			# yum install ladspa-caps-plugins
			label Eq
			id 1773
			input {
				controls [ 8 5 3 -5 -6 -10 -6 -5 8 8 ]
			}
		}
	]
}



pcm.2to6 {
	type route
	slave {
		pcm "dmix51dup"
		channels 6
	}

	ttable.0.0 1.0
	ttable.0.2 1.0
	ttable.0.4 0.5
	ttable.0.5 0.5
	ttable.1.1 1.0
	ttable.1.3 1.0
	ttable.1.4 0.5
	ttable.1.5 0.5
}




#pcm.!default {
#	type dmix
#	slave.channels 2
#	ttable {
#		0.0     1       # left channel
#		1.1     1       # right channel
#	}
#}

# For ice1724, see http://alsa.opensrc.org/Dmix
# Tech docs for M-Audio Revolution 5.1:  http://seehuhn.de/pages/revolution

# Not used on its own. See surround51-ice.
pcm.dmix6 {
	type dmix
	ipc_key 245  # Must be unique
	ipc_key_add_uid false
	# ipc_perm is probably not needed:
	# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
	ipc_perm 0660
	slave {
		pcm "hw:0,0"
		#rate 48000
		# Is 44100, to stop "clicks and pops" when changing songs in Audacious.
		rate 44100
		#format "S32_LE"
		channels 6
		period_time 0
		period_size 1024
		buffer_time 0
		# buffer_size of e.g. 2048, 4096, 5120, 8192, 16384, 32768.
		# Some apps may prefer different sizes - create a separate pcm for those.
		buffer_size 8192
	}
}



# http://gentoo-wiki.com/HOWTO_Surround_Sound
# 6 channel dmix:
# From http://ubuntuforums.org/showthread.php?t=400268
# Sound command for Pidgin:  /usr/bin/aplay -D plug:surround51-ice %s
# Darkplaces command-line:  -sndpcm "plug:surround51-ice" -sndspeed 44100
# Can still have nspluginwrapper blocking the soundcard, because it uses OSS!
# Posted at http://forums.gentoo.org/viewtopic-p-4534793.html#4534793
pcm.surround51-ice {
	slave.channels 6
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.4 1
	ttable.3.5 1
	ttable.4.2 1
	ttable.5.3 1
	slave.pcm {
		type dmix
		ipc_key 25  # Must be unique
		ipc_key_add_uid false
		# ipc_perm is probably not needed:
		# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		ipc_perm 0660
		slave {
			pcm "hw:0,0"
			#rate 48000
			# Is 44100, to stop "clicks and pops" when changing songs in Audacious.
			# Keeps the "Multi Track Internal Clock" in alsamixer at 44100 rather than 48000.
			rate 44100
			#format "S32_LE"
			channels 6
			period_time 0
			period_size 1024
			buffer_time 0
			# buffer_size of e.g. 2048, 4096, 5120, 8192, 16384, 32768.
			# Some apps may prefer different sizes - create a separate pcm for those.
			buffer_size 4096
		}
	}
}


# P5K onboard card
# doom3 has buffer size problem with ad1988b - use oss in its autoexec.cfg
pcm.surround51-adi {
	slave.channels 6
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.2 1
	ttable.3.3 1
	ttable.4.4 1
	ttable.5.5 1
	slave.pcm {
		type dmix
		ipc_key 1078  # Must be unique
		ipc_key_add_uid false
		# ipc_perm is probably not needed:
		# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		ipc_perm 0660
		slave {
			pcm "hw:0,0"
			#rate 48000
			# Is 44100, to stop "clicks and pops" when changing songs in Audacious.
			rate 44100
			#format "S32_LE"
			channels 6
			period_time 0
			period_size 1024
			buffer_time 0
			# buffer_size of e.g. 2048, 4096, 5120, 8192, 16384, 32768.
			# Some apps may prefer different sizes - create a separate pcm for those.
			buffer_size 4096
		}
	}
}


pcm.doom3-stereo-revo51 {
	# Works, with M-Audio Revolution 5.1 soundcard
	type plug
	slave.pcm {
		type dmix
		ipc_key 1093  # Must be unique
		ipc_key_add_uid false
		ipc_perm 0660
		slave {
			pcm "hw:0,0"
			rate 44100
			channels 2
			period_time 0
			period_size 1024
			buffer_time 0
			# Doom 3 wants buffer_size 8192
			# In ~/.doom3/base/autoexec.cfg
			# And ~/.quake4/q4base/autoexec.cfg
			# seta s_alsa_pcm "doom3-stereo-revo51"
			buffer_size 8192
		}
	}
}


# Playing with ice card
pcm.surround51-doom3 {
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.4 1
	ttable.3.5 1
	ttable.4.2 1
	ttable.5.3 1
	slave.pcm {
		type dmix
		ipc_key 1093  # Must be unique
		ipc_key_add_uid false
		ipc_perm 0660
		slave {
			pcm "hw:0,0"
			#rate 48000
			rate 44100
			#format "S32_LE"
			channels 6
			period_time 0
			period_size 1024
			buffer_time 0
			# Doom 3 wants buffer_size 8192
			# In ~/.doom3/base/autoexec.cfg
			# And ~/.quake4/q4base/autoexec.cfg
			# seta s_alsa_pcm "plug:surround51-doom3"
			buffer_size 8192
		}
	}
}



# Examples:
pcm.ice_spdif {
    type plug
    ttable.0.8 1 # S/PDIF left...Delta 9
    ttable.1.9 1 # S/PDIF right...Delta 10
    slave.pcm ice1712
}

#pcm.!default {
#  type plug
#  slave.pcm ice_spdif
#}


# DOES NOT WORK, but might with some tweaks.
# speaker-test -D surround70 -c 7 -t wav
# http://forums.gentoo.org/viewtopic-p-4640690.html#4640690
#pcm.surround70 {
#	type route
#	slave {
#		pcm "surround71"
#		channels 8
#	}
#	ttable.0.0 1.0
#	ttable.0.2 1.0
#	ttable.0.4 0.5
#	ttable.0.5 0.5
#	ttable.1.1 1.0
#	ttable.1.3 1.0
#	ttable.1.4 0.5
#	ttable.1.5 0.5
#}


# From http://bbs.archlinux.org/viewtopic.php?id=50586
#pcm.6to2ch {
#   type route
#   slave.pcm surround51
#   slave.channels 6
#   ttable.0.0 1
#   ttable.1.1 1
#   ttable.2.0 1
#   ttable.3.1 1
#   ttable.4.0 1
#   ttable.4.1 1
#   ttable.5.0 1
#   ttable.5.1 1
#}


# From http://www.volkerschatz.com/noise/alsa.html
# speaker-test -D 51to2 -c 6 -t wav
pcm.51to2 {
  @args.0 SLAVE
  @args.SLAVE { type string default "plughw:0,0" }
  type route
  slave {
    pcm $SLAVE
    channels 2
  }
  ttable {
    0.0= 0.3
    2.0= 0.3
    4.0= 0.19
    5.0= 0.21
    1.1= 0.3
    3.1= 0.3
    4.1= 0.19
    5.1= 0.21
  }
}

pcm.2to51 {
  @args.0 SLAVE
  @args.SLAVE { type string default "plughw:0,0" }
  type route
  slave {
    pcm $SLAVE
    channels 6
  }
  ttable {
    0.0= 1
    0.2= -0.6
    0.3= -0.4
    0.4= 0.5
    0.5= 0.5
    1.1= 1
    1.2= -0.4
    1.3= -0.6
    1.4= 0.5
    1.5= 0.5
  }
}