From dabdb5b5845596aaa218ce2889ed7d1de3dc41b0 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Sat, 20 Jan 2024 14:15:13 -0500 Subject: [PATCH] if streaming env is set prepare to use streaming tts --- lib/synth-audio.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 7ca8759..cc413c5 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -194,7 +194,17 @@ 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, options, stats, language, voice, text, filePath}); + if (process.env.JAMBONES_ELEVENLABS_STREAMING) { + return { + filePath: `say:${text}`, + servedFromCache: false, + rtt: 0 + }; + } + else { + audioBuffer = await synthElevenlabs(logger, {credentials, options, stats, language, voice, text, filePath}); + + } break; case 'whisper': audioBuffer = await synthWhisper(logger, {credentials, stats, voice, text});