Skip to content

SynthesizeSpeech

Source: src/AWS/Polly/SynthesizeSpeech.ts

Runtime binding for polly:SynthesizeSpeech — synthesize UTF-8 plain text or SSML into a stream of audio bytes.

Polly is a pure pay-per-call service with no resource to manage: the binding takes no arguments and grants the function polly:SynthesizeSpeech. The response AudioStream is a byte Stream of the encoded audio (raw distilled types, no marshalling). Provide the implementation with Effect.provide(AWS.Polly.SynthesizeSpeechHttp).

// init
const synthesizeSpeech = yield* AWS.Polly.SynthesizeSpeech();
// runtime — AudioStream is a byte Stream of the encoded audio
const result = yield* synthesizeSpeech({
Engine: "neural",
OutputFormat: "mp3",
VoiceId: "Joanna",
Text: "Hello from Alchemy.",
});
const chunks = yield* Stream.runCollect(result.AudioStream!);