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.

This is the response object from the SynthesizeSpeech operation.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.Polly.Model.SynthesizeSpeechResponse

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

Syntax

C#
public class SynthesizeSpeechResponse : AmazonWebServiceResponse
         IDisposable

The SynthesizeSpeechResponse type exposes the following members

Constructors

NameDescription
Public Method SynthesizeSpeechResponse()

Properties

NameTypeDescription
Public Property AudioStream System.IO.Stream

Gets and sets the property AudioStream.

Stream containing the synthesized speech.

Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ContentType System.String

Gets and sets the property ContentType.

Specifies the type audio stream. This should reflect the OutputFormat parameter in your request.

  • If you request mp3 as the OutputFormat, the ContentType returned is audio/mpeg.

  • If you request ogg_vorbis as the OutputFormat, the ContentType returned is audio/ogg.

  • If you request pcm as the OutputFormat, the ContentType returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.

  • If you request json as the OutputFormat, the ContentType returned is application/x-json-stream.

Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property RequestCharacters System.Int32

Gets and sets the property RequestCharacters.

Number of characters synthesized.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method Dispose()

Disposes of all managed and unmanaged resources.

Examples

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

To synthesize speech


var client = new AmazonPollyClient();
var response = client.SynthesizeSpeech(new SynthesizeSpeechRequest 
{
    LexiconNames = new List<string> {
        "example"
    },
    OutputFormat = "mp3",
    SampleRate = "8000",
    Text = "All Gaul is divided into three parts",
    TextType = "text",
    VoiceId = "Joanna"
});

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

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5