Skip to content

StartSpeechSynthesisTask

Source: src/AWS/Polly/StartSpeechSynthesisTask.ts

Runtime binding for polly:StartSpeechSynthesisTask — start an asynchronous synthesis task that writes the audio (or speech marks) to an S3 bucket, for texts too long for the synchronous SynthesizeSpeech.

The binding grants polly:StartSpeechSynthesisTask. Polly writes the output with the caller’s credentials, so the function also needs s3:PutObject on the output bucket — compose with AWS.S3.PutObject(bucket). Provide the implementation with Effect.provide(AWS.Polly.StartSpeechSynthesisTaskHttp).

// init — the S3 PutObject binding grants Polly's output write
yield* AWS.S3.PutObject(bucket);
const startSpeechSynthesisTask = yield* AWS.Polly.StartSpeechSynthesisTask();
// runtime
const started = yield* startSpeechSynthesisTask({
OutputFormat: "mp3",
OutputS3BucketName: "my-audio-bucket",
VoiceId: "Joanna",
Text: longArticleText,
});
const taskId = started.SynthesisTask?.TaskId;