@jambonz/speech-utils 0.2.24 → 0.2.25
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.
- package/lib/synth-audio.js +3 -2
- package/package.json +1 -1
package/lib/synth-audio.js
CHANGED
|
@@ -877,7 +877,7 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice,
|
|
|
877
877
|
const synthElevenlabs = async(logger, {
|
|
878
878
|
credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming, disableTtsCache
|
|
879
879
|
}) => {
|
|
880
|
-
const {api_key, model_id, options: credOpts} = credentials;
|
|
880
|
+
const {api_key, model_id, api_uri, options: credOpts} = credentials;
|
|
881
881
|
const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}');
|
|
882
882
|
|
|
883
883
|
/* default to using the streaming interface, unless disabled by env var OR we want just a cache file */
|
|
@@ -889,6 +889,7 @@ const synthElevenlabs = async(logger, {
|
|
|
889
889
|
params += `,voice=${voice}`;
|
|
890
890
|
params += `,model_id=${model_id}`;
|
|
891
891
|
params += `,write_cache_file=${disableTtsCache ? 0 : 1}`;
|
|
892
|
+
if (api_uri) params += `,api_uri=${api_uri}`;
|
|
892
893
|
if (opts.optimize_streaming_latency !== null && opts.optimize_streaming_latency !== undefined) {
|
|
893
894
|
params += `,optimize_streaming_latency=${opts.optimize_streaming_latency}`;
|
|
894
895
|
}
|
|
@@ -914,7 +915,7 @@ const synthElevenlabs = async(logger, {
|
|
|
914
915
|
const optimize_streaming_latency = opts.optimize_streaming_latency ?
|
|
915
916
|
`?optimize_streaming_latency=${opts.optimize_streaming_latency}` : '';
|
|
916
917
|
try {
|
|
917
|
-
const post = bent(
|
|
918
|
+
const post = bent(`https://${api_uri}`, 'POST', 'buffer', {
|
|
918
919
|
'xi-api-key': api_key,
|
|
919
920
|
'Accept': 'audio/mpeg',
|
|
920
921
|
'Content-Type': 'application/json'
|