Package 

Class SpeechService


  • 
    public class SpeechService
    
                        

    Service 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
      boolean startListening(RecognitionListener listener) Starts recognition.
      boolean startListening(RecognitionListener listener, int timeout) Starts recognition.
      boolean stop() Stops recognition.
      boolean cancel() Cancel recognition.
      void shutdown() Shutdown the recognizer and release the recorder
      void setPause(boolean paused)
      void reset() Resets recognizer in a thread, starts recognition over again
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpeechService

        SpeechService(Recognizer recognizer, float sampleRate)
        Creates speech service.
    • Method Detail

      • 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