The challenge I'm looking at is to design an iPhone component that listens to microphone input and triggers when it hears a particular blip (preferably < 0.1sec duration).

I can design the blip myself, and also false positives are okay.

The key constraint is that the listener is lightweight, so it doesn't drain CPU.

Can anyone suggest a mechanism, or point me in a good direction?


EDIT: this is as far as I have got:

I should be feeding audio into a ~1s buffer

so the first check may throw up lots of false positives, but this allows a second check to delve into the one second history and determine whether it was indeed a false positive or a valid blip.

so the first check may just be listening for the presence of a particular frequency sustained over 0.1s

to do this I could feed incoming audio into a 100 sample (for example) ring buffer, and then, 50 times per second multiply the ring-data by a sine wave (giving x) and cosine wave (giving y), effectively manually calculating a single FFT bin x+iy. then I could flag whenever the phase remains roughly constant over three frames.

or maybe I could use 3 such rings, length 99, 100, 101 samples. and monitor the amount of energy getting accumulated in each; if the 100-sample-ring wins and the neighbours are roughly balanced, that would be an indicator that the 100-ring's resonant frequency has been detected.

but this approach would require feeding all audio data into three rings. it isn't particularly lightweight... maybe I could only feed one in 17 (say) samples into each ring, throwing away the other 16. As 17 is co-prime with 99,100,101 it would fill all cells of the ring before overwriting the first again.


2 Answers 2


One lighter-weight approach might be to use a narrow-band IIR filter centered at your blip frequency, rectify or square, feed this result to a low-pass filter, and look for a value passing some threshold. A Goertzel filter is another possibility.

Note that the most current iOS Accelerate framework includes a reportedly power-efficient biquad IIR filtering function. Also note that on recent iOS devices, even a more heavyweight approach (FFTs, autocorrelation, and such) on a single channel of real-time audio input might use only a tiny percentage of total device power.


If you know what the bleep is going to look/sound like, you can use a matched filter to detect the bleep.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.