support rimelabs tts streaming (#1047)

This commit is contained in:
Hoan Luu Huu
2025-01-18 20:17:33 +07:00
committed by GitHub
parent a194ba833e
commit ba282d775d
3 changed files with 23 additions and 0 deletions

View File

@@ -94,6 +94,23 @@ class TtsTask extends Task {
...(style && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_STYLE: style}) ...(style && {ELEVENLABS_TTS_STREAMING_VOICE_SETTINGS_STYLE: style})
}; };
break; break;
case 'rimelabs':
const {
pauseBetweenBrackets, phonemizeBetweenBrackets, inlineSpeedAlpha, speedAlpha, reduceLatency
} = this.options;
obj = {
RIMELABS_API_KEY: api_key,
RIMELABS_TTS_STREAMING_MODEL_ID: model_id,
RIMELABS_TTS_STREAMING_VOICE_ID: voice,
RIMELABS_TTS_STREAMING_LANGUAGE: language || 'en',
...(pauseBetweenBrackets && {RIMELABS_TTS_STREAMING_PAUSE_BETWEEN_BRACKETS: pauseBetweenBrackets}),
...(phonemizeBetweenBrackets &&
{RIMELABS_TTS_STREAMING_PHONEMIZE_BETWEEN_BRACKETS: phonemizeBetweenBrackets}),
...(inlineSpeedAlpha && {RIMELABS_TTS_STREAMING_INLINE_SPEED_ALPHA: inlineSpeedAlpha}),
...(speedAlpha && {RIMELABS_TTS_STREAMING_SPEED_ALPHA: speedAlpha}),
...(reduceLatency && {RIMELABS_TTS_STREAMING_REDUCE_LATENCY: reduceLatency})
};
break;
default: default:
if (vendor.startsWith('custom:')) { if (vendor.startsWith('custom:')) {
const use_tls = custom_tts_streaming_url.startsWith('wss://'); const use_tls = custom_tts_streaming_url.startsWith('wss://');

View File

@@ -259,6 +259,11 @@
"ConnectFailure": "elevenlabs_tts_streaming::connect_failed", "ConnectFailure": "elevenlabs_tts_streaming::connect_failed",
"Connect": "elevenlabs_tts_streaming::connect" "Connect": "elevenlabs_tts_streaming::connect"
}, },
"RimelabsTtsStreamingEvents": {
"Empty": "rimelabs_tts_streaming::empty",
"ConnectFailure": "rimelabs_tts_streaming::connect_failed",
"Connect": "rimelabs_tts_streaming::connect"
},
"CustomTtsStreamingEvents": { "CustomTtsStreamingEvents": {
"Empty": "custom_tts_streaming::empty", "Empty": "custom_tts_streaming::empty",
"ConnectFailure": "custom_tts_streaming::connect_failed", "ConnectFailure": "custom_tts_streaming::connect_failed",

View File

@@ -278,6 +278,7 @@ class TtsStreamingBuffer extends Emitter {
'deepgram', 'deepgram',
'cartesia', 'cartesia',
'elevenlabs', 'elevenlabs',
'rimelabs',
'custom' 'custom'
].forEach((vendor) => { ].forEach((vendor) => {
const eventClassName = `${vendor.charAt(0).toUpperCase() + vendor.slice(1)}TtsStreamingEvents`; const eventClassName = `${vendor.charAt(0).toUpperCase() + vendor.slice(1)}TtsStreamingEvents`;