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
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.
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);
});
}
You'll want to use an FFT, so I'd recommend looking at this Q&A: