Current Level of Microphone Input
Asked Answered
F

2

7

How can I get the current audio input level of a microphone via a shell command under Ubuntu 12.04 LTS?

I checked out amixer to set the volume but could not find a way to get the audio input level at the time of the shell call.

Thank you in advance!

For answered 28/11, 2012 at 13:45 Comment(0)
P
8

To get the level of the input signal, you have to actually record from the input device. Use the -d 1 parameter for arecord to get a short file.

To read the level of the data in that file, use something like sox recordedfile.wav -n stat.

Proportionate answered 28/11, 2012 at 14:35 Comment(0)
S
2

Based on the above answer, to get the maximum amplitude:

arecord -qd 1 volt && sox volt -n stat &> volt.d && sed '4q;d' volt.d
Spline answered 8/8, 2017 at 22:13 Comment(1)
That is exactly what I want.Mueller

© 2022 - 2024 — McMap. All rights reserved.