LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Silent pulse audio output detection/indication, with bash + arecord

Posted 10-02-2016 at 03:16 AM by the dsc
Updated 10-02-2016 at 03:19 AM by the dsc

You can "grep" something at /proc or whatever that tells whether there's some sound theoretically being played, but it will give a false positive when "silent sound" is being played.

A clumsy hack along these lines can detect "silent audio" as silence:

Code:
while true ; do 
arecord -d 1 -D pulse > /dev/shm/test-audio 2>&1 
cut -c 300- /dev/shm/test-audio | grep -a [[:alpha:]] > /dev/null && echo sound || echo silence
done
The output of the command will be a bunch of "random" characters, but question mark in a diamond (whatever it's called -- apparently "replacement character") will be the predominant character on silent output.
Posted in Uncategorized
Views 1544 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 02:15 PM.

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