From f06f96a6f0ab84b059371039cefea710e7147d34 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Sun, 10 Mar 2024 06:41:46 +0700 Subject: [PATCH] wip --- lib/synth-audio.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 6409831..670f694 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -184,14 +184,8 @@ async function synthAudio(client, logger, stats, { account_sid, case 'microsoft': vendorLabel = 'microsoft'; audioBuffer = await synthMicrosoft(logger, {credentials, stats, language, voice, text, deploymentId, - filePath, renderForCaching}); - if (typeof audioBuffer === 'object' && audioBuffer.filePath) { - return audioBuffer; - } - else { - audioBuffer = await synthMicrosoft(logger, {credentials, stats, language, voice, text, deploymentId, - filePath, renderForCaching}); - } + filePath, renderForCaching, disableTtsStreaming}); + if (audioBuffer?.filePath) return audioBuffer; break; case 'nuance': model = model || 'enhanced'; @@ -390,7 +384,8 @@ const synthMicrosoft = async(logger, { voice, text, filePath, - renderForCaching + renderForCaching, + disableTtsStreaming }) => { try { const {api_key: apiKey, region, use_custom_tts, custom_tts_endpoint, custom_tts_endpoint_url} = credentials; @@ -412,7 +407,7 @@ const synthMicrosoft = async(logger, { logger.info({content}, 'synthMicrosoft'); } - if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching) { + if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) { let params = ''; params += `{api_key=${apiKey}`; params += `,language=${language}`;