How to detect blow in android device microphone

Darko picture Darko · Nov 23, 2011 · Viewed 8.4k times · Source

How can I detect when the user blows into the device microphone? This would then be used to trigger some action by the app.

Answer

user849998 picture user849998 · Nov 23, 2011

The job of detecting when a user blows into the microphone is separable into two parts: (1) taking input from the microphone and (2) listening for a blowing sound. The noise/sound of someone blowing into the mic is made up of low-frequency sounds. We’ll use a low pass filter to reduce the high frequency sounds coming in on the mic; when the level of the filtered signal spikes we’ll know someone’s blowing into the mic.

Source: http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/

EDIT And here is some small SoundMeter class for Android: http://code.google.com/p/android-labs/source/browse/trunk/NoiseAlert/src/com/google/android/noisealert/SoundMeter.java?r=2