Add delay to continue conversation before listening (#342)
Add a configurable amount of delay (defaulting to 0.5s) after the TTS playback is finished to avoid the mic to capture the end of response during start/continue conversation. Fixes #313
This commit is contained in:
1 parent
eb29a00386
commit
1d84fa0898
5 files changed
+32
-3
No files matched your search
@@ -714,11 +714,25 @@ class VoiceSatelliteProtocol(APIServer):
|
||||
self.send_messages([VoiceAssistantAnnounceFinished()])
|
||||
|
||||
if self._continue_conversation:
|
||||
self.send_messages([VoiceAssistantRequest(start=True)])
|
||||
self._is_streaming_audio = True
|
||||
self._continue_conversation = False
|
||||
# Keep pipeline active during the settle delay so the mic stays closed
|
||||
# and does not capture the tail end of the TTS audio from the speaker.
|
||||
self._pipeline_active = True
|
||||
_LOGGER.debug("Continuing conversation")
|
||||
_LOGGER.debug("Continuing conversation after %.2fs settle delay", self.state.continue_conversation_delay)
|
||||
|
||||
def _start_continued_conversation() -> None:
|
||||
if self.state.muted:
|
||||
_LOGGER.debug("Skipping continued conversation: muted")
|
||||
self._pipeline_active = False
|
||||
self.unduck()
|
||||
return
|
||||
self.send_messages([VoiceAssistantRequest(start=True)])
|
||||
self._is_streaming_audio = True
|
||||
_LOGGER.debug("Continued conversation started")
|
||||
|
||||
threading.Timer(self.state.continue_conversation_delay, _start_continued_conversation).start()
|
||||
else:
|
||||
self._continue_conversation = False
|
||||
self.unduck()
|
||||
|
||||
_LOGGER.debug("TTS response finished")
|
||||
|
||||
Reference in new issue
Block a user