I am looking for a library that can determine the peak and RMS levels in an audio file, for a list of one or more frequencies. I'm looking for something that could be used from C++ on Linux.

I'm interested in using it to help answer questions like "Which audio files in a given directory haven't been low-passed or high-passed?" by checking the peak and RMS levels at frequencies that should have been cut, or "Which audio files in a given directory could use some EQ-ing at known bad frequencies?" by looking at some frequencies that I've historically had trouble with (home studio issues).

While I'm mainly interested in just checking specific frequencies, something that could give me RMS and peak information across a sampling between 0 and 20kHz would also be useful.


1 Answer 1


To determine the peak and RMS levels of a sound file on a frequency by frequency basis first you need to split out the various frequencies - this is most commonly done with Fourier Transforms and one of the most used libraries to do this is a free C library called: FFTW which is a C library but perfectly usable from C++, (as well as C and Fortran) but it can be a little overwhelming so you might also like to take a look at KissFFT.

You actually need to first specify your desired auto formats and find libraries to load them in a way that results in an array of floating point numbers, perform your FFT on time slices and then for the frequencies that you are interested in simple maths can determine peak and RMS values.

If you are not irrevocably tied to C++ you could take a look at the python librosa which will get you up and running a lot faster, the plot below is from a librosa introductory iPython notebook that took about 30 line of code:

MEL Demo

You could also consider either calling python from within C++ or embedding python into your C++ application.

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.