mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-10-03 23:33:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37fb045431 | ||
|
|
c328df67a2 | ||
|
|
877cba7065 | ||
|
|
35a178b468 | ||
|
|
7327190471 | ||
|
|
e5b5e3d0c6 | ||
|
|
3760be088b | ||
|
|
5cb52eb8ec | ||
|
|
8a390a8edf | ||
|
|
d96ab5cdf3 | ||
|
|
3bf74671c6 |
@@ -3,6 +3,27 @@ const {noopLogger, makeSynthKey} = require('./utils');
|
|||||||
const {JAMBONES_TTS_CACHE_DURATION_MINS} = require('./config');
|
const {JAMBONES_TTS_CACHE_DURATION_MINS} = require('./config');
|
||||||
const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
|
const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
|
||||||
|
|
||||||
|
function getExtensionAndSampleRate(path) {
|
||||||
|
const match = path.match(/\.([^.]*)$/);
|
||||||
|
if (!match) {
|
||||||
|
//default should be wav file.
|
||||||
|
return ['wav', 8000];
|
||||||
|
}
|
||||||
|
|
||||||
|
const extension = match[1];
|
||||||
|
const sampleRateMap = {
|
||||||
|
r8: 8000,
|
||||||
|
r16: 16000,
|
||||||
|
r24: 24000,
|
||||||
|
r44: 44100,
|
||||||
|
r48: 48000,
|
||||||
|
r96: 96000,
|
||||||
|
};
|
||||||
|
|
||||||
|
const sampleRate = sampleRateMap[extension] || 8000;
|
||||||
|
return [extension, sampleRate];
|
||||||
|
}
|
||||||
|
|
||||||
async function addFileToCache(client, logger, path,
|
async function addFileToCache(client, logger, path,
|
||||||
{account_sid, vendor, language, voice, deploymentId, engine, text}) {
|
{account_sid, vendor, language, voice, deploymentId, engine, text}) {
|
||||||
let key;
|
let key;
|
||||||
@@ -17,8 +38,15 @@ async function addFileToCache(client, logger, path,
|
|||||||
engine,
|
engine,
|
||||||
text,
|
text,
|
||||||
});
|
});
|
||||||
|
const [extension, sampleRate] = getExtensionAndSampleRate(path);
|
||||||
const audioBuffer = await fs.readFile(path);
|
const audioBuffer = await fs.readFile(path);
|
||||||
await client.setex(key, EXPIRES, audioBuffer.toString('base64'));
|
await client.setex(key, EXPIRES, JSON.stringify(
|
||||||
|
{
|
||||||
|
audioContent: audioBuffer.toString('base64'),
|
||||||
|
extension,
|
||||||
|
sampleRate
|
||||||
|
}
|
||||||
|
));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err, 'addFileToCache: Error');
|
logger.error(err, 'addFileToCache: Error');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,22 +7,23 @@ const CACHE_EXPIRY = process.env.AWS_STS_SESSION_RESET_EXPIRY || (EXPIRY - 600);
|
|||||||
|
|
||||||
async function getAwsAuthToken(
|
async function getAwsAuthToken(
|
||||||
logger, createHash, retrieveHash,
|
logger, createHash, retrieveHash,
|
||||||
{accessKeyId, secretAccessKey, region, roleArn}) {
|
{speech_credential_sid, accessKeyId, secretAccessKey, region, roleArn}) {
|
||||||
logger = logger || noopLogger;
|
logger = logger || noopLogger;
|
||||||
try {
|
try {
|
||||||
const key = makeAwsKey(roleArn || accessKeyId);
|
// if incase instance profile is used, speech_credential_sid will be used as key to lookup cache
|
||||||
|
const key = makeAwsKey(roleArn || accessKeyId || speech_credential_sid);
|
||||||
const obj = await retrieveHash(key);
|
const obj = await retrieveHash(key);
|
||||||
if (obj) return {...obj, servedFromCache: true};
|
if (obj) return {...obj, servedFromCache: true};
|
||||||
|
/* access token not found in cache, so generate it using STS */
|
||||||
let data;
|
let data;
|
||||||
|
let expiry = CACHE_EXPIRY;
|
||||||
if (roleArn) {
|
if (roleArn) {
|
||||||
const stsClient = new STSClient({ region });
|
const stsClient = new STSClient({ region });
|
||||||
const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY};
|
const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY};
|
||||||
const command = new AssumeRoleCommand(roleToAssume);
|
const command = new AssumeRoleCommand(roleToAssume);
|
||||||
|
|
||||||
data = await stsClient.send(command);
|
data = await stsClient.send(command);
|
||||||
} else {
|
} else if (accessKeyId) {
|
||||||
/* access token not found in cache, so generate it using STS */
|
|
||||||
const stsClient = new STSClient({
|
const stsClient = new STSClient({
|
||||||
region,
|
region,
|
||||||
credentials: {
|
credentials: {
|
||||||
@@ -32,6 +33,26 @@ async function getAwsAuthToken(
|
|||||||
});
|
});
|
||||||
const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY});
|
const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY});
|
||||||
data = await stsClient.send(command);
|
data = await stsClient.send(command);
|
||||||
|
} else {
|
||||||
|
// instance profile is used.
|
||||||
|
const stsClient = new STSClient({ region });
|
||||||
|
const cred = await stsClient.config.credentials();
|
||||||
|
// method in the AWS SDK automatically fetches credentials using the default credential
|
||||||
|
// provider chain. If the credentials come from an instance profile or an environment
|
||||||
|
// variable, their expiration is controlled by AWS and not explicitly by our code.
|
||||||
|
if (cred && cred.expiration) {
|
||||||
|
const currentTime = new Date();
|
||||||
|
const expiryTime = new Date(cred.expiration);
|
||||||
|
const remainingTimeInSeconds = Math.round((expiryTime - currentTime) / 1000);
|
||||||
|
expiry = remainingTimeInSeconds;
|
||||||
|
}
|
||||||
|
data = {
|
||||||
|
Credentials: {
|
||||||
|
AccessKeyId: cred.accessKeyId,
|
||||||
|
SecretAccessKey: cred.secretAccessKey,
|
||||||
|
SessionToken: cred.sessionToken
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const credentials = {
|
const credentials = {
|
||||||
@@ -40,9 +61,11 @@ async function getAwsAuthToken(
|
|||||||
sessionToken: data.Credentials.SessionToken,
|
sessionToken: data.Credentials.SessionToken,
|
||||||
securityToken: data.Credentials.SessionToken
|
securityToken: data.Credentials.SessionToken
|
||||||
};
|
};
|
||||||
|
// Only cache if expiry is good
|
||||||
createHash(key, credentials, CACHE_EXPIRY)
|
if (expiry > 0) {
|
||||||
|
createHash(key, credentials, expiry)
|
||||||
.catch((err) => logger.error(err, `Error saving hash for key ${key}`));
|
.catch((err) => logger.error(err, `Error saving hash for key ${key}`));
|
||||||
|
}
|
||||||
|
|
||||||
return {...credentials, servedFromCache: false};
|
return {...credentials, servedFromCache: false};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
+228
-124
@@ -3,6 +3,7 @@ const fs = require('fs');
|
|||||||
const bent = require('bent');
|
const bent = require('bent');
|
||||||
const ttsGoogle = require('@google-cloud/text-to-speech');
|
const ttsGoogle = require('@google-cloud/text-to-speech');
|
||||||
const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly');
|
const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly');
|
||||||
|
const { CartesiaClient } = require('@cartesia/cartesia-js');
|
||||||
|
|
||||||
const sdk = require('microsoft-cognitiveservices-speech-sdk');
|
const sdk = require('microsoft-cognitiveservices-speech-sdk');
|
||||||
const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
|
const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
|
||||||
@@ -45,7 +46,7 @@ const {
|
|||||||
JAMBONES_HTTP_PROXY_IP,
|
JAMBONES_HTTP_PROXY_IP,
|
||||||
JAMBONES_HTTP_PROXY_PORT,
|
JAMBONES_HTTP_PROXY_PORT,
|
||||||
JAMBONES_TTS_CACHE_DURATION_MINS,
|
JAMBONES_TTS_CACHE_DURATION_MINS,
|
||||||
JAMBONES_EAGERLY_PRE_CACHE_AUDIO,
|
JAMBONES_TTS_TRIM_SILENCE,
|
||||||
} = require('./config');
|
} = require('./config');
|
||||||
const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
|
const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
|
||||||
const OpenAI = require('openai');
|
const OpenAI = require('openai');
|
||||||
@@ -90,13 +91,13 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
|||||||
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId,
|
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId,
|
||||||
disableTtsCache, renderForCaching = false, disableTtsStreaming, options
|
disableTtsCache, renderForCaching = false, disableTtsStreaming, options
|
||||||
}) {
|
}) {
|
||||||
let audioBuffer;
|
let audioData;
|
||||||
let servedFromCache = false;
|
let servedFromCache = false;
|
||||||
let rtt;
|
let rtt;
|
||||||
logger = logger || noopLogger;
|
logger = logger || noopLogger;
|
||||||
|
|
||||||
assert.ok(['google', 'aws', 'polly', 'microsoft', 'wellsaid', 'nuance', 'nvidia', 'ibm', 'elevenlabs',
|
assert.ok(['google', 'aws', 'polly', 'microsoft', 'wellsaid', 'nuance', 'nvidia', 'ibm', 'elevenlabs',
|
||||||
'whisper', 'deepgram', 'playht', 'rimelabs', 'verbio'].includes(vendor) ||
|
'whisper', 'deepgram', 'playht', 'rimelabs', 'verbio', 'cartesia'].includes(vendor) ||
|
||||||
vendor.startsWith('custom'),
|
vendor.startsWith('custom'),
|
||||||
`synthAudio supported vendors are google, aws, microsoft, nuance, nvidia and wellsaid ..etc, not ${vendor}`);
|
`synthAudio supported vendors are google, aws, microsoft, nuance, nvidia and wellsaid ..etc, not ${vendor}`);
|
||||||
if ('google' === vendor) {
|
if ('google' === vendor) {
|
||||||
@@ -157,7 +158,9 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
|||||||
if (!credentials.deepgram_tts_uri) {
|
if (!credentials.deepgram_tts_uri) {
|
||||||
assert.ok(credentials.api_key, 'synthAudio requires api_key when deepgram is used');
|
assert.ok(credentials.api_key, 'synthAudio requires api_key when deepgram is used');
|
||||||
}
|
}
|
||||||
|
} else if ('cartesia' === vendor) {
|
||||||
|
assert.ok(credentials.api_key, 'synthAudio requires api_key when cartesia is used');
|
||||||
|
assert.ok(credentials.model_id, 'synthAudio requires model_id when cartesia is used');
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = makeSynthKey({
|
const key = makeSynthKey({
|
||||||
@@ -166,57 +169,24 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
|||||||
language: language || '',
|
language: language || '',
|
||||||
voice: voice || deploymentId,
|
voice: voice || deploymentId,
|
||||||
engine,
|
engine,
|
||||||
text,
|
text
|
||||||
renderForCaching
|
|
||||||
});
|
});
|
||||||
let filePath;
|
|
||||||
// used only for custom vendor
|
|
||||||
let fileExtension;
|
|
||||||
filePath = makeFilePath({vendor, voice, key, salt, renderForCaching});
|
|
||||||
debug(`synth key is ${key}`);
|
debug(`synth key is ${key}`);
|
||||||
let cached;
|
let cached;
|
||||||
if (!disableTtsCache) {
|
if (!disableTtsCache) {
|
||||||
cached = await client.get(key);
|
cached = await client.get(key);
|
||||||
/**
|
|
||||||
* If we are using tts streaming and also precaching audio, audio could have been cached by streaming (r8)
|
|
||||||
* or here in speech-utils due to precaching (mp3), so we need to check for both keys.
|
|
||||||
*/
|
|
||||||
if (!cached && JAMBONES_EAGERLY_PRE_CACHE_AUDIO) {
|
|
||||||
const preCachekey = makeSynthKey({
|
|
||||||
account_sid,
|
|
||||||
vendor,
|
|
||||||
language: language || '',
|
|
||||||
voice: voice || deploymentId,
|
|
||||||
engine,
|
|
||||||
text,
|
|
||||||
renderForCaching: true
|
|
||||||
});
|
|
||||||
cached = await client.get(preCachekey);
|
|
||||||
if (cached) {
|
|
||||||
// Precache audio is available update filpath with precache file extension.
|
|
||||||
filePath = makeFilePath({vendor, voice, key, salt, renderForCaching: true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cached) {
|
if (cached) {
|
||||||
// found in cache - extend the expiry and use it
|
// found in cache - extend the expiry and use it
|
||||||
debug('result WAS found in cache');
|
debug('result WAS found in cache');
|
||||||
servedFromCache = true;
|
servedFromCache = true;
|
||||||
stats.increment('tts.cache.requests', ['found:yes']);
|
stats.increment('tts.cache.requests', ['found:yes']);
|
||||||
if (vendor.startsWith('custom')) {
|
audioData = JSON.parse(cached);
|
||||||
// custom vendors support multiple mime types such as: mp3, wav, r8, r16 ...etc,
|
// convert base64 audio to buffer
|
||||||
// mime type/file extension is available when http response has header Content-type.
|
audioData.audioContent = Buffer.from(audioData.audioContent, 'base64');
|
||||||
// In cache, file extension is store together with audiBuffer in a json.
|
|
||||||
// Normal cache audio will be base64 string
|
|
||||||
const payload = JSON.parse(cached);
|
|
||||||
filePath = filePath.replace(/\.[^\.]*$/g, payload.fileExtension);
|
|
||||||
audioBuffer = Buffer.from(payload.audioBuffer, 'base64');
|
|
||||||
} else {
|
|
||||||
audioBuffer = Buffer.from(cached, 'base64');
|
|
||||||
}
|
|
||||||
client.expire(key, EXPIRES).catch((err) => logger.info(err, 'Error setting expires'));
|
client.expire(key, EXPIRES).catch((err) => logger.info(err, 'Error setting expires'));
|
||||||
}
|
} else {
|
||||||
if (!cached) {
|
|
||||||
// not found in cache - go get it from speech vendor and add to cache
|
// not found in cache - go get it from speech vendor and add to cache
|
||||||
debug('result was NOT found in cache');
|
debug('result was NOT found in cache');
|
||||||
stats.increment('tts.cache.requests', ['found:no']);
|
stats.increment('tts.cache.requests', ['found:no']);
|
||||||
@@ -224,89 +194,92 @@ 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':
|
||||||
audioBuffer = await synthGoogle(logger, {credentials, stats, language, voice, gender, text});
|
audioData = await synthGoogle(logger, {credentials, stats, language, voice, gender, text});
|
||||||
break;
|
break;
|
||||||
case 'aws':
|
case 'aws':
|
||||||
case 'polly':
|
case 'polly':
|
||||||
vendorLabel = 'aws';
|
vendorLabel = 'aws';
|
||||||
audioBuffer = await synthPolly(createHash, retrieveHash, logger,
|
audioData = await synthPolly(createHash, retrieveHash, logger,
|
||||||
{credentials, stats, language, voice, text, engine});
|
{credentials, stats, language, voice, text, engine});
|
||||||
break;
|
break;
|
||||||
case 'azure':
|
case 'azure':
|
||||||
case 'microsoft':
|
case 'microsoft':
|
||||||
vendorLabel = 'microsoft';
|
vendorLabel = 'microsoft';
|
||||||
audioBuffer = await synthMicrosoft(logger, {credentials, stats, language, voice, text, deploymentId,
|
audioData = await synthMicrosoft(logger, {credentials, stats, language, voice, text, deploymentId,
|
||||||
filePath, renderForCaching, disableTtsStreaming});
|
renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'nuance':
|
case 'nuance':
|
||||||
model = model || 'enhanced';
|
model = model || 'enhanced';
|
||||||
audioBuffer = await synthNuance(client, logger, {credentials, stats, voice, model, text});
|
audioData = await synthNuance(client, logger, {credentials, stats, voice, model, text});
|
||||||
break;
|
break;
|
||||||
case 'nvidia':
|
case 'nvidia':
|
||||||
audioBuffer = await synthNvidia(client, logger, {credentials, stats, language, voice, model, text});
|
audioData = await synthNvidia(client, logger, {credentials, stats, language, voice, model, text});
|
||||||
break;
|
break;
|
||||||
case 'ibm':
|
case 'ibm':
|
||||||
audioBuffer = await synthIbm(logger, {credentials, stats, voice, text});
|
audioData = await synthIbm(logger, {credentials, stats, voice, text});
|
||||||
break;
|
break;
|
||||||
case 'wellsaid':
|
case 'wellsaid':
|
||||||
audioBuffer = await synthWellSaid(logger, {credentials, stats, language, voice, text, filePath});
|
audioData = await synthWellSaid(logger, {credentials, stats, language, voice, text});
|
||||||
break;
|
break;
|
||||||
case 'elevenlabs':
|
case 'elevenlabs':
|
||||||
audioBuffer = await synthElevenlabs(logger, {
|
audioData = await synthElevenlabs(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming, filePath
|
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 'playht':
|
case 'playht':
|
||||||
audioBuffer = await synthPlayHT(client, logger, {
|
audioData = await synthPlayHT(client, logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming, filePath
|
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
});
|
break;
|
||||||
|
case 'cartesia':
|
||||||
|
audioData = await synthCartesia(logger, {
|
||||||
|
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'rimelabs':
|
case 'rimelabs':
|
||||||
audioBuffer = await synthRimelabs(logger, {
|
audioData = await synthRimelabs(logger, {
|
||||||
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming, filePath
|
credentials, options, stats, language, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 'whisper':
|
case 'whisper':
|
||||||
audioBuffer = await synthWhisper(logger, {
|
audioData = await synthWhisper(logger, {
|
||||||
credentials, stats, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, stats, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case 'verbio':
|
case 'verbio':
|
||||||
audioBuffer = await synthVerbio(client, logger, {
|
audioData = await synthVerbio(client, logger, {
|
||||||
credentials, stats, voice, text, renderForCaching, disableTtsStreaming});
|
credentials, stats, voice, text, renderForCaching, disableTtsStreaming});
|
||||||
if (audioBuffer?.filePath) return audioBuffer;
|
if (audioData?.filePath) return audioData;
|
||||||
break;
|
break;
|
||||||
case 'deepgram':
|
case 'deepgram':
|
||||||
audioBuffer = await synthDeepgram(logger, {credentials, stats, model, text,
|
audioData = await synthDeepgram(logger, {credentials, stats, model, text,
|
||||||
renderForCaching, disableTtsStreaming});
|
renderForCaching, disableTtsStreaming});
|
||||||
break;
|
break;
|
||||||
case vendor.startsWith('custom') ? vendor : 'cant_match_value':
|
case vendor.startsWith('custom') ? vendor : 'cant_match_value':
|
||||||
({ audioBuffer, filePath, fileExtension } = await synthCustomVendor(logger,
|
audioData = await synthCustomVendor(logger,
|
||||||
{credentials, stats, language, voice, text, filePath}));
|
{credentials, stats, language, voice, text});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(`synthAudio: unsupported speech vendor ${vendor}`);
|
assert(`synthAudio: unsupported speech vendor ${vendor}`);
|
||||||
}
|
}
|
||||||
if ('filePath' in audioBuffer) return audioBuffer;
|
if ('filePath' in audioData) return audioData;
|
||||||
const diff = process.hrtime(startAt);
|
const diff = process.hrtime(startAt);
|
||||||
const time = diff[0] * 1e3 + diff[1] * 1e-6;
|
const time = diff[0] * 1e3 + diff[1] * 1e-6;
|
||||||
rtt = time.toFixed(0);
|
rtt = time.toFixed(0);
|
||||||
stats.histogram('tts.response_time', rtt, [`vendor:${vendorLabel}`]);
|
stats.histogram('tts.response_time', rtt, [`vendor:${vendorLabel}`]);
|
||||||
debug(`tts rtt time for ${text.length} chars on ${vendorLabel}: ${rtt}`);
|
debug(`tts rtt time for ${text.length} chars on ${vendorLabel}: ${rtt}`);
|
||||||
logger.info(`tts rtt time for ${text.length} chars on ${vendorLabel}: ${rtt}`);
|
logger.info(`tts rtt time for ${text.length} chars on ${vendorLabel}: ${rtt}`);
|
||||||
|
// Save audio json to cache
|
||||||
const base64Audio = audioBuffer.toString('base64');
|
client.setex(key, EXPIRES, JSON.stringify({
|
||||||
const cacheContent = vendor.startsWith('custom') ?
|
...audioData,
|
||||||
JSON.stringify({
|
audioContent: audioData.audioContent?.toString('base64')
|
||||||
audioBuffer: base64Audio,
|
}))
|
||||||
fileExtension
|
|
||||||
}) : base64Audio;
|
|
||||||
|
|
||||||
client.setex(key, EXPIRES, cacheContent)
|
|
||||||
.catch((err) => logger.error(err, `error calling setex on key ${key}`));
|
.catch((err) => logger.error(err, `error calling setex on key ${key}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.writeFile(filePath, audioBuffer, (err) => {
|
const { audioContent, extension } = audioData;
|
||||||
|
const filePath = makeFilePath({
|
||||||
|
key,
|
||||||
|
salt,
|
||||||
|
extension
|
||||||
|
});
|
||||||
|
fs.writeFile(filePath, audioContent, (err) => {
|
||||||
if (err) return reject(err);
|
if (err) return reject(err);
|
||||||
resolve({filePath, servedFromCache, rtt});
|
resolve({filePath, servedFromCache, rtt});
|
||||||
});
|
});
|
||||||
@@ -361,7 +334,13 @@ const synthPolly = async(createHash, retrieveHash, logger,
|
|||||||
.on('data', (chunk) => {
|
.on('data', (chunk) => {
|
||||||
chunks.push(chunk);
|
chunks.push(chunk);
|
||||||
})
|
})
|
||||||
.on('end', () => resolve(Buffer.concat(chunks)));
|
.on('end', () => resolve(
|
||||||
|
{
|
||||||
|
audioContent: Buffer.concat(chunks),
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
}
|
||||||
|
));
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synthAudio: Error synthesizing speech using aws polly');
|
logger.info({err}, 'synthAudio: Error synthesizing speech using aws polly');
|
||||||
@@ -403,7 +382,11 @@ const synthGoogle = async(logger, {credentials, stats, language, voice, gender,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wav = await post('/v1beta1/text:synthesize', payload);
|
const wav = await post('/v1beta1/text:synthesize', payload);
|
||||||
return Buffer.from(wav.audioContent, 'base64');
|
return {
|
||||||
|
audioContent: Buffer.from(wav.audioContent, 'base64'),
|
||||||
|
extension: 'wav',
|
||||||
|
sampleRate: 24000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err: await err.text()}, 'synthGoogle returned error');
|
logger.info({err: await err.text()}, 'synthGoogle returned error');
|
||||||
throw err;
|
throw err;
|
||||||
@@ -424,7 +407,11 @@ const synthGoogle = async(logger, {credentials, stats, language, voice, gender,
|
|||||||
const responses = await client.synthesizeSpeech(opts);
|
const responses = await client.synthesizeSpeech(opts);
|
||||||
stats.increment('tts.count', ['vendor:google', 'accepted:yes']);
|
stats.increment('tts.count', ['vendor:google', 'accepted:yes']);
|
||||||
client.close();
|
client.close();
|
||||||
return responses[0].audioContent;
|
return {
|
||||||
|
audioContent: responses[0].audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
logger.info({err, opts}, 'synthAudio: Error synthesizing speech using google');
|
logger.info({err, opts}, 'synthAudio: Error synthesizing speech using google');
|
||||||
@@ -455,7 +442,11 @@ const synthIbm = async(logger, {credentials, stats, voice, text}) => {
|
|||||||
for await (const chunk of r.result) {
|
for await (const chunk of r.result) {
|
||||||
chunks.push(chunk);
|
chunks.push(chunk);
|
||||||
}
|
}
|
||||||
return Buffer.concat(chunks);
|
return {
|
||||||
|
audioContent: Buffer.concat(chunks),
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err, params}, 'synthAudio: Error synthesizing speech using ibm');
|
logger.info({err, params}, 'synthAudio: Error synthesizing speech using ibm');
|
||||||
stats.increment('tts.count', ['vendor:ibm', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:ibm', 'accepted:no']);
|
||||||
@@ -465,11 +456,9 @@ const synthIbm = async(logger, {credentials, stats, voice, text}) => {
|
|||||||
|
|
||||||
async function _synthOnPremMicrosoft(logger, {
|
async function _synthOnPremMicrosoft(logger, {
|
||||||
credentials,
|
credentials,
|
||||||
stats,
|
|
||||||
language,
|
language,
|
||||||
voice,
|
voice,
|
||||||
text,
|
text
|
||||||
filePath
|
|
||||||
}) {
|
}) {
|
||||||
const {use_custom_tts, custom_tts_endpoint_url, api_key} = credentials;
|
const {use_custom_tts, custom_tts_endpoint_url, api_key} = credentials;
|
||||||
let content = text;
|
let content = text;
|
||||||
@@ -491,15 +480,19 @@ async function _synthOnPremMicrosoft(logger, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const trimSilence = filePath.endsWith('.r8');
|
const trimSilence = JAMBONES_TTS_TRIM_SILENCE;
|
||||||
const post = bent('POST', 'buffer', {
|
const post = bent('POST', 'buffer', {
|
||||||
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
|
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
|
||||||
'Content-Type': 'application/ssml+xml',
|
'Content-Type': 'application/ssml+xml',
|
||||||
'User-Agent': 'Jambonz',
|
'User-Agent': 'Jambonz',
|
||||||
...(api_key && {'Ocp-Apim-Subscription-Key': api_key})
|
...(api_key && {'Ocp-Apim-Subscription-Key': api_key})
|
||||||
});
|
});
|
||||||
const mp3 = await post(custom_tts_endpoint_url, content);
|
const audioContent = await post(custom_tts_endpoint_url, content);
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: trimSilence ? 'r8' : 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, '_synthMicrosoftByHttp returned error');
|
logger.info({err}, '_synthMicrosoftByHttp returned error');
|
||||||
throw err;
|
throw err;
|
||||||
@@ -512,7 +505,6 @@ const synthMicrosoft = async(logger, {
|
|||||||
language,
|
language,
|
||||||
voice,
|
voice,
|
||||||
text,
|
text,
|
||||||
filePath,
|
|
||||||
renderForCaching,
|
renderForCaching,
|
||||||
disableTtsStreaming
|
disableTtsStreaming
|
||||||
}) => {
|
}) => {
|
||||||
@@ -555,17 +547,18 @@ const synthMicrosoft = async(logger, {
|
|||||||
rtt: 0
|
rtt: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// Azure Onprem
|
||||||
if (use_custom_tts && custom_tts_endpoint_url) {
|
if (use_custom_tts && custom_tts_endpoint_url) {
|
||||||
return await _synthOnPremMicrosoft(logger, {
|
return await _synthOnPremMicrosoft(logger, {
|
||||||
credentials,
|
credentials,
|
||||||
stats,
|
stats,
|
||||||
language,
|
language,
|
||||||
voice,
|
voice,
|
||||||
text,
|
text
|
||||||
filePath
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const trimSilence = filePath.endsWith('.r8');
|
// Azure hosted service
|
||||||
|
const trimSilence = JAMBONES_TTS_TRIM_SILENCE;
|
||||||
const speechConfig = SpeechConfig.fromSubscription(apiKey, region);
|
const speechConfig = SpeechConfig.fromSubscription(apiKey, region);
|
||||||
speechConfig.speechSynthesisLanguage = language;
|
speechConfig.speechSynthesisLanguage = language;
|
||||||
speechConfig.speechSynthesisVoiceName = voice;
|
speechConfig.speechSynthesisVoiceName = voice;
|
||||||
@@ -600,7 +593,11 @@ const synthMicrosoft = async(logger, {
|
|||||||
case ResultReason.SynthesizingAudioCompleted:
|
case ResultReason.SynthesizingAudioCompleted:
|
||||||
let buffer = Buffer.from(result.audioData);
|
let buffer = Buffer.from(result.audioData);
|
||||||
if (trimSilence) buffer = trimTrailingSilence(buffer);
|
if (trimSilence) buffer = trimTrailingSilence(buffer);
|
||||||
resolve(buffer);
|
resolve({
|
||||||
|
audioContent: buffer,
|
||||||
|
extension: trimSilence ? 'r8' : 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
});
|
||||||
synthesizer.close();
|
synthesizer.close();
|
||||||
stats.increment('tts.count', ['vendor:microsoft', 'accepted:yes']);
|
stats.increment('tts.count', ['vendor:microsoft', 'accepted:yes']);
|
||||||
break;
|
break;
|
||||||
@@ -630,11 +627,15 @@ const synthWellSaid = async(logger, {credentials, stats, language, voice, gender
|
|||||||
'Accept': 'audio/mpeg',
|
'Accept': 'audio/mpeg',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
const mp3 = await post('/v1/tts/stream', {
|
const audioContent = await post('/v1/tts/stream', {
|
||||||
text,
|
text,
|
||||||
speaker_id: voice
|
speaker_id: voice
|
||||||
});
|
});
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'testWellSaidTts returned error');
|
logger.info({err}, 'testWellSaidTts returned error');
|
||||||
throw err;
|
throw err;
|
||||||
@@ -671,8 +672,8 @@ const synthNuance = async(client, logger, {credentials, stats, voice, model, tex
|
|||||||
t.setText(text);
|
t.setText(text);
|
||||||
input.setText(t);
|
input.setText(t);
|
||||||
}
|
}
|
||||||
|
const sampleRate = 8000;
|
||||||
pcm.setSampleRateHz(8000);
|
pcm.setSampleRateHz(sampleRate);
|
||||||
f.setPcm(pcm);
|
f.setPcm(pcm);
|
||||||
p.setAudioFormat(f);
|
p.setAudioFormat(f);
|
||||||
v.setName(voice);
|
v.setName(voice);
|
||||||
@@ -696,7 +697,11 @@ const synthNuance = async(client, logger, {credentials, stats, voice, model, tex
|
|||||||
const details = status.getDetails();
|
const details = status.getDetails();
|
||||||
return reject({code, message, details});
|
return reject({code, message, details});
|
||||||
}
|
}
|
||||||
resolve(Buffer.from(response.getAudio()));
|
resolve({
|
||||||
|
audioContent: Buffer.from(response.getAudio()),
|
||||||
|
extension: 'r8',
|
||||||
|
sampleRate
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -704,12 +709,13 @@ const synthNuance = async(client, logger, {credentials, stats, voice, model, tex
|
|||||||
const synthNvidia = async(client, logger, {credentials, stats, language, voice, model, text}) => {
|
const synthNvidia = async(client, logger, {credentials, stats, language, voice, model, text}) => {
|
||||||
const {riva_server_uri} = credentials;
|
const {riva_server_uri} = credentials;
|
||||||
let rivaClient, request;
|
let rivaClient, request;
|
||||||
|
const sampleRate = 8000;
|
||||||
try {
|
try {
|
||||||
rivaClient = await createRivaClient(riva_server_uri);
|
rivaClient = await createRivaClient(riva_server_uri);
|
||||||
request = new SynthesizeSpeechRequest();
|
request = new SynthesizeSpeechRequest();
|
||||||
request.setVoiceName(voice);
|
request.setVoiceName(voice);
|
||||||
request.setLanguageCode(language);
|
request.setLanguageCode(language);
|
||||||
request.setSampleRateHz(8000);
|
request.setSampleRateHz(sampleRate);
|
||||||
request.setEncoding(AudioEncoding.LINEAR_PCM);
|
request.setEncoding(AudioEncoding.LINEAR_PCM);
|
||||||
request.setText(text);
|
request.setText(text);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -723,7 +729,11 @@ const synthNvidia = async(client, logger, {credentials, stats, language, voice,
|
|||||||
logger.info({err, voice, language}, 'error synthesizing speech using Nvidia');
|
logger.info({err, voice, language}, 'error synthesizing speech using Nvidia');
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
resolve(Buffer.from(response.getAudio()));
|
resolve({
|
||||||
|
audioContent: Buffer.from(response.getAudio()),
|
||||||
|
extension: 'r8',
|
||||||
|
sampleRate
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -745,14 +755,13 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice, te
|
|||||||
text
|
text
|
||||||
});
|
});
|
||||||
|
|
||||||
const regex = /\.[^\.]*$/g;
|
|
||||||
const mime = response.headers['content-type'];
|
const mime = response.headers['content-type'];
|
||||||
const buffer = await response.arrayBuffer();
|
const buffer = await response.arrayBuffer();
|
||||||
const fileExtension = getFileExtFromMime(mime);
|
const [extension, sampleRate] = getFileExtFromMime(mime);
|
||||||
return {
|
return {
|
||||||
audioBuffer: buffer,
|
audioContent: buffer,
|
||||||
filePath: filePath.replace(regex, fileExtension),
|
extension,
|
||||||
fileExtension
|
sampleRate
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, `Vendor ${vendor} returned error`);
|
logger.info({err}, `Vendor ${vendor} returned error`);
|
||||||
@@ -798,7 +807,7 @@ const synthElevenlabs = async(logger, {
|
|||||||
'Accept': 'audio/mpeg',
|
'Accept': 'audio/mpeg',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
const mp3 = await post(`/v1/text-to-speech/${voice}${optimize_streaming_latency}`, {
|
const audioContent = await post(`/v1/text-to-speech/${voice}${optimize_streaming_latency}`, {
|
||||||
text,
|
text,
|
||||||
model_id,
|
model_id,
|
||||||
voice_settings: {
|
voice_settings: {
|
||||||
@@ -807,7 +816,11 @@ const synthElevenlabs = async(logger, {
|
|||||||
},
|
},
|
||||||
...opts
|
...opts
|
||||||
});
|
});
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth Elevenlabs returned error');
|
logger.info({err}, 'synth Elevenlabs returned error');
|
||||||
stats.increment('tts.count', ['vendor:elevenlabs', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:elevenlabs', 'accepted:no']);
|
||||||
@@ -889,7 +902,7 @@ const synthPlayHT = async(client, logger, {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
|
|
||||||
const mp3 = await post(synthesizeUrl, {
|
const audioContent = await post(synthesizeUrl, {
|
||||||
text,
|
text,
|
||||||
...(voice_engine === 'Play3.0' && { language }),
|
...(voice_engine === 'Play3.0' && { language }),
|
||||||
voice,
|
voice,
|
||||||
@@ -898,7 +911,11 @@ const synthPlayHT = async(client, logger, {
|
|||||||
sample_rate: 8000,
|
sample_rate: 8000,
|
||||||
...opts
|
...opts
|
||||||
});
|
});
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth PlayHT returned error');
|
logger.info({err}, 'synth PlayHT returned error');
|
||||||
stats.increment('tts.count', ['vendor:playht', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:playht', 'accepted:no']);
|
||||||
@@ -937,14 +954,19 @@ const synthRimelabs = async(logger, {
|
|||||||
'Accept': 'audio/mp3',
|
'Accept': 'audio/mp3',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
const mp3 = await post('/v1/rime-tts', {
|
const sampleRate = 8000;
|
||||||
|
const audioContent = await post('/v1/rime-tts', {
|
||||||
speaker: voice,
|
speaker: voice,
|
||||||
text,
|
text,
|
||||||
modelId: model_id,
|
modelId: model_id,
|
||||||
samplingRate: 8000,
|
samplingRate: sampleRate,
|
||||||
...opts
|
...opts
|
||||||
});
|
});
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth rimelabs returned error');
|
logger.info({err}, 'synth rimelabs returned error');
|
||||||
stats.increment('tts.count', ['vendor:rimelabs', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:rimelabs', 'accepted:no']);
|
||||||
@@ -978,13 +1000,17 @@ const synthVerbio = async(client, logger, {credentials, stats, voice, text, rend
|
|||||||
'User-Agent': 'jambonz',
|
'User-Agent': 'jambonz',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
const r8 = await post('/api/v1/synthesize', {
|
const audioContent = await post('/api/v1/synthesize', {
|
||||||
voice_id: voice,
|
voice_id: voice,
|
||||||
output_sample_rate: '8k',
|
output_sample_rate: '8k',
|
||||||
output_encoding: 'pcm16',
|
output_encoding: 'pcm16',
|
||||||
text
|
text
|
||||||
});
|
});
|
||||||
return r8;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'r8',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth Verbio returned error');
|
logger.info({err}, 'synth Verbio returned error');
|
||||||
stats.increment('tts.count', ['vendor:verbio', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:verbio', 'accepted:no']);
|
||||||
@@ -1024,7 +1050,11 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, renderForCa
|
|||||||
input: text,
|
input: text,
|
||||||
response_format: 'mp3'
|
response_format: 'mp3'
|
||||||
});
|
});
|
||||||
return Buffer.from(await mp3.arrayBuffer());
|
return {
|
||||||
|
audioContent: Buffer.from(await mp3.arrayBuffer()),
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth whisper returned error');
|
logger.info({err}, 'synth whisper returned error');
|
||||||
stats.increment('tts.count', ['vendor:openai', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:openai', 'accepted:no']);
|
||||||
@@ -1056,10 +1086,14 @@ const synthDeepgram = async(logger, {credentials, stats, model, text, renderForC
|
|||||||
'Accept': 'audio/mpeg',
|
'Accept': 'audio/mpeg',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
const mp3 = await post(`/v1/speak?model=${model}`, {
|
const audioContent = await post(`/v1/speak?model=${model}`, {
|
||||||
text
|
text
|
||||||
});
|
});
|
||||||
return mp3;
|
return {
|
||||||
|
audioContent,
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate: 8000
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'synth Deepgram returned error');
|
logger.info({err}, 'synth Deepgram returned error');
|
||||||
stats.increment('tts.count', ['vendor:deepgram', 'accepted:no']);
|
stats.increment('tts.count', ['vendor:deepgram', 'accepted:no']);
|
||||||
@@ -1067,26 +1101,96 @@ const synthDeepgram = async(logger, {credentials, stats, model, text, renderForC
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const synthCartesia = async(logger, {
|
||||||
|
credentials, options, stats, voice, language, text, renderForCaching, disableTtsStreaming
|
||||||
|
}) => {
|
||||||
|
const {api_key, model_id, embedding, options: credOpts} = credentials;
|
||||||
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
||||||
|
|
||||||
|
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
||||||
|
let params = '';
|
||||||
|
params += `{api_key=${api_key}`;
|
||||||
|
params += `,model_id=${model_id}`;
|
||||||
|
params += ',vendor=cartesia';
|
||||||
|
params += `,voice=${voice}`;
|
||||||
|
params += ',write_cache_file=1';
|
||||||
|
params += `,language=${language}`;
|
||||||
|
params += `,voice_mode=${embedding ? 'embedding' : 'id'}`;
|
||||||
|
if (embedding) params += `,embedding=${embedding}`;
|
||||||
|
if (opts.speed) params += `,speed=${opts.speed}`;
|
||||||
|
if (opts.emotion) params += `,emotion=${opts.emotion}`;
|
||||||
|
params += '}';
|
||||||
|
|
||||||
|
return {
|
||||||
|
filePath: `say:${params}${text.replace(/\n/g, ' ').replace(/\r/g, ' ')}`,
|
||||||
|
servedFromCache: false,
|
||||||
|
rtt: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const client = new CartesiaClient({ apiKey: api_key });
|
||||||
|
const sampleRate = 48000;
|
||||||
|
const mp3 = await client.tts.bytes({
|
||||||
|
modelId: model_id,
|
||||||
|
transcript: text,
|
||||||
|
voice: {
|
||||||
|
mode: embedding ? 'embedding' : 'id',
|
||||||
|
...(embedding ?
|
||||||
|
{
|
||||||
|
embedding: embedding.split(',').map(Number)
|
||||||
|
} :
|
||||||
|
{
|
||||||
|
id: voice
|
||||||
|
}
|
||||||
|
),
|
||||||
|
...(opts.speed || opts.emotion && {
|
||||||
|
experimentalControls: {
|
||||||
|
...(opts.speed !== null && opts.speed !== undefined && {speed: opts.speed}),
|
||||||
|
...(opts.emotion && {emotion: opts.emotion}),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
language: language,
|
||||||
|
outputFormat: {
|
||||||
|
container: 'mp3',
|
||||||
|
bitRate: 128000,
|
||||||
|
sampleRate
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
audioContent: Buffer.from(mp3),
|
||||||
|
extension: 'mp3',
|
||||||
|
sampleRate
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
logger.info({err}, 'synth Cartesia returned error');
|
||||||
|
stats.increment('tts.count', ['vendor:cartesia', 'accepted:no']);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
const getFileExtFromMime = (mime) => {
|
const getFileExtFromMime = (mime) => {
|
||||||
switch (mime) {
|
switch (mime) {
|
||||||
case 'audio/wav':
|
case 'audio/wav':
|
||||||
case 'audio/x-wav':
|
case 'audio/x-wav':
|
||||||
return '.wav';
|
return ['wav', 8000];
|
||||||
case /audio\/l16.*rate=8000/.test(mime) ? mime : 'cant match value':
|
case /audio\/l16.*rate=8000/.test(mime) ? mime : 'cant match value':
|
||||||
return '.r8';
|
return ['r8', 8000];
|
||||||
case /audio\/l16.*rate=16000/.test(mime) ? mime : 'cant match value':
|
case /audio\/l16.*rate=16000/.test(mime) ? mime : 'cant match value':
|
||||||
return '.r16';
|
return ['r16', 16000];
|
||||||
case /audio\/l16.*rate=24000/.test(mime) ? mime : 'cant match value':
|
case /audio\/l16.*rate=24000/.test(mime) ? mime : 'cant match value':
|
||||||
return '.r24';
|
return ['r24', 24000];
|
||||||
case /audio\/l16.*rate=32000/.test(mime) ? mime : 'cant match value':
|
case /audio\/l16.*rate=32000/.test(mime) ? mime : 'cant match value':
|
||||||
return '.r32';
|
return ['r32', 32000];
|
||||||
case /audio\/l16.*rate=48000/.test(mime) ? mime : 'cant match value':
|
case /audio\/l16.*rate=48000/.test(mime) ? mime : 'cant match value':
|
||||||
return '.r48';
|
return ['r48', 48000];
|
||||||
case 'audio/mpeg':
|
case 'audio/mpeg':
|
||||||
case 'audio/mp3':
|
case 'audio/mp3':
|
||||||
return '.mp3';
|
return ['mp3', 8000];
|
||||||
default:
|
default:
|
||||||
return '.wav';
|
return ['wav', 8000];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-52
@@ -6,7 +6,7 @@ const pool = new Pool('https://auth.crt.nuance.com');
|
|||||||
const NUANCE_AUTH_ENDPOINT = 'tts.api.nuance.com:443';
|
const NUANCE_AUTH_ENDPOINT = 'tts.api.nuance.com:443';
|
||||||
const grpc = require('@grpc/grpc-js');
|
const grpc = require('@grpc/grpc-js');
|
||||||
const formurlencoded = require('form-urlencoded');
|
const formurlencoded = require('form-urlencoded');
|
||||||
const { JAMBONES_DISABLE_TTS_STREAMING, JAMBONES_TTS_TRIM_SILENCE, TMP_FOLDER, HTTP_TIMEOUT } = require('./config');
|
const { TMP_FOLDER, HTTP_TIMEOUT } = require('./config');
|
||||||
|
|
||||||
const debug = require('debug')('jambonz:realtimedb-helpers');
|
const debug = require('debug')('jambonz:realtimedb-helpers');
|
||||||
/**
|
/**
|
||||||
@@ -17,67 +17,19 @@ const debug = require('debug')('jambonz:realtimedb-helpers');
|
|||||||
//const nuanceClientMap = new Map();
|
//const nuanceClientMap = new Map();
|
||||||
|
|
||||||
function makeSynthKey({
|
function makeSynthKey({
|
||||||
account_sid = '', vendor, language, voice, engine = '', text,
|
account_sid = '', vendor, language, voice, engine = '', text}) {
|
||||||
renderForCaching = false}) {
|
|
||||||
const hash = crypto.createHash('sha1');
|
const hash = crypto.createHash('sha1');
|
||||||
hash.update(`${language}:${vendor}:${voice}:${engine}:${text}`);
|
hash.update(`${language}:${vendor}:${voice}:${engine}:${text}`);
|
||||||
const hexHashKey = hash.digest('hex');
|
const hexHashKey = hash.digest('hex');
|
||||||
const accountKey = account_sid ? `:${account_sid}` : '';
|
const accountKey = account_sid ? `:${account_sid}` : '';
|
||||||
const namespace = vendor.startsWith('custom') ? vendor : getFileExtension({vendor, voice, renderForCaching});
|
const key = `tts${accountKey}:${hexHashKey}`;
|
||||||
const key = `tts${accountKey}:${namespace}:${hexHashKey}`;
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeFilePath({vendor, voice, key, salt = '', renderForCaching = false}) {
|
function makeFilePath({key, salt = '', extension}) {
|
||||||
const extension = getFileExtension({vendor, renderForCaching, voice});
|
|
||||||
return `${TMP_FOLDER}/${key.replace('tts:', `tts-${salt}`)}.${extension}`;
|
return `${TMP_FOLDER}/${key.replace('tts:', `tts-${salt}`)}.${extension}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileExtension({vendor, voice, renderForCaching = false}) {
|
|
||||||
const mp3Extension = 'mp3';
|
|
||||||
const r8Extension = 'r8';
|
|
||||||
const wavExtension = 'wav';
|
|
||||||
|
|
||||||
switch (vendor) {
|
|
||||||
case 'azure':
|
|
||||||
case 'microsoft':
|
|
||||||
if (!renderForCaching && !JAMBONES_DISABLE_TTS_STREAMING || JAMBONES_TTS_TRIM_SILENCE) {
|
|
||||||
return r8Extension;
|
|
||||||
} else {
|
|
||||||
return mp3Extension;
|
|
||||||
}
|
|
||||||
case 'deepgram':
|
|
||||||
case 'elevenlabs':
|
|
||||||
case 'rimelabs':
|
|
||||||
case 'playht':
|
|
||||||
if (renderForCaching || JAMBONES_DISABLE_TTS_STREAMING) {
|
|
||||||
return mp3Extension;
|
|
||||||
} else {
|
|
||||||
return r8Extension;
|
|
||||||
}
|
|
||||||
case 'nuance':
|
|
||||||
case 'nvidia':
|
|
||||||
case 'verbio':
|
|
||||||
return r8Extension;
|
|
||||||
case 'google':
|
|
||||||
// google voice cloning just support wav.
|
|
||||||
if (typeof voice === 'object' && voice.voice_cloning_key) {
|
|
||||||
return wavExtension;
|
|
||||||
} else {
|
|
||||||
return mp3Extension;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
// If vendor is custom
|
|
||||||
if (vendor.startsWith('custom')) {
|
|
||||||
if (renderForCaching || JAMBONES_DISABLE_TTS_STREAMING) {
|
|
||||||
return mp3Extension;
|
|
||||||
} else {
|
|
||||||
return r8Extension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mp3Extension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const noopLogger = {
|
const noopLogger = {
|
||||||
info: () => {},
|
info: () => {},
|
||||||
|
|||||||
Generated
+218
-43
@@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.1.22",
|
"version": "0.2.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.1.22",
|
"version": "0.2.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-polly": "^3.496.0",
|
"@aws-sdk/client-polly": "^3.496.0",
|
||||||
"@aws-sdk/client-sts": "^3.496.0",
|
"@aws-sdk/client-sts": "^3.496.0",
|
||||||
|
"@cartesia/cartesia-js": "^2.1.0",
|
||||||
"@google-cloud/text-to-speech": "^5.5.0",
|
"@google-cloud/text-to-speech": "^5.5.0",
|
||||||
"@grpc/grpc-js": "^1.9.14",
|
"@grpc/grpc-js": "^1.9.14",
|
||||||
"@jambonz/realtimedb-helpers": "^0.8.7",
|
"@jambonz/realtimedb-helpers": "^0.8.7",
|
||||||
@@ -1173,6 +1174,92 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cartesia/cartesia-js/-/cartesia-js-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-r4uqhFWxVmFbm0A6aDeY0y3RVJHAc6PQ8hTwHmb2ZO2kmyAP4WoZdEEQ9GIU/5c1XpV5n3Y/y6zKjMzUwgG64A==",
|
||||||
|
"dependencies": {
|
||||||
|
"emittery": "^0.13.1",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"form-data-encoder": "^4.0.2",
|
||||||
|
"formdata-node": "^6.0.3",
|
||||||
|
"human-id": "^4.1.1",
|
||||||
|
"node-fetch": "2.7.0",
|
||||||
|
"qs": "6.11.2",
|
||||||
|
"readable-stream": "^4.5.2",
|
||||||
|
"url-join": "4.0.1",
|
||||||
|
"ws": "^8.15.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js/node_modules/form-data": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js/node_modules/form-data-encoder": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js/node_modules/formdata-node": {
|
||||||
|
"version": "6.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-6.0.3.tgz",
|
||||||
|
"integrity": "sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js/node_modules/readable-stream": {
|
||||||
|
"version": "4.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
|
||||||
|
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"process": "^0.11.10",
|
||||||
|
"string_decoder": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cartesia/cartesia-js/node_modules/ws": {
|
||||||
|
"version": "8.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@eslint-community/eslint-utils": {
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
||||||
@@ -2691,7 +2778,6 @@
|
|||||||
"version": "6.0.3",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||||
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
||||||
"dev": true,
|
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -2752,7 +2838,6 @@
|
|||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
||||||
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -3035,7 +3120,6 @@
|
|||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
||||||
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -3152,6 +3236,18 @@
|
|||||||
"integrity": "sha512-xT1HVAu5xFn7bDfkjGQi9dNpMqGchUkebwf1GL7cZN32NSwwlHRPMSDJ1KN6HkS0bWUtndbSQZqvpQftKG2uFQ==",
|
"integrity": "sha512-xT1HVAu5xFn7bDfkjGQi9dNpMqGchUkebwf1GL7cZN32NSwwlHRPMSDJ1KN6HkS0bWUtndbSQZqvpQftKG2uFQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/emittery": {
|
||||||
|
"version": "0.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz",
|
||||||
|
"integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sindresorhus/emittery?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/emoji-regex": {
|
"node_modules/emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@@ -3222,7 +3318,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
||||||
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"get-intrinsic": "^1.2.4"
|
"get-intrinsic": "^1.2.4"
|
||||||
},
|
},
|
||||||
@@ -3234,7 +3329,6 @@
|
|||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
@@ -3580,7 +3674,6 @@
|
|||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.x"
|
"node": ">=0.8.x"
|
||||||
}
|
}
|
||||||
@@ -3882,7 +3975,6 @@
|
|||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||||
"dev": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
@@ -3961,7 +4053,6 @@
|
|||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
||||||
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
"function-bind": "^1.1.2",
|
"function-bind": "^1.1.2",
|
||||||
@@ -4106,7 +4197,6 @@
|
|||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||||
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"get-intrinsic": "^1.1.3"
|
"get-intrinsic": "^1.1.3"
|
||||||
},
|
},
|
||||||
@@ -4168,7 +4258,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
||||||
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-define-property": "^1.0.0"
|
"es-define-property": "^1.0.0"
|
||||||
},
|
},
|
||||||
@@ -4180,7 +4269,6 @@
|
|||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
||||||
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
},
|
},
|
||||||
@@ -4192,7 +4280,6 @@
|
|||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
},
|
},
|
||||||
@@ -4244,7 +4331,6 @@
|
|||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"function-bind": "^1.1.2"
|
"function-bind": "^1.1.2"
|
||||||
},
|
},
|
||||||
@@ -4294,6 +4380,15 @@
|
|||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/human-id": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/human-id/-/human-id-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"human-id": "dist/cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/humanize-ms": {
|
"node_modules/humanize-ms": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
||||||
@@ -5690,7 +5785,6 @@
|
|||||||
"version": "1.13.1",
|
"version": "1.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
||||||
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
||||||
"dev": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
@@ -6084,7 +6178,6 @@
|
|||||||
"version": "0.11.10",
|
"version": "0.11.10",
|
||||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6.0"
|
"node": ">= 0.6.0"
|
||||||
}
|
}
|
||||||
@@ -6159,6 +6252,21 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/qs": {
|
||||||
|
"version": "6.11.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
|
||||||
|
"integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"side-channel": "^1.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/querystringify": {
|
"node_modules/querystringify": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||||
@@ -6481,7 +6589,6 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||||
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"define-data-property": "^1.1.4",
|
"define-data-property": "^1.1.4",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -6533,7 +6640,6 @@
|
|||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.0",
|
"call-bind": "^1.0.0",
|
||||||
"get-intrinsic": "^1.0.2",
|
"get-intrinsic": "^1.0.2",
|
||||||
@@ -7133,6 +7239,12 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/url-join": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/url-parse": {
|
"node_modules/url-parse": {
|
||||||
"version": "1.5.10",
|
"version": "1.5.10",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||||
@@ -8300,6 +8412,63 @@
|
|||||||
"to-fast-properties": "^2.0.0"
|
"to-fast-properties": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@cartesia/cartesia-js": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cartesia/cartesia-js/-/cartesia-js-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-r4uqhFWxVmFbm0A6aDeY0y3RVJHAc6PQ8hTwHmb2ZO2kmyAP4WoZdEEQ9GIU/5c1XpV5n3Y/y6zKjMzUwgG64A==",
|
||||||
|
"requires": {
|
||||||
|
"emittery": "^0.13.1",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"form-data-encoder": "^4.0.2",
|
||||||
|
"formdata-node": "^6.0.3",
|
||||||
|
"human-id": "^4.1.1",
|
||||||
|
"node-fetch": "2.7.0",
|
||||||
|
"qs": "6.11.2",
|
||||||
|
"readable-stream": "^4.5.2",
|
||||||
|
"url-join": "4.0.1",
|
||||||
|
"ws": "^8.15.13"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"form-data": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"form-data-encoder": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw=="
|
||||||
|
},
|
||||||
|
"formdata-node": {
|
||||||
|
"version": "6.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-6.0.3.tgz",
|
||||||
|
"integrity": "sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg=="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "4.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
|
||||||
|
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
|
||||||
|
"requires": {
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"process": "^0.11.10",
|
||||||
|
"string_decoder": "^1.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ws": {
|
||||||
|
"version": "8.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
|
"requires": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@eslint-community/eslint-utils": {
|
"@eslint-community/eslint-utils": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
||||||
@@ -9459,7 +9628,6 @@
|
|||||||
"version": "6.0.3",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||||
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"base64-js": "^1.3.1",
|
"base64-js": "^1.3.1",
|
||||||
"ieee754": "^1.2.1"
|
"ieee754": "^1.2.1"
|
||||||
@@ -9499,7 +9667,6 @@
|
|||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
||||||
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -9697,7 +9864,6 @@
|
|||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
||||||
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -9784,6 +9950,11 @@
|
|||||||
"integrity": "sha512-xT1HVAu5xFn7bDfkjGQi9dNpMqGchUkebwf1GL7cZN32NSwwlHRPMSDJ1KN6HkS0bWUtndbSQZqvpQftKG2uFQ==",
|
"integrity": "sha512-xT1HVAu5xFn7bDfkjGQi9dNpMqGchUkebwf1GL7cZN32NSwwlHRPMSDJ1KN6HkS0bWUtndbSQZqvpQftKG2uFQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"emittery": {
|
||||||
|
"version": "0.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz",
|
||||||
|
"integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ=="
|
||||||
|
},
|
||||||
"emoji-regex": {
|
"emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@@ -9848,7 +10019,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
||||||
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"get-intrinsic": "^1.2.4"
|
"get-intrinsic": "^1.2.4"
|
||||||
}
|
}
|
||||||
@@ -9856,8 +10026,7 @@
|
|||||||
"es-errors": {
|
"es-errors": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"es-get-iterator": {
|
"es-get-iterator": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
@@ -10108,8 +10277,7 @@
|
|||||||
"events": {
|
"events": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"expect": {
|
"expect": {
|
||||||
"version": "26.6.2",
|
"version": "26.6.2",
|
||||||
@@ -10324,8 +10492,7 @@
|
|||||||
"function-bind": {
|
"function-bind": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"function.prototype.name": {
|
"function.prototype.name": {
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
@@ -10380,7 +10547,6 @@
|
|||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
||||||
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
"function-bind": "^1.1.2",
|
"function-bind": "^1.1.2",
|
||||||
@@ -10483,7 +10649,6 @@
|
|||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||||
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"get-intrinsic": "^1.1.3"
|
"get-intrinsic": "^1.1.3"
|
||||||
}
|
}
|
||||||
@@ -10527,7 +10692,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
||||||
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"es-define-property": "^1.0.0"
|
"es-define-property": "^1.0.0"
|
||||||
}
|
}
|
||||||
@@ -10535,14 +10699,12 @@
|
|||||||
"has-proto": {
|
"has-proto": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
||||||
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"has-symbols": {
|
"has-symbols": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"has-tostringtag": {
|
"has-tostringtag": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -10575,7 +10737,6 @@
|
|||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"function-bind": "^1.1.2"
|
"function-bind": "^1.1.2"
|
||||||
}
|
}
|
||||||
@@ -10615,6 +10776,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"human-id": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/human-id/-/human-id-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg=="
|
||||||
|
},
|
||||||
"humanize-ms": {
|
"humanize-ms": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
||||||
@@ -11669,8 +11835,7 @@
|
|||||||
"object-inspect": {
|
"object-inspect": {
|
||||||
"version": "1.13.1",
|
"version": "1.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
||||||
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"object-is": {
|
"object-is": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
@@ -11966,8 +12131,7 @@
|
|||||||
"process": {
|
"process": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.10",
|
||||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"process-on-spawn": {
|
"process-on-spawn": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -12026,6 +12190,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||||
},
|
},
|
||||||
|
"qs": {
|
||||||
|
"version": "6.11.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
|
||||||
|
"integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==",
|
||||||
|
"requires": {
|
||||||
|
"side-channel": "^1.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"querystringify": {
|
"querystringify": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||||
@@ -12230,7 +12402,6 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||||
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"define-data-property": "^1.1.4",
|
"define-data-property": "^1.1.4",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -12270,7 +12441,6 @@
|
|||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"call-bind": "^1.0.0",
|
"call-bind": "^1.0.0",
|
||||||
"get-intrinsic": "^1.0.2",
|
"get-intrinsic": "^1.0.2",
|
||||||
@@ -12718,6 +12888,11 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"url-join": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
|
||||||
|
},
|
||||||
"url-parse": {
|
"url-parse": {
|
||||||
"version": "1.5.10",
|
"version": "1.5.10",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jambonz/speech-utils",
|
"name": "@jambonz/speech-utils",
|
||||||
"version": "0.1.22",
|
"version": "0.2.1",
|
||||||
"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",
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-polly": "^3.496.0",
|
"@aws-sdk/client-polly": "^3.496.0",
|
||||||
"@aws-sdk/client-sts": "^3.496.0",
|
"@aws-sdk/client-sts": "^3.496.0",
|
||||||
|
"@cartesia/cartesia-js": "^2.1.0",
|
||||||
"@google-cloud/text-to-speech": "^5.5.0",
|
"@google-cloud/text-to-speech": "^5.5.0",
|
||||||
"@grpc/grpc-js": "^1.9.14",
|
"@grpc/grpc-js": "^1.9.14",
|
||||||
"@jambonz/realtimedb-helpers": "^0.8.7",
|
"@jambonz/realtimedb-helpers": "^0.8.7",
|
||||||
|
|||||||
+38
-13
@@ -686,6 +686,40 @@ test('PlayHT3.0 speech synth tests', async(t) => {
|
|||||||
await testPlayHT(t, 'Play3.0');
|
await testPlayHT(t, 'Play3.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Cartesia speech synth tests', async(t) => {
|
||||||
|
const fn = require('..');
|
||||||
|
const {synthAudio, client} = fn(opts, logger);
|
||||||
|
|
||||||
|
if (!process.env.CARTESIA_API_KEY) {
|
||||||
|
t.pass('skipping Cartesia speech synth tests since CARTESIA_API_KEY is not provided');
|
||||||
|
return t.end();
|
||||||
|
}
|
||||||
|
const text = 'Hi there and welcome to jambones! ' + Date.now();
|
||||||
|
try {
|
||||||
|
const opts = await synthAudio(stats, {
|
||||||
|
vendor: 'cartesia',
|
||||||
|
credentials: {
|
||||||
|
api_key: process.env.CARTESIA_API_KEY,
|
||||||
|
model_id: 'sonic-english',
|
||||||
|
options: JSON.stringify({
|
||||||
|
speed: 1,
|
||||||
|
emotion: 'female_happy',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
language: 'en',
|
||||||
|
voice: '694f9389-aac1-45b6-b726-9d9369183238',
|
||||||
|
text,
|
||||||
|
renderForCaching: true
|
||||||
|
});
|
||||||
|
t.ok(!opts.servedFromCache, `successfully playht eleven audio to ${opts.filePath}`);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error(JSON.stringify(err));
|
||||||
|
t.end(err);
|
||||||
|
}
|
||||||
|
client.quit();
|
||||||
|
});
|
||||||
|
|
||||||
test('rimelabs speech synth tests', async(t) => {
|
test('rimelabs speech synth tests', async(t) => {
|
||||||
const fn = require('..');
|
const fn = require('..');
|
||||||
const {synthAudio, client} = fn(opts, logger);
|
const {synthAudio, client} = fn(opts, logger);
|
||||||
@@ -854,24 +888,15 @@ test('TTS Cache tests', async(t) => {
|
|||||||
language: 'non-existing',
|
language: 'non-existing',
|
||||||
voice: 'non-existing',
|
voice: 'non-existing',
|
||||||
});
|
});
|
||||||
t.ok(purgedCountWhenErrored === 0, `purged no records when specified key was not found`);
|
t.ok(purgedCountWhenErrored === 0, 'purged no records when specified key was not found');
|
||||||
t.ok(error, `error returned when specified key was not found`);
|
t.ok(error, 'error returned when specified key was not found');
|
||||||
|
|
||||||
// make sure other tts keys are still there
|
// make sure other tts keys are still there
|
||||||
const cached = await client.keys('tts:*')
|
const cached = await client.keys('tts:*');
|
||||||
t.ok(cached.length >= 1, `successfully kept all non-specified tts records in cache`);
|
t.ok(cached.length >= 1, 'successfully kept all non-specified tts records in cache');
|
||||||
|
|
||||||
// retrieve keys from cache and check the key contains the file extension
|
|
||||||
let key = cached[0];
|
|
||||||
t.ok(key.includes('mp3'), `tts cache extension shoult be part of the key and equal mp3`);
|
|
||||||
|
|
||||||
process.env.VG_TRIM_TTS_SILENCE = 'true';
|
process.env.VG_TRIM_TTS_SILENCE = 'true';
|
||||||
await client.set(makeSynthKey({ vendor: 'azure' }), 'value');
|
await client.set(makeSynthKey({ vendor: 'azure' }), 'value');
|
||||||
|
|
||||||
const r8Keys = await client.keys('tts:r8*');
|
|
||||||
key = r8Keys[0];
|
|
||||||
t.ok(key.includes('r8'), `tts cache extension shoult be part of the key and equal r8`);
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(JSON.stringify(err));
|
console.error(JSON.stringify(err));
|
||||||
t.end(err);
|
t.end(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user