@jambonz/speech-utils 0.0.8 → 0.0.10
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 +2 -9
- package/package.json +10 -10
package/lib/synth-audio.js
CHANGED
|
@@ -2,14 +2,12 @@ const assert = require('assert');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const bent = require('bent');
|
|
4
4
|
const ttsGoogle = require('@google-cloud/text-to-speech');
|
|
5
|
-
//const Polly = require('aws-sdk/clients/polly');
|
|
6
5
|
const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly');
|
|
7
6
|
|
|
8
7
|
const sdk = require('microsoft-cognitiveservices-speech-sdk');
|
|
9
8
|
const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
|
|
10
9
|
const { IamAuthenticator } = require('ibm-watson/auth');
|
|
11
10
|
const {
|
|
12
|
-
AudioConfig,
|
|
13
11
|
ResultReason,
|
|
14
12
|
SpeechConfig,
|
|
15
13
|
SpeechSynthesizer,
|
|
@@ -302,8 +300,7 @@ const synthMicrosoft = async(logger, {
|
|
|
302
300
|
if (!content.startsWith('<speak')) content = `<speak>${text}</speak>`;
|
|
303
301
|
}
|
|
304
302
|
speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
|
|
305
|
-
const
|
|
306
|
-
const synthesizer = new SpeechSynthesizer(speechConfig, config);
|
|
303
|
+
const synthesizer = new SpeechSynthesizer(speechConfig);
|
|
307
304
|
|
|
308
305
|
if (content.startsWith('<speak>')) {
|
|
309
306
|
/* microsoft enforces some properties and uses voice xml element so if the user did not supply do it for them */
|
|
@@ -329,11 +326,8 @@ const synthMicrosoft = async(logger, {
|
|
|
329
326
|
break;
|
|
330
327
|
case ResultReason.SynthesizingAudioCompleted:
|
|
331
328
|
stats.increment('tts.count', ['vendor:microsoft', 'accepted:yes']);
|
|
329
|
+
resolve(result.audioData);
|
|
332
330
|
synthesizer.close();
|
|
333
|
-
fs.readFile(filePath, (err, data) => {
|
|
334
|
-
if (err) return reject(err);
|
|
335
|
-
resolve(data);
|
|
336
|
-
});
|
|
337
331
|
break;
|
|
338
332
|
default:
|
|
339
333
|
logger.info({result}, 'synthAudio: (Microsoft) unexpected result');
|
|
@@ -444,7 +438,6 @@ const synthNvidia = async(client, logger, {credentials, stats, language, voice,
|
|
|
444
438
|
request.setText(text);
|
|
445
439
|
|
|
446
440
|
return new Promise((resolve, reject) => {
|
|
447
|
-
console.log(`language ${language} voice ${voice} model ${model} text ${text}`);
|
|
448
441
|
rivaClient.synthesize(request, (err, response) => {
|
|
449
442
|
if (err) {
|
|
450
443
|
console.error(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jambonz/speech-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "TTS-related speech utilities for jambonz",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Dave Horton",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/jambonz/speech-utils#readme",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-polly": "^3.
|
|
28
|
-
"@google-cloud/text-to-speech": "^4.2.
|
|
29
|
-
"@grpc/grpc-js": "^1.8.
|
|
30
|
-
"@jambonz/
|
|
31
|
-
"aws-sdk": "^2.1310.0",
|
|
27
|
+
"@aws-sdk/client-polly": "^3.303.0",
|
|
28
|
+
"@google-cloud/text-to-speech": "^4.2.1",
|
|
29
|
+
"@grpc/grpc-js": "^1.8.13",
|
|
30
|
+
"@jambonz/promisify-redis": "^0.0.6",
|
|
32
31
|
"bent": "^7.3.12",
|
|
33
32
|
"debug": "^4.3.4",
|
|
34
|
-
"google-protobuf": "^3.21.2",
|
|
35
|
-
"ibm-watson": "^7.1.2",
|
|
36
33
|
"form-urlencoded": "^6.1.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
34
|
+
"google-protobuf": "^3.21.2",
|
|
35
|
+
"ibm-watson": "^8.0.0",
|
|
36
|
+
"microsoft-cognitiveservices-speech-sdk": "^1.26.0",
|
|
37
|
+
"redis": "^3.1.2",
|
|
38
|
+
"undici": "^5.21.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"config": "^3.3.9",
|