Text to Speech and Avatars
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
This page targets Azure CLI 2.90.0, Speech SDK 1.52.0 and the batch synthesis REST API 2024-04-01, checked on
2026-10-06. Voice names and the SSML support matrix change often. Check the voice gallery before you hard-code a
voice.
Azure Speech in Foundry Tools also does the reverse of speech to text: it turns text, or SSML markup, into natural speech. The vendor-neutral comparison with other TTS providers is on Text to Speech.
Voices
| Voice family | Notes |
|---|---|
Standard neural voices |
Hundreds of voices in more than 140 languages and variants, at 24 kHz (some at 48 kHz). Names look like
|
HD voices |
Higher-quality voices that adapt tone to the text, for example |
Azure OpenAI voices |
OpenAI voices ( |
Multilingual voices |
One voice that speaks many languages with the same timbre and switches language inside one text. Useful for mixed-language content such as book titles in their original language. |
SSML
Speech Synthesis Markup Language controls pronunciation and delivery:
-
<prosody>sets rate, pitch and volume;<break>inserts pauses;<emphasis>stresses words -
<mstts:express-as style="..." role="...">picks a speaking style or role (a Microsoft extension) -
<lexicon uri="...">points to a custom pronunciation lexicon, for example for author names -
<phoneme>and<say-as>control how one word, a date or a number is read -
<mstts:viseme type="FacialExpression"/>asks for viseme (mouth-shape) events, used to animate an avatar or a 3D character in sync with the audio
Not every voice supports every element. HD and OpenAI voices ignore styles and some prosody settings. Check the SSML support matrix per voice family.
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:mstts="https://www.w3.org/2001/mstts" xml:lang="en-US">
<voice name="en-US-AvaMultilingualNeural">
<mstts:express-as style="narration-relaxed">
Chapter one. <break time="600ms"/>
<prosody rate="-5%">It was a bright cold day in April,</prosody>
and the clocks were striking thirteen.
</mstts:express-as>
</voice>
</speak>
Provisioning
In the Azure portal
-
Use the Foundry resource
foundry-bookshelf(Resources, Endpoints and Authentication). -
In the Foundry portal (
https://ai.azure.com), open Playgrounds → Speech playground → Text to speech to try voices and SSML. The Voice gallery lists every voice with samples. -
For long content, the Audio Content Creation tool in Speech Studio (
https://speech.microsoft.com) is a no-code SSML editor. -
Assign
Cognitive Services Speech Userto the identity that calls the API.
With the Azure CLI
TOKEN=$(az account get-access-token --resource https://cognitiveservices.azure.com --query accessToken -o tsv)
curl -s "https://$FOUNDRY.cognitiveservices.azure.com/tts/cognitiveservices/voices/list" \
-H "Authorization: Bearer $TOKEN" | jq -r '.[] | select(.Locale=="en-US") | .ShortName' | head
Synthesis with the Speech SDK
Synthesize a book description to an MP3 file:
import azure.cognitiveservices.speech as speechsdk
from azure.identity import DefaultAzureCredential
speech_config = speechsdk.SpeechConfig(
endpoint="https://foundry-bookshelf.cognitiveservices.azure.com/",
token_credential=DefaultAzureCredential(),
)
speech_config.speech_synthesis_voice_name = "en-US-AvaMultilingualNeural"
speech_config.set_speech_synthesis_output_format(
speechsdk.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3
)
audio_config = speechsdk.audio.AudioOutputConfig(filename="isbn-9780143111597.mp3")
synth = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
result = synth.speak_text_async("A sweeping novel about memory and loss.").get()
assert result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted
Synthesize SSML from a file and stream the audio to memory (for example to return it from catalog-api):
using Azure.Identity;
using Microsoft.CognitiveServices.Speech;
var config = SpeechConfig.FromEndpoint(
new Uri("https://foundry-bookshelf.cognitiveservices.azure.com/"), new DefaultAzureCredential());
config.SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3);
using var synthesizer = new SpeechSynthesizer(config, null); // null = no speaker, keep audio in memory
string ssml = await File.ReadAllTextAsync("sample-chapter.ssml");
SpeechSynthesisResult result = await synthesizer.SpeakSsmlAsync(ssml);
if (result.Reason == ResultReason.SynthesizingAudioCompleted)
{
await File.WriteAllBytesAsync("sample-chapter.mp3", result.AudioData);
}
Source: How to synthesize speech (C#)
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.microsoft.cognitiveservices.speech.*;
import java.net.URI;
import java.nio.file.*;
SpeechConfig config = SpeechConfig.fromEndpoint(
new URI("https://foundry-bookshelf.cognitiveservices.azure.com/"),
new DefaultAzureCredentialBuilder().build());
config.setSpeechSynthesisVoiceName("en-US-AvaMultilingualNeural");
config.setSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3);
try (SpeechSynthesizer synth = new SpeechSynthesizer(config, null)) {
SpeechSynthesisResult result = synth.speakText("A sweeping novel about memory and loss.");
Files.write(Path.of("description.mp3"), result.getAudioData());
}
Source: How to synthesize speech (Java)
To get viseme events, subscribe to viseme_received (Python) or VisemeReceived (C#). Each event has an
audio offset and a viseme ID, or a blend-shapes frame when you use <mstts:viseme type="FacialExpression"/>.
Batch synthesis
Real-time synthesis is limited to 10 minutes of audio per request. For longer content, such as a full sample chapter, use the asynchronous batch synthesis API. It accepts plain text or SSML, and writes the audio to a storage location you can download from.
curl -s -X PUT \
"https://$FOUNDRY.cognitiveservices.azure.com/texttospeech/batchsyntheses/sample-ch1-9780143111597?api-version=2024-04-01" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"description": "Bookshelf audiobook sample, chapter 1",
"inputKind": "SSML",
"inputs": [{"content": "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"en-US\"><voice name=\"en-US-AvaMultilingualNeural\">Chapter one...</voice></speak>"}],
"properties": {
"outputFormat": "audio-24khz-96kbitrate-mono-mp3",
"wordBoundaryEnabled": true,
"concatenateResult": true,
"destinationContainerUrl": "https://stbookshelf.blob.core.windows.net/media"
}
}'
curl -s "https://$FOUNDRY.cognitiveservices.azure.com/texttospeech/batchsyntheses/sample-ch1-9780143111597?api-version=2024-04-01" \
-H "Authorization: Bearer $TOKEN" | jq '{status, outputs}'
Source: Batch synthesis API
Custom voice
Custom voice builds a voice from recordings of a real person. Both options are Limited Access: you apply, describe your use case, and record the voice talent’s consent statement in the service.
-
Professional voice fine-tuning trains a brand voice from hundreds to thousands of studio-quality utterances. Training and endpoint hosting are billed separately from synthesis.
-
Personal voice creates a voice from a short (about 1 minute) consented sample, for apps where users speak with their own voice, for example in translated dubbing.
Source: Custom voice overview
Text-to-speech avatars
An avatar is a photorealistic talking-head video driven by text to speech.
-
Batch avatar synthesis renders a video file (for example a training clip) asynchronously.
-
Real-time avatar streams video over WebRTC for interactive agents, and pairs with Voice Live.
-
Standard avatars are prebuilt characters. Custom avatars are trained from video of a real actor, and are Limited Access with recorded consent.
Source: What is text to speech avatar?
Use cases
| Scenario | Feature | Why this feature | Example input → output |
|---|---|---|---|
Bookshelf: audiobook samples |
Batch synthesis with SSML and a multilingual voice |
Chapters run over 10 minutes; SSML adds pauses and narration style. |
Chapter 1 text → |
Bookshelf: read-aloud of book descriptions |
SDK synthesis to a stream |
Short text, needed on demand; cache the MP3 in Blob behind Front Door. |
Description → 20-second MP3 played in the browser |
Accessibility read-aloud |
Neural voices, or Immersive Reader for a full reading UI |
Natural voice, many languages. |
Article → audio for screen-reader users |
IVR prompts |
SSML with styles and |
Correct reading of dates, amounts and order numbers. |
"Your order 4512 ships on 7 October" → telephony WAV at 8 kHz |
E-learning narration |
Batch synthesis, avatar video |
Long scripts; consistent voice across modules. |
Course script → narrated video |
In-car navigation |
Neural TTS container |
Works offline; low latency. |
Route instruction → spoken prompt |
Bookshelf’s read-aloud page also offers Immersive Reader for readers who want word highlighting and translation.
When not to use it
-
For a full voice conversation (listen, reason, respond), Voice Live handles synthesis for you with turn-taking built in.
-
When you need one fixed sentence in a few languages, pre-render the audio once and serve it from Blob, rather than synthesizing on every request.
-
For expressive, open-ended speech generation, an LLM audio model may fit better. See Choosing a Foundry Tool (or a Foundry Model).
Clean up
curl -s -X DELETE \
"https://$FOUNDRY.cognitiveservices.azure.com/texttospeech/batchsyntheses/sample-ch1-9780143111597?api-version=2024-04-01" \
-H "Authorization: Bearer $TOKEN"
Source: Batch synthesis API
Related pages
-
Text to Speech compares TTS vendors and voices.
-
Speech to Text covers the opposite direction on the same resource.
-
Networking, Security and Responsible AI covers Limited Access for custom voice and avatars.
-
Front Door and CDN covers caching the generated audio at the edge.