问题
How can I detect when the user blows into the device microphone? This would then be used to trigger some action by the app.
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/8248784/how-to-detect-blow-in-android-device-microphone