How to detect blow in android device microphone

我怕爱的太早我们不能终老 提交于 2019-12-21 04:49:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!