-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Restored ability to store wakewords locally #2141
Conversation
The code that handles the local save of wake words configuration - "record_wake_words" - was removed some time ago. This restores that capability. == TESTING == Add the mycroft.conf { "record_wake_words": true } Then restart Mycroft. It should begin saving .wav files under the /tmp/mycroft_wake_words directory.
Add documentation for 'record_wake_words' and improve the doc for 'save_utterances'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from that this seems to be doing what it should.
@@ -356,14 +362,16 @@ def _upload_wake_word(self, audio): | |||
else: | |||
model_hash = '0' | |||
|
|||
metadata = { | |||
return { | |||
'name': self.wake_word_name.replace(' ', '-'), | |||
'engine': md5(ww_module.encode('utf-8')).hexdigest(), | |||
'time': str(int(1000 * get_time())), | |||
'sessionId': SessionManager.get().session_id, | |||
'accountId': self.account_id, | |||
'model': str(model_hash) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you want a simple list here. This currently results in the literal filename name.engine.time.sessionId.accountId.model.wav
(join of a dict seem to be joining the keys).
Alternatively you could use the .values()
but I'm not sure if that will always preserve the order so maybe make it an ordered dict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works better if I hit "Save" in my editor...
I'd already changed that to use values(). I don't honestly care that much about order when reviewing a local copy, so I don't think it matters much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally care (otherwise I wouldn't have mentioned it). It's good style to guarantee consistency and if anyone makes a script for doing any type of analysis on the recorded wakewords or something it'd be good if it can easily parse out the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
The wakeword file was built from a dict with no guaranteed consistency. Now it sorts the dictionary when building the, filename, and used underscore separators resulting in a filename like: <accountId>_<engine>_<model>_<name>_<sessionId>_<time>.wav
The grumpy swede is pleased with the consistency. Merging |
"Bork a bork a bork bork a...." |
The code that handles the local save of wake words configuration -
"record_wake_words" - was removed some time ago. This restores that
capability.
How to test
Add the mycroft.conf
Then restart Mycroft. It should begin saving .wav files under the
/tmp/mycroft_wake_words directory.