Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
mycroft.client.speech.mic.ResponsiveRecognizer Class Reference
Inheritance diagram for mycroft.client.speech.mic.ResponsiveRecognizer:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, wake_word_recognizer)
 
def listen (self, source, emitter, stream=None)
 
def record_sound_chunk (self, source)
 
def stop (self)
 

Static Public Member Functions

def calc_energy (sound_chunk, sample_width)
 
def sec_to_bytes (sec, source)
 

Public Attributes

 account_id
 
 audio
 
 config
 
 energy_ratio
 
 energy_threshold
 
 filenames_to_upload
 
 mic_level_file
 
 multiplier
 
 overflow_exc
 
 save_utterances
 
 save_wake_words
 
 saved_wake_words_dir
 
 SAVED_WW_SEC
 
 TEST_WW_SEC
 
 upload_disabled
 
 upload_lock
 
 upload_url
 
 wake_word_name
 
 wake_word_recognizer
 

Static Public Attributes

float MIN_LOUD_SEC_PER_PHRASE = 0.5
 
float MIN_SILENCE_AT_END = 0.25
 
float RECORDING_TIMEOUT = 10.0
 
float RECORDING_TIMEOUT_WITH_SILENCE = 3.0
 
float SEC_BETWEEN_WW_CHECKS = 0.2
 
float SILENCE_SEC = 0.01
 

Private Member Functions

def _adjust_threshold (self, energy, seconds_per_buffer)
 
def _compile_metadata (self)
 
def _record_phrase (self, source, sec_per_buffer, stream=None)
 
def _skip_wake_word (self)
 
def _upload_wake_word (self, audio, metadata)
 
def _wait_until_wake_word (self, source, sec_per_buffer)
 

Static Private Member Functions

def _create_audio_data (raw_data, source)
 

Private Attributes

 _stop_signaled
 

Detailed Description

Definition at line 163 of file mic.py.

Constructor & Destructor Documentation

def mycroft.client.speech.mic.ResponsiveRecognizer.__init__ (   self,
  wake_word_recognizer 
)

Definition at line 186 of file mic.py.

Member Function Documentation

def mycroft.client.speech.mic.ResponsiveRecognizer._adjust_threshold (   self,
  energy,
  seconds_per_buffer 
)
private

Definition at line 573 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._compile_metadata (   self)
private

Definition at line 365 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._create_audio_data (   raw_data,
  source 
)
staticprivate
Constructs an AudioData instance with the same parameters
as the source and the specified frame_data

Definition at line 505 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._record_phrase (   self,
  source,
  sec_per_buffer,
  stream = None 
)
private
Record an entire spoken phrase.

Essentially, this code waits for a period of silence and then returns
the audio.  If silence isn't detected, it will terminate and return
a buffer of RECORDING_TIMEOUT duration.

Args:
    source (AudioSource):  Source producing the audio chunks
    sec_per_buffer (float):  Fractional number of seconds in each chunk
    stream (AudioStreamHandler): Stream target that will receive chunks
                         of the utterance audio while it is
                         being recorded

Returns:
    bytearray: complete audio buffer recorded, including any
       silence at the end of the user's utterance

Definition at line 237 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._skip_wake_word (   self)
private

Definition at line 339 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._upload_wake_word (   self,
  audio,
  metadata 
)
private

Definition at line 383 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer._wait_until_wake_word (   self,
  source,
  sec_per_buffer 
)
private
Listen continuously on source until a wake word is spoken

Args:
    source (AudioSource):  Source producing the audio chunks
    sec_per_buffer (float):  Fractional number of seconds in each chunk

Definition at line 391 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer.calc_energy (   sound_chunk,
  sample_width 
)
static

Definition at line 234 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer.listen (   self,
  source,
  emitter,
  stream = None 
)
Listens for chunks of audio that Mycroft should perform STT on.

This will listen continuously for a wake-up-word, then return the
audio chunk containing the spoken phrase that comes immediately
afterwards.

Args:
    source (AudioSource):  Source producing the audio chunks
    emitter (EventEmitter): Emitter for notifications of when recording
                    begins and ends.
    stream (AudioStreamHandler): Stream target that will receive chunks
                         of the utterance audio while it is
                         being recorded

Returns:
    AudioData: audio with the user's utterance, minus the wake-up-word

Definition at line 512 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer.record_sound_chunk (   self,
  source 
)

Definition at line 230 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer.sec_to_bytes (   sec,
  source 
)
static

Definition at line 336 of file mic.py.

def mycroft.client.speech.mic.ResponsiveRecognizer.stop (   self)
    Signal stop and exit waiting state.

Definition at line 359 of file mic.py.

Member Data Documentation

mycroft.client.speech.mic.ResponsiveRecognizer._stop_signaled
private

Definition at line 216 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.account_id

Definition at line 226 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.audio

Definition at line 198 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.config

Definition at line 188 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.energy_ratio

Definition at line 200 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.energy_threshold

Definition at line 448 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.filenames_to_upload

Definition at line 214 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.mic_level_file

Definition at line 215 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.MIN_LOUD_SEC_PER_PHRASE = 0.5
static

Definition at line 169 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.MIN_SILENCE_AT_END = 0.25
static

Definition at line 173 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.multiplier

Definition at line 199 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.overflow_exc

Definition at line 194 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.RECORDING_TIMEOUT = 10.0
static

Definition at line 177 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.RECORDING_TIMEOUT_WITH_SILENCE = 3.0
static

Definition at line 181 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.save_utterances

Definition at line 205 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.save_wake_words

Definition at line 210 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.saved_wake_words_dir

Definition at line 211 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.SAVED_WW_SEC

Definition at line 223 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.SEC_BETWEEN_WW_CHECKS = 0.2
static

Definition at line 184 of file mic.py.

float mycroft.client.speech.mic.ResponsiveRecognizer.SILENCE_SEC = 0.01
static

Definition at line 165 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.TEST_WW_SEC

Definition at line 222 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.upload_disabled

Definition at line 191 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.upload_lock

Definition at line 213 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.upload_url

Definition at line 190 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.wake_word_name

Definition at line 192 of file mic.py.

mycroft.client.speech.mic.ResponsiveRecognizer.wake_word_recognizer

Definition at line 197 of file mic.py.


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


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40