22

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.

4 Answers 4

17

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.

1
  • 2
    I've been using lsof wrong for years. Smh. Thanks for this post.
    – insaner
    Commented Mar 8, 2019 at 4:37
7

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

7

If your Linux installation is using PulseAudio, then it is possible to

List all processes which are connected to your pulse audio

run this command pactl list clients


However, it will give you POSSIBLE sound-making processes, if you really want to:

catch the process making sound then run this command:

watch -n0.5 'pacmd list-sink-inputs | tee -a sound-inputs.log'

and after a while you will see what processes are making sound, they could disappear fast, this is why tee -a sound-inputs.log command is storing/logging in sound-inputs.log all information, and you can review which process exactly is making noise now.

you can review it by less sound-inputs command, an example output is below:

0 sink input(s) available.
0 sink input(s) available.
0 sink input(s) available.
1 sink input(s) available.
    index: 277
    driver: <protocol-native.c>
    flags: START_CORKED 
    state: RUNNING
    sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
    volume: front-left: 55420 /  85% / -4.37 dB,   front-right: 55420 /  85% / -4.37 dB
            balance 0.00
    muted: no
    current latency: 35.85 ms
    requested latency: 7.52 ms
    sample spec: float32le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    resample method: copy
    module: 10
    client: 1884 <Chromium>
    properties:
        application.icon_name = "chromium-browser"
        media.name = "Playback"
        application.name = "Chromium"
        native-protocol.peer = "UNIX socket client"
        native-protocol.version = "33"
        application.process.id = "2993986"
        application.process.user = "aneutrino"
        application.process.host = "xiexie"
        application.process.binary = "Discord"
        application.language = "en_US.UTF-8"
        window.x11.display = ":0"
        application.process.machine_id = "13335995d81e4f4faf75ac28835b4f8c"
        module-stream-restore.id = "sink-input-by-application-name:Chromium"

in the example, above it was Discord chat application using chrome-browser making noises PID 2993986 I have entered to settings and disabled sounds in it, but alternatively I could simply kill it kill 2993986

3

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

1
  • 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
    Commented Oct 13, 2009 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .