2026/03/19 - Amazon Polly - 1 new api methods
Changes Added bi-directional streaming functionality through a new API, StartSpeechSynthesisStream. This API allows streaming input text through inbound events and receiving audio as part of an output stream simultaneously.
Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.
This operation serves as a bidirectional counterpart to SynthesizeSpeech:
See also: AWS API Documentation
Request Syntax
client.start_speech_synthesis_stream(
Engine='standard'|'neural'|'long-form'|'generative',
LanguageCode='arb'|'cmn-CN'|'cy-GB'|'da-DK'|'de-DE'|'en-AU'|'en-GB'|'en-GB-WLS'|'en-IN'|'en-US'|'es-ES'|'es-MX'|'es-US'|'fr-CA'|'fr-FR'|'is-IS'|'it-IT'|'ja-JP'|'hi-IN'|'ko-KR'|'nb-NO'|'nl-NL'|'pl-PL'|'pt-BR'|'pt-PT'|'ro-RO'|'ru-RU'|'sv-SE'|'tr-TR'|'en-NZ'|'en-ZA'|'ca-ES'|'de-AT'|'yue-CN'|'ar-AE'|'fi-FI'|'en-IE'|'nl-BE'|'fr-BE'|'cs-CZ'|'de-CH'|'en-SG',
LexiconNames=[
'string',
],
OutputFormat='json'|'mp3'|'ogg_opus'|'ogg_vorbis'|'pcm',
SampleRate='string',
VoiceId='Aditi'|'Amy'|'Astrid'|'Bianca'|'Brian'|'Camila'|'Carla'|'Carmen'|'Celine'|'Chantal'|'Conchita'|'Cristiano'|'Dora'|'Emma'|'Enrique'|'Ewa'|'Filiz'|'Gabrielle'|'Geraint'|'Giorgio'|'Gwyneth'|'Hans'|'Ines'|'Ivy'|'Jacek'|'Jan'|'Joanna'|'Joey'|'Justin'|'Karl'|'Kendra'|'Kevin'|'Kimberly'|'Lea'|'Liv'|'Lotte'|'Lucia'|'Lupe'|'Mads'|'Maja'|'Marlene'|'Mathieu'|'Matthew'|'Maxim'|'Mia'|'Miguel'|'Mizuki'|'Naja'|'Nicole'|'Olivia'|'Penelope'|'Raveena'|'Ricardo'|'Ruben'|'Russell'|'Salli'|'Seoyeon'|'Takumi'|'Tatyana'|'Vicki'|'Vitoria'|'Zeina'|'Zhiyu'|'Aria'|'Ayanda'|'Arlet'|'Hannah'|'Arthur'|'Daniel'|'Liam'|'Pedro'|'Kajal'|'Hiujin'|'Laura'|'Elin'|'Ida'|'Suvi'|'Ola'|'Hala'|'Andres'|'Sergio'|'Remi'|'Adriano'|'Thiago'|'Ruth'|'Stephen'|'Kazuha'|'Tomoko'|'Niamh'|'Sofie'|'Lisa'|'Isabelle'|'Zayd'|'Danielle'|'Gregory'|'Burcu'|'Jitka'|'Sabrina'|'Jasmine'|'Jihye'|'Ambre'|'Beatrice'|'Florian'|'Lennart'|'Lorenzo'|'Tiffany',
ActionStream={...}
)
string
[REQUIRED]
Specifies the engine for Amazon Polly to use when processing input text for speech synthesis. Currently, only the generative engine is supported. If you specify a voice that the selected engine doesn't support, Amazon Polly returns an error.
string
An optional parameter that sets the language code for the speech synthesis request. Specify this parameter only when using a bilingual voice. If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice.
list
The names of one or more pronunciation lexicons for the service to apply during synthesis. Amazon Polly applies lexicons only when the lexicon language matches the voice language.
(string) --
string
[REQUIRED]
The audio format for the synthesized speech. Currently, Amazon Polly does not support JSON speech marks.
string
The audio frequency, specified in Hz.
string
[REQUIRED]
The voice to use in synthesis. To get a list of available voice IDs, use the DescribeVoices operation.
dict
The input event stream that contains text events and stream control events.
dict
The response of this operation contains an :class:`.EventStream` member. When iterated the :class:`.EventStream` will yield events based on the structure below, where only one of the top level keys will be present for any given event.
Response Syntax
{
'EventStream': EventStream({
'AudioEvent': {
'AudioChunk': b'bytes'
},
'StreamClosedEvent': {
'RequestCharacters': 123
},
'ValidationException': {
'message': 'string',
'reason': 'unsupportedOperation'|'fieldValidationFailed'|'other'|'invalidInboundEvent',
'fields': [
{
'name': 'string',
'message': 'string'
},
]
},
'ServiceQuotaExceededException': {
'message': 'string',
'quotaCode': 'input-stream-inbound-event-timeout'|'input-stream-timeout',
'serviceCode': 'polly'
},
'ServiceFailureException': {
'message': 'string'
},
'ThrottlingException': {
'message': 'string',
'throttlingReasons': [
{
'reason': 'string',
'resource': 'string'
},
]
}
})
}
Response Structure
(dict) --
EventStream (:class:`.EventStream`) --
The output event stream that contains synthesized audio events and stream status events.
AudioEvent (dict) --
An audio event containing synthesized speech.
AudioChunk (bytes) --
A chunk of synthesized audio data encoded in the format specified by the OutputFormat parameter.
StreamClosedEvent (dict) --
An event, with summary information, indicating the stream has closed.
RequestCharacters (integer) --
The total number of characters synthesized during the streaming session.
ValidationException (dict) --
An exception indicating the input failed validation.
message (string) --
reason (string) --
The reason the request failed validation.
fields (list) --
The fields that caused the validation error.
(dict) --
Information about a field that failed validation.
name (string) --
The name of the field that failed validation.
message (string) --
A message describing why the field failed validation.
ServiceQuotaExceededException (dict) --
An exception indicating a service quota would be exceeded.
message (string) --
quotaCode (string) --
The quota code identifying the specific quota.
serviceCode (string) --
The service code identifying the originating service.
ServiceFailureException (dict) --
An unknown condition has caused a service failure.
message (string) --
ThrottlingException (dict) --
An exception indicating the request was throttled.
message (string) --
throttlingReasons (list) --
A list of reasons explaining why the request was throttled.
(dict) --
Provides information about a specific throttling reason.
reason (string) --
The reason code explaining why the request was throttled.
resource (string) --
The resource that caused the throttling.