From 77f0fc85a3fdd9cdda5251f9dfbc0e8118c02656 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Wed, 9 Apr 2025 23:32:06 +0700 Subject: [PATCH] ell tts support speech and pronunciation_dictionary_locators (#1137) --- lib/tasks/tts-task.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/tasks/tts-task.js b/lib/tasks/tts-task.js index f7f3c43a..a3f31285 100644 --- a/lib/tasks/tts-task.js +++ b/lib/tasks/tts-task.js @@ -65,7 +65,6 @@ class TtsTask extends Task { async setTtsStreamingChannelVars(vendor, language, voice, credentials, ep) { const {api_key, model_id, custom_tts_streaming_url, auth_token} = credentials; - const {stability, similarity_boost, use_speaker_boost, style} = this.options; let obj; this.logger.debug({credentials}, @@ -87,6 +86,7 @@ class TtsTask extends Task { }; break; case 'elevenlabs': + const {stability, similarity_boost, use_speaker_boost, style, speed} = this.options.voice_settings || {}; obj = { ELEVENLABS_API_KEY: api_key, ELEVENLABS_TTS_STREAMING_MODEL_ID: model_id, @@ -96,7 +96,14 @@ class TtsTask extends Task { ...(stability && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_STABILITY: stability}), ...(similarity_boost && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_SIMILARITY_BOOST: similarity_boost}), ...(use_speaker_boost && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_USE_SPEAKER_BOOST: use_speaker_boost}), - ...(style && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_STYLE: style}) + ...(style && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_STYLE: style}), + // speed has value 0.7 to 1.2, 1.0 is default, make sure we send the value event it's 0 + ...(speed !== null && speed !== undefined && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_SPEED: `${speed}`}), + ...(this.options.pronunciation_dictionary_locators && + Array.isArray(this.options.pronunciation_dictionary_locators) && { + ELEVENLABS_TTS_STREAMING_PRONUNCIATION_DICTIONARY_LOCATORS: + JSON.stringify(this.options.pronunciation_dictionary_locators) + }), }; break; case 'rimelabs':