How can I get a peak frequency of an audio (plz help,,)

First of all, I’m very new at this framework, and also my mother lang is not an english so plz be generous for That.

So, I want a Find a peak frequency from an audio. I tried this with FFT data, but i can’t find how to do it.

Is there any function for that?

and it would be grateful that share the code(or link) about peak frequency.


Generally speaking applying a window to the audio block of sufficient size, doing an FFT and finding the peak in the magnitudes should be a good start. It depends on what you want to achieve.

1 Like

If you don’t mind a bit of C, then LibXtract has a peak spectrum function.

It’s modular, so you would first get the peak spectrum as a vector then extract the “highest value” from the magnitudes, then look up the frequency of this value.

However, “peak frequency” might not be exactly what you want. Maybe spectral centroid, F0, or spectral rolloff. In pitched material you’d generally expect F0 to be the strongest component.

The docs are here: LibXtract: Main Page


If you want to find the frequency with the strongest signal you want to take the spectral centroid of the FFT result. I’ve also found that squaring the FFT bin level that you accumulate whilst calculating the spectral centroid gives better results.


Many Thax Guys! I solved my problem! lol
i found a answer from FFT data!
again, Thax guys!