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.
The way this feature works is that your phone's microphone listens in and detects any specific sounds that you may have chosen, and sends you alerts that these have been heard in the vicinity.
Tap Open Sound Notifications Tap Sound Notifications are active. Choose the sounds that you'd like to detect: Smoke and fire alarms. Siren.
Samsung Sound Detectors is a great app for detecting sounds with your Samsung smartphone and receiving useful alerts. Take advantage of your Samsung smartphone's microphone to take appropriate actions in an incredibly easy way. Samsung Sound Detectors appears on your Samsung accessibility menu.
Musicg library is useful for whistle detection. Concerning claps, I wouldn't recommend use it, cause it reacts to every loud sound (even speech).
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();
You can tune your detector by adjusting sensitivity (0-100) and threshold (0-20).
Good luck!
There is an Api that works very well for your needs in my opinion.
http://code.google.com/p/musicg/
Good Luck!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With