Table of Contents
If some application accesses the sound card though one of the lower audio layers (see Kernel layer), the sound card might become inaccessible and other applications might fail to open the sound card, or even hang.
Finding out which application is holding your sound card
OSS
You can see which applications are using OSS (or the ALSA OSS Emulation layer) with:
$ sudo fuser /dev/dsp*
ALSA
You can see which applications are using ALSA with:
$ sudo fuser /dev/snd/pcm*
Resolving the problem
Stopping the application holding the card
In most cases you can simply close or kill the application that is using your sound card.
PulseAudio
If PulseAudio is holding your sound card, you can stop it with 'pulseaudio -k'.
TiMiDity++
Some distributions start timidity on startup. It can generally be stopped with 'sudo /etc/init.d/timidity stop'
Using Dmix
ALSA has a Dmix plugin that allows multiple applications to use the sound card.
Using Dmix is not recommended for audio work, as it might increase latencies and reduce quality because of resampling.
Using a sound server
For audio work, use JACK.
For desktop audio, you might want to consider PulseAudio or use the Dmix plugin mentioned above.