I am currently trying to compare the amplitude vs time data between two different microphone readings (.wav files of inhales and exhales) and detect which reading produced a louder sound, on average. I was wondering what the best methodology for this would be, and if there is a good mathematical way to go about this, is there any Python support for it (i.e. a library or article about it).

For reference, the current approach we are looking into is to calculate some sort of curve that encompasses the readings, and then take the absolute value, and then calculate the area under the curve during each inhale/exhale, comparing that integral value between each reading on average.

Here is an image of what the data looks like: Image of amplitude data over time for a .wav file of inhales and exhales... a recording of breathing

Thank you


1 Answer 1


A typical loudness chain comprises of

  1. Frequency weighting filter. For breathing, A-weighting is probably fine
  2. RMS detector with a suitable time constant (maybe 100ms or so)
  3. If you want a single number: suitable integration over the entire clip. Energy average will probably be ok here.

Potential Python libraries:

https://github.com/csteinmetz1/pyloudnorm https://github.com/SuperShinyEyes/spl-meter-with-RPi

I have no experience with any of these, so use at your own risk.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.