HOWTO: Figure out what's using your soundcard in Linux
It's 2008, and while Linux audio is getting better for desktop users, I still occasionally find myself running into a situation where one application is tying up my soundcard. Sometimes I'll try to run jackd through qjackctl and it'll fail because Firefox has a flash video loaded in it or something like that.
Anyways, to figure out what's using your soundcard on Linux, you can run:
sudo fuser -v /dev/dsp*
sudo fuser -v /dev/snd/*
The first command above will list all the OSS applications using your sound hardware, and the latter will tackle ALSA applications.
For example, if I run those commands with nothing running:
gamegod@home:~/$ sudo fuser -v /dev/dsp*
gamegod@home:~/$ sudo fuser -v /dev/snd/*
USER PID ACCESS COMMAND
/dev/snd/controlC0: gamegod 6236 F.... mixer_applet2
The output above is showing me that GNOME's mixer applet is using the "control" interface on my soundcard. This won't interfere with any applications, so you can always safely keep this running.
As another example, if I run Mixxx (software for DJs) before running those commands, I'll see:
gamegod@home:~/$ sudo fuser -v /dev/dsp*
gamegod@home:~/$ sudo fuser -v /dev/snd/*
USER PID ACCESS COMMAND
/dev/snd/controlC0: gamegod 6236 F.... mixer_applet2
/dev/snd/pcmC0D0p: gamegod 12936 F...m mixxx
/dev/snd/seq: gamegod 12936 F.... mixxx
This time the output above is showing me that Mixxx is using my soundcard's audio first ouput interface (pcmC0D0p corresponds to ALSA's hw:0,0), as well as ALSA's MIDI interface.