mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-07-04 19:31:49 +00:00
wip
This commit is contained in:
+2
-3
@@ -421,8 +421,6 @@ const synthGoogle = async(logger, {
|
|||||||
const isVoiceCloning = typeof voice === 'object' && voice.voice_cloning_key;
|
const isVoiceCloning = typeof voice === 'object' && voice.voice_cloning_key;
|
||||||
// HD voices have pattern like en-US-Chirp3-HD-Charon
|
// HD voices have pattern like en-US-Chirp3-HD-Charon
|
||||||
const isHDVoice = typeof voice === 'string' && voice.includes('-HD-');
|
const isHDVoice = typeof voice === 'string' && voice.includes('-HD-');
|
||||||
// Live API is used for HD voices and Gemini voices
|
|
||||||
const useLiveApi = isGemini || isHDVoice;
|
|
||||||
|
|
||||||
// Streaming support for Google TTS (Gemini, HD voices, and standard voices)
|
// Streaming support for Google TTS (Gemini, HD voices, and standard voices)
|
||||||
// Voice cloning does not support streaming
|
// Voice cloning does not support streaming
|
||||||
@@ -441,7 +439,8 @@ const synthGoogle = async(logger, {
|
|||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
params += `,language_code=${language || 'en-US'}`;
|
params += `,language_code=${language || 'en-US'}`;
|
||||||
params += `,write_cache_file=${disableTtsCache ? 0 : 1}`;
|
params += `,write_cache_file=${disableTtsCache ? 0 : 1}`;
|
||||||
params += `,use_live_api=${useLiveApi ? 1 : 0}`;
|
params += `,use_live_api=${isHDVoice ? 1 : 0}`;
|
||||||
|
params += `,use_gemini_tts=${isGemini ? 1 : 0}`;
|
||||||
if (model) params += `,model_name=${model}`;
|
if (model) params += `,model_name=${model}`;
|
||||||
if (gender) params += `,gender=${gender}`;
|
if (gender) params += `,gender=${gender}`;
|
||||||
// comma is used to separate parameters in freeswitch tts module
|
// comma is used to separate parameters in freeswitch tts module
|
||||||
|
|||||||
+4
-1
@@ -305,6 +305,7 @@ test('Google TTS streaming tests (!JAMBONES_DISABLE_TTS_STREAMING)', async(t) =>
|
|||||||
t.ok(result.filePath.startsWith('say:'), 'Standard voice returns streaming say: path');
|
t.ok(result.filePath.startsWith('say:'), 'Standard voice returns streaming say: path');
|
||||||
t.ok(result.filePath.includes('vendor=google'), 'Standard voice streaming path contains vendor=google');
|
t.ok(result.filePath.includes('vendor=google'), 'Standard voice streaming path contains vendor=google');
|
||||||
t.ok(result.filePath.includes('use_live_api=0'), 'Standard voice uses use_live_api=0');
|
t.ok(result.filePath.includes('use_live_api=0'), 'Standard voice uses use_live_api=0');
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=0'), 'Standard voice uses use_gemini_tts=0');
|
||||||
t.ok(result.filePath.includes('voice=en-US-Wavenet-D'), 'Standard voice streaming path contains voice');
|
t.ok(result.filePath.includes('voice=en-US-Wavenet-D'), 'Standard voice streaming path contains voice');
|
||||||
// Verify credentials are base64 encoded (no raw JSON braces that would break FreeSWitch parsing)
|
// Verify credentials are base64 encoded (no raw JSON braces that would break FreeSWitch parsing)
|
||||||
t.ok(result.filePath.includes('credentials='), 'Standard voice streaming path contains credentials');
|
t.ok(result.filePath.includes('credentials='), 'Standard voice streaming path contains credentials');
|
||||||
@@ -327,6 +328,7 @@ test('Google TTS streaming tests (!JAMBONES_DISABLE_TTS_STREAMING)', async(t) =>
|
|||||||
t.ok(result.filePath.startsWith('say:'), 'HD voice returns streaming say: path');
|
t.ok(result.filePath.startsWith('say:'), 'HD voice returns streaming say: path');
|
||||||
t.ok(result.filePath.includes('vendor=google'), 'HD voice streaming path contains vendor=google');
|
t.ok(result.filePath.includes('vendor=google'), 'HD voice streaming path contains vendor=google');
|
||||||
t.ok(result.filePath.includes('use_live_api=1'), 'HD voice uses use_live_api=1 (Live API)');
|
t.ok(result.filePath.includes('use_live_api=1'), 'HD voice uses use_live_api=1 (Live API)');
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=0'), 'HD voice uses use_gemini_tts=0');
|
||||||
t.ok(result.filePath.includes('voice=en-US-Chirp3-HD-Charon'), 'HD voice streaming path contains voice');
|
t.ok(result.filePath.includes('voice=en-US-Chirp3-HD-Charon'), 'HD voice streaming path contains voice');
|
||||||
|
|
||||||
// Test 3: Gemini TTS streaming (use_live_api=1)
|
// Test 3: Gemini TTS streaming (use_live_api=1)
|
||||||
@@ -347,7 +349,8 @@ test('Google TTS streaming tests (!JAMBONES_DISABLE_TTS_STREAMING)', async(t) =>
|
|||||||
});
|
});
|
||||||
t.ok(result.filePath.startsWith('say:'), 'Gemini TTS returns streaming say: path');
|
t.ok(result.filePath.startsWith('say:'), 'Gemini TTS returns streaming say: path');
|
||||||
t.ok(result.filePath.includes('vendor=google'), 'Gemini TTS streaming path contains vendor=google');
|
t.ok(result.filePath.includes('vendor=google'), 'Gemini TTS streaming path contains vendor=google');
|
||||||
t.ok(result.filePath.includes('use_live_api=1'), 'Gemini TTS uses use_live_api=1 (Live API)');
|
t.ok(result.filePath.includes('use_live_api=0'), 'Gemini TTS uses use_live_api=0');
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=1'), 'Gemini TTS uses use_gemini_tts=1');
|
||||||
t.ok(result.filePath.includes(`model_name=${geminiModel}`), 'Gemini TTS streaming path contains model_name');
|
t.ok(result.filePath.includes(`model_name=${geminiModel}`), 'Gemini TTS streaming path contains model_name');
|
||||||
t.ok(result.filePath.includes('prompt=Speak naturally.'), 'Gemini TTS streaming path contains prompt');
|
t.ok(result.filePath.includes('prompt=Speak naturally.'), 'Gemini TTS streaming path contains prompt');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user