Skip to content

Instantly share code, notes, and snippets.

@EcutDavid
Last active August 25, 2019 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EcutDavid/2c9aae78b8613fa0cff30e0b5f06fa6a to your computer and use it in GitHub Desktop.
Save EcutDavid/2c9aae78b8613fa0cff30e0b5f06fa6a to your computer and use it in GitHub Desktop.
const AWS = require("aws-sdk");
const polly = new AWS.Polly();
const bucketName = "polly-voice-notes";
const pollyCommonParas = {
OutputFormat: "mp3",
VoiceId: "Matthew",
OutputS3BucketName: bucketName
};
async function pollyTask(text) {
const result = await polly
.startSpeechSynthesisTask({
...pollyCommonParas,
Text: text
})
.promise();
// We can query `getSpeechSynthesisTask` with this taskId to check the status(e.g., "failed").
const taskId = result.SynthesisTask.TaskId;
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment