analyze a .wav or .mp3 file

Chris Brannon cmbrannon79 at
Mon Jan 11 22:48:15 UTC 2010

Terry Klarich wrote:
> I would like to see if anyone has an idea how to analyze a wav or mp3 file in
>  a shell script to see if there is any audio present;
> or, it is a blank file.

The command-line syntax of sox changed.
As of version 14.3.0, it is sox whatever.wav -n stat, instead of -e stat.

Here's some sample output generated by an audio file of mine.
Note that the data is written to stderr.
Samples read:         215560756
Length (seconds):   9775.998005
Scaled by:         2147483647.0
Maximum amplitude:     1.000000
Minimum amplitude:    -1.000000
Midline amplitude:    -0.000000
Mean    norm:          0.073211
Mean    amplitude:    -0.000002
RMS     amplitude:     0.119737
Maximum delta:         1.026207
Minimum delta:         0.000000
Mean    delta:         0.019383
RMS     delta:         0.035299
Rough   frequency:         1034
Volume adjustment:        1.000

The volume adjustment number always seemed helpful when looking for a blank
file.  It is much greater than 1.00 if the file contains silence.
The other statistics are probably useful as well, but I don't know very
much about digital audio.

-- Chris
PS. I think that you and I have a few common acquaintances outside of the net.
I caught mention of your name several times when I was pursuing an undergrad
CS degree.


More information about the Blinux-list mailing list