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.
You can see which applications are using OSS (or the ALSA OSS Emulation layer) with:
$ sudo fuser /dev/dsp*
You can see which applications are using ALSA with:
$ sudo fuser /dev/snd/pcm*
In most cases you can simply close or kill the application that is using your sound card.
If PulseAudio is holding your sound card, you can stop it with 'pulseaudio -k'.
Some distributions start timidity on startup. It can generally be stopped with 'sudo /etc/init.d/timidity stop'
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.
For audio work, use JACK.
For desktop audio, you might want to consider PulseAudio or use the Dmix plugin mentioned above.