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

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 audio/json.

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.

Examples

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

To synthesize speech


var response = client.SynthesizeSpeech(new SynthesizeSpeechRequest 
{
    LexiconNames = new List {
        "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;
integer requestCharacters = response.RequestCharacters;

            

Version Information

.NET Standard:
Supported in: 1.3

.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