Sound mixing with the ALSA Dmix plugin instead of a soundserver
Im quite sure you have already tried to play 2 or more sounds simultaneously, you probably got a message saying that /dev/dsp is busy that's because only one process can open the sound device at a time.
Of course there are different solutions to work around this problem. One possibility is to use a soundserver like aRtsd, EsoundD or jackd. Applications will no longer talk directly to the sound device, instead they will send their data to the soundserver which will then mixe several audio streams for playback by a single audio device.
However for my purpose a soundserver is overkill, there is another way to achieve the same thing with dmix which is a alsa plugin. I honestly don't know why they call it plugin because at least in my alsa it was already integrated and i just had to create a ~/.asoundrc configuration file to work with my sound chip (snd_intel8x0).
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}
bindings {
0 0
1 1
}
}
pcm.dsp0 {
type plug
slave.pcm "dmixer"
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.default {
type plug
slave.pcm "dmixer"
}
ctl.mixer0 {
type hw
card 0
}The downside of this method is that you have to configure each sound application to use the alsa:dmix plugin. In xmms this can be done in the Preference window by choosing the "ALSA output plugin [libALSA.so]" and configuring it to use "plug:dmix" as audio device. For vlc you have to install an additionally package.
apt-get install vlc-plugin-alsaAfterwards you can change your ~/.vlc/vlcrc to use the plugin.
[alsa] # ALSA audio output
# ALSA Device Name (string)
alsadev=plug:dmixThe correct settings for other applications can be found with google. This howto could also be of interest.
Comments (0)
There are currently no comments available
