clap sound detection in android

android-asynctask, android-audiorecord

Solution

Refer the book named "Android Sensor Programming 2012".

In Part-3 Chapter-14 "Using the Microphone", you will get all the relevant details

Problem

I've searched StackOverflow and the web for many questions on whistle detection, etc, and many people did explain as much as they could as to how they can go about detecting their stuff. Detect Whistle sound in android Detect the beginning of a sound or voice in Android But I don't get how to detect "Jack Hammer sound count" in android app? Required counter can count atleast 33 strike/sec(or 2000 strike/min). Can any one suggest some solution? This is my doInBackground method ``` @Override protected Integer doInBackground(AudioCilpListener... listeners) { if (listeners.length == 0) { return 0; } AudioCilpListener listener = listeners[0]; AudioClipRecorder recorder = new AudioClipRecorder(listener, this); // boolean heard = false; int count = 0; for (int i = 0; i < 10; i++) { try { count = recorder.startRecordingForTime(30, AudioClipRecorder.RECORDER_SAMPLERATE_CD, AudioFormat.ENCODING_PCM_16BIT); break; } catch (IllegalStateException ie) { // failed to setup, sleep and try again // if still can't set it up, just fail ie.printStackTrace(); } } //collect the audio return count; } ```

Original source

Related problems