1

I want to build an android application which will recognize my voice, convert it into text and will show what i just spoke in a toast. i am able to do this by using a button which will launch voice recognizer for me. But now i want to make it work on the bases of my voice only.

The application should trigger voice recognizer and start listening to me only when i start speaking and should stop listening when it senses silence. Just like the functioning of talking tom application. There it records the voice but i want to recognize it using voice recognizer. Some thing like this:

if(no silense)
   Launch Recognizer
else if(silence)
   Stop Recognizer
Show toast

The main problem is that how can i sense if user is speaking something or not before launching voice recognizer. Is there any way to sense noise intensity..??

Secondly, is there any way to launch voice recognizer in the background...??

Is it possible if I can detect audio signal (someone starts speaking) in a background service, which will then immediately launch the voice recognizer to recognize the speech.

Pargat
  • 769
  • 9
  • 23
  • Talking Tom also changes other sounds, not only voice, so it probably keeps recording the audio, applying the filter and playing the sound continuously. – Marcio Covre Jun 12 '12 at 18:58
  • @nininho I know that it records the sound. Thats what i also mentioned in the question. I only want to know how it speaks back only when there is some silence gap. It must have sensed silence when it speaks back. The main idea is, I just want to know how to sense silent gaps so that i can fire some intents in those gaps. – Pargat Jun 12 '12 at 19:05
  • Well, your voice has a certain frequency range called the Voice Band. This ranges from 300 Hz to 3400 Hz. You could use a digital filter to listen for something within that range. Other than that, I'm not really sure. – Willem Ellis Jun 12 '12 at 19:28
  • @baudday In that case i will need to make recognizer keep listening continuously even if there is complete silence. so that i can filter voice commands on the bases of silent gaps. But as much i know, we can't control- for how long recognizer window will appear. How can i make recognizer keep on listening continuously... ??? – Pargat Jun 13 '12 at 18:53
  • Unfortunately I can't really help you on that. I was presenting a possible way to begin approaching your problem. That's why I submitted it as a comment and not an answer. – Willem Ellis Jun 13 '12 at 18:59
  • I have many applications installed in my phone which detect voice without even touching the phone. 'Vlingo' available on android market also has an option of 'wake up command' where we can launch recognizer just by saying 'Haye vlingo'. Can any one explain me how can i launch voice recognizer in my app without touching any button...?? – Pargat Jun 15 '12 at 19:36
  • FYI this problem is commonly called [voice activity detection](http://en.wikipedia.org/wiki/Voice_activity_detection). – John Wiseman Feb 26 '13 at 20:51
  • FYI, https://stackoverflow.com/questions/55233832/voice-recognition-for-alquran-arabic/55294744#55294744 – Googlian Aug 30 '19 at 05:27

2 Answers2

2

Most speech recognizers already have an endpointer to detect the start-of-speech and end-of-speech. Endpointers usually try to read the ambient noise level to determine a baseline for silence and to adapt the signal-to-noise ratio. But, if the input noise level changes, it might trigger the start-of-speech of the endpointer. If listening all the time, with a sensitive microphone, the endpointer might also pickup someone speaking next to you, instead of you.

As such, using a speech button is a good practice to announce when you wish to talk. Trying to get the recognizer to listen all of the time is probably not what you want to do, or should be left up to researchers.

Christian
  • 1,900
  • 14
  • 19
1

Ok I have figured it out. I have used mediaRecorder class for this. When the application launches i start recording the audio using mediaRecoder (or you can provide a button to start and stop the whole process). I check for the amplitude of the audio being recorded by the mediaRecorder. If the amplitude passes over a predefined threshold, I pause the recording and launch the Voice Recognition activity. In OnActivityResult I again resume the recorder.

if(mRecorder != null){
        int i= mRecorder.getMaxAmplitude();   // Getting amplitude 
        Log.d("AMPL : ", String.valueOf(i));

        if(i>20000){      // If amplitude is more than 20000
            onRecord(false);    //Stop recording before launching recognizer
            Intent intent=new Intent(this,VoiceRecognizer.class);   //Launch recognizer activity
            startActivityForResult(intent, 12112);
        }

Alternatively: You can also use RecognitionListener interface as referred in this SO post.

Community
  • 1
  • 1
Pargat
  • 769
  • 9
  • 23