How to detect blow in android device microphone
Asked Answered
P

2

6

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

Peeved answered 23/11, 2011 at 20:42 Comment(1)
From a design perspective, be careful with this feature. We used it on a DS game (My Word Coach), and the player ended up getting dizzy from it. :)Anglesey
P
8

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

Porphyria answered 23/11, 2011 at 20:50 Comment(1)
@Porphyria really nice answer. But for ios it is good example but not for android. Do you know any alternate of it?Bigg
F
0

I would make and FFT and compare the spectrum with that of more sensible sounds. The blow will likely resemble white noise. Before seeing the spectrums of blow, speech and white noise, I have no idea how to tell one from another.

Fid answered 6/3, 2015 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.