Public Member Functions | Public Attributes | List of all members
snowboy.snowboydecoder.HotwordDetector Class Reference
Inheritance diagram for snowboy.snowboydecoder.HotwordDetector:
Inheritance graph

Public Member Functions

def __init__ (self, decoder_model, resource=RESOURCE_FILE, sensitivity=[], audio_gain=1)
def start (self, detected_callback=play_audio_file, interrupt_check=lambda:False, sleep_time=0.03)
def terminate (self)

Public Attributes


Detailed Description

Snowboy decoder to detect whether a keyword specified by `decoder_model`
exists in a microphone input stream.

:param decoder_model: decoder model file path, a string or a list of strings
:param resource: resource file path.
:param sensitivity: decoder sensitivity, a float of a list of floats.
                          The bigger the value, the more senstive the
                          decoder. If an empty list is provided, then the
                          default sensitivity in the model will be used.
:param audio_gain: multiply input volume by this factor.

Definition at line 59 of file

Constructor & Destructor Documentation

def snowboy.snowboydecoder.HotwordDetector.__init__ (   self,
  resource = RESOURCE_FILE,
  sensitivity = [],
  audio_gain = 1 

Definition at line 75 of file

Member Function Documentation

def snowboy.snowboydecoder.HotwordDetector.start (   self,
  detected_callback = play_audio_file,
  interrupt_check = lambda: False,
  sleep_time = 0.03 
Start the voice detector. For every `sleep_time` second it checks the
audio buffer for triggering keywords. If detected, then call
corresponding function in `detected_callback`, which can be a single
function (single model) or a list of callback functions (multiple
models). Every loop it also calls `interrupt_check` -- if it returns
True, then breaks from the loop and return.

:param detected_callback: a function or list of functions. The number of
                  items must match the number of models in
:param interrupt_check: a function that returns True if the main loop
                needs to stop.
:param float sleep_time: how much time in second every loop waits.
:return: None

Definition at line 120 of file

def snowboy.snowboydecoder.HotwordDetector.terminate (   self)
Terminate audio stream. Users cannot call start() again to detect.
:return: None

Definition at line 176 of file

Member Data Documentation

Definition at line 107 of file


Definition at line 90 of file


Definition at line 93 of file


Definition at line 105 of file


Definition at line 108 of file

The documentation for this class was generated from the following file:

Author(s): Anas Abou Allaban
autogenerated on Mon Jun 10 2019 13:02:59