STTRunner

Inherits: Node < Object

Category: Core

Brief Description

Uses STT (Speech to Text) to identify keywords spoken by the user.

Member Functions

Object get_config ( ) const
Object get_queue ( ) const
int get_rec_buffer_size ( )
int get_run_error ( )
void reset_run_error ( )
bool running ( )
void set_config ( Object stt_config )
void set_queue ( Object stt_queue )
void set_rec_buffer_size ( int size )
int start ( )
void stop ( )

Numeric Constants

  • DEFAULT_REC_BUFFER_SIZE = 2048 — Microphone recorder default buffer size.

Description

Responsible for running speech recognition itself, identifying keywords spoken by the user.

Member Function Description

Returns the STTConfig object containing recognition variables, or null if not previously set.

Returns the STTQueue that stores recognized keywords, or null if not previously set.

  • int get_rec_buffer_size ( )

Returns the microphone recorder buffer size used for speech recognition.

  • int get_run_error ( )

Returns the STTError value that depicts how the previously running speech recognition thread has ended. It can be one of the following values:

  • OK
  • REC_START_ERR
  • REC_STOP_ERR
  • UTT_START_ERR
  • UTT_RESTART_ERR
  • AUDIO_READ_ERR

If no thread was previously run, returns OK.

  • void reset_run_error ( )

Resets the STTError value that depicts how the previously running speech recognition thread has ended, setting its value to OK.

Returns true if the speech recognition thread is active, or false otherwise.

  • void set_config ( Object stt_config )

Sets the STTConfig object containing recognition variables. If the speech recognition thread is currently running, it will be stopped.

  • void set_queue ( Object stt_queue )

Sets the STTQueue that stores recognized keywords. If the speech recognition thread is already running, it will be stopped.

  • void set_rec_buffer_size ( int size )

Sets the microphone recorder buffer size used for speech recognition as the specified value. Must be > 0. If the speech recognition thread is currently running, it will be stopped.

  • int start ( )

Creates a thread to repeatedly listen to keywords. The thread can be stopped with stop. If start was previously called, the current thread is halted and a new recognition, with the specified arguments, is created.

Returns one of the following STTError values:

  • OK
  • UNDEF_CONFIG_ERR
  • UNDEF_QUEUE_ERR

Note: To check for an error that occurred and stopped the thread, see get_last_error.

  • void stop ( )

Stops the thread currently doing speech recognition. If start wasn’t called previously, this function does nothing.