问题描述
我希望我的Android应用程序识别的声音。例如,我想知道,如果从麦克风的声音是拍手或敲或别的东西。
I want my Android app to recognize sound. For example I want to know if the sound from microphone is a clapping or knocking or something else.
我需要用数学,或可我只是用一些库是什么?
Do I need to use math, or can I just use some library for that?
如果有任何图书馆的声音分析请让我知道。谢谢你。
If there are any libraries for sound analysis please let me know. Thanks.
推荐答案
Musicg 图书馆是哨子检测有用。至于鼓掌,我不建议使用它,因为它反应到每一个响亮的声音(甚至是语音)。
Musicg library is useful for whistle detection. Concerning claps, I wouldn't recommend use it, cause it reacts to every loud sound (even speech).
有关拍手等声音撞击检测,我建议 TarsosDSP 。它具有丰富的功能,(间距检测等)的简单API。对于拍手检测,你可以使用类似(如果你使用TarsosDSPAndroid-V3):
For clap and other percussive sounds detection I recommend TarsosDSP. It has a simple API with a rich functionality (pitch detection and so on). For clap detection you can use something like (if you use TarsosDSPAndroid-v3):
MicrophoneAudioDispatcher mDispatcher = new MicrophoneAudioDispatcher((int) SAMPLE_RATE, BUFFER_SIZE, BUFFER_OVERLAP);
double threshold = 8;
double sensitivity = 20;
mPercussionDetector = new PercussionOnsetDetector(22050, 1024,
new OnsetHandler() {
@Override
public void handleOnset(double time, double salience) {
Log.d(TAG, "Clap detected!");
}
}, sensitivity, threshold);
mDispatcher.addAudioProcessor(mPercussionDetector);
new Thread(mDispatcher).start();
您可以调整你的检测器,通过调节灵敏度(0-100)和阈值(0-20)。
You can tune your detector by adjusting sensitivity (0-100) and threshold (0-20).
祝你好运!
这篇关于声音识别Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!