AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.


For .NET Core and PCL this operation is only available in asynchronous form. Please refer to SynthesizeSpeechAsync.

Namespace: Amazon.Polly
Assembly: AWSSDK.Polly.dll
Version: 3.x.y.z


public virtual SynthesizeSpeechResponse SynthesizeSpeech(
         SynthesizeSpeechRequest request
Type: Amazon.Polly.Model.SynthesizeSpeechRequest

Container for the necessary parameters to execute the SynthesizeSpeech service method.

Return Value
The response from the SynthesizeSpeech service method, as returned by Polly.


InvalidSampleRateException The specified sample rate is not valid.
InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region. Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
ServiceFailureException An unknown condition has caused a service failure.
SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.


Synthesizes plain text or SSML into a file of human-like speech.

To synthesize speech

var response = client.SynthesizeSpeech(new SynthesizeSpeechRequest 
    LexiconNames = new List {
    OutputFormat = "mp3",
    SampleRate = "8000",
    Text = "All Gaul is divided into three parts",
    TextType = "text",
    VoiceId = "Joanna"

MemoryStream audioStream = response.AudioStream;
string contentType = response.ContentType;
integer requestCharacters = response.RequestCharacters;


Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also