3

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;

    }
Community
  • 1
  • 1
Susomrof
  • 234
  • 5
  • 21
  • what is your problem? did you try and recreate those whislty/soudnstart apps / that source code? And what happened then? WHere are you stuk: do you have anything that can detect one strike, but are you having trouble with the speed? Is the speed ok, but can you not make the app? what is going on? – Nanne Sep 04 '13 at 12:33
  • Till now I can detect 500 strike/minute. But I need help to achieve the resolution. – Susomrof Sep 04 '13 at 12:59
  • then show your code, or part of it. Without knowing what you are allready doing, we're just going to throw out random stuff, aren't we? How can we see what you can approve if we don't see what you are doing? – Nanne Sep 04 '13 at 13:06
  • I just dont want any code from u guys, Ionly need some suggestions. – Susomrof Sep 04 '13 at 13:36
  • See I've edited my ques and post my doInBackground method stuff of AsyncTask class And also if u really want to help then see this post also: [link] http://stackoverflow.com/q/18463765/2563740 – Susomrof Sep 04 '13 at 13:46

1 Answers1

4

Refer the book named "Android Sensor Programming 2012".

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

Abhinav
  • 523
  • 6
  • 17