I ran into this problem a while back, and it's well worth noting the
solution. Basically, a lot of cheapo soundcards and laptop sound
hardware doesn't support hardware mixing, which means that when
one app has the audio device open, all others will freeze attempting
to access it.
With some help from http://alsa.opensrc.org/index.php?page=AlsaSharing and
http://alsa.opensrc.org/index.php?page=DmixPlugin , here's the
/etc/asound.conf stanza that I use to do software mixing with ALSA:
pcm.dmix0 {
type dmix
ipc_key 219345 # any unique number here
slave {
pcm "hw:0,0"
period_time 0
buffer_time 0
period_size 2048 # jm: much smoother than 1024/8192!
buffer_size 32768
rate 44100
}
bindings {
0 0 # from 0 => to 0
1 1 # from 1 => to 1
}
}
pcm.dsp0 {
type plug
slave.pcm "dmix0"
}
pcm.!default {
type plug
slave.pcm "dmix0"
}
ctl.dsp0 {
type hw
card 0
}
# this makes native ALSA apps default to using dmix
pcm.!default {
type plug
slave.pcm "dmix0"
}
ctl.!default {
type hw
card 0
}
Note: I use a bigger period_size/buffer_size than the default DmixPlugin
settings -- it gives much smoother output at the cost of being slower to
respond to track/volume changes. c'est la vie.
Then, configure your apps to use "alsa" as the output driver, and it'll
work nicely.
Application success reports:
- xine and amaroK work nicely;
- mplayer attempts to always open the "hw0:0" device, sidelining the
DMix mixer for some reason, so it freezes;
- JuK (by far the best KDE music player) uses KDE's gstreamer
bindings, which hardcode use of "osssink" internally, so it freezes;
- the Mozilla Flash player plugin also doesn't seem to support ALSA
output, so there's no sound output from that if you have another app
using ALSA at the same time. But at least it doesn't freeze. ;)
I have a patch in for KDE (http://bugs.kde.org/show_bug.cgi?id=92786)
to support use of other gstreamer outputs instead of OSS, but no
word yet...
--j.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!