2

Is there a way (via the command line) to output the decibel level of the audio coming into the soundcard's line-in jack? I want to run a script if the volume/intensity of the audio coming into line-in exceeds a certain threshold.

I've checked the files and sub-directories in /proc/asound and have played with the alsa/a* tools a bit, but I haven't found anything promising.

Any ideas/thoughts?

migrated from serverfault.com Nov 18 '10 at 20:26

This question came from our site for system and network administrators.

3

Try rec, included in sox package, with the silence filter. You can determine a level and duration to start and stop a record. Then, you can use it as a trigger to continue the script.

There is a very good link: http://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/

Regards,

  • 1
    Hi @neogurb, welcome to SuperUser. Not totally sure you would want to spend too much time answering 2 year old questions though ;) – Julian Knight Mar 7 '13 at 23:13
  • 2
    @JulianKnight I disagree, (one of) the point(s) of SO is to maintain an archive of information. It's not just meant to help the op, but also future visitors (such as myself). neo: I haven't tried it yet (will let you know), but thank you for the info. I have the same goal as fsmaniac – Adam Plocher Jul 22 '16 at 23:28
1

Generically, no. The data recorded is a relative value (relative to the maximum the setup will record, which varies by mic, sound card, and other factors).

If you have another piece of equipment by which you can calibrate the values output by the sound card then you can figure it out (again, for a particular setup). But without this external reference there's no way to know.

  • That makes sense. Given that, is there a command-line program that will tell me if there is audio coming into the line-in jack, regardless of strength/decibel level/volume? At the end of the day, the decibel level isn't as important - simply knowing whether or not there is a signal on the line is. – fsmaniac Nov 18 '10 at 21:53
0

you may try something like this:

/usr/bin/arecord -L # figure out what device to use

/usr/bin/arecord -d 1 --device plughw:CARD=HD1,DEV=0 -t wav | sox -t .wav - -n stats 2>&1 | awk '/RMS lev dB/{print $4}'
  • 2
    Can you share what these commands are doing? Not all users here has technical knowledge, so advising what these commands doing is a must. – Vylix Jun 7 '17 at 20:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.