finding the dominant frequency in a signal

Finding the dominant frequency is usually performed with a (fast-) fourier transformation (fft). An other method (not by far as accurate as fft) is zero crossing.

A third way can be: a binary search combined with band-pass filtering.

binary search combined with band-pass filtering

In this way, one splits the search-band (starting with 0...sample_rate/2 Hz) into two parts. The lower part is obtained by doing a band-pass filtering, same thing for the upper part.
Then, the standard deviation of the lower part and the upper part are compared.
If the lower part has a higher deviation, then the process is performed again for the lower part, else for the upper part.
This process is repeated no more than log2(sample_rate / 2) times.

sample implementation

download link:


calculating a spectral plot

This script: finds all frequencies in a signal.


2019/3/01: added noise to the signal

2019/3/14: added link to spectral plot generator