Verbara.Sdk.VoiceAi
2.2.0
See the version list below for details.
dotnet add package Verbara.Sdk.VoiceAi --version 2.2.0
NuGet\Install-Package Verbara.Sdk.VoiceAi -Version 2.2.0
<PackageReference Include="Verbara.Sdk.VoiceAi" Version="2.2.0" />
<PackageVersion Include="Verbara.Sdk.VoiceAi" Version="2.2.0" />
<PackageReference Include="Verbara.Sdk.VoiceAi" />
paket add Verbara.Sdk.VoiceAi --version 2.2.0
#r "nuget: Verbara.Sdk.VoiceAi, 2.2.0"
#:package Verbara.Sdk.VoiceAi@2.2.0
#addin nuget:?package=Verbara.Sdk.VoiceAi&version=2.2.0
#tool nuget:?package=Verbara.Sdk.VoiceAi&version=2.2.0
Verbara.Sdk.VoiceAi
Voice AI pipeline for Verbara.Sdk — orchestration layer for STT, TTS, and conversation with turn-taking and barge-in detection.
Installation
dotnet add package Verbara.Sdk.VoiceAi
Quick Start
// Implement your conversation handler (called once per user utterance)
public class MyHandler : IConversationHandler
{
public ValueTask<string> HandleAsync(
string transcript, ConversationContext context, CancellationToken ct)
{
return ValueTask.FromResult($"You said: {transcript}");
}
}
// Register in DI
services.AddAudioSocketServer(opts => opts.Port = 9092);
services.AddVoiceAiPipeline<MyHandler>(opts =>
{
opts.InputFormat = AudioFormat.Slin16Mono8kHz;
opts.OutputFormat = AudioFormat.Slin16Mono8kHz;
opts.EndOfUtteranceSilence = TimeSpan.FromMilliseconds(600);
});
// Subscribe to pipeline events
var pipeline = app.Services.GetRequiredService<VoiceAiPipeline>();
pipeline.Events.Subscribe(evt => Console.WriteLine(evt));
Features
VoiceAiPipeline— full VAD → STT →IConversationHandler→ TTS loop per AudioSocket session- Barge-in detection: cancels TTS playback when the caller speaks
IConversationHandler— scoped per session; implement to plug in any LLM or business logicISessionHandler— low-level interface; implement for fully custom session handlingVoiceAiSessionBroker— hosted service that routesAudioSocketSessioninstances to the active handler- Observable
Eventsstream (SpeechStartedEvent,TranscriptReceivedEvent,BargInDetectedEvent, etc.) - Native AOT compatible
Custom STT / TTS Providers
When writing your own SpeechRecognizer or SpeechSynthesizer subclass, override ProviderName with a stable literal to avoid the per-utterance GetType().Name allocation on the pipeline hot path (used as a tag on STT/TTS activities):
public sealed class MyCustomRecognizer : SpeechRecognizer
{
public override string ProviderName => "MyCustom";
public override IAsyncEnumerable<SpeechRecognitionResult> StreamAsync(
IAsyncEnumerable<ReadOnlyMemory<byte>> audioFrames,
AudioFormat format,
CancellationToken ct = default)
{
// ...
}
}
If you don't override ProviderName the default falls back to GetType().Name — functional, but incurs one reflection call per utterance.
Observability
- Metrics:
VoiceAiMetrics(sessions started/completed/failed, session duration),SpeechRecognitionMetrics(transcriptions started/completed/failed, latency),SpeechSynthesisMetrics(syntheses started/completed/failed, latency, characters). - Tracing:
VoiceAiActivitySource— session / recognition / synthesis spans. - Health:
VoiceAiHealthCheck,SttHealthCheck,TtsHealthCheckauto-registered byAddVoiceAiPipeline<THandler>(). - Discover names via
AsteriskTelemetry.ActivitySourceNames/MeterNamesfromVerbara.Sdk.Hosting.
Documentation
See the main README for full documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
- System.Reactive (>= 6.1.0)
- Verbara.Sdk.Audio (>= 2.2.0)
- Verbara.Sdk.VoiceAi.AudioSocket (>= 2.2.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Verbara.Sdk.VoiceAi:
| Package | Downloads |
|---|---|
|
Verbara.Sdk.VoiceAi.Stt
STT providers for Verbara.Sdk.VoiceAi — Deepgram, Cartesia, AssemblyAI (WebSocket streaming), OpenAI Whisper, Azure Whisper, Google Speech (REST batch). Zero third-party dependencies. |
|
|
Verbara.Sdk.VoiceAi.Tts
TTS providers for Verbara.Sdk.VoiceAi — ElevenLabs (WebSocket streaming) and Azure TTS (REST). Zero third-party dependencies. |
|
|
Verbara.Sdk.VoiceAi.Testing
Test fakes for Verbara.Sdk.VoiceAi -- FakeSpeechRecognizer, FakeSpeechSynthesizer, FakeConversationHandler for testing Voice AI apps without API keys. |
|
|
Verbara.Sdk.VoiceAi.OpenAiRealtime
OpenAI Realtime API bridge for Verbara.Sdk.VoiceAi — connects Asterisk AudioSocket directly to GPT-4o in real time, with function calling and observability. Zero third-party dependencies. |
|
|
Verbara.Sdk.VoiceAi.TurnDetection
ML-based turn detection for Verbara.Sdk VoiceAi pipeline using Pipecat smart-turn-v3 ONNX model. |
GitHub repositories
This package is not used by any popular GitHub repositories.