Amazon Polly

2017/04/19 - Amazon Polly - 1 updated api methods

Changes  API Update for Amazon Polly: Add support for speech marks

SynthesizeSpeech (updated) Link ΒΆ
Changes (request)
{'OutputFormat': ['json'],
 'SpeechMarkTypes': ['sentence | ssml | viseme | word']}

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 .

See also: AWS API Documentation

Request Syntax

client.synthesize_speech(
    LexiconNames=[
        'string',
    ],
    OutputFormat='json'|'mp3'|'ogg_vorbis'|'pcm',
    SampleRate='string',
    SpeechMarkTypes=[
        'sentence'|'ssml'|'viseme'|'word',
    ],
    Text='string',
    TextType='ssml'|'text',
    VoiceId='Geraint'|'Gwyneth'|'Mads'|'Naja'|'Hans'|'Marlene'|'Nicole'|'Russell'|'Amy'|'Brian'|'Emma'|'Raveena'|'Ivy'|'Joanna'|'Joey'|'Justin'|'Kendra'|'Kimberly'|'Salli'|'Conchita'|'Enrique'|'Miguel'|'Penelope'|'Chantal'|'Celine'|'Mathieu'|'Dora'|'Karl'|'Carla'|'Giorgio'|'Mizuki'|'Liv'|'Lotte'|'Ruben'|'Ewa'|'Jacek'|'Jan'|'Maja'|'Ricardo'|'Vitoria'|'Cristiano'|'Ines'|'Carmen'|'Maxim'|'Tatyana'|'Astrid'|'Filiz'
)
type LexiconNames

list

param LexiconNames

List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see PutLexicon .

  • (string) --

type OutputFormat

string

param OutputFormat

[REQUIRED]

The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

type SampleRate

string

param SampleRate

The audio frequency specified in Hz.

The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

Valid values for pcm are "8000" and "16000" The default value is "16000".

type SpeechMarkTypes

list

param SpeechMarkTypes

The type of speech marks returned for the input text.

  • (string) --

type Text

string

param Text

[REQUIRED]

Input text to synthesize. If you specify ssml as the TextType , follow the SSML format for the input text.

type TextType

string

param TextType

Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML .

type VoiceId

string

param VoiceId

[REQUIRED]

Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.

rtype

dict

returns

Response Syntax

{
    'AudioStream': StreamingBody(),
    'ContentType': 'string',
    'RequestCharacters': 123
}

Response Structure

  • (dict) --

    • AudioStream (:class:`.StreamingBody`) --

      Stream containing the synthesized speech.

    • ContentType (string) --

      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.

    • RequestCharacters (integer) --

      Number of characters synthesized.