OpenVoiceOS / ovos-dinkum-listener

ovos-listener based on the voice loop from mycroft-dinkum
Apache License 2.0
3 stars 3 forks source link

Write wakewords and utterances in the dedicated thread #104

Open goldyfruit opened 3 months ago

goldyfruit commented 3 months ago

Make sure the audio files are written in a dedicated thread to avoid potential delays caused by poor storage.

Matrix dicsussion: https://matrix.to/#/!EOygeDJPfJQOfNacqH:matrix.org/$rPLrUZV32aoIcaDKb42-ycc8FvhAp-np8U8Id5UIgD8?via=matrix.org&via=mozilla.org&via=tchncs.de

goldyfruit commented 3 months ago
Wakeword without NFS storage recording: 0.013s
Wakeword with NFS storage recording:    0.925s

No recording

Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.085 - voice - ovos_dinkum_listener.voice_loop.hotwords:found:259 - DEBUG - Detected wake_word: hey_mycroft
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.087 - voice - ovos_dinkum_listener.voice_loop.voice_loop:_detect_ww:460 - DEBUG - Wake word detected=hey_mycroft
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.091 - voice - ovos_dinkum_listener.service:_hotword_audio:569 - DEBUG - Handling listen sound: snd/start_listening.wav
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.093 - voice - ovos_dinkum_listener.service:_hotword_audio:593 - DEBUG - Emitting hotword event: recognizer_loop:wakeword
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.094 - voice - ovos_dinkum_listener.service:_record_begin:460 - DEBUG - Record begin
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.096 - voice - ovos_dinkum_listener.voice_loop.voice_loop:_detect_ww:484 - DEBUG - STATE: ListeningState.BEFORE_COMMAND
Apr 09 11:30:15 neon ovos-dinkum-listener[1582]: 2024-04-09 11:30:15.098 - voice - ovos_dinkum_listener.voice_loop.voice_loop:run:224 - INFO - Wakeword detected

With recording

Apr 09 11:31:23 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:23.288 - voice - ovos_dinkum_listener.voice_loop.hotwords:found:259 - DEBUG - Detected wake_word: hey_mycroft
Apr 09 11:31:23 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:23.292 - voice - ovos_dinkum_listener.voice_loop.voice_loop:_detect_ww:460 - DEBUG - Wake word detected=hey_mycroft
Apr 09 11:31:23 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:23.315 - voice - ovos_bus_client.session:get:585 - DEBUG - No message, use default session
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.199 - voice - ovos_dinkum_listener.service:_save_ww:487 - DEBUG - Wrote /home/goldyfruit/.local/share/mycroft/listener/wake_words/Anon_2c9f1b86ec79857733c579fcf42795b8_0_hey_mycroft_default_1712676683304.wav
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.201 - voice - ovos_dinkum_listener.service:_hotword_audio:569 - DEBUG - Handling listen sound: snd/start_listening.wav
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.203 - voice - ovos_dinkum_listener.service:_hotword_audio:593 - DEBUG - Emitting hotword event: recognizer_loop:wakeword
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.206 - voice - ovos_dinkum_listener.service:_record_begin:460 - DEBUG - Record begin
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.211 - voice - ovos_dinkum_listener.voice_loop.voice_loop:_detect_ww:484 - DEBUG - STATE: ListeningState.BEFORE_COMMAND
Apr 09 11:31:24 neon ovos-dinkum-listener[1678]: 2024-04-09 11:31:24.213 - voice - ovos_dinkum_listener.voice_loop.voice_loop:run:224 - INFO - Wakeword detected
JarbasAl commented 2 months ago

consideration, the save file path is included in the message.context, putting this in a thread will remove that info from downstream clients. eg, something could be parsing the audio for speaker recognition or something

so using a thread should probably be a flag with this documented, it shouldnt be an issue most of time and can even default to using a thread. in hivemind context this info is useless too as the file path doesnt exist in both sides of hivemind connection