AVAudio detect note/pitch/etc. iPhone xcode objective-c

Albert Renshaw picture Albert Renshaw · Oct 1, 2011 · Viewed 10.4k times · Source

I'm making an app on the iphone and I need a way of detecting the tune of the sounds coming in through the microphone. (I.e. A#, G, C♭, etc.) I assumed I'd use AVAudio but I really don't know and I can't find anything in the documentation..

Any help?

Answer

e.James picture e.James · Oct 1, 2011

Musical notes are nothing more than specific frequencies of sound. You will need a way to analyze all of the frequencies in your input signal, and then find a way to isolate the individual notes.

Finding frequencies in an audio signal is done using the Fast Fourier Transform (FFT). There is plenty of source code available online to compute the FFT from an audio signal. In particular, oScope offers an open-source solution for the iPhone.

Edit: Pitch detection seems to be the technical name for what you are trying to do. The answers to a similar question here on SO may be of use.