start_speech_synthesis_stream¶
Operation¶
start_speech_synthesis_stream
async
¶
start_speech_synthesis_stream(input: StartSpeechSynthesisStreamInput, plugins: list[Plugin] | None = None) -> DuplexEventStream[StartSpeechSynthesisStreamActionStream, StartSpeechSynthesisStreamEventStream, StartSpeechSynthesisStreamOutput]
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:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
StartSpeechSynthesisStreamInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
DuplexEventStream[StartSpeechSynthesisStreamActionStream, StartSpeechSynthesisStreamEventStream, StartSpeechSynthesisStreamOutput]
|
A |
Input¶
StartSpeechSynthesisStreamInput
dataclass
¶
Dataclass for StartSpeechSynthesisStreamInput structure.
Attributes¶
engine
class-attribute
instance-attribute
¶
engine: Engine | None = None
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.
language_code
class-attribute
instance-attribute
¶
language_code: LanguageCode | None = None
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.
lexicon_names
class-attribute
instance-attribute
¶
lexicon_names: list[str] | None = None
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.
output_format
class-attribute
instance-attribute
¶
output_format: OutputFormat | None = None
The audio format for the synthesized speech. Currently, Amazon Polly does not support JSON speech marks.
sample_rate
class-attribute
instance-attribute
¶
sample_rate: str | None = None
The audio frequency, specified in Hz.
voice_id
class-attribute
instance-attribute
¶
voice_id: VoiceId | None = None
The voice to use in synthesis. To get a list of available voice IDs, use the DescribeVoices operation.
Output¶
This operation returns a DuplexEventStream for bidirectional streaming.
Event Stream Structure¶
Input Event Type¶
StartSpeechSynthesisStreamActionStream
Output Event Type¶
StartSpeechSynthesisStreamEventStream
Initial Response Structure¶
StartSpeechSynthesisStreamOutput
dataclass
¶
Dataclass for StartSpeechSynthesisStreamOutput structure.