0

How can I get the frequency for an audio input on iPhone? Is it necessary to use a FFT if I'm only interested in finding a specific frequency (i.e. within a timeframe of x milliseconds, check if there is a peak at y Hz)?

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • See my answer to the same question here: [http://stackoverflow.com/a/19966776/468812][1] [1]: http://stackoverflow.com/a/19966776/468812 – krafter Nov 13 '13 at 23:49

1 Answers1

4

If you're just interested in a specific, fixed frequency (i.e. a pure tone) then you can use the Goertzel algorithm which is very simple to implement and relatively lightweight (computationally) compared to an FFT.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • 1
    Also, to determine if the output of the Goertzel filter is actually a peak, one should compare that output to a computation of the average power over the same time interval. A big percentage of that average power suggests a peak. – hotpaw2 Jun 18 '12 at 22:00