diff --git a/lib/synth-audio.js b/lib/synth-audio.js index d0796f9..1fe45fd 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -302,8 +302,7 @@ const synthMicrosoft = async(logger, { if (!content.startsWith('${text}`; } speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3; - const config = AudioConfig.fromAudioFileOutput(filePath); - const synthesizer = new SpeechSynthesizer(speechConfig, config); + const synthesizer = new SpeechSynthesizer(speechConfig); if (content.startsWith('')) { /* microsoft enforces some properties and uses voice xml element so if the user did not supply do it for them */ @@ -330,10 +329,7 @@ const synthMicrosoft = async(logger, { case ResultReason.SynthesizingAudioCompleted: stats.increment('tts.count', ['vendor:microsoft', 'accepted:yes']); synthesizer.close(); - fs.readFile(filePath, (err, data) => { - if (err) return reject(err); - resolve(data); - }); + resolve(result.audioData()); break; default: logger.info({result}, 'synthAudio: (Microsoft) unexpected result');