Skip to content
Introducing AI Conversations: Natural Language Interaction for Your Apps! Learn More

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.

await aiService.StartWakeWord("Hey Copilot");

Once started, the service:

  1. Continuously listens for the wake word phrase
  2. When detected, captures the user’s utterance via speech-to-text
  3. Sends the utterance to the AI via TalkTo()
  4. If the AI response ends with a question, skips wake word detection and listens directly for the user’s reply (conversation continuation)
  5. Otherwise, loops back to listening for the 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.

if (aiService.IsWakeWordEnabled)
{
Console.WriteLine($"Listening for: {aiService.WakeWord}");
}

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.

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
  • Only one wake word at a time — calling StartWakeWord() while already active throws InvalidOperationException
  • Exclusive with ListenAndTalkListenAndTalk() throws InvalidOperationException if wake word is active (they both use the microphone)
  • Waits for in-progress workStartWakeWord() waits for any active TalkTo() call to complete before starting the listener
async Task ToggleWakeWord()
{
if (aiService.IsWakeWordEnabled)
{
aiService.StopWakeWord();
}
else
{
await aiService.StartWakeWord("Hey Copilot");
}
}

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.