Adas
Adas

Reputation: 65

How to see input signal frequency in real time?

I want to see (in real time) the frequency (first harmonic) of the input signal (from a laptop microphone). I searched how to calculate FFT, I would need to see it in real time tho, is there any simple way to do this?

Upvotes: 1

Views: 888

Answers (2)

VladP
VladP

Reputation: 537

Use sliding DFT as suggested in one of the stackoverflow answers on this: Doing FFT in realtime. There is a source code there as well. However, there is no easy and simple implementation of it, unless you encounter some already written code.

Upvotes: 0

jaket
jaket

Reputation: 9341

FFT is a perfectly legitimate way to measure frequency. You don't usually need to run in realtime because you only need to perform an FFT at the rate you want to update the frequency reading. Even so, modern computers can do FFT in better than realtime (IOW, you'll be I/O bound by the audio samples). One issue with FFT frequency measurements is that the FFT bins are equally spaced in frequency. That means that you'll have higher frequency resolution at high frequencies and lower at low frequencies. To measure low frequencies you need a really long FFT and to measure high frequencies you can use a really short one.

Another option is to use a frequency counter (counting zero crossings) but it has drawbacks if the signal is noisy or other signals are present.

Upvotes: 2

Related Questions