2

I need a way to get the frequency from the microphone and determine the average frequency. Is there a library or something to handle this?

Thanks

sohil
  • 818
  • 2
  • 15
  • 38
Jake
  • 21
  • 2

3 Answers3

3

If you're targeting iOS 4 and above, Apple now includes the Accelerate framework. From Apple's "What's new" page:

http://developer.apple.com/technologies/iphone/whats-new.html#api

Accelerate

Accelerate provides hundreds of mathematical functions optimized for iPhone and iPod touch, including signal-processing routines, fast Fourier transforms, basic vector and matrix operations, and industry-standard functions for factoring matrices and solving systems of linear equations.

Paul
  • 2,698
  • 22
  • 27
0

You can use the EZAudio Class to get the Frequency Download the Demo Here and use this method to get Frequency

- (void) fft:(EZAudioFFT *)fft updatedWithFFTData:(float *)fftData bufferSize:(vDSP_Length)bufferSize
 {
     float maxFrequency = [fft maxFrequency];

       NSString *noteName = [EZAudioUtilities noteNameStringForFrequency:maxFrequency
                                                                includeOctave:YES];
            dispatch_async(dispatch_get_main_queue(), ^{
                [audioPlotFreq updateBuffer:fftData withBufferSize:(UInt32)bufferSize];
            NSLog(@"Frequncy : %f Highest Note : %@",maxFrequency,noteName);
      });
 } 
sohil
  • 818
  • 2
  • 15
  • 38
0

You'll want to use an FFT, so I'd recommend looking at this Q&A:

Do you know a good and efficient FFT?

Community
  • 1
  • 1
Avalanchis
  • 4,500
  • 3
  • 39
  • 48