Cached service for sayings worth repeating
npm install say-again
npm install --save say-again
`##### AWS credentials (JSON file)
Configure a SayAgain AWS configuration file
(e.g.,
MY_AWS.json)
`
cp test/data/aws-sample.json MY_AWS.json
`
Edit MY_AWS.json with your actual AWS credentials.##### AWS credentials (environment)
You can also configure AWS credentials
using nodejs environment variables:
*
aws_config_region
* aws_config_accessKeyId
* aws_config_secretAccessKey$3
`
const CFGPATH = "MY_AWS.json";
const { SayAgain, TtsPolly } = require("say-again");var request = {
"api": "aws-polly",
"apiVersion": "v4",
"audioFormat": "mp3",
"voice": "Amy",
"language": "en-GB",
"text": "hello "
}
var v = new SayAgain(CFGPATH);
var res = await v.speak(request);
// {
// request,
// s3Key,
// response: {
// mime: "audio/mpeg",
// base64: "..."
// }
// }
`To generate an MP3 file from the result:
`
var buf = Buffer.from(res.response.base64, 'base64');
fs.writeFileSync('hello.mp3', buf);
``