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.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginSynthesizeSpeech and EndSynthesizeSpeech.

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

Syntax

C#
public virtual Task<SynthesizeSpeechResponse> SynthesizeSpeechAsync(
         SynthesizeSpeechRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.Polly.Model.SynthesizeSpeechRequest

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

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


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

Exceptions

ExceptionCondition
EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
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.

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5

See Also