EdgeTTS.DotNet 0.2.0

dotnet add package EdgeTTS.DotNet --version 0.2.0
                    
NuGet\Install-Package EdgeTTS.DotNet -Version 0.2.0
                    
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="EdgeTTS.DotNet" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EdgeTTS.DotNet" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="EdgeTTS.DotNet" />
                    
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 EdgeTTS.DotNet --version 0.2.0
                    
#r "nuget: EdgeTTS.DotNet, 0.2.0"
                    
#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 EdgeTTS.DotNet@0.2.0
                    
#: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=EdgeTTS.DotNet&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=EdgeTTS.DotNet&version=0.2.0
                    
Install as a Cake Tool

EdgeTTS.DotNet

NuGet Version NuGet Downloads Build Status License: MIT .NET Platform

EdgeTTS.DotNet is a C# (.NET) library that allows you to use Microsoft Edge's online text-to-speech service. It is a feature-complete migration of the popular Python edge-tts library, designed for performance, cross-platform compatibility, and ease of use.

Features

  • High-Quality Speech: Access Microsoft Edge's neural TTS voices for natural-sounding speech.
  • Multilingual Support: Supports over 400 voices across numerous languages and regions.
  • Subtitles: Generate SRT formatted subtitles from WordBoundary or SentenceBoundary events.
  • Customizable Prosody: Adjust speech rate, volume, and pitch to suit your needs.
  • Cross-Platform: Built with .NET 10.0, fully compatible with Windows, macOS, Linux, and mobile platforms like .NET MAUI.
  • Robustness: Includes built-in clock skew correction (DRM), automatic 403 retry, WebSocket compression, and comprehensive error handling.
  • Voice Metadata: Access voice tags including ContentCategories and VoicePersonalities.

Installation

dotnet add package EdgeTTS.DotNet

Quick Start

Basic Usage

Save text to an MP3 file:

using EdgeTTS.DotNet;

var request = new Communicate("Hello, world!", voice: "en-US-EmmaMultilingualNeural");
await request.SaveAsync("hello.mp3");

Generating Subtitles

Use the SubMaker class to create subtitles:

using EdgeTTS.DotNet;
using EdgeTTS.DotNet.Models;

var communicate = new Communicate("Hello world!", rate: "+10%", boundaryType: "WordBoundary");
var subMaker = new SubMaker();

await foreach (var chunk in communicate.StreamAsync())
{
    if (chunk is AudioChunk audio)
    {
        // Handle audio data
    }
    else if (chunk is MetadataChunk metadata)
    {
        subMaker.Feed(metadata);
    }
}

string srt = subMaker.GetSrt();
File.WriteAllText("hello.srt", srt);

Listing Available Voices

using EdgeTTS.DotNet;

var voices = await Voices.ListVoicesAsync();
foreach (var voice in voices)
{
    Console.WriteLine($"{voice.ShortName} ({voice.Gender}) - {voice.Locale}");
    Console.WriteLine($"  Categories: {string.Join(", ", voice.VoiceTag.ContentCategories)}");
    Console.WriteLine($"  Personalities: {string.Join(", ", voice.VoiceTag.VoicePersonalities)}");
}

Advanced Options

Option Description Format
voice The short name of the voice (e.g., en-US-EmmaMultilingualNeural) String
rate The speed of the speech +0%, -50%, etc.
volume The volume of the speech +0%, -25%, etc.
pitch The pitch of the speech +0Hz, -5Hz, etc.
boundaryType Type of metadata events to receive SentenceBoundary (default) or WordBoundary
proxy Proxy server for network requests http://proxy:port

Error Handling

The library provides specific exception types for robust error handling:

Exception Description
NoAudioReceivedException No audio was received from the service
UnexpectedResponseException Unexpected response format from the server
UnknownResponseException Unknown response type received
WebSocketException WebSocket connection or communication error
SkewAdjustmentException Clock skew correction failed (missing server date)

Testing

The project includes a comprehensive test suite using xUnit:

dotnet test

License

This project is licensed under the MIT License. See the Python project edge-tts for more details on the original implementation.

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.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 77 2/25/2026
0.1.3 156 12/26/2025
0.1.2 178 12/22/2025
0.1.1 172 12/22/2025
0.1.0 172 12/22/2025