View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-26-2004, 02:01 PM   #1
Registered: Jul 2003
Location: Israel
Distribution: slackware current kernel 2.6.9
Posts: 70

Rep: Reputation: 15
how to know who use the sound device

I develop a small application that has to know in a specific time, whether someone writes to the /dev/dsp or in other words, emits sounds.

Now, contrary to windows, in linux there is no restriction for wrting at the same time to the same file, namely, you can have a file opened with two different applications for write purposes.

The question is how can I track it, at least to know if there is an application which uses the sound card.
If I run cat /dev/dsp - it doesn't show anything though I easily produce sound with
echo "something" > /dev/dsp
(I tried get the same effect as with cat /dev/mouse - where every movement of the mouse, prints jibbrish).

Any Ideas?
Old 09-26-2004, 03:08 PM   #2
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
If an application has a file open it will show in the output of the lsof command. My Alsa audio device is /dev/snd/pcmC0D0p so if I want to check if an application is using it I can type lsof /dev/snd/pcmC0D0p, and lo and behold:
root@royne:~# lsof /dev/snd/pcmC0D0p 
beep-medi 27820   hw  mem    CHR 116,16      1311306 /dev/snd/pcmC0D0p
beep-medi 27820   hw   12u   CHR 116,16      1311306 /dev/snd/pcmC0D0p
I am using Beep Media Player (real executable name "beep-media-player") to play some tunes right now so it showing up is right. If I hit the stop button so it stops playing, it doesn't show up in the lsof output.


Last edited by hw-tph; 09-26-2004 at 03:09 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mplayer sound error: "Could not open/initialize audio device -> no sound" GTBlackwell Linux - Software 9 06-11-2008 03:23 PM
sound device in use? JoeUser11 Linux - Newbie 3 06-15-2005 01:29 PM
Sound device not working Dragonblade Linux - General 2 07-25-2004 06:05 PM
no sound from cd player, good sound from audio device test fmickel Linux - Hardware 5 06-04-2004 01:46 PM
Sound - what is using the device? BlurredWeasel Linux - Newbie 7 10-01-2003 01:57 PM

All times are GMT -5. The time now is 06:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration