From da3cdbb7aaf915c7eb9bbd0cf9eec6d7b14ceca2 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Fri, 8 Sep 2023 15:42:57 +0700 Subject: [PATCH] fix raw audio downloaded from onprem azure --- lib/synth-audio.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 514cb72..53b0eb4 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -331,8 +331,9 @@ async function _synthOnPremMicrosoft(logger, { } try { + const trimSilence = filePath.endsWith('.r8'); const post = bent('POST', 'buffer', { - 'X-Microsoft-OutputFormat': 'audio-16khz-128kbitrate-mono-mp3', + 'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3', 'Content-Type': 'application/ssml+xml', 'User-Agent': 'Jambonz' });