views:

1672

answers:

5

I want to analyze MIC audio on an ongoing basis (not just a snipper or prerecorded sample), and display frequency graph and filter out certain aspects of the audio. Is the iPhone powerful enough for that? I suspect the answer is a yes, given the Google and iPhone voice recognition, Shazaam and other music recognition apps, and guitar tuner apps out there. However, I don't know what limitations I'll have to deal with.

Anyone play around with this area?

+2  A: 

The apps that I've seen do some sort of music/voice recognition need an internet connection, so it's highly likely that these just so some sort of feature calculation on the audio and send these features via http to do the recognition on the server.

In any case, frequency graphs and filtering have been done before on lesser CPUs a dozen years ago. The iPhone should be no problem.

moogs
+2  A: 

Apple's sample code aurioTouch has a FFT implementation.

zaph
Thank you. Wow. Have those developers heard of comments? Has anyone done a obj-c port of their c++? Not that it's that important but it might make it more readable.
mahboudz
vDSP and FFT now part of os4 with the addition of Accelerate.framework
slf
A: 

You cant just port FFT code written in C into your app...there is the thumb compiler option that complicates floating point arithmetic. You need to put it in arm mode

yan bellavance
The code mentioned above is already written for the iPhone.
mahboudz
+2  A: 

"Fast enough" may be a function of your (or your customer's) expectations on how much frequency resolution you are looking for and your base sample rate.

An N-point FFT is on the order of N*log2(N) computations, so if you don't have enough MIPS, reducing N is a potential area of concession for you.

In many applications, sample rate is a non-negotiable, but if it was, this would be another possibility.

Overdrive
Sampling rate must be twice the highest frequency I might be looking for, correct?
mahboudz
Correct. The spacing between bins in the frequency domain is a function of the number of points (N) in your FFT, and the nyquist frequency is always at the top (half the sample rate).
Overdrive
+1  A: 

I made an app that calculates the FFT live

http://www.itunes.com/apps/oscope

You can find my code for the FFT on GitHub (although it's a little rough)

http://github.com/alexbw/iPhoneFFT

Apple's new iPhone OS 4.0 SDK allows for built-in computation of the FFT with the "Accelerate" library, so I'd definitely start working with the new OS if it's a central part of your app's functionality.

alexbw
I think I saw you mention oscope today on the CoreAudio list. Congrats for getting it up on the app store!
mahboudz
Thanks! Serious bummer about those sampling rate limitations, but the iPhone still is an incredible platform for audio analysis nonetheless.
alexbw