1

I want to know the frequency of data. I had a little bit idea that it can be done using FFT, but I am not sure how to do it. Once I passed the entire data to FFT, then it is giving me 2 peaks, but how can I get the frequency?

Thanks a lot in advance.

Dan
  • 1,060
  • 13
  • 39
Ankit Kumar
  • 123
  • 7
  • 2
    The position of the peaks are the frequency. – David Schwartz Aug 30 '13 at 07:31
  • possible duplicate of [How to get Frequency from FFT result](http://stackoverflow.com/questions/4364823/how-to-get-frequency-from-fft-result) – Paul R Aug 30 '13 at 08:26
  • 1
    This is asked so often on SE I wrote a blog post explaining it with code: http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html – Bjorn Roche Aug 30 '13 at 13:38

2 Answers2

3

Have a look at this page for an explanation on how to calculate it: FFT Fundamentals

Please also check this answer (it's C# code but I think you can easily understand it)
How do I obtain the frequencies of each value in an FFT?

And finally have a look at this one, it uses DFT instead of FFT:
Determining the magnitude of a certain frequency on the iPhone

I also found this implementation that you can use in Objective-C:

A lib to find the frequency https://github.com/jkells/sc_listener
A example using the above library https://github.com/jkells/sc_listener_sample

Regards

Community
  • 1
  • 1
Dan
  • 1,060
  • 13
  • 39
1

An FFT will give you the frequency of all the sinusoidal components of a signal. If instead you want just the frequency of the periodicity of common waveforms (more interesting sounding and looking that a plain sinewave) such as produced by speech and music, then you may want to use a pitch detection/estimation algorithm instead of just an FFT peak.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153