-
public class SpeechServiceService that records audio in a thread, passes it to a recognizer and emits recognition results. Recognition events are passed to a client using RecognitionListener
-
-
Constructor Summary
Constructors Constructor Description SpeechService(Recognizer recognizer, float sampleRate)Creates speech service.
-
Method Summary
Modifier and Type Method Description booleanstartListening(RecognitionListener listener)Starts recognition. booleanstartListening(RecognitionListener listener, int timeout)Starts recognition. booleanstop()Stops recognition. booleancancel()Cancel recognition. voidshutdown()Shutdown the recognizer and release the recorder voidsetPause(boolean paused)voidreset()Resets recognizer in a thread, starts recognition over again -
-
Constructor Detail
-
SpeechService
SpeechService(Recognizer recognizer, float sampleRate)
Creates speech service.
-
-
Method Detail
-
startListening
boolean startListening(RecognitionListener listener)
Starts recognition. Does nothing if recognition is active.
-
startListening
boolean startListening(RecognitionListener listener, int timeout)
Starts recognition. After specified timeout listening stops and theendOfSpeech signals about that. Does nothing if recognition is active.
timeout - timeout in milliseconds to listen.
-
stop
boolean stop()
Stops recognition. Listener should receive final result if there isany. Does nothing if recognition is not active.
-
cancel
boolean cancel()
Cancel recognition. Do not post any new events, simply cancel processing.Does nothing if recognition is not active.
-
shutdown
void shutdown()
Shutdown the recognizer and release the recorder
-
setPause
void setPause(boolean paused)
-
reset
void reset()
Resets recognizer in a thread, starts recognition over again
-
-
-
-