How can I find out what programs are using sound in Linux?

13

4

Is there anyway of knowing what binaries are using the sound system/server ? Like seeing something in the /proc directory (or /dev) ?

After a while ALSA stops working , and I would like to know why.

Geo

Posted 2009-09-26T10:07:27.637

Reputation: 348

Answers

14

One of the following commands might give you what you are after:

burhan@Ganymede:~$ lsof /dev/snd/*
COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
pulseaudi 1142 burhan  mem    CHR  116,3          7885 /dev/snd/pcmC0D0p
pulseaudi 1142 burhan   21u   CHR  116,5      0t0 7887 /dev/snd/controlC0
pulseaudi 1142 burhan   28u   CHR  116,5      0t0 7887 /dev/snd/controlC0
pulseaudi 1142 burhan   36r   CHR 116,33      0t0 6351 /dev/snd/timer
pulseaudi 1142 burhan   37u   CHR  116,3      0t0 7885 /dev/snd/pcmC0D0p


burhan@Ganymede:~$ fuser -v /dev/snd/*
                     USER PID ACCESS COMMAND
/dev/snd/controlC0:  burhan     1142 F.... pulseaudio
/dev/snd/pcmC0D0p:   burhan     1142 F...m pulseaudio
/dev/snd/timer:      burhan     1142 f.... pulseaudio

On this system, pulseaudio is the only thing making use of the sound device but this is a fresh Ubuntu 11.04 VM. You may have other things listed.

Burhan Ali

Posted 2009-09-26T10:07:27.637

Reputation: 498

1I've been using lsof wrong for years. Smh. Thanks for this post. – insaner – 2019-03-08T04:37:06.280

6

I'm not sure about the sound interfaces in /proc, but if you have PulseAudio running, you can get this information from the PulseAudio Volume Control, a GTK based tool. On Ubuntu, it is installed from the pavucontrol package.

It lets you see all the applications using the sound streams, and lets you control the volume levels for each stream individually (in addition to the volume of the channel itself).

alt text

user4358

Posted 2009-09-26T10:07:27.637

Reputation:

4

Run 'lsof | grep dev/snd' as root. You'll see what processes have files in /dev/snd open.

PiedPiper

Posted 2009-09-26T10:07:27.637

Reputation: 206

On my machine, lsof shows a screen or two of output, and then it just sits. It does nothing anymore. Any clues on what could be wrong? – Geo – 2009-10-13T16:04:57.860