Verbara.Sdk.VoiceAi 2.2.1

dotnet add package Verbara.Sdk.VoiceAi --version 2.2.1
                    
NuGet\Install-Package Verbara.Sdk.VoiceAi -Version 2.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Verbara.Sdk.VoiceAi" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verbara.Sdk.VoiceAi" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Verbara.Sdk.VoiceAi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Verbara.Sdk.VoiceAi --version 2.2.1
                    
#r "nuget: Verbara.Sdk.VoiceAi, 2.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Verbara.Sdk.VoiceAi@2.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Verbara.Sdk.VoiceAi&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Verbara.Sdk.VoiceAi&version=2.2.1
                    
Install as a Cake Tool

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 logic
  • ISessionHandler — low-level interface; implement for fully custom session handling
  • VoiceAiSessionBroker — hosted service that routes AudioSocketSession instances to the active handler
  • Observable Events stream (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, TtsHealthCheck auto-registered by AddVoiceAiPipeline<THandler>().
  • Discover names via AsteriskTelemetry.ActivitySourceNames / MeterNames from Verbara.Sdk.Hosting.

Documentation

See the main README for full documentation.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
2.2.1 211 5/23/2026
2.2.0 160 5/20/2026
2.1.2 165 5/8/2026
2.1.1 146 5/7/2026
2.1.0 689 5/7/2026
2.0.0 149 5/6/2026