Skip to content
Permalink
Browse files
feat/instant_listen
experimental config option to not require the pause between "hey mycroft" and actually issuing an order
  • Loading branch information
JarbasAl committed Oct 7, 2021
1 parent 1cbdb6e commit 8629da4777767f30a0410ddcb55eebd6c22366ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
@@ -331,6 +331,7 @@ def __init__(self, wake_word_recognizer, watchdog=None):
self._watchdog = watchdog or (lambda: None) # Default to dummy func
self.config = Configuration.get()
listener_config = self.config.get('listener')
self.instant_listen = listener_config.get("instant_listen", False)
self.upload_url = listener_config['wake_word_upload']['url']
self.upload_disabled = listener_config['wake_word_upload']['disable']
self.wake_word_name = wake_word_recognizer.key_phrase
@@ -672,9 +673,14 @@ def mute_and_confirm_listening(self, source):
audio_file = resolve_resource_file(
self.config.get('sounds').get('start_listening'))
if audio_file:
source.mute()
play_wav(audio_file).wait()
source.unmute()
if self.instant_listen:
# keep recording while playing sound
# assume STT can handle it
play_wav(audio_file)
else:
source.mute()
play_wav(audio_file).wait()
source.unmute()
return True
else:
return False
@@ -727,9 +733,10 @@ def listen(self, source, emitter, stream=None):
# indicate recording has begun.
if self.config.get('confirm_listening'):
if self.mute_and_confirm_listening(source):
# Clear frames from wakeword detctions since they're
# Clear frames from wakeword detections since they're
# irrelevant after mute - play wav - unmute sequence
ww_frames = None
if not self.instant_listen:
ww_frames = None

# Notify system of recording start
emitter.emit("recognizer_loop:record_begin")
@@ -226,7 +226,12 @@

// Settings used by microphone to set recording timeout
"recording_timeout": 10.0,
"recording_timeout_with_silence": 3.0
"recording_timeout_with_silence": 3.0,

// instant listen is an experimental setting, it removes the need for
// the pause between "hey mycroft" and starting to speak the utterance,
//however it might slightly downgrade STT accuracy depending on engine used
"instant_listen": false
},

// Settings used for any precise wake words

0 comments on commit 8629da4

Please sign in to comment.