DotNetTtsWrapper 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetTtsWrapper --version 1.1.2
                    
NuGet\Install-Package DotNetTtsWrapper -Version 1.1.2
                    
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="DotNetTtsWrapper" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetTtsWrapper" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="DotNetTtsWrapper" />
                    
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 DotNetTtsWrapper --version 1.1.2
                    
#r "nuget: DotNetTtsWrapper, 1.1.2"
                    
#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 DotNetTtsWrapper@1.1.2
                    
#: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=DotNetTtsWrapper&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=DotNetTtsWrapper&version=1.1.2
                    
Install as a Cake Tool

DotNet TTS Wrapper

A .NET NuGet package that provides a unified API for working with multiple cloud-based and local Text-to-Speech (TTS) services. Ported from js-tts-wrapper.

Repository: https://github.com/AACTools/dotnet-tts-wrapper

Supported Engines

Engine Word Events Streaming Notes
SAPI ⚠️ Estimated ❌ No Windows only, built-in system voices
Azure ✅ Real ✅ Yes Azure Speech SDK (requires Azure key)
Google ❌ No ✅ Yes Requires Google Cloud credentials
Polly ❌ No ✅ Yes AWS Polly (requires AWS credentials)
OpenAI ❌ No ✅ Yes OpenAI TTS API
Google ✅ Word ✅ Yes Google Cloud TTS (word timepoints)
ElevenLabs ✅ Character ✅ Yes ElevenLabs API (character + word events)
Watson ❌ No ✅ Yes IBM Watson TTS
PlayHT ❌ No ✅ Yes Play.ht API
WitAI ❌ No ✅ Yes Wit.ai API
Gemini ❌ No ✅ Yes Google Gemini TTS
Cartesia ❌ No ✅ Yes Cartesia API
Deepgram ❌ No ✅ Yes Deepgram TTS
Hume ❌ No ✅ Yes Hume AI API
xAI ❌ No ✅ Yes xAI Grok TTS
FishAudio ❌ No ✅ Yes Fish Audio API
Mistral ❌ No ✅ Yes Mistral AI TTS
Murf ❌ No ✅ Yes Murf AI API
UnrealSpeech ❌ No ✅ Yes Unreal Speech API
Resemble ❌ No ✅ Yes Resemble AI API
UpliftAI ❌ No ✅ Yes Uplift AI API
ModelsLab ❌ No ✅ Yes Models Lab API
SherpaOnnx ❌ No ✅ Yes Local offline TTS with real streaming (Kokoro/Matcha/VITS models)
eSpeak ❌ No ❌ No Coming soon (local offline TTS)
CereVoice ❌ No ❌ No Coming soon (CereProc TTS)

Features

  • Unified API: Single interface for 20+ TTS engines
  • True Streaming: IAsyncEnumerable-based audio chunk streaming where supported
  • Word Timings: Real word boundary events from Azure SDK, estimated for other engines
  • SSML Support: Fluent SSML builder for expressive speech synthesis
  • Cross-platform: Windows, Linux, macOS support (engine-dependent)
  • Modern .NET: Built for .NET 8.0 with latest C# language features

Installation

dotnet add package DotNetTtsWrapper

Basic Usage

using DotNetTtsWrapper.Models;
using DotNetTtsWrapper.Engines;

// Create a TTS client
var azureCredentials = new AzureCredentials 
{ 
    SubscriptionKey = "your-key", 
    Region = "westus" 
};
var client = TtsFactory.CreateClient("azure", azureCredentials);

// Get available voices
var voices = await client.GetVoicesAsync();
client.SetVoice(voices[0].Id);

// Synthesize speech
var result = await client.SynthToBytesAsync("Hello world!");
File.WriteAllBytes("output.wav", result.AudioData);

// With word timings
var options = new TtsOptions { EnableWordTimings = true };
var resultWithTimings = await client.SynthToBytesAsync("Hello world!", options);
foreach (var timing in resultWithTimings.WordTimings)
{
    Console.WriteLine($"{timing.Word}: {timing.StartTime}s - {timing.EndTime}s");
}

// Stream audio
var streamResult = await client.SynthToStreamAsync("Hello world!");
await foreach (var chunk in streamResult.AudioStream)
{
    // Process audio chunks
    ProcessAudioChunk(chunk.AudioData);
}

Advanced Features

SSML Builder

var ssml = SsmlBuilder.Speak()
    .Voice("en-US-AriaNeural")
    .WithRate("fast")
    .WithPitch("high")
    .WithVolume(80)
    .AddText("Hello world!")
    .Build();

Word Events

client.WordBoundary += (sender, e) => 
{
    Console.WriteLine($"Word: {e.Word}, Time: {e.StartTime}s");
};
await client.SpeakAsync("Hello world!");

Engine-Specific Setup

Azure Speech SDK

var credentials = new AzureCredentials 
{ 
    SubscriptionKey = "your-key", 
    Region = "your-region" 
};
var client = new AzureSdkTtsClient(credentials);

SAPI (Windows Only)

var client = new SapiTtsClient();
var voices = await client.GetVoicesAsync();

Architecture

  • Abstract Factory Pattern: TtsFactory.CreateClient() for engine creation
  • Event-Driven: Word boundary, speech started/completed events
  • Async-First: Full async/await support throughout
  • Streaming: IAsyncEnumerable for true audio chunk streaming
  • Modular: Optional engine-specific packages for reduced dependencies

Requirements

  • .NET 8.0 or higher
  • Windows OS for SAPI engine
  • Platform-specific packages for some engines

License

Ported from js-tts-wrapper with .NET-specific enhancements.

Roadmap

  • eSpeak integration (local offline TTS)
  • Speech Markdown support
  • Advanced model management for SherpaOnnx
  • Additional cloud engine integrations
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on DotNetTtsWrapper:

Package Downloads
RustTtsWrapper.Bindings

.NET bindings for rust-tts-wrapper. Includes a low-level P/Invoke client (TtsClient) and a drop-in DotNetTtsWrapper.AbstractTtsClient adapter (RustTtsClient) so projects like VoiceGarden-SAPI can swap backends without touching their TTS code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.9 187 6/26/2026
1.1.8 120 6/26/2026
1.1.7 95 6/25/2026
1.1.6 128 6/25/2026
1.1.5 103 6/25/2026
1.1.4 749 6/24/2026
1.1.3 135 6/21/2026
1.1.2 121 6/19/2026
1.1.1 300 5/22/2026
1.0.0 115 5/21/2026

v1.0.0 - Initial release
     - Support for 20+ TTS engines with unified API
     - Real streaming support for Azure SDK and SherpaOnnx
     - Word boundary events from Azure Speech SDK
     - Cross-platform support (Windows, Linux, macOS)
     - SSML builder for expressive speech synthesis