Skip to main content
net8.0net10.0

Core abstractions for real-time audio conversation in .NET. Provides ITextToSpeechClient, IVoiceActivityDetector, and IRealtimeConversationClient interfaces following Microsoft.Extensions.AI patterns. Pluggable providers for STT, TTS, VAD, and LLM.

Published
May 5, 2026
5mo ago
Total Downloads
1.6K
1,568

Install

dotnet add package ElBruno.Realtime --version 0.1.1-preview
ProductVersions
.NET
net10.0net8.0

README

ElBruno.Realtime

NuGet NuGet Downloads Build Status License: MIT GitHub stars Twitter Follow

A pluggable real-time audio conversation framework for .NET, following Microsoft.Extensions.AI patterns. Build voice-powered apps with local STT, TTS, VAD, and any LLM β€” all running on your machine, no cloud required.

Powered By

This project is built on two core Microsoft frameworks for AI and conversation management:

  • Microsoft.Extensions.AI (MEAI) β€” Provides unified abstractions for chat clients (IChatClient) and speech-to-text (ISpeechToTextClient), enabling pluggable LLM and STT providers throughout the pipeline.
  • Microsoft Agent Framework β€” Manages conversation sessions, per-user state, and dialogue continuity, ensuring each user gets a consistent, stateful conversation experience.

Together with industry-standard models (Whisper STT, Silero VAD, ONNX Runtime), these frameworks provide a production-ready foundation for real-time voice applications.

Architecture

    Microphone (Audio Input)
        β”‚ raw PCM audio
        β–Ό
    πŸ”‡ Silero VAD ─── Voice Activity Detection (~2 MB ONNX)
        β”‚ speech segments
        β–Ό
    πŸŽ™οΈ Whisper STT ─── Speech-to-Text (~75 MB GGML)
        β”‚ transcribed text
        β–Ό
    πŸ€– Any IChatClient ─── LLM Chat (Ollama / OpenAI / Azure)
        β”‚ response text
        β–Ό
    πŸ—£οΈ Any TTS ─── Text-to-Speech (pluggable)
        β”‚ WAV audio
        β–Ό
    Speaker (Audio Output)

All models download automatically on first use. The LLM is pluggable via IChatClient β€” use Ollama, OpenAI, Azure, or any provider.

Features

  • Local-First β€” All audio processing runs locally. No data leaves your machine.
  • Microsoft.Extensions.AI β€” Implements ISpeechToTextClient and follows M.E.AI patterns throughout
  • Pluggable Providers β€” Swap STT, TTS, VAD, or LLM independently
  • Auto Model Download β€” Models download from HuggingFace/Whisper.net on first use
  • DI-Ready β€” One-line setup with AddPersonaPlexRealtime() + fluent builder
  • Streaming β€” Full async streaming via IAsyncEnumerable for real-time processing
  • Multi-Target β€” Supports .NET 8.0 and .NET 10.0

Quick Start

Install

dotnet add package ElBruno.Realtime          # Core abstractions + pipeline
dotnet add package ElBruno.Realtime.Whisper   # Local STT (Whisper.net)
dotnet add package ElBruno.Realtime.SileroVad # Local VAD (Silero)

Basic Usage

using ElBruno.Realtime;
using ElBruno.Realtime.Whisper;
using ElBruno.Realtime.SileroVad;
using Microsoft.Extensions.AI;

// 1. Configure the pipeline (models auto-download on first use)
builder.Services.AddPersonaPlexRealtime(opts =>
{
    opts.DefaultSystemPrompt = "You are a helpful voice assistant.";
})
.UseWhisperStt("whisper-tiny.en")   // 75MB, or "whisper-base.en" for accuracy
.UseSileroVad();                    // Voice activity detection
// .UseYourTts()  β€” plug in any ITextToSpeechClient

// 2. Register your LLM (any IChatClient provider)
builder.Services.AddChatClient(new OllamaChatClient(
    new Uri("http://localhost:11434"), "phi4-mini"));

// 3. Use the pipeline
var conversation = app.Services.GetRequiredService<IRealtimeConversationClient>();

// One-shot turn
using var audio = File.OpenRead("question.wav");
var turn = await conversation.ProcessTurnAsync(audio);
Console.WriteLine($"User: {turn.UserText}");
Console.WriteLine($"AI: {turn.ResponseText}");

// Streaming full-duplex
await foreach (var evt in conversation.ConverseAsync(microphoneStream))
{
    if (evt.Kind == ConversationEventKind.ResponseTextChunk)
        Console.Write(evt.ResponseText);
}

Packages

Package Description
ElBruno.Realtime Core: ITextToSpeechClient, IVoiceActivityDetector, IRealtimeConversationClient, pipeline orchestration, DI
ElBruno.Realtime.Whisper ISpeechToTextClient (M.E.AI) via Whisper.net β€” auto-downloads GGML models
ElBruno.Realtime.SileroVad IVoiceActivityDetector via Silero VAD v5 ONNX β€” configurable thresholds

Samples

Sample Description
scenario-01-console Realtime console app
scenario-02-api ASP.NET Core API with SignalR
scenario-03-blazor-aspire Blazor + .NET Aspire with voice chat + voice-controlled side-scroller game
scenario-04-realtime-console Real-time microphone conversation with Whisper STT + Ollama LLM

Run a Sample

# Prerequisites: Ollama running with phi4-mini
ollama pull phi4-mini
ollama serve

# Run the console sample
cd src/samples/scenario-01-console
dotnet run

Auto-Downloaded Models

All models are cached in %LOCALAPPDATA%/ElBruno/Realtime/ and shared across apps:

Model Size Purpose Auto-Download
Silero VAD v5 ~2 MB Voice activity detection βœ… Yes
Whisper tiny.en ~75 MB Speech-to-text (fast) βœ… Yes
Whisper base.en ~142 MB Speech-to-text (accurate) βœ… Yes
Phi4-Mini (Ollama) ~2.7 GB LLM chat ❌ Manual: ollama pull phi4-mini

Documentation

Document Description
Models Overview How each model is used in the pipeline
Architecture Three-layer architecture, data flow, M.E.AI integration
Publishing NuGet publishing guide

Building from Source

git clone https://github.com/elbruno/ElBruno.Realtime.git
cd ElBruno.Realtime
dotnet build
dotnet test

Requirements

  • .NET 8.0 or .NET 10.0 SDK
  • ONNX Runtime compatible platform (Windows, Linux, macOS)
  • Ollama (or any IChatClient provider) for the LLM
  • Sufficient disk space for model files

Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a branch for your feature or fix: git checkout -b feature/my-feature
  3. Make your changes and ensure the solution builds: dotnet build
  4. Run tests: dotnet test
  5. Submit a pull request with a clear description of the changes

Please open an issue first for major changes or new features to discuss the approach.


πŸ‘‹ About the Author

Hi! I'm ElBruno 🧑, a passionate developer and content creator exploring AI, .NET, and modern development practices.

Made with ❀️ by ElBruno

If you like this project, consider following my work across platforms:

  • πŸ“» Podcast: No Tienen Nombre β€” Spanish-language episodes on AI, development, and tech culture
  • πŸ’» Blog: ElBruno.com β€” Deep dives on embeddings, RAG, .NET, and local AI
  • πŸ“Ί YouTube: youtube.com/elbruno β€” Demos, tutorials, and live coding
  • πŸ”— LinkedIn: @elbruno β€” Professional updates and insights
  • 𝕏 Twitter: @elbruno β€” Quick tips, releases, and tech news

License

This project is licensed under the MIT License β€” see the LICENSE file for details.

Related Projects

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.