Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sound recognition in 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.

like image 592
Elephant Avatar asked Dec 15 '11 17:12

Elephant


People also ask

What is sound detectors on my phone?

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.

Does Samsung phone have sound recognition?

Tap Open Sound Notifications Tap Sound Notifications are active. Choose the sounds that you'd like to detect: Smoke and fire alarms. Siren.

What is sound detector on Android?

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.


2 Answers

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!

like image 58
Andrei Buneyeu Avatar answered Oct 11 '22 21:10

Andrei Buneyeu


There is an Api that works very well for your needs in my opinion.

http://code.google.com/p/musicg/

Good Luck!!!

like image 32
Ana Llera Avatar answered Oct 11 '22 23:10

Ana Llera