# dmix - plug:dmix supports 1-8 channels, and does use dmix! # Whereas surround51 doesn't use dmix # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946 # cat /proc/asound/card0/pcm0p/sub0/hw_params # Output to hw:0,0 to keep at 44.1k rather than dmix's 48k # 44.1k stops dmix from working, though. # From https://bugs.launchpad.net/debian/+source/sdl-mixer1.2/+bug/66483 # Not needed. #defaults.pcm.dmix_max_periods -1 #defaults.pcm.rate_converter "samplerate_best" # See /usr/share/alsa/pcm/dmix.conf #defaults.dmix.period_time 0 #defaults.dmix.periods 4 #defaults.pcm.surround51.device "0" # From https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1853 pcm.dmixed { @args [ CHANNELS ] @args.CHANNELS { type integer default 2 } @args.CARD { type string default 0 } @args.$DEV { type string default 0 } @args.$SUBDEV { type string default 0 } type asym playback.pcm { type dmix ipc_key 5678293 ipc_perm 0660 ipc_gid audio slave{ channels $CHANNELS pcm { type hw card $CARD device $DEV subdevice $SUBDEV } period_time { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dmix.period_time" ] } default -1 } period_size { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dmix.period_size" ] } default 1024 } periods { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dmix.periods" ] } default 16 } } } capture.pcm { type dsnoop ipc_key 5778293 ipc_perm 0660 slave{ pcm { type hw card $CARD device $DEV subdevice $SUBDEV } period_size { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dsnoop.period_size" ] } default 1024 } period_time { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dsnoop.period_time" ] } default -1 } periods { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.dsnoop.periods" ] } default 16 } } } } pcm.snd_card { type hw card 0 device 0 } pcm.dmixer { type dmix ipc_key 813 ipc_key_add_uid false ipc_perm 0666 slave { pcm "snd_card" rate 48000 format S16_LE channels 6 period_time 0 period_size 1024 buffer_time 0 buffer_size 4096 } bindings { 0 0 1 1 2 2 3 3 4 4 5 5 } } # From https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2695 pcm.dmix6 { type dmix ipc_key 1024 ipc_key_add_uid false ipc_perm 0660 slave { pcm "hw:0,1" rate 48000 channels 6 period_time 0 period_size 1024 buffer_time 0 buffer_size 5120 } } #pcm.!dmix { # type plug # slave { # pcm surround51 # channels 6 # } #} # Playing pcm.!default { type asym playback.pcm "upmix_20to51_resample" } # If get error "Slave PCM not usable", then need to use plug: # If get error "Cannot find rate converter", then install libsamplerate and alsa-plugins # Lunar Linux: lin ladspa-bs2b # listplugins # analyseplugin bs2b pcm.bs2b { type ladspa path "/usr/lib/ladspa" plugins { 0 { id 4221 # Bauer stereophonic-to-binaural (4221/bs2b) input { controls [ 700 6 ] } } } # http://bbs.archlinux.org/viewtopic.php?id=95582 slave.pcm "plug:dmix" #slave.pcm "default" } # speaker-test -D headphones -c 2 -t wav # audacious uses less CPU when running bs2b as a listed plugin, probably because of samplerate_best # Posted at http://bbs.archlinux.org/viewtopic.php?pid=626573#p626573 pcm.headphones { type rate slave { pcm "plug:bs2b" rate 48000 } # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear converter "samplerate_best" hint { show on description "Headphones" } } pcm.ch51dup { #slave.pcm surround51 slave.pcm "plug:dmix" 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 ttable.0.4 0.5 ttable.1.4 0.5 # Front left/right to rear ttable.0.2 0.5 ttable.1.3 0.5 } # http://alsa.opensrc.org/SurroundSound # http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO) # Lunar: lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate # 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 # Debugging: speaker-test -D plug:lowpass_21to21 -c 3 -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" } # 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" } # Debugging: speaker-test -D upmix_21to51 -c 3 -t wav pcm.upmix_21to51 { type plug # For ice1724: #slave.pcm surround51-ice # For Audigy: #slave.pcm surround51 # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946 slave.pcm "dmixed:6" #slave.pcm "plug:dmixer" # 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.5 1.4 0.5 # Subwoofer, more powerful to compensate for bass-removal from other speakers. 2.5 2 } } # Channels are wrong way around 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. # Posted at http://ubuntuforums.org/showthread.php?t=1304228 pcm.doom-surround51 { 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 } pcm.doom3-8930g { 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-8930g" buffer_size 8192 } } }