StartSpeechSynthesisStream
Source:
src/AWS/Polly/StartSpeechSynthesisStream.ts
Runtime binding for polly:StartSpeechSynthesisStream — bidirectional
streaming synthesis: send text incrementally as TextEvents on the input
ActionStream and receive AudioEvent chunks on the output EventStream
as they become available.
The binding takes no arguments and grants the function
polly:StartSpeechSynthesisStream. Provide the implementation with
Effect.provide(AWS.Polly.StartSpeechSynthesisStreamHttp).
NOTE: the distilled HTTP transport does not yet support bidirectional
(input) event-stream request bodies — a live call currently hangs waiting
for response headers (probed 2026-07; same transport gap leaves
transcribe-streaming and lex StartConversation unbound). Prefer
SynthesizeSpeech (request-response) until distilled core ships
event-stream request support.
Streaming Synthesis
Section titled “Streaming Synthesis”// initconst startSpeechSynthesisStream = yield* AWS.Polly.StartSpeechSynthesisStream();
// runtimeconst result = yield* startSpeechSynthesisStream({ Engine: "generative", OutputFormat: "mp3", VoiceId: "Matthew", ActionStream: Stream.make( { TextEvent: { Text: "Hello from Alchemy." } }, { CloseStreamEvent: {} }, ),});const events = yield* Stream.runCollect(result.EventStream!);const audioBytes = Array.from(events) .flatMap((event) => (event.AudioEvent?.AudioChunk ? [event.AudioEvent.AudioChunk] : [])) .reduce((total, chunk) => total + chunk.length, 0);