ElevenLabs
| Downloads |
Overview
Section titled “Overview”ElevenLabs provides high-quality, AI-powered text-to-speech with natural-sounding multilingual voices, and the Scribe speech-to-text model for transcription. This provider replaces the platform-native ITextToSpeechService and/or ISpeechToTextService registrations with ElevenLabs cloud calls while still using platform-native audio capture / playback for the actual microphone and speakers.
// In MauiProgram.cs — register both STT (Scribe) and TTSbuilder.Services.AddElevenLabsSpeech("your-api-key");
// Or pick one:builder.Services.AddElevenLabsSpeechToText("your-api-key"); // Scribe onlybuilder.Services.AddElevenLabsTextToSpeech("your-api-key"); // TTS onlyIAudioSource (microphone) is auto-registered when STT is enabled; IAudioPlayer (speakers) is auto-registered when TTS is enabled.
Or with a config object:
builder.Services.AddElevenLabsSpeech(new ElevenLabsConfig{ ApiKey = "your-api-key", SpeechToTextModel = "scribe_v1", // default TextToSpeechModel = "eleven_multilingual_v2", // default DefaultVoiceId = "21m00Tcm4TlvDq8ikWAM" // Rachel (default)});Configuration
Section titled “Configuration”public record ElevenLabsConfig{ public required string ApiKey { get; init; } public string DefaultVoiceId { get; init; } = "21m00Tcm4TlvDq8ikWAM"; // Rachel public string TextToSpeechModel { get; init; } = "eleven_multilingual_v2"; public string SpeechToTextModel { get; init; } = "scribe_v1";}| Property | Description | Default |
|---|---|---|
ApiKey |
Your ElevenLabs API key | (required) |
DefaultVoiceId |
Voice ID to use when none specified in TextToSpeechOptions |
21m00Tcm4TlvDq8ikWAM (Rachel) |
TextToSpeechModel |
The TTS model to use | eleven_multilingual_v2 |
SpeechToTextModel |
The Scribe transcription model to use | scribe_v1 |
TTS Usage
Section titled “TTS Usage”public class MyViewModel(ITextToSpeechService tts){ async Task Speak() { await tts.SpeakAsync("Hello from ElevenLabs!");
var voices = await tts.GetVoicesAsync(); 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 }); } }}Audio Tags & Tone
Section titled “Audio Tags & Tone”ElevenLabs is the one provider that takes emotion inline, as bracketed audio tags in the text —
but only on eleven_v3. Older models (including the default eleven_multilingual_v2, plus turbo and
flash) read the tags aloud as words.
Shiny.Speech derives the provider’s tone capabilities from
TextToSpeechModel, so switching models automatically switches between performing tags and
stripping them:
builder.Services.AddElevenLabsSpeech(new ElevenLabsConfig{ ApiKey = "your-api-key", TextToSpeechModel = "eleven_v3" // required for audio tags});
// Tags perform on eleven_v3, and are stripped on every older modelawait tts.SpeakAsync("[excited] We just shipped it. [laughs] Everything is live.");
// A portable SpeechTone is emitted as a leading tagawait tts.SpeakAsync("Don't wake them.", new TextToSpeechOptions{ Tone = new SpeechTone { Emotion = SpeechEmotion.Whispering }});// -> "[whispers] Don't wake them."SpeechTone.Intensity has no ElevenLabs equivalent and is ignored. Note that eleven_v3 only
accepts a voice_settings.stability of 0.0, 0.5 or 1.0.
STT Usage (Scribe)
Section titled “STT Usage (Scribe)”Use it like any other ISpeechToTextService. Because Scribe is non-streaming, you’ll get partial results from the audio source only after Stop() is called:
public class MyViewModel(ISpeechToTextService stt){ async Task Listen(CancellationToken ct) { var access = await stt.RequestAccess(); if (access != AccessState.Available) return;
stt.ResultReceived += (_, r) => Console.WriteLine($"[final] {r.Text}");
await stt.Start(new SpeechRecognitionOptions { Culture = CultureInfo.GetCultureInfo("en-US") });
// ... user speaks ...
await stt.Stop(); // triggers the single POST + final result }
// Or with the convenience extension method: async Task<string?> ListenOnce(CancellationToken ct) => await stt.ListenUntilSilence(cancellationToken: ct);}Combining ElevenLabs STT with Native TTS (or vice versa)
Section titled “Combining ElevenLabs STT with Native TTS (or vice versa)”You can mix-and-match — register only the direction you need, and let the other side stay platform-native:
// Scribe STT + native TTSbuilder.Services.AddSpeechServices();builder.Services.AddElevenLabsSpeechToText("your-api-key");
// Native STT + ElevenLabs TTSbuilder.Services.AddSpeechServices();builder.Services.AddElevenLabsTextToSpeech("your-api-key");Later registrations win when the same service is registered twice.


