Acknowledgements & Sound
The IAiConversationService provides four acknowledgement modes that control how the AI delivers responses — from silent text-only to full text-to-speech.
Acknowledgement Modes
Section titled “Acknowledgement Modes”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. |
Full | Text-to-speech reads the full, unmodified response aloud. |
Sound Effects
Section titled “Sound Effects”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 streamsaiService.SoundResolver = name => FileSystem.OpenAppPackageFileAsync(name);
// Assign sound file namesaiService.OkSound = "ok.mp3";aiService.ThinkSound = "think.mp3";aiService.RespondingSound = "responding.mp3";aiService.CancelSound = "cancel.mp3";aiService.ErrorSound = "error.mp3";Sound Trigger Points
Section titled “Sound Trigger Points”| 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 |
SoundResolver
Section titled “SoundResolver”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)));State Tracking
Section titled “State Tracking”The service exposes its current state and fires events you can observe:
// Current statevar state = aiService.Status; // Idle, Listening, Thinking, Responding
// State change eventaiService.StateChanged += () =>{ Console.WriteLine($"State: {aiService.Status}");};
// AI response eventaiService.AiResponded += response =>{ Console.WriteLine($"AI said: {response.Message}"); Console.WriteLine($"At: {response.Timestamp}"); Console.WriteLine($"Was read aloud: {response.WasReadAloud}");};The AiResponse record includes WasReadAloud so your UI can decide whether to display a visual notification for responses that were already spoken.