node-red-contrib-tts-ultimate 1.0.38 → 1.0.39
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Usare IntelliSense per informazioni sui possibili attributi.
|
|
3
|
+
// Al passaggio del mouse vengono visualizzate le descrizioni degli attributi esistenti.
|
|
4
|
+
// Per altre informazioni, visitare: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "pwa-node",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Launch Program",
|
|
11
|
+
"skipFiles": [
|
|
12
|
+
"<node_internals>/**"
|
|
13
|
+
],
|
|
14
|
+
"program": "${workspaceFolder}/ttsultimate/ttsultimate.js"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.paypal.me/techtoday)
|
|
4
4
|
|
|
5
|
+
<p>
|
|
6
|
+
<b>Version 1.0.39</b> January 2022<br/>
|
|
7
|
+
- SSML: fixed an issue prevent using it.<br/>
|
|
8
|
+
- SSML: if SSML is enabled, the text auto split function is disabled, to avoid splitting SSML XML text.<br/>
|
|
9
|
+
- Microsoft Azure: update TTS engine to 1.19.0<br/>
|
|
10
|
+
- Google paid TTS: update TTS engine to 3.4.0<br/>
|
|
5
11
|
<p>
|
|
6
12
|
<b>Version 1.0.38</b> December 2021<br/>
|
|
7
13
|
- Removed some unwanted startup logs.<br/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-tts-ultimate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "Transforms the text in speech and hear it using Sonos player or generate an audio file to be used with third parties nodes. Works with voices from Amazon, Google (without credentials as well), Microsoft TTS Azure, or your own voice. You can also only create a TTS file to be read by third party nodes. Update of the popular SonosPollyTTS node.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"formidable": "1.2.2",
|
|
47
47
|
"os": ">=0.1.1",
|
|
48
48
|
"path": ">=0.12.7",
|
|
49
|
-
"@google-cloud/text-to-speech": "3.
|
|
49
|
+
"@google-cloud/text-to-speech": "3.4.0",
|
|
50
50
|
"google-translate-tts": ">=0.2.1",
|
|
51
|
-
"microsoft-cognitiveservices-speech-sdk": ">=1.
|
|
51
|
+
"microsoft-cognitiveservices-speech-sdk": ">=1.19.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"eslint": ">=4.18.2",
|
|
@@ -180,13 +180,13 @@ module.exports = function (RED) {
|
|
|
180
180
|
}
|
|
181
181
|
} catch (error) {
|
|
182
182
|
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error parsing Microsoft Azure TTS voices: ' + error.message);
|
|
183
|
-
node.microsoftAzureTTSVoiceList.push({ name: "Error parsing Microsoft Azure voices: " + error.message, id: "Ivy" });
|
|
183
|
+
node.microsoftAzureTTSVoiceList.push({ name: "Error parsing Microsoft Azure voices: " + error.message + " Check cretentials, deploy and restart node-red.", id: "Ivy" });
|
|
184
184
|
}
|
|
185
185
|
})
|
|
186
186
|
})
|
|
187
187
|
reqAzure.on('error', error => {
|
|
188
188
|
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error contacting Azure for getting the voices list: ' + error.message);
|
|
189
|
-
node.microsoftAzureTTSVoiceList.push({ name: "Error getting Microsoft Azure voices: " + error.message, id: "Ivy" })
|
|
189
|
+
node.microsoftAzureTTSVoiceList.push({ name: "Error getting Microsoft Azure voices: " + error.message + " Check cretentials, deploy and restart node-red.", id: "Ivy" })
|
|
190
190
|
reqAzure.end();
|
|
191
191
|
})
|
|
192
192
|
reqAzure.end();
|
|
@@ -365,7 +365,7 @@ module.exports = function (RED) {
|
|
|
365
365
|
node.polly.describeVoices(jfiltroVoci, function (err, data) {
|
|
366
366
|
if (err) {
|
|
367
367
|
RED.log.warn('ttsultimate-config ' + node.id + ': Error getting polly voices ' + err);
|
|
368
|
-
jListVoices.push({ name: "Error retrieving voices. " + err, id: "Ivy" })
|
|
368
|
+
jListVoices.push({ name: "Error retrieving voices. " + err + " Check cretentials, deploy and restart node-red.", id: "Ivy" })
|
|
369
369
|
res.json(jListVoices)
|
|
370
370
|
} else {
|
|
371
371
|
for (let index = 0; index < data.Voices.length; index++) {
|
|
@@ -392,15 +392,15 @@ module.exports = function (RED) {
|
|
|
392
392
|
});
|
|
393
393
|
res.json(jListVoices)
|
|
394
394
|
} catch (error) {
|
|
395
|
-
RED.log.error('ttsultimate-config ' + node.id + ': Error getting google TTS voices ' + error.message);
|
|
396
|
-
jListVoices.push({ name: "Error getting Google TTS voices. " + error.message, id: "Ivy" })
|
|
395
|
+
RED.log.error('ttsultimate-config ' + node.id + ': Error getting google TTS voices ' + error.message + " Please deploy and restart node-red.");
|
|
396
|
+
jListVoices.push({ name: "Error getting Google TTS voices. " + error.message + " Check credentials, deploy and restart node-red.", id: "Ivy" })
|
|
397
397
|
res.json(jListVoices)
|
|
398
398
|
}
|
|
399
399
|
};
|
|
400
400
|
try {
|
|
401
401
|
listVoices();
|
|
402
402
|
} catch (error) {
|
|
403
|
-
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error getting google TTS voices ' + error.message);
|
|
403
|
+
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error getting google TTS voices ' + error.message + " Please deploy and restart node-red.");
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
} else if (ttsservice === "googletranslate") {
|
|
@@ -413,14 +413,14 @@ module.exports = function (RED) {
|
|
|
413
413
|
res.json(jListVoices)
|
|
414
414
|
} catch (error) {
|
|
415
415
|
RED.log.error('ttsultimate-config ' + node.id + ': Error getting google Translate voices ' + error.message);
|
|
416
|
-
jListVoices.push({ name: "Error getting Google Translate voices. " + error.message, id: "Ivy" })
|
|
416
|
+
jListVoices.push({ name: "Error getting Google Translate voices. " + error.message + " Deploy and restart node-red.", id: "Ivy" })
|
|
417
417
|
res.json(jListVoices)
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
420
|
try {
|
|
421
421
|
listVoices();
|
|
422
422
|
} catch (error) {
|
|
423
|
-
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error getting google Translate voices ' + error.message);
|
|
423
|
+
RED.log.error('ttsultimate-config ' + node.id + ': listVoices: Error getting google Translate voices ' + error.message + " Please deploy and restart node-red.");
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
} else if (ttsservice === "microsoftazuretts") {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</div>
|
|
40
40
|
<div class="form-row">
|
|
41
41
|
<label></label>
|
|
42
|
-
<input type="checkbox" id="node-input-ssml" style="margin-left: 0px; vertical-align: top; width: auto !important;"> <label style="width:auto !important;"> Enable SSML</label>
|
|
42
|
+
<input type="checkbox" id="node-input-ssml" style="margin-left: 0px; vertical-align: top; width: auto !important;"> <label style="width:auto !important;"> Enable SSML (unsupported by Google without authentication)</label>
|
|
43
43
|
</div>
|
|
44
44
|
<div class="form-row">
|
|
45
45
|
<label for="node-input-sonoshailing"><i class="fa fa-bell"></i> Hailing</label>
|
|
@@ -78,7 +78,7 @@ module.exports = function (RED) {
|
|
|
78
78
|
node.speakingrate = config.speakingrate === undefined ? "1" : config.speakingrate; // 21/09/2021 AudioConfig speakingrate
|
|
79
79
|
node.unmuteIfMuted = config.unmuteIfMuted === undefined ? false : config.unmuteIfMuted; // 21/10/2021 Unmute if previiously muted.
|
|
80
80
|
node.sonosCoordinatorIsPreviouslyMuted = false;
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
if (typeof node.server !== "undefined" && node.server !== null) {
|
|
83
83
|
node.sNoderedURL = node.server.sNoderedURL || "";
|
|
84
84
|
}
|
|
@@ -591,11 +591,11 @@ module.exports = function (RED) {
|
|
|
591
591
|
voice: { name: node.voiceId.split("#")[0], languageCode: node.voiceId.split("#")[1], ssmlGender: node.voiceId.split("#")[2] },
|
|
592
592
|
audioConfig: { audioEncoding: "MP3", speakingRate: parseFloat(node.speakingrate), pitch: parseFloat(node.speakingpitch), },
|
|
593
593
|
};
|
|
594
|
-
params.input = node.ssml ===
|
|
594
|
+
params.input = node.ssml === false ? { text: msg } : { ssml: msg };
|
|
595
595
|
data = await synthesizeSpeechGoogleTTS([node.server.googleTTS, params]);
|
|
596
596
|
} else if (node.server.ttsservice === "googletranslate") {
|
|
597
597
|
node.setNodeStatus({ fill: 'green', shape: 'ring', text: 'Downloading from Google Translate...' });
|
|
598
|
-
// VoiceId is: code
|
|
598
|
+
// VoiceId is: code. SSML is not supported by google translate
|
|
599
599
|
const params = {
|
|
600
600
|
text: msg,
|
|
601
601
|
voice: node.voiceId,
|
|
@@ -941,35 +941,41 @@ module.exports = function (RED) {
|
|
|
941
941
|
}
|
|
942
942
|
// ########################
|
|
943
943
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
944
|
+
// 03/01/2022 if ssml is enabled, disable the auto split function
|
|
945
|
+
if (!node.ssml) {
|
|
946
|
+
// SSML disabled
|
|
947
|
+
// 30/01/2021 split the text if it's too long, otherwies i'll have issues with filename too long.
|
|
948
|
+
if (msg.payload.length >= node.server.limitTTSFilenameLenght) {
|
|
949
|
+
let sTemp = "";
|
|
950
|
+
let aSeps = [".", ",", ":", ";", "!", "?"];
|
|
951
|
+
let sPayload = msg.payload.replace(/[\r\n]+/gm, "");
|
|
952
|
+
for (let index = 0; index < sPayload.length; index++) {
|
|
953
|
+
const element = sPayload.substr(index, 1);
|
|
954
|
+
sTemp += element;
|
|
955
|
+
if (aSeps.indexOf(element) > -1 && sTemp.length > 20) {
|
|
956
|
+
const oMsg = RED.util.cloneMessage(msg);
|
|
957
|
+
oMsg.payload = sTemp;
|
|
958
|
+
node.tempMSGStorage.push(oMsg);
|
|
959
|
+
sTemp = "";
|
|
960
|
+
}
|
|
961
|
+
if (sTemp.length > node.server.limitTTSFilenameLenght && element === " ") {
|
|
962
|
+
// Split using space
|
|
963
|
+
const oMsg = RED.util.cloneMessage(msg);
|
|
964
|
+
oMsg.payload = sTemp;
|
|
965
|
+
node.tempMSGStorage.push(oMsg);
|
|
966
|
+
sTemp = "";
|
|
967
|
+
}
|
|
965
968
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
node.tempMSGStorage.push(oMsg);
|
|
969
|
+
// Remaining
|
|
970
|
+
const oMsg = RED.util.cloneMessage(msg);
|
|
971
|
+
oMsg.payload = sTemp;
|
|
972
|
+
node.tempMSGStorage.push(oMsg);
|
|
971
973
|
|
|
974
|
+
} else {
|
|
975
|
+
node.tempMSGStorage.push(msg);
|
|
976
|
+
}
|
|
972
977
|
} else {
|
|
978
|
+
// SSML enabled
|
|
973
979
|
node.tempMSGStorage.push(msg);
|
|
974
980
|
}
|
|
975
981
|
|