Shiny.Maui.Shell v6 support for AI routing tools Learn More
ElevenLabs
| Downloads |
Frameworks
.NET
.NET MAUI
Operating Systems
Android
iOS
Windows
Overview
Section titled “Overview”ElevenLabs provides high-quality, AI-powered text-to-speech with natural-sounding voices and multilingual support. This provider replaces the platform-native ITextToSpeechService registration with ElevenLabs cloud synthesis while still using platform-native audio playback.
// In MauiProgram.csbuilder.Services.AddAudioPlayer(); // Platform-native audio playback (required)builder.Services.AddElevenLabsTextToSpeech("your-api-key");Or with a config object for additional options:
builder.Services.AddAudioPlayer();builder.Services.AddElevenLabsTextToSpeech(new ElevenLabsConfig{ ApiKey = "your-api-key", DefaultVoiceId = "21m00Tcm4TlvDq8ikWAM", // Rachel (default) ModelId = "eleven_multilingual_v2" // default});Configuration
Section titled “Configuration”public record ElevenLabsConfig{ public required string ApiKey { get; init; } public string DefaultVoiceId { get; init; } = "21m00Tcm4TlvDq8ikWAM"; // Rachel public string ModelId { get; init; } = "eleven_multilingual_v2";}| Property | Description | Default |
|---|---|---|
ApiKey | Your ElevenLabs API key | (required) |
DefaultVoiceId | Voice ID to use when none specified in TextToSpeechOptions | 21m00Tcm4TlvDq8ikWAM (Rachel) |
ModelId | The TTS model to use | eleven_multilingual_v2 |
Once registered, inject and use ITextToSpeechService exactly as you would with platform-native speech:
public class MyViewModel(ITextToSpeechService tts){ async Task Speak() { // Simple speech with default voice await tts.SpeakAsync("Hello from ElevenLabs!");
// List available ElevenLabs voices var voices = await tts.GetVoicesAsync();
// Speak with a specific voice var voice = voices.FirstOrDefault(v => v.Name.Contains("Adam")); if (voice != null) { await tts.SpeakAsync("Hello!", new TextToSpeechOptions { Voice = voice, SpeechRate = 1.0f, Volume = 0.9f }); } }}Combining with Platform STT
Section titled “Combining with Platform STT”A common pattern is to use ElevenLabs for high-quality TTS while keeping platform-native STT:
builder.Services.AddSpeechToText(); // Platform-native STTbuilder.Services.AddAudioPlayer(); // Platform-native playbackbuilder.Services.AddElevenLabsTextToSpeech("your-api-key");