mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-10-03 23:33:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea1ab301d5 | ||
|
|
0a4994c5a3 | ||
|
|
cb71460189 | ||
|
|
f08efa49b1 | ||
|
|
80eda37ef6 | ||
|
|
7768e58b19 | ||
|
|
6efc99ad83 | ||
|
|
127d01a8c1 | ||
|
|
1900b26d8b | ||
|
|
aa25a6f6d9 | ||
|
|
8dfe17b600 | ||
|
|
5463e9f56e | ||
|
|
2eb36af650 | ||
|
|
b186cbc4f2 |
+67
-50
@@ -53,7 +53,6 @@ const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
|
|||||||
const OpenAI = require('openai');
|
const OpenAI = require('openai');
|
||||||
const getAwsAuthToken = require('./get-aws-sts-token');
|
const getAwsAuthToken = require('./get-aws-sts-token');
|
||||||
|
|
||||||
|
|
||||||
const trimTrailingSilence = (buffer) => {
|
const trimTrailingSilence = (buffer) => {
|
||||||
assert.ok(buffer instanceof Buffer, 'trimTrailingSilence - argument is not a Buffer');
|
assert.ok(buffer instanceof Buffer, 'trimTrailingSilence - argument is not a Buffer');
|
||||||
|
|
||||||
@@ -205,74 +204,74 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
|||||||
const startAt = process.hrtime();
|
const startAt = process.hrtime();
|
||||||
switch (vendor) {
|
switch (vendor) {
|
||||||
case 'google':
|
case 'google':
|
||||||
audioData = await synthGoogle(logger, {credentials, stats, language, voice, gender, text});
|
audioData = await synthGoogle(logger, {credentials, stats, language, voice, gender, key, text});
|
||||||
break;
|
break;
|
||||||
case 'aws':
|
case 'aws':
|
||||||
case 'polly':
|
case 'polly':
|
||||||
vendorLabel = 'aws';
|
vendorLabel = 'aws';
|
||||||
audioData = await synthPolly(createHash, retrieveHash, logger,
|
audioData = await synthPolly(createHash, retrieveHash, logger,
|
||||||
{credentials, stats, language, voice, text, engine, renderForCaching, disableTtsStreaming});
|
{credentials, stats, language, voice, key, text, engine, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'azure':
|
case 'azure':
|
||||||
case 'microsoft':
|
case 'microsoft':
|
||||||
vendorLabel = 'microsoft';
|
vendorLabel = 'microsoft';
|
||||||
audioData = await synthMicrosoft(logger, {credentials, stats, language, voice, text, deploymentId,
|
audioData = await synthMicrosoft(logger, {credentials, stats, language, voice, key, text, deploymentId,
|
||||||
renderForCaching, disableTtsStreaming});
|
renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'nuance':
|
case 'nuance':
|
||||||
model = model || 'enhanced';
|
model = model || 'enhanced';
|
||||||
audioData = await synthNuance(client, logger, {credentials, stats, voice, model, text});
|
audioData = await synthNuance(client, logger, {credentials, stats, voice, model, key, text});
|
||||||
break;
|
break;
|
||||||
case 'nvidia':
|
case 'nvidia':
|
||||||
audioData = await synthNvidia(client, logger, {credentials, stats, language, voice, model, text,
|
audioData = await synthNvidia(client, logger, {credentials, stats, language, voice, model, key, text,
|
||||||
renderForCaching, disableTtsStreaming});
|
renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'ibm':
|
case 'ibm':
|
||||||
audioData = await synthIbm(logger, {credentials, stats, voice, text});
|
audioData = await synthIbm(logger, {credentials, stats, voice, key, text});
|
||||||
break;
|
break;
|
||||||
case 'wellsaid':
|
case 'wellsaid':
|
||||||
audioData = await synthWellSaid(logger, {credentials, stats, language, voice, text});
|
audioData = await synthWellSaid(logger, {credentials, stats, language, voice, key, text});
|
||||||
break;
|
break;
|
||||||
case 'elevenlabs':
|
case 'elevenlabs':
|
||||||
audioData = await synthElevenlabs(logger, {
|
audioData = await synthElevenlabs(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'playht':
|
case 'playht':
|
||||||
audioData = await synthPlayHT(client, logger, {
|
audioData = await synthPlayHT(client, logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'cartesia':
|
case 'cartesia':
|
||||||
audioData = await synthCartesia(logger, {
|
audioData = await synthCartesia(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'inworld':
|
case 'inworld':
|
||||||
audioData = await synthInworld(logger, {
|
audioData = await synthInworld(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'rimelabs':
|
case 'rimelabs':
|
||||||
audioData = await synthRimelabs(logger, {
|
audioData = await synthRimelabs(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'whisper':
|
case 'whisper':
|
||||||
audioData = await synthWhisper(logger, {
|
audioData = await synthWhisper(logger, {
|
||||||
credentials, stats, voice, text, instructions, renderForCaching, disableTtsStreaming});
|
credentials, stats, voice, key, text, instructions, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'verbio':
|
case 'verbio':
|
||||||
audioData = await synthVerbio(client, logger, {
|
audioData = await synthVerbio(client, logger, {
|
||||||
credentials, stats, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, stats, voice, key, text, renderForCaching, disableTtsStreaming});
|
||||||
if (audioData?.filePath) return audioData;
|
if (audioData?.filePath) return audioData;
|
||||||
break;
|
break;
|
||||||
case 'deepgram':
|
case 'deepgram':
|
||||||
audioData = await synthDeepgram(logger, {credentials, stats, model, text,
|
audioData = await synthDeepgram(logger, {credentials, stats, model, key, text,
|
||||||
renderForCaching, disableTtsStreaming});
|
renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'resemble':
|
case 'resemble':
|
||||||
audioData = await synthResemble(logger, {
|
audioData = await synthResemble(logger, {
|
||||||
credentials, stats, voice, text, options, renderForCaching, disableTtsStreaming});
|
credentials, stats, voice, key, text, options, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case vendor.startsWith('custom') ? vendor : 'cant_match_value':
|
case vendor.startsWith('custom') ? vendor : 'cant_match_value':
|
||||||
audioData = await synthCustomVendor(logger,
|
audioData = await synthCustomVendor(logger,
|
||||||
{credentials, stats, language, voice, text});
|
{credentials, stats, language, voice, key, text});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(`synthAudio: unsupported speech vendor ${vendor}`);
|
assert(`synthAudio: unsupported speech vendor ${vendor}`);
|
||||||
@@ -307,12 +306,13 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
|||||||
}
|
}
|
||||||
|
|
||||||
const synthPolly = async(createHash, retrieveHash, logger,
|
const synthPolly = async(createHash, retrieveHash, logger,
|
||||||
{credentials, stats, language, voice, engine, text, renderForCaching, disableTtsStreaming}) => {
|
{credentials, stats, language, voice, engine, key, text, renderForCaching, disableTtsStreaming}) => {
|
||||||
const {region, accessKeyId, secretAccessKey, roleArn} = credentials;
|
const {region, accessKeyId, secretAccessKey, roleArn} = credentials;
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
|
|
||||||
let params = '{';
|
let params = '{';
|
||||||
params += `language=${language}`;
|
params += `language=${language}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
params += ',vendor=aws';
|
params += ',vendor=aws';
|
||||||
if (accessKeyId && secretAccessKey) {
|
if (accessKeyId && secretAccessKey) {
|
||||||
@@ -333,6 +333,7 @@ const synthPolly = async(createHash, retrieveHash, logger,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (region) params += `,region=${region}`;
|
if (region) params += `,region=${region}`;
|
||||||
|
if (engine) params += `,engine=${engine}`;
|
||||||
params += '}';
|
params += '}';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -559,6 +560,7 @@ const synthMicrosoft = async(logger, {
|
|||||||
stats,
|
stats,
|
||||||
language,
|
language,
|
||||||
voice,
|
voice,
|
||||||
|
key,
|
||||||
text,
|
text,
|
||||||
renderForCaching,
|
renderForCaching,
|
||||||
disableTtsStreaming
|
disableTtsStreaming
|
||||||
@@ -588,8 +590,9 @@ const synthMicrosoft = async(logger, {
|
|||||||
}
|
}
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !JAMBONES_DISABLE_AZURE_TTS_STREAMING &&
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !JAMBONES_DISABLE_AZURE_TTS_STREAMING &&
|
||||||
!renderForCaching && !disableTtsStreaming) {
|
!renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${apiKey}`;
|
params += `api_key=${apiKey}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,language=${language}`;
|
params += `,language=${language}`;
|
||||||
params += ',vendor=microsoft';
|
params += ',vendor=microsoft';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
@@ -766,12 +769,13 @@ const synthNuance = async(client, logger, {credentials, stats, voice, model, tex
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthNvidia = async(client, logger, {
|
const synthNvidia = async(client, logger, {
|
||||||
credentials, stats, language, voice, model, text, renderForCaching, disableTtsStreaming
|
credentials, stats, language, voice, model, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {riva_server_uri} = credentials;
|
const {riva_server_uri} = credentials;
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '';
|
||||||
params += `{riva_server_uri=${riva_server_uri}`;
|
params += `{riva_server_uri=${riva_server_uri}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
params += `,language=${language}`;
|
params += `,language=${language}`;
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
@@ -845,20 +849,23 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice, te
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthElevenlabs = async(logger, {
|
const synthElevenlabs = async(logger, {
|
||||||
credentials, options, stats, voice, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, model_id, options: credOpts} = credentials;
|
const {api_key, model_id, options: credOpts} = credentials;
|
||||||
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
|
|
||||||
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += ',vendor=elevenlabs';
|
params += ',vendor=elevenlabs';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
params += `,model_id=${model_id}`;
|
params += `,model_id=${model_id}`;
|
||||||
params += `,optimize_streaming_latency=${opts.optimize_streaming_latency || 2}`;
|
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
|
if (opts.optimize_streaming_latency !== null && opts.optimize_streaming_latency !== undefined) {
|
||||||
|
params += `,optimize_streaming_latency=${opts.optimize_streaming_latency}`;
|
||||||
|
}
|
||||||
if (opts.voice_settings?.similarity_boost) params += `,similarity_boost=${opts.voice_settings.similarity_boost}`;
|
if (opts.voice_settings?.similarity_boost) params += `,similarity_boost=${opts.voice_settings.similarity_boost}`;
|
||||||
if (opts.voice_settings?.stability) params += `,stability=${opts.voice_settings.stability}`;
|
if (opts.voice_settings?.stability) params += `,stability=${opts.voice_settings.stability}`;
|
||||||
if (opts.voice_settings?.style) params += `,style=${opts.voice_settings.style}`;
|
if (opts.voice_settings?.style) params += `,style=${opts.voice_settings.style}`;
|
||||||
@@ -908,7 +915,7 @@ const synthElevenlabs = async(logger, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthPlayHT = async(client, logger, {
|
const synthPlayHT = async(client, logger, {
|
||||||
credentials, options, stats, voice, language, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, voice, language, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, user_id, voice_engine, playht_tts_uri, options: credOpts} = credentials;
|
const {api_key, user_id, voice_engine, playht_tts_uri, options: credOpts} = credentials;
|
||||||
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
@@ -942,8 +949,9 @@ const synthPlayHT = async(client, logger, {
|
|||||||
|
|
||||||
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,user_id=${user_id}`;
|
params += `,user_id=${user_id}`;
|
||||||
params += ',vendor=playht';
|
params += ',vendor=playht';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
@@ -1002,15 +1010,16 @@ const synthPlayHT = async(client, logger, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthInworld = async(logger, {
|
const synthInworld = async(logger, {
|
||||||
credentials, options, stats, voice, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, model_id, options: credOpts} = credentials;
|
const {api_key, model_id, options: credOpts} = credentials;
|
||||||
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
|
|
||||||
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,model_id=${model_id}`;
|
params += `,model_id=${model_id}`;
|
||||||
params += ',vendor=inworld';
|
params += ',vendor=inworld';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
@@ -1066,15 +1075,16 @@ const synthInworld = async(logger, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthRimelabs = async(logger, {
|
const synthRimelabs = async(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, language, voice, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, model_id, options: credOpts} = credentials;
|
const {api_key, model_id, options: credOpts} = credentials;
|
||||||
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
|
|
||||||
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,model_id=${model_id}`;
|
params += `,model_id=${model_id}`;
|
||||||
params += ',vendor=rimelabs';
|
params += ',vendor=rimelabs';
|
||||||
params += `,language=${language}`;
|
params += `,language=${language}`;
|
||||||
@@ -1122,15 +1132,18 @@ const synthRimelabs = async(logger, {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const synthVerbio = async(client, logger, {credentials, stats, voice, text, renderForCaching, disableTtsStreaming}) => {
|
const synthVerbio = async(client, logger, {
|
||||||
|
credentials, stats, voice, key, text, renderForCaching, disableTtsStreaming
|
||||||
|
}) => {
|
||||||
//https://doc.speechcenter.verbio.com/#tag/Text-To-Speech-REST-API
|
//https://doc.speechcenter.verbio.com/#tag/Text-To-Speech-REST-API
|
||||||
if (text.length > 2000) {
|
if (text.length > 2000) {
|
||||||
throw new Error('Verbio cannot synthesize for the text length larger than 2000 characters');
|
throw new Error('Verbio cannot synthesize for the text length larger than 2000 characters');
|
||||||
}
|
}
|
||||||
const token = await getVerbioAccessToken(client, logger, credentials);
|
const token = await getVerbioAccessToken(client, logger, credentials);
|
||||||
if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{access_token=${token.access_token}`;
|
params += `access_token=${token.access_token}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += ',vendor=verbio';
|
params += ',vendor=verbio';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
@@ -1167,13 +1180,14 @@ const synthVerbio = async(client, logger, {credentials, stats, voice, text, rend
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const synthWhisper = async(logger, {credentials, stats, voice, text, instructions,
|
const synthWhisper = async(logger, {credentials, stats, voice, key, text, instructions,
|
||||||
renderForCaching, disableTtsStreaming}) => {
|
renderForCaching, disableTtsStreaming}) => {
|
||||||
const {api_key, model_id, baseURL, timeout, speed} = credentials;
|
const {api_key, model_id, baseURL, timeout, speed} = credentials;
|
||||||
/* if the env is set to stream then bag out, unless we are specifically rendering to generate a cache file */
|
/* if the env is set to stream then bag out, unless we are specifically rendering to generate a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,model_id=${model_id}`;
|
params += `,model_id=${model_id}`;
|
||||||
params += ',vendor=whisper';
|
params += ',vendor=whisper';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
@@ -1215,11 +1229,12 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, instruction
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const synthDeepgram = async(logger, {credentials, stats, model, text, renderForCaching, disableTtsStreaming}) => {
|
const synthDeepgram = async(logger, {credentials, stats, model, key, text, renderForCaching, disableTtsStreaming}) => {
|
||||||
const {api_key, deepgram_tts_uri} = credentials;
|
const {api_key, deepgram_tts_uri} = credentials;
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += ',vendor=deepgram';
|
params += ',vendor=deepgram';
|
||||||
params += `,voice=${model}`;
|
params += `,voice=${model}`;
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
@@ -1255,14 +1270,15 @@ const synthDeepgram = async(logger, {credentials, stats, model, text, renderForC
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthCartesia = async(logger, {
|
const synthCartesia = async(logger, {
|
||||||
credentials, options, stats, voice, language, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, voice, language, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, model_id, embedding, options: credOpts} = credentials;
|
const {api_key, model_id, embedding, options: credOpts} = credentials;
|
||||||
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
|
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += `,model_id=${model_id}`;
|
params += `,model_id=${model_id}`;
|
||||||
params += ',vendor=cartesia';
|
params += ',vendor=cartesia';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
@@ -1325,15 +1341,16 @@ const synthCartesia = async(logger, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const synthResemble = async(logger, {
|
const synthResemble = async(logger, {
|
||||||
credentials, options, stats, voice, text, renderForCaching, disableTtsStreaming
|
credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
const {api_key, resemble_tts_uri, resemble_tts_use_tls} = credentials;
|
const {api_key, resemble_tts_uri, resemble_tts_use_tls} = credentials;
|
||||||
const {project_uuid, use_hd} = options || {};
|
const {project_uuid, use_hd} = options || {};
|
||||||
|
|
||||||
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
||||||
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
let params = '';
|
let params = '{';
|
||||||
params += `{api_key=${api_key}`;
|
params += `api_key=${api_key}`;
|
||||||
|
params += `,playback_id=${key}`;
|
||||||
params += ',vendor=resemble';
|
params += ',vendor=resemble';
|
||||||
params += `,voice=${voice}`;
|
params += `,voice=${voice}`;
|
||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.2.18",
|
"version": "0.2.23",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.2.18",
|
"version": "0.2.23",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"23": "^0.0.0",
|
"23": "^0.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.2.18",
|
"version": "0.2.23",
|
||||||
"description": "TTS-related speech utilities for jambonz",
|
"description": "TTS-related speech utilities for jambonz",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Dave Horton",
|
"author": "Dave Horton",
|
||||||
|
|||||||
Reference in New Issue
Block a user