@jambonz/speech-utils 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/synth-audio.js +10 -3
  2. package/package.json +1 -1
@@ -151,6 +151,11 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
151
151
  assert.ok(voice, 'synthAudio requires voice when verbio is used');
152
152
  assert.ok(credentials.client_id, 'synthAudio requires client_id when verbio is used');
153
153
  assert.ok(credentials.client_secret, 'synthAudio requires client_secret when verbio is used');
154
+ } else if ('deepgram' === vendor) {
155
+ if (!credentials.deepgram_tts_uri) {
156
+ assert.ok(credentials.api_key, 'synthAudio requires api_key when deepgram is used');
157
+ }
158
+
154
159
  }
155
160
  const key = makeSynthKey({
156
161
  account_sid,
@@ -909,13 +914,14 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, renderForCa
909
914
  };
910
915
 
911
916
  const synthDeepgram = async(logger, {credentials, stats, model, text, renderForCaching, disableTtsStreaming}) => {
912
- const {api_key} = credentials;
917
+ const {api_key, deepgram_tts_uri} = credentials;
913
918
  if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
914
919
  let params = '';
915
920
  params += `{api_key=${api_key}`;
916
921
  params += ',vendor=deepgram';
917
922
  params += `,voice=${model}`;
918
923
  params += ',write_cache_file=1';
924
+ if (deepgram_tts_uri) params += `,endpoint=${deepgram_tts_uri}`;
919
925
  params += '}';
920
926
 
921
927
  return {
@@ -925,8 +931,9 @@ const synthDeepgram = async(logger, {credentials, stats, model, text, renderForC
925
931
  };
926
932
  }
927
933
  try {
928
- const post = bent('https://api.deepgram.com', 'POST', 'buffer', {
929
- 'Authorization': `Token ${api_key}`,
934
+ const post = bent(deepgram_tts_uri || 'https://api.deepgram.com', 'POST', 'buffer', {
935
+ // on-premise deepgram does not require to have api_key
936
+ ...(api_key && {'Authorization': `Token ${api_key}`}),
930
937
  'Accept': 'audio/mpeg',
931
938
  'Content-Type': 'application/json'
932
939
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/speech-utils",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "TTS-related speech utilities for jambonz",
5
5
  "main": "index.js",
6
6
  "author": "Dave Horton",