This commit is contained in:
Quan HL
2024-03-10 06:41:46 +07:00
parent 2988e800b1
commit f06f96a6f0

View File

@@ -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}`;