# goals of this config: # 1. resample everything to 48000 inside ALSA. # actually what alsa does is tell the calling program, # ``please use 48kHz only''. This is good for mplayer, # but maybe we should add a pcm.plug? # 2. mix together multiple playback # 3. software volume control (XXX) # # I'm kinda upset ALSA doesn't ship with a default config that # does these things. It's not right that I should spend more # than a day learning these incantations when I have no desire # to implement anything other than the specific and generic # features they claimed to offer. # # These guys more or less do ship such a config file, but who the # hell are they? # # http://www.sabi.co.uk/Cfg/ALSA/asound.conf # http://WWW.sabi.co.UK/Notes/linuxSoundALSA.html # pcm.!default { type asym; playback.pcm "svol0"; } ctl.!default { type hw; card 0; } # OSS garbage -- try without this first #pcm.dsp0 { type asym; # playback.pcm "svol0"; } #ctl.dsp0 { type hw; card 0; } #ctl.mixer0 { type hw; card 0; } # Amazingly, XMMS has problems if one defines 'pcm.dsp0' to be # 'plug' for 'pcm.asym0' and not directly as 'asym'. # -- sabi guy pcm.asym0 { type asym; playback.pcm "svol0"; } pcm.svol0 { type softvol; slave.pcm { type plug; slave { pcm "dmix0"; rate 48000; } route_policy average; } control { name "PCM Playback Volume" card 0; } } #pcm.plug0 { # type plug; # slave { # pcm { # type softvol; # slave { pcm "dmix0"; } # control { # name "PCM Playback Volume" # card 0; } } # rate 48000; } # route_policy average; #} # Buffering (period time defaults to 125000 usecs). # Size of period, expressed either in usec or byte units: # period_time USECS # period_size BYTES # Size of buffers, expressed either in period, usec, or byte units: # periods PERIODS # buffer_time USECS # buffer_size BYTES # The ALSA docs have examples with 'period_time' set to 0, # when 'period_size' and 'buffer_size' are used instead, # but this can cause trouble in later releases of ALSA. # For OSS compatibility, 'period_size' and 'buffer_size' # should be powers of 2. Also, many cards cannot accept # a 'period_size' much greater than 4096, so 4096 is safe. # On my VIA 8233A, any value for 'period_time' greater than # 85333 usecs (precisely!) causes hiccups in sound output. # Why? At 48kHz, 85333 usec are are just over 4096 bytes/channel. # -- sabi guy # here is one example: # # slave.period_size 4096; # slave.buffer_size 81920; # # slave.period_time 84000; # slave.buffer_time 504000; # # I found this example _almost_ worked. It made DVD's play kind of # jerkey. when I removed asound.conf entirely, DVD's played fine. I # did a diff of the working->nonworking mplayer startup output: # #--- munch-withasound 2007-03-25 15:46:42.000000000 -0800 #+++ munch-withoutasound 2007-03-25 15:46:16.000000000 -0800 #@@ -259,8 +259,8 @@ # alsa-init: setup for 1/2 channel(s) # alsa-init: 1 soundcard found, using: default # alsa-init: pcm opend in block-mode #-alsa-init: chunksize set to 4096 #-alsa-init: fragcount=4 #+alsa-init: chunksize set to 1024 #+alsa-init: fragcount=16 # alsa-init: got buffersize=65536 # alsa: 48000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian # AO: [alsa] 48000Hz 2ch s16le (2 bps) # # so, I've set period_size to 1024 (the working chunksize) pcm.dmix0 { type dmix; ipc_key 13759; slave.pcm "hw:0"; slave.channels 2; slave.rate 48000; slave.period_size 1024; slave.periods 6; bindings.0 0; bindings.1 1; }