Wake Word
Wake word detection enables a hands-free “Hey Siri” style experience. The service listens continuously for a keyword phrase, captures the user’s utterance that follows, and sends it to the AI automatically.
Starting Wake Word
Section titled “Starting Wake Word”await aiService.StartWakeWord("Hey Copilot");Once started, the service:
- Continuously listens for the wake word phrase
- When detected, captures the user’s utterance via speech-to-text
- Sends the utterance to the AI via
TalkTo() - If the AI response ends with a question, skips wake word detection and listens directly for the user’s reply (conversation continuation)
- Otherwise, loops back to listening for the wake word
Stopping Wake Word
Section titled “Stopping Wake Word”aiService.StopWakeWord();This cancels the background listening loop and returns the service to an idle state. The WakeWord property is cleared and IsWakeWordEnabled returns to false.
Checking State
Section titled “Checking State”if (aiService.IsWakeWordEnabled){ Console.WriteLine($"Listening for: {aiService.WakeWord}");}Conversation Continuation
Section titled “Conversation Continuation”When the AI asks a question (its response ends with ?), the wake word loop skips keyword detection and immediately listens for the user’s reply. This creates a natural back-and-forth conversation without requiring the user to say the wake word again after every AI response.
The conversation continues as long as the AI keeps asking questions. Once the AI gives a statement that doesn’t end with a question, the loop returns to wake word detection.
If voice interruption is enabled and the user says a quiet word during TTS playback, the conversation breaks immediately and returns to wake word detection. See Voice Interruption below.
Voice Interruption
Section titled “Voice Interruption”During text-to-speech playback, the service can listen for voice interruptions. This is controlled by the QuietWords property:
// Default quiet words: cancel, quiet, shut up, stop, nevermind, never mind, hush// Customize:aiService.QuietWords = ["stop", "cancel", "quiet"];
// Disable voice interruption entirely:aiService.QuietWords = null;Two interruption behaviors:
- Quiet words — If the user says only a quiet word (e.g., “stop”), TTS is silenced and the conversation loop breaks, returning to wake word detection
- Other speech — If the user says anything else during TTS (e.g., “actually, tell me about…”), TTS is silenced and the new utterance is sent to the AI as the next message, continuing the conversation
Constraints
Section titled “Constraints”- Only one wake word at a time — calling
StartWakeWord()while already active throwsInvalidOperationException - Exclusive with ListenAndTalk —
ListenAndTalk()throwsInvalidOperationExceptionif wake word is active (they both use the microphone) - Waits for in-progress work —
StartWakeWord()waits for any activeTalkTo()call to complete before starting the listener
Example: Settings Toggle
Section titled “Example: Settings Toggle”async Task ToggleWakeWord(){ if (aiService.IsWakeWordEnabled) { aiService.StopWakeWord(); } else { await aiService.StartWakeWord("Hey Copilot"); }}How It Works
Section titled “How It Works”Wake word detection is powered by Shiny.Speech’s ISpeechToTextService. The service calls ListenForKeyword() to detect the wake phrase, then ListenUntilSilence() to capture the user’s command. Both are platform-native implementations — no cloud API is needed for the wake word detection itself.