Compare commits

..
8 Commits
Author SHA1 Message Date
Dave Horton 6efc99ad83 0.2.21 2025-08-20 10:59:40 -04:00
Dave Horton 127d01a8c1 add playback_id setting to additional tts vendors 2025-08-20 10:58:28 -04:00
Dave Horton 1900b26d8b 0.2.20 2025-08-20 10:01:01 -04:00
Dave Horton aa25a6f6d9 Merge pull request #125 from jambonz/feat/add-playback-id
add playback_id to say metadata
2025-08-20 10:00:37 -04:00
Dave Horton 8dfe17b600 add playback_id to say metadata 2025-08-20 08:58:46 -04:00
Dave Horton 5463e9f56e 0.2.19 2025-08-17 09:35:07 -04:00
Dave Horton 2eb36af650 Merge pull request #124 from jambonz/fix/aws_tts
support mod_aws_tts with engine parameter
2025-08-17 09:23:58 -04:00
Quan HL b186cbc4f2 support mod_aws_tts with engine parameter 2025-08-17 06:44:40 +07:00
3 changed files with 38 additions and 23 deletions
+35 -20
View File
@@ -53,6 +53,8 @@ const EXPIRES = JAMBONES_TTS_CACHE_DURATION_MINS;
const OpenAI = require('openai');
const getAwsAuthToken = require('./get-aws-sts-token');
/* counter for playback id */
let playbackIdCounter = 0;
const trimTrailingSilence = (buffer) => {
assert.ok(buffer instanceof Buffer, 'trimTrailingSilence - argument is not a Buffer');
@@ -313,6 +315,7 @@ const synthPolly = async(createHash, retrieveHash, logger,
let params = '{';
params += `language=${language}`;
params += `,playback_id=${playbackIdCounter++}`;
params += ',write_cache_file=1';
params += ',vendor=aws';
if (accessKeyId && secretAccessKey) {
@@ -333,6 +336,7 @@ const synthPolly = async(createHash, retrieveHash, logger,
}
}
if (region) params += `,region=${region}`;
if (engine) params += `,engine=${engine}`;
params += '}';
return {
@@ -588,8 +592,9 @@ const synthMicrosoft = async(logger, {
}
if (!JAMBONES_DISABLE_TTS_STREAMING && !JAMBONES_DISABLE_AZURE_TTS_STREAMING &&
!renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{api_key=${apiKey}`;
let params = '{';
params += `api_key=${apiKey}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,language=${language}`;
params += ',vendor=microsoft';
params += `,voice=${voice}`;
@@ -772,6 +777,7 @@ const synthNvidia = async(client, logger, {
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{riva_server_uri=${riva_server_uri}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,voice=${voice}`;
params += `,language=${language}`;
params += ',write_cache_file=1';
@@ -852,8 +858,9 @@ const synthElevenlabs = async(logger, {
/* 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) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += ',vendor=elevenlabs';
params += `,voice=${voice}`;
params += `,model_id=${model_id}`;
@@ -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 */
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,user_id=${user_id}`;
params += ',vendor=playht';
params += `,voice=${voice}`;
@@ -1009,8 +1017,9 @@ const synthInworld = async(logger, {
/* 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) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,model_id=${model_id}`;
params += ',vendor=inworld';
params += `,voice=${voice}`;
@@ -1073,8 +1082,9 @@ const synthRimelabs = async(logger, {
/* 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) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,model_id=${model_id}`;
params += ',vendor=rimelabs';
params += `,language=${language}`;
@@ -1129,8 +1139,9 @@ const synthVerbio = async(client, logger, {credentials, stats, voice, text, rend
}
const token = await getVerbioAccessToken(client, logger, credentials);
if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{access_token=${token.access_token}`;
let params = '{';
params += `access_token=${token.access_token}`;
params += `,playback_id=${playbackIdCounter++}`;
params += ',vendor=verbio';
params += `,voice=${voice}`;
params += ',write_cache_file=1';
@@ -1172,8 +1183,9 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, instruction
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 (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,model_id=${model_id}`;
params += ',vendor=whisper';
params += `,voice=${voice}`;
@@ -1218,8 +1230,9 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, instruction
const synthDeepgram = async(logger, {credentials, stats, model, text, renderForCaching, disableTtsStreaming}) => {
const {api_key, deepgram_tts_uri} = credentials;
if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += ',vendor=deepgram';
params += `,voice=${model}`;
params += ',write_cache_file=1';
@@ -1261,8 +1274,9 @@ const synthCartesia = async(logger, {
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}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += `,model_id=${model_id}`;
params += ',vendor=cartesia';
params += `,voice=${voice}`;
@@ -1332,8 +1346,9 @@ const synthResemble = async(logger, {
/* 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) {
let params = '';
params += `{api_key=${api_key}`;
let params = '{';
params += `api_key=${api_key}`;
params += `,playback_id=${playbackIdCounter++}`;
params += ',vendor=resemble';
params += `,voice=${voice}`;
params += ',write_cache_file=1';
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@jambonz/speech-utils",
"version": "0.2.18",
"version": "0.2.21",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@jambonz/speech-utils",
"version": "0.2.18",
"version": "0.2.21",
"license": "MIT",
"dependencies": {
"23": "^0.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@jambonz/speech-utils",
"version": "0.2.18",
"version": "0.2.21",
"description": "TTS-related speech utilities for jambonz",
"main": "index.js",
"author": "Dave Horton",