@jambonz/speech-utils 0.2.4 → 0.2.7

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 +23 -2
  2. package/package.json +1 -1
@@ -215,7 +215,8 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
215
215
  audioData = await synthNuance(client, logger, {credentials, stats, voice, model, text});
216
216
  break;
217
217
  case 'nvidia':
218
- audioData = await synthNvidia(client, logger, {credentials, stats, language, voice, model, text});
218
+ audioData = await synthNvidia(client, logger, {credentials, stats, language, voice, model, text,
219
+ renderForCaching, disableTtsStreaming});
219
220
  break;
220
221
  case 'ibm':
221
222
  audioData = await synthIbm(logger, {credentials, stats, voice, text});
@@ -708,8 +709,24 @@ const synthNuance = async(client, logger, {credentials, stats, voice, model, tex
708
709
  });
709
710
  };
710
711
 
711
- const synthNvidia = async(client, logger, {credentials, stats, language, voice, model, text}) => {
712
+ const synthNvidia = async(client, logger, {
713
+ credentials, stats, language, voice, model, text, renderForCaching, disableTtsStreaming
714
+ }) => {
712
715
  const {riva_server_uri} = credentials;
716
+ if (!JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
717
+ let params = '';
718
+ params += `{riva_server_uri=${riva_server_uri}`;
719
+ params += `,voice=${voice}`;
720
+ params += `,language=${language}`;
721
+ params += ',write_cache_file=1';
722
+ params += '}';
723
+
724
+ return {
725
+ filePath: `say:${params}${text.replace(/\n/g, ' ')}`,
726
+ servedFromCache: false,
727
+ rtt: 0
728
+ };
729
+ }
713
730
  let rivaClient, request;
714
731
  const sampleRate = 8000;
715
732
  try {
@@ -789,9 +806,13 @@ const synthElevenlabs = async(logger, {
789
806
  if (opts.voice_settings?.similarity_boost) params += `,similarity_boost=${opts.voice_settings.similarity_boost}`;
790
807
  if (opts.voice_settings?.stability) params += `,stability=${opts.voice_settings.stability}`;
791
808
  if (opts.voice_settings?.style) params += `,style=${opts.voice_settings.style}`;
809
+ if (opts.voice_settings?.speed !== null && opts.voice_settings?.speed !== undefined)
810
+ params += `,speed=${opts.voice_settings.speed}`;
792
811
  if (opts.voice_settings?.use_speaker_boost === false) params += ',use_speaker_boost=false';
793
812
  if (opts.previous_text) params += `,previous_text=${opts.previous_text}`;
794
813
  if (opts.next_text) params += `,next_text=${opts.next_text}`;
814
+ if (opts.pronunciation_dictionary_locators && Array.isArray(opts.pronunciation_dictionary_locators))
815
+ params += `,pronunciation_dictionary_locators=${JSON.stringify(opts.pronunciation_dictionary_locators)}`;
795
816
  params += '}';
796
817
 
797
818
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/speech-utils",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "TTS-related speech utilities for jambonz",
5
5
  "main": "index.js",
6
6
  "author": "Dave Horton",