|
From: Mike C. <mie...@gm...> - 2012-08-30 19:34:38
|
Hi all,
I'm wondering if it is possible to get SoX to calculate a wav file's
RMS as sample value. For example, given a 16-bit linear signed wav
file, I can run the command:
sox -V3 myaudio.wav -n stats
Which outputs a bunch of statistics including "RMS lev dB", e.g.:
RMS lev dB -35.59
I think I can convert "RMS lev dB" to "RMS lev Value" by:
((rms_lev_dB / 20) ^ 10) * full_scale_digital_sample = rms_lev_value
Which for my example data (16-bit linear signed, -35.59 rms_lev_dB)
would yield 550:
((-35.59 / 20) ^ 10) * 32,768 = _550_
(full_scale_digital_sample = 2^sample_size_in_bits / 2 = 2^16/2 = 32,768)
I'd prefer if SoX could output this value (e.g. 550) directly, rather
than my having to convert the dB value every time. I can get the
commercial product Sound Forge to give me this value via Tools ->
Statistics, then changing the level format to "Sample Value", so I
know it's not a completely obscure request. I suppose I could write a
wrapper around SoX to convert the value on the fly, but if it's
already built in I'd like to save myself the trouble.
thanks!
-Mike
|