mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-07-04 19:31:49 +00:00
wip
This commit is contained in:
+4
-2
@@ -439,8 +439,10 @@ 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=${isHDVoice ? 1 : 0}`;
|
const useLiveApi = options?.useLiveApi ?? isHDVoice;
|
||||||
params += `,use_gemini_tts=${isGemini ? 1 : 0}`;
|
const useGeminiTts = options?.useGeminiTts ?? isGemini;
|
||||||
|
params += `,use_live_api=${useLiveApi ? 1 : 0}`;
|
||||||
|
params += `,use_gemini_tts=${useGeminiTts ? 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
|
||||||
|
|||||||
@@ -394,6 +394,60 @@ test('Google TTS streaming tests (!JAMBONES_DISABLE_TTS_STREAMING)', async(t) =>
|
|||||||
// Commas in prompt should be replaced with semicolons
|
// Commas in prompt should be replaced with semicolons
|
||||||
t.ok(result.filePath.includes('prompt=Speak in a warm; friendly tone'), 'Commas in prompt are escaped to semicolons');
|
t.ok(result.filePath.includes('prompt=Speak in a warm; friendly tone'), 'Commas in prompt are escaped to semicolons');
|
||||||
|
|
||||||
|
// Test 6: options.useLiveApi override (force live api on standard voice)
|
||||||
|
result = await synthAudio(stats, {
|
||||||
|
vendor: 'google',
|
||||||
|
credentials: {
|
||||||
|
credentials: {
|
||||||
|
client_email: creds.client_email,
|
||||||
|
private_key: creds.private_key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
language: 'en-US',
|
||||||
|
voice: 'en-US-Wavenet-D',
|
||||||
|
text: 'Testing useLiveApi option override.',
|
||||||
|
options: { useLiveApi: true },
|
||||||
|
disableTtsCache: true
|
||||||
|
});
|
||||||
|
t.ok(result.filePath.includes('use_live_api=1'), 'options.useLiveApi=true overrides default for standard voice');
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=0'), 'use_gemini_tts remains 0 for standard voice');
|
||||||
|
|
||||||
|
// Test 7: options.useGeminiTts override (force gemini tts without model)
|
||||||
|
result = await synthAudio(stats, {
|
||||||
|
vendor: 'google',
|
||||||
|
credentials: {
|
||||||
|
credentials: {
|
||||||
|
client_email: creds.client_email,
|
||||||
|
private_key: creds.private_key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
language: 'en-US',
|
||||||
|
voice: 'Kore',
|
||||||
|
text: 'Testing useGeminiTts option override.',
|
||||||
|
options: { useGeminiTts: true },
|
||||||
|
disableTtsCache: true
|
||||||
|
});
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=1'), 'options.useGeminiTts=true overrides default');
|
||||||
|
t.ok(result.filePath.includes('use_live_api=0'), 'use_live_api remains 0 without HD voice');
|
||||||
|
|
||||||
|
// Test 8: Both options override together
|
||||||
|
result = await synthAudio(stats, {
|
||||||
|
vendor: 'google',
|
||||||
|
credentials: {
|
||||||
|
credentials: {
|
||||||
|
client_email: creds.client_email,
|
||||||
|
private_key: creds.private_key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
language: 'en-US',
|
||||||
|
voice: 'en-US-Wavenet-D',
|
||||||
|
text: 'Testing both options override.',
|
||||||
|
options: { useLiveApi: true, useGeminiTts: true },
|
||||||
|
disableTtsCache: true
|
||||||
|
});
|
||||||
|
t.ok(result.filePath.includes('use_live_api=1'), 'options.useLiveApi=true works with useGeminiTts');
|
||||||
|
t.ok(result.filePath.includes('use_gemini_tts=1'), 'options.useGeminiTts=true works with useLiveApi');
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
t.end(err);
|
t.end(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user