From 689fab6857cd2cf4b9671c36f19f05bf1e8a0b65 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Thu, 30 Nov 2023 15:48:26 +0700 Subject: [PATCH] get elevenlabs options from syntheizier.options --- lib/synth-audio.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index a564319..4b55d68 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -76,7 +76,7 @@ const trimTrailingSilence = (buffer) => { * the synthesized audio, and a variable indicating whether it was served from cache */ async function synthAudio(client, logger, stats, { account_sid, - vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId, disableTtsCache + vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId, disableTtsCache, options }) { let audioBuffer; let servedFromCache = false; @@ -194,7 +194,7 @@ async function synthAudio(client, logger, stats, { account_sid, audioBuffer = await synthWellSaid(logger, {credentials, stats, language, voice, text, filePath}); break; case 'elevenlabs': - audioBuffer = await synthElevenlabs(logger, {credentials, stats, language, voice, text, filePath}); + audioBuffer = await synthElevenlabs(logger, {credentials, options, stats, language, voice, text, filePath}); break; case 'whisper': audioBuffer = await synthWhisper(logger, {credentials, stats, voice, text}); @@ -585,9 +585,9 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice, te } }; -const synthElevenlabs = async(logger, {credentials, stats, language, voice, text}) => { - const {api_key, model_id, options} = credentials; - const opts = JSON.parse(options || '{}'); +const synthElevenlabs = async(logger, {credentials, options, stats, language, voice, text}) => { + const {api_key, model_id, options: credOpts} = credentials; + const opts = JSON.parse(options || credOpts || '{}'); const optimize_streaming_latency = opts.optimize_streaming_latency ? `?optimize_streaming_latency=${opts.optimize_streaming_latency}` : ''; try {