It's possible to make SpeechRecognizer faster?
<p>I'm developing an application which is using the android SpeechRecognizer. I'm using it for something simple. I click in a button, my SpeechRecognizer start listening and I got some results from what I said.</p>
<p>Easy right? Well, My problem is that I need to make SpeechRecognizer fast. I mean, I click in my button, I say &quot;Hello&quot; and SpeechRecognizer takes like 3-4 seconds in return an array with the possible results. My question is:</p>
<p>It's possible to make SpeechRecognizer return results more faster?
Or take less time to close the Listening intent and start to process what it listen?
Maybe another way to do it? which will have a better performance than this?</p>
<p>I was checking the library and I saw this 3 parameters:</p>
<blockquote>
<p><strong>EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS:</strong></p>
<p>The amount of time that it should take after we stop hearing speech to consider the input complete.</p>
</blockquote>
<blockquote>
<p><strong>EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS</strong></p>
<p>The minimum length of an utterance.</p>
</blockquote>
<blockquote>
<p><strong>EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS</strong></p>
<p>The amount of time that it should take after we stop hearing speech to
consider the input possibly complete.</p>
</blockquote>
<p><a href="http://developer.android.com/intl/es/reference/android/speech/RecognizerIntent.html" rel="nofollow noreferrer">http://developer.android.com/intl/es/reference/android/speech/RecognizerIntent.html</a></p>
<p>I have tried all of them but it is not working, or maybe I'm not using them right. Here is my code:</p>
<pre><code>public class MainActivity extends Activity {
private static final String TIME_FORMAT = &quot;%02d:%02d:%02d&quot;;
private final String TAG = &quot;MainActivity&quot;;

private StartTimerButton mSpeakButton;
private CircleProgressBar mCountdownProgressBar;
private CountDownTimer mCountDownTimer;
private TextView mTimer;
private int mRunSeconds = 0;
private SpeechRecognizer mSpeechRecognizer;
private Intent mSpeechRecognizerIntent;
private boolean mIsListening = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mRunSeconds = 0;
    mTimer = (TextView) findViewById(R.id.timerText);
    mCountdownProgressBar = (CircleProgressBar) findViewById(R.id.progressBar);
    mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
    mSpeechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
            this.getPackageName());

//          mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS,
//                1000);
//        mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,
//                1000);
//        mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS,
//                1000);

    SpeechRecognitionListener listener = new SpeechRecognitionListener();
    mSpeechRecognizer.setRecognitionListener(listener);
    mSpeakButton = (StartTimerButton) findViewById(R.id.btnSpeak);
    mSpeakButton.setReadyState(false);
    mSpeakButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mSpeakButton.isReady()) {
                if (!mIsListening)
                    mSpeechRecognizer.startListening(mSpeechRecognizerIntent);
            } else
                mSpeakButton.setReadyState(true);
        }
    });

}     

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    return true;
}

public void onSpeechResults(ArrayList&lt;String&gt; matches) {
    for (String match : matches) {

        match = match.toLowerCase();
        Log.d(TAG, &quot;Got speech: &quot; + match);

        if (match.contains(&quot;go&quot;)) {
            //Do Something
            mSpeechRecognizer.stopListening();
        }
        if (match.contains(&quot;stop&quot;)) {
            //Do Something
            mSpeechRecognizer.stopListening();
        }
    }
}

protected class SpeechRecognitionListener implements RecognitionListener
{

    @Override
    public void onBeginningOfSpeech()
    {
        //Log.d(TAG, &quot;onBeginingOfSpeech&quot;);
    }

    @Override
    public void onBufferReceived(byte[] buffer)
    {

    }

    @Override
    public void onEndOfSpeech()
    {
        //Log.d(TAG, &quot;onEndOfSpeech&quot;);
    }

    @Override
    public void onError(int error)
    {
        mSpeechRecognizer.startListening(mSpeechRecognizerIntent);

        //Log.d(TAG, &quot;error = &quot; + error);
    }

    @Override
    public void onEvent(int eventType, Bundle params)
    {

    }

    @Override
    public void onPartialResults(Bundle partialResults)
    {
        ArrayList&lt;String&gt; matches = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
        for (String match : matches) {
            match = match.toLowerCase();
            Log.d(TAG, &quot;onPartialResults : &quot; + match);
        }
    }

    @Override
    public void onReadyForSpeech(Bundle params)
    {
        Log.d(TAG, &quot;onReadyForSpeech&quot;); //$NON-NLS-1$
    }

    @Override
    public void onResults(Bundle results)
    {
        //Log.d(TAG, &quot;onResults&quot;); //$NON-NLS-1$
        ArrayList&lt;String&gt; matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
        onSpeechResults(matches);
        // matches are the return values of speech recognition engine
        // Use these values for whatever you wish to do
    }

    @Override
    public void onRmsChanged(float rmsdB)
    {
    }
}}
</code></pre>