Last active
August 25, 2019 01:47
-
-
Save EcutDavid/2c9aae78b8613fa0cff30e0b5f06fa6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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