for speech recognition by the Google server, I use the SpeechRecognizer class in combination with the RecognitionListener, as suggested by Stephan's answer to this question . Also, I am trying to capture an audio signal recognized by the onBufferReceived () callback from RecognitionListener, for example:
byte[] sig = new byte[500000] ; int sigPos = 0 ; ... public void onBufferReceived(byte[] buffer) { System.arraycopy(buffer, 0, sig, sigPos, buffer.length) ; sigPos += buffer.length ; } ...
This works just fine unless SpeechRecognizer is unable to connect to the Google server, when a piece of audio is not copied to the aforementioned sig array, and an HTTP connection timeout exception is thrown. SpeechRecognizer eventually connects to the Google server, and the recognition results show that the full audio signal was received; only in the sig array is some piece of audio missing.
Does anyone have a similar problem? Any hint of a solution? Thank!
android speech-recognition voice-recognition
Dusan May 8 '11 at 4:44 2011-05-08 04:44
source share