Skip to content
Shiny.NET

Acknowledgements & Sound

The IAiConversationService provides four acknowledgement modes that control how the AI delivers responses — from silent text-only to full text-to-speech.

aiService.Acknowledgement = AiAcknowledgement.Full;
Mode Behavior
None No audio feedback. Responses are text-only via the AiResponded event.
AudioBlip Short sound effects play at state transitions (thinking, responding, ok, cancel, error). No text-to-speech.
LessWordy Text-to-speech reads the response aloud. A system prompt is added requesting concise responses. A voice-chat system prompt is also injected so the AI knows it’s in a real-time voice conversation and will ask follow-up questions naturally.
Full Text-to-speech reads the full, unmodified response aloud. A voice-chat system prompt is also injected so the AI knows it’s in a real-time voice conversation and will ask follow-up questions naturally.

When Acknowledgement is set to AudioBlip, the service plays sounds at each state transition. Configure sounds with string file names and a resolver callback:

// Set the resolver that converts file names to streams
aiService.SoundResolver = name => FileSystem.OpenAppPackageFileAsync(name);
// Assign sound file names
aiService.OkSound = "ok.mp3";
aiService.ThinkSound = "think.mp3";
aiService.RespondingSound = "responding.mp3";
aiService.CancelSound = "cancel.mp3";
aiService.ErrorSound = "error.mp3";
Sound When it plays
ThinkSound AI begins processing (state → Thinking)
RespondingSound AI starts streaming response (state → Responding)
OkSound Request completes successfully
CancelSound Operation is cancelled
ErrorSound An error occurs during processing

The SoundResolver property is a Func<string, Task<Stream>>? that the service calls with the sound file name to get a playable audio stream. This keeps the library platform-agnostic — you provide the resolver appropriate for your platform:

MAUI:

aiService.SoundResolver = name => FileSystem.OpenAppPackageFileAsync(name);

Blazor / ASP.NET:

var env = app.Services.GetRequiredService<IWebHostEnvironment>();
aiService.SoundResolver = name =>
Task.FromResult<Stream>(File.OpenRead(Path.Combine(env.WebRootPath, "sounds", name)));

The service exposes its current state and fires events you can observe:

// Current state
var state = aiService.Status; // Idle, Listening, Thinking, Responding
// State change event (receives the new AiState)
aiService.StatusChanged += state =>
{
Console.WriteLine($"State: {state}");
};
// AI response event (fired when the AI completes its response)
aiService.AiResponded += response =>
{
if (response.Response.Text is { } text)
Console.WriteLine($"AI: {text}");
Console.WriteLine($"Was read aloud: {response.WasReadAloud}");
};

The AiResponse record is fired once when the AI completes its response:

  • Response — the complete ChatResponse including text, tool calls, and usage details
  • WasReadAloud — whether TTS was used, so your UI can decide whether to show a visual notification
  • ExpectsResponse — true when the AI’s response ends with a question, indicating the service will automatically keep listening for a reply (conversation continuation)

Configure speech-to-text and text-to-speech options on the service:

// Speech-to-text options (culture, silence timeout, prefer on-device)
aiService.SpeechToTextOptions = new SpeechRecognitionOptions
{
Culture = "en-US",
SilenceTimeoutMs = 2000
};
// Text-to-speech options (culture, voice, speech rate, pitch, volume)
aiService.TextToSpeechOptions = new Shiny.Speech.TextToSpeechOptions
{
SpeechRate = 1.2f
};

During TTS playback, the service can listen for voice interruptions using the QuietWords property:

// Default: cancel, quiet, shut up, stop, nevermind, never mind, hush
aiService.QuietWords = ["stop", "cancel", "quiet"];
// Disable entirely:
aiService.QuietWords = null;
Speech Behavior
Quiet words saying only a quiet word (e.g., “stop”) silences TTS and breaks the conversation loop
Other speech saying anything else during TTS silences it and sends the new utterance to the AI as the next message

See Wake Word — Voice Interruption for more details.