@jambonz/speech-utils 0.0.43 → 0.0.44
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 -0
- package/package.json +1 -1
- package/test/synth.js +50 -0
package/lib/synth-audio.js
CHANGED
|
@@ -614,6 +614,8 @@ const synthElevenlabs = async(logger, {
|
|
|
614
614
|
if (!process.env.JAMBONES_DISABLE_TTS_STREAMING && !renderForCaching && !disableTtsStreaming) {
|
|
615
615
|
let params = '';
|
|
616
616
|
params += `{api_key=${api_key}`;
|
|
617
|
+
params += ',vendor=elevenlabs';
|
|
618
|
+
params += `,voice=${voice}`;
|
|
617
619
|
params += `,model_id=${model_id}`;
|
|
618
620
|
params += `,optimize_streaming_latency=${opts.optimize_streaming_latency || 2}`;
|
|
619
621
|
params += ',write_cache_file=1';
|
|
@@ -662,6 +664,7 @@ const synthWhisper = async(logger, {credentials, stats, voice, text, renderForCa
|
|
|
662
664
|
let params = '';
|
|
663
665
|
params += `{api_key=${api_key}`;
|
|
664
666
|
params += `,model_id=${model_id}`;
|
|
667
|
+
params += ',vendor=whisper';
|
|
665
668
|
params += `,voice=${voice}`;
|
|
666
669
|
params += ',write_cache_file=1';
|
|
667
670
|
if (speed) params += `,speed=${speed}`;
|
package/package.json
CHANGED
package/test/synth.js
CHANGED
|
@@ -212,6 +212,56 @@ test('Azure speech synth tests', async(t) => {
|
|
|
212
212
|
client.quit();
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
+
test('Azure SSML tests', async(t) => {
|
|
216
|
+
const fn = require('..');
|
|
217
|
+
const {synthAudio, client} = fn(opts, logger);
|
|
218
|
+
|
|
219
|
+
if (!process.env.MICROSOFT_API_KEY || !process.env.MICROSOFT_REGION) {
|
|
220
|
+
t.pass('skipping Microsoft speech synth tests since MICROSOFT_API_KEY or MICROSOFT_REGION not provided');
|
|
221
|
+
return t.end();
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const text = `<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xml:lang="en-US">
|
|
225
|
+
<voice name="en-US-JennyMultilingualNeural">
|
|
226
|
+
<mstts:express-as style="cheerful" styledegree="2">That'd be just amazing!
|
|
227
|
+
</mstts:express-as>
|
|
228
|
+
</voice>
|
|
229
|
+
</speak>`;
|
|
230
|
+
|
|
231
|
+
let opts = await synthAudio(stats, {
|
|
232
|
+
vendor: 'microsoft',
|
|
233
|
+
credentials: {
|
|
234
|
+
api_key: process.env.MICROSOFT_API_KEY,
|
|
235
|
+
region: process.env.MICROSOFT_REGION,
|
|
236
|
+
},
|
|
237
|
+
language: 'en-US',
|
|
238
|
+
voice: 'en-US-ChristopherNeural',
|
|
239
|
+
text,
|
|
240
|
+
});
|
|
241
|
+
t.ok(!opts.servedFromCache, `successfully synthesized microsoft audio to ${opts.filePath}`);
|
|
242
|
+
if (process.env.JAMBONES_HTTP_PROXY_IP && process.env.JAMBONES_HTTP_PROXY_PORT) {
|
|
243
|
+
t.pass('successfully used proxy to reach microsoft tts service');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
opts = await synthAudio(stats, {
|
|
247
|
+
vendor: 'microsoft',
|
|
248
|
+
credentials: {
|
|
249
|
+
api_key: process.env.MICROSOFT_API_KEY,
|
|
250
|
+
region: process.env.MICROSOFT_REGION,
|
|
251
|
+
},
|
|
252
|
+
language: 'en-US',
|
|
253
|
+
voice: 'en-US-ChristopherNeural',
|
|
254
|
+
text,
|
|
255
|
+
});
|
|
256
|
+
t.ok(opts.servedFromCache, `successfully retrieved microsoft audio from cache ${opts.filePath}`);
|
|
257
|
+
} catch (err) {
|
|
258
|
+
console.error(err);
|
|
259
|
+
t.end(err);
|
|
260
|
+
}
|
|
261
|
+
client.quit();
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
|
|
215
265
|
test('Azure custom voice speech synth tests', async(t) => {
|
|
216
266
|
const fn = require('..');
|
|
217
267
|
const {synthAudio, client} = fn(opts, logger);
|