scripting: peak, RMS levels from command line?

I have Audacity v2.1.2 on Ubuntu 17.04 and it works OK.

I would like to get the kind of audio statistics that the “ACX Check” plugin displays (peak, RMS and noise floor) but under script control and entirely from the command line.

Is it possible? My LISP is a little rusty but I could probably rewrite the plugin as needed, if it was possible for it to write to stdout and there was an example of a plugin intended for command-line usage.

Or maybe there is an easier way to get such audio stats on command line outside of Audacity, something like SOX? Thanks for any suggestions!


Audacity does very little from the command line (other than launching the application).
There is an experimental scripting interface, but not really ready for prime-time, and it requires building Audacity from the source code.

SoX looks like a better option. See “stat” and “stats” in the documentation:

I appreciate the response. I tried out sox myfile.mp3 -n channels 2 stats
and it looks good enough for what I want. Thanks again!

sox ChB_2018-02-10_19-25-00.mp3 -n channels 2 stats

             Overall     Left      Right
DC offset  -0.000015 -0.000015 -0.000015
Min level  -0.233424 -0.233424 -0.224065
Max level   0.274835  0.274835  0.272619
Pk lev dB     -11.22    -11.22    -11.29
RMS lev dB    -38.64    -38.56    -38.73
RMS Pk dB     -20.53    -20.53    -20.78
RMS Tr dB     -48.95    -48.95    -48.57
Crest factor       -     23.27     23.55
Flat factor     0.00      0.00      0.00
Pk count           2         2         2
Bit-depth      27/29     27/29     27/29
Num samples    14.4M
Length s     300.000
Scale max   1.000000
Window s       0.050