feat: add --listen-during-wake-sound argument (#273)

* feat: add --listen-during-wake-sound argument

---------

Co-authored-by: Florian Asche <github@florian-asche.de>
This commit is contained in:
Willian WangandFlorian Asche authored and GitHub committed 2026-07-18 19:16:11 +02:00
1 parent 9b2a8b4b30
commit a66c0e4f28
7 files changed
+48 -5

No files matched your search

+6
View File
@@ -224,6 +224,11 @@ async def main() -> None:
default=900.0, # 15 minutes
help="Seconds before a ringing timer auto-stops (default: 900)",
)
parser.add_argument(
"--listen-during-wake-sound",
action="store_true",
help="Start listening immediately after wake word detection, without waiting for the wake sound to finish",
)
parser.add_argument(
"--debug",
action="store_true",
@@ -426,6 +431,7 @@ async def main() -> None:
mic_noise_suppression=preferences.mic_noise_suppression,
audio_input_channels=args.audio_input_channels,
timer_max_ring_seconds=args.timer_max_ring_seconds,
listen_during_wake_sound=args.listen_during_wake_sound,
)
if fallback_used:
+1
View File
@@ -174,6 +174,7 @@ class ServerState:
mic_volume: int = 100 # 1–100, default maximum
audio_input_channels: int = 2 # number of mic channels to stream
timer_max_ring_seconds: float = 900.0
listen_during_wake_sound: bool = False
def broadcast(self, msgs: "Iterable[message.Message]") -> None:
"""Send messages to every connected API client.
+18 -3
View File
@@ -834,10 +834,25 @@ class VoiceSatelliteProtocol(APIServer):
self._pipeline_active = True
self._emit(LVAEvent.WAKE_WORD_DETECTED)
self.duck()
self.state.tts_player.play(
self.state.wakeup_sound,
done_callback=lambda: self._on_wakeup_sound_finished(wake_word_phrase),
if self.state.listen_during_wake_sound:
_LOGGER.debug("Starting audio streaming immediately (listen_during_wake_sound enabled)")
self.state.tts_player.play(self.state.wakeup_sound)
self._start_audio_streaming(wake_word_phrase)
else:
self.state.tts_player.play(
self.state.wakeup_sound,
done_callback=lambda: self._on_wakeup_sound_finished(wake_word_phrase),
)
def _start_audio_streaming(self, wake_word_phrase: str) -> None:
"""Start streaming audio during wake sound detection."""
_LOGGER.debug(
"Starting audio streaming for: %s",
wake_word_phrase,
)
self.send_messages([VoiceAssistantRequest(start=True, wake_word_phrase=wake_word_phrase)])
self._is_streaming_audio = True
self._emit(LVAEvent.LISTENING)
def _on_wakeup_sound_finished(self, wake_word_phrase: str) -> None:
"""Callback invoked when the wakeup chime finishes; begin STT streaming."""