I've got several small audio files and I need to find out which ones contain loud sounds. With the stat
command of Sox I get max and min amplitudes which are always around -1 and +1.
For example, this sound is louder:
$ sox out6.wav -n stat
Samples read: 220500
Length (seconds): 5.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999939
Minimum amplitude: -1.000000
Midline amplitude: -0.000031
Mean norm: 0.079951
Mean amplitude: -0.002050
RMS amplitude: 0.244085
Maximum delta: 0.386505
Minimum delta: 0.000000
Mean delta: 0.007803
RMS delta: 0.024331
Rough frequency: 699
Volume adjustment: 1.000
than this one:
$ sox out5.wav -n stat
Samples read: 220500
Length (seconds): 5.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999939
Minimum amplitude: -1.000000
Midline amplitude: -0.000031
Mean norm: 0.035560
Mean amplitude: -0.000054
RMS amplitude: 0.121909
Maximum delta: 0.085022
Minimum delta: 0.000000
Mean delta: 0.002599
RMS delta: 0.006305
Rough frequency: 363
Volume adjustment: 1.000
But they both have the same min and max amplitude.
How can I determine which one is the loudest?
Peak amplitude is not a good measure of overall loudness. All this measurement does is find the maximum or minimum sample that occurs over a period. The problem with this is that a clip with all zeros and a single one will measure the same max peak amplitude as the clip with all ones. The RMS (root mean square) amplitude is a better gauge of loudness. Its computed by summing the square of all of the samples and then taking the sqrt of the result. https://en.wikipedia.org/wiki/Amplitude