2026/03/25 - Amazon Polly - 5 updated api methods
Changes Add support for Mu-law and A-law codecs for output format
{'SynthesisTask': {'OutputFormat': {'mulaw', 'alaw'}}}
Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.
See also: AWS API Documentation
Request Syntax
client.get_speech_synthesis_task(
TaskId='string'
)
string
[REQUIRED]
The Amazon Polly generated identifier for a speech synthesis task.
dict
Response Syntax
{
'SynthesisTask': {
'Engine': 'standard'|'neural'|'long-form'|'generative',
'TaskId': 'string',
'TaskStatus': 'scheduled'|'inProgress'|'completed'|'failed',
'TaskStatusReason': 'string',
'OutputUri': 'string',
'CreationTime': datetime(2015, 1, 1),
'RequestCharacters': 123,
'SnsTopicArn': 'string',
'LexiconNames': [
'string',
],
'OutputFormat': 'json'|'mp3'|'ogg_opus'|'ogg_vorbis'|'pcm'|'mulaw'|'alaw',
'SampleRate': 'string',
'SpeechMarkTypes': [
'sentence'|'ssml'|'viseme'|'word',
],
'TextType': 'ssml'|'text',
'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',
'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'
}
}
Response Structure
(dict) --
SynthesisTask (dict) --
SynthesisTask object that provides information from the requested task, including output format, creation time, task status, and so on.
Engine (string) --
Specifies the engine ( standard, neural, long-form or generative) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
TaskId (string) --
The Amazon Polly generated identifier for a speech synthesis task.
TaskStatus (string) --
Current status of the individual speech synthesis task.
TaskStatusReason (string) --
Reason for the current status of a specific speech synthesis task, including errors if the task has failed.
OutputUri (string) --
Pathway for the output speech file.
CreationTime (datetime) --
Timestamp for the time the synthesis task was started.
RequestCharacters (integer) --
Number of billable characters synthesized.
SnsTopicArn (string) --
ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
LexiconNames (list) --
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.
(string) --
OutputFormat (string) --
The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, ogg_opus, mu-law, a-law, or pcm. For speech marks, this will be json.
SampleRate (string) --
The audio frequency specified in Hz.
The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000".
Valid values for pcm are "8000" and "16000" The default value is "16000".
Valid value for ogg_opus is "48000".
Valid value for mu-law and a-law is "8000".
SpeechMarkTypes (list) --
The type of speech marks returned for the input text.
(string) --
TextType (string) --
Specifies whether the input text is plain text or SSML. The default value is plain text.
VoiceId (string) --
Voice ID to use for the synthesis.
LanguageCode (string) --
Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
{'SynthesisTasks': {'OutputFormat': {'mulaw', 'alaw'}}}
Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.
See also: AWS API Documentation
Request Syntax
client.list_speech_synthesis_tasks(
MaxResults=123,
NextToken='string',
Status='scheduled'|'inProgress'|'completed'|'failed'
)
integer
Maximum number of speech synthesis tasks returned in a List operation.
string
The pagination token to use in the next request to continue the listing of speech synthesis tasks.
string
Status of the speech synthesis tasks returned in a List operation
dict
Response Syntax
{
'NextToken': 'string',
'SynthesisTasks': [
{
'Engine': 'standard'|'neural'|'long-form'|'generative',
'TaskId': 'string',
'TaskStatus': 'scheduled'|'inProgress'|'completed'|'failed',
'TaskStatusReason': 'string',
'OutputUri': 'string',
'CreationTime': datetime(2015, 1, 1),
'RequestCharacters': 123,
'SnsTopicArn': 'string',
'LexiconNames': [
'string',
],
'OutputFormat': 'json'|'mp3'|'ogg_opus'|'ogg_vorbis'|'pcm'|'mulaw'|'alaw',
'SampleRate': 'string',
'SpeechMarkTypes': [
'sentence'|'ssml'|'viseme'|'word',
],
'TextType': 'ssml'|'text',
'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',
'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'
},
]
}
Response Structure
(dict) --
NextToken (string) --
An opaque pagination token returned from the previous List operation in this request. If present, this indicates where to continue the listing.
SynthesisTasks (list) --
List of SynthesisTask objects that provides information from the specified task in the list request, including output format, creation time, task status, and so on.
(dict) --
SynthesisTask object that provides information about a speech synthesis task.
Engine (string) --
Specifies the engine ( standard, neural, long-form or generative) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
TaskId (string) --
The Amazon Polly generated identifier for a speech synthesis task.
TaskStatus (string) --
Current status of the individual speech synthesis task.
TaskStatusReason (string) --
Reason for the current status of a specific speech synthesis task, including errors if the task has failed.
OutputUri (string) --
Pathway for the output speech file.
CreationTime (datetime) --
Timestamp for the time the synthesis task was started.
RequestCharacters (integer) --
Number of billable characters synthesized.
SnsTopicArn (string) --
ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
LexiconNames (list) --
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.
(string) --
OutputFormat (string) --
The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, ogg_opus, mu-law, a-law, or pcm. For speech marks, this will be json.
SampleRate (string) --
The audio frequency specified in Hz.
The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000".
Valid values for pcm are "8000" and "16000" The default value is "16000".
Valid value for ogg_opus is "48000".
Valid value for mu-law and a-law is "8000".
SpeechMarkTypes (list) --
The type of speech marks returned for the input text.
(string) --
TextType (string) --
Specifies whether the input text is plain text or SSML. The default value is plain text.
VoiceId (string) --
Voice ID to use for the synthesis.
LanguageCode (string) --
Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
{'OutputFormat': {'mulaw', 'alaw'}}
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'|'mulaw'|'alaw',
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.
{'OutputFormat': {'mulaw', 'alaw'}}
Response {'SynthesisTask': {'OutputFormat': {'mulaw', 'alaw'}}}
Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters ( OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status. The SpeechSynthesisTask object is available for 72 hours after starting the asynchronous synthesis task.
See also: AWS API Documentation
Request Syntax
client.start_speech_synthesis_task(
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'|'mulaw'|'alaw',
OutputS3BucketName='string',
OutputS3KeyPrefix='string',
SampleRate='string',
SnsTopicArn='string',
SpeechMarkTypes=[
'sentence'|'ssml'|'viseme'|'word',
],
Text='string',
TextType='ssml'|'text',
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'
)
string
Specifies the engine ( standard, neural, long-form or generative) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
string
Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
list
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.
(string) --
string
[REQUIRED]
The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, ogg_opus, mu-law, a-law, or pcm. For speech marks, this will be json.
string
[REQUIRED]
Amazon S3 bucket name to which the output file will be saved.
string
The Amazon S3 key prefix for the output speech file.
string
The audio frequency specified in Hz.
The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000".
Valid values for pcm are "8000" and "16000" The default value is "16000".
Valid value for ogg_opus is "48000".
Valid value for mu-law and a-law is "8000".
string
ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
list
The type of speech marks returned for the input text.
(string) --
string
[REQUIRED]
The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
string
Specifies whether the input text is plain text or SSML. The default value is plain text.
string
[REQUIRED]
Voice ID to use for the synthesis.
dict
Response Syntax
{
'SynthesisTask': {
'Engine': 'standard'|'neural'|'long-form'|'generative',
'TaskId': 'string',
'TaskStatus': 'scheduled'|'inProgress'|'completed'|'failed',
'TaskStatusReason': 'string',
'OutputUri': 'string',
'CreationTime': datetime(2015, 1, 1),
'RequestCharacters': 123,
'SnsTopicArn': 'string',
'LexiconNames': [
'string',
],
'OutputFormat': 'json'|'mp3'|'ogg_opus'|'ogg_vorbis'|'pcm'|'mulaw'|'alaw',
'SampleRate': 'string',
'SpeechMarkTypes': [
'sentence'|'ssml'|'viseme'|'word',
],
'TextType': 'ssml'|'text',
'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',
'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'
}
}
Response Structure
(dict) --
SynthesisTask (dict) --
SynthesisTask object that provides information and attributes about a newly submitted speech synthesis task.
Engine (string) --
Specifies the engine ( standard, neural, long-form or generative) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
TaskId (string) --
The Amazon Polly generated identifier for a speech synthesis task.
TaskStatus (string) --
Current status of the individual speech synthesis task.
TaskStatusReason (string) --
Reason for the current status of a specific speech synthesis task, including errors if the task has failed.
OutputUri (string) --
Pathway for the output speech file.
CreationTime (datetime) --
Timestamp for the time the synthesis task was started.
RequestCharacters (integer) --
Number of billable characters synthesized.
SnsTopicArn (string) --
ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
LexiconNames (list) --
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.
(string) --
OutputFormat (string) --
The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, ogg_opus, mu-law, a-law, or pcm. For speech marks, this will be json.
SampleRate (string) --
The audio frequency specified in Hz.
The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000".
Valid values for pcm are "8000" and "16000" The default value is "16000".
Valid value for ogg_opus is "48000".
Valid value for mu-law and a-law is "8000".
SpeechMarkTypes (list) --
The type of speech marks returned for the input text.
(string) --
TextType (string) --
Specifies whether the input text is plain text or SSML. The default value is plain text.
VoiceId (string) --
Voice ID to use for the synthesis.
LanguageCode (string) --
Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
{'OutputFormat': {'mulaw', 'alaw'}}
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(
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'|'mulaw'|'alaw',
SampleRate='string',
SpeechMarkTypes=[
'sentence'|'ssml'|'viseme'|'word',
],
Text='string',
TextType='ssml'|'text',
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'
)
string
Specifies the engine ( standard, neural, long-form, or generative) for Amazon Polly to use when processing input text for speech synthesis. Provide an engine that is supported by the voice you select. If you don't provide an engine, the standard engine is selected by default. If a chosen voice isn't supported by the standard engine, this will result in an error. For information on Amazon Polly voices and which voices are available for each engine, see Available Voices.
string
Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
list
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) --
string
[REQUIRED]
The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, ogg_opus, mu-law, a-law or pcm. For speech marks, this will be json.
When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.
string
The audio frequency specified in Hz.
The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", "24000", "44100" and "48000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000".
Valid values for pcm are "8000" and "16000" The default value is "16000".
Valid value for ogg_opus is "48000".
Valid value for mu-law and a-law is "8000".
list
The type of speech marks returned for the input text.
(string) --
string
[REQUIRED]
Input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
string
Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.
string
[REQUIRED]
Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.
dict
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 ogg_opus 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 mu-law as the OutputFormat, the ContentType returned is audio/mulaw.
If you request a-law as the OutputFormat, the ContentType returned is audio/alaw.
If you request json as the OutputFormat, the ContentType returned is application/x-json-stream.
RequestCharacters (integer) --
Number of characters synthesized.