I am trying to create an MP3 file using Azure Text to Speech. The node file runs, but nothing gets created or outputted. The Node.js docs files and example aren't too good
https://github.com/Azure-Samples/Cognitive-Speech-TTS
const sdk = require("microsoft-cognitiveservices-speech-sdk");
var subscriptionKey = "809-myazureapikey";
var serviceRegion = "westeurope"; // e.g., "westus"
function synthesizeSpeech() {
const speechConfig = sdk.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion);
const audioConfig = AudioConfig.fromAudioFileOutput("speech.mp3");
const synthesizer = new SpeechSynthesizer(speechConfig, audioConfig);F
synthesizer.speakTextAsync(
"A simple test to write to a file.",
result => {
if (result) {
console.log(JSON.stringify(result));
}
synthesizer.close();
},
error => {
console.log(error);
synthesizer.close();
});
};
Do I need to declare and use the fs service to write the file?
This is a Bing Speech example, which is different from the Azure service and example
https://github.com/palmerabollo/bingspeech-api-client/blob/master/examples/index.js