node-red-contrib-tts-ultimate 1.0.46 → 1.0.50
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/CHANGELOG.md +17 -1
- package/README.md +16 -5
- package/package.json +3 -3
- package/ttsultimate/ttsultimate-config.js +15 -8
- package/ttsultimate/ttsultimate.js +29 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.paypal.me/techtoday)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p>
|
|
6
|
+
<b>Version 1.0.50</b> August 2022<br/>
|
|
7
|
+
- Fixed a wrong "sonos unreachable" message when you select to simply save the file instead of using it with sonos<br/>
|
|
8
|
+
- FIX: temporary fix for chinese language in google translate engine, that was not working anymore.<br/>
|
|
9
|
+
</p>
|
|
10
|
+
<p>
|
|
11
|
+
<b>Version 1.0.49</b> June 2022<br/>
|
|
12
|
+
- Due to Microsoft Azure SDK limitation, the node can only be installed on systems with NodeJS versions: (^12.22.0, ^14.17.0, or >=16.0.0) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.). Currently, the Microsoft Azure SDK and, thus, TTS-Ultimate, doesn't run on NodeJS 18.x.x !!<br/>
|
|
13
|
+
</p>
|
|
14
|
+
<p>
|
|
15
|
+
<b>Version 1.0.48</b> Mai 2022<br/>
|
|
16
|
+
- Try to fixe a clunky issue with microsoft azure package, on nodejs versions that are not supported by Microsoft.<br/>
|
|
17
|
+
</p>
|
|
18
|
+
<p>
|
|
19
|
+
<b>Version 1.0.47</b> Mai 2022<br/>
|
|
20
|
+
- Fixed other compatibility issue with some Node version.<br/>
|
|
21
|
+
</p>
|
|
6
22
|
<p>
|
|
7
23
|
<b>Version 1.0.46</b> Mai 2022<br/>
|
|
8
24
|
- Fixed a compatibility issue with Node 18, where a breaking change has been introduced.<br/>
|
package/README.md
CHANGED
|
@@ -20,13 +20,16 @@
|
|
|
20
20
|
```
|
|
21
21
|
</details>
|
|
22
22
|
|
|
23
|
+
## WARNING
|
|
24
|
+
Due to Microsoft Azure SDK limitation, the node can only be installed on systems with **NodeJS** versions: (^12.22.0, ^14.17.0, or >=16.0.0) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.). Currently, the **Microsoft Azure SDK and, thus, TTS-Ultimate, doesn't run on NodeJS 18.x.x !!**
|
|
23
25
|
|
|
24
26
|
## DESCRIPTION
|
|
25
|
-
This node transforms a text into a speech audio
|
|
27
|
+
This node transforms a text into a speech audio that you can hear natively via <b>SONOS</b> speakers.<br/>
|
|
28
|
+
You can also generate an audio file for bluetooth speakers, web pages, etc.<br/>
|
|
26
29
|
Uses Amazon Polly (standard and neural engines), Google TTS voices (even without credentials nor registration) and Microsoft TTS Azure voices, and you can use it with **your own audio file** as well and it can be used **totally offline** even without the use of TTS, without internet connection.<br/>
|
|
27
30
|
The node can also create a ***TTS file (without the use of any Sonos device)***, to be read by third parties nodes.<br/>
|
|
28
31
|
This is a major ***upgrade from the previously popular node SonosPollyTTS*** (SonosPollyTTS is not developed anymore).<br/>
|
|
29
|
-
|
|
32
|
+
|
|
30
33
|
|
|
31
34
|
[](https://www.paypal.me/techtoday)
|
|
32
35
|
|
|
@@ -34,6 +37,7 @@ This is a major ***upgrade from the previously popular node SonosPollyTTS*** (So
|
|
|
34
37
|
* See <a href="https://github.com/Supergiovane/node-red-contrib-tts-ultimate/blob/master/CHANGELOG.md">here the changelog</a>
|
|
35
38
|
|
|
36
39
|
## FEATURES
|
|
40
|
+
* **Native Sonos support**: hear the TTS audio directly via Sonos. You can also group speakers, set an hailing sound, choose the volume of each speaker etc.
|
|
37
41
|
* **Output audio file**: the node can just create the TTS file to be used by other nodes. In this case, you doesn't need to use Sonos as player.
|
|
38
42
|
* **Amazon Voices, Gooogle Translate Voices, Google TTS Voices and Microsoft TTS Azure voices** are all supported, with all avaiables languages and genders.
|
|
39
43
|
* **Automatic grouping** is supported. You can group all players you want to play your announcements.
|
|
@@ -215,9 +219,16 @@ return msg;
|
|
|
215
219
|
```
|
|
216
220
|
|
|
217
221
|
```js
|
|
218
|
-
// Play
|
|
219
|
-
msg.sonoshailing = "
|
|
220
|
-
msg.payload = "
|
|
222
|
+
// Play smoke detection
|
|
223
|
+
msg.sonoshailing = "SmokeAlert";
|
|
224
|
+
msg.payload = "Warning, smoke detected. Fire extinguishers are in the kitchen, hall and garage.";
|
|
225
|
+
return msg;
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
// Play an mp3
|
|
230
|
+
msg.sonoshailing = "MeteoJingle";
|
|
231
|
+
msg.payload = "http://192.125.22.44/meteotoday.mp3";
|
|
221
232
|
return msg;
|
|
222
233
|
```
|
|
223
234
|
|
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.50",
|
|
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": {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"os": ">=0.1.1",
|
|
48
48
|
"path": ">=0.12.7",
|
|
49
49
|
"@google-cloud/text-to-speech": "3.4.0",
|
|
50
|
-
"google-translate-tts": ">=0.
|
|
51
|
-
"microsoft-cognitiveservices-speech-sdk": "
|
|
50
|
+
"google-translate-tts": ">=0.3.0",
|
|
51
|
+
"microsoft-cognitiveservices-speech-sdk": "1.21.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"eslint": ">=4.18.2",
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
const { Redshift } = require('aws-sdk');
|
|
2
|
+
|
|
1
3
|
module.exports = function (RED) {
|
|
2
4
|
'use strict';
|
|
3
5
|
|
|
6
|
+
// 31/05/2022 checking nodejs version due to Microsoft Azure SDK bad nodejs compatibility.
|
|
7
|
+
let nodejsVersion = process.version.match(/^v(\d+\.\d+)/)[1];
|
|
8
|
+
if (nodejsVersion.startsWith("18")) {
|
|
9
|
+
RED.log.error('ttsultimate-config: YOUR NODEJS VERSION IS CURRENTLY INCOMPATIBLE WITH Microsoft Azure SDK. Your NodeJS version: ' + nodejsVersion + ", please install one of these: (^12.22.0, ^14.17.0, or >=16.0.0), with SSL support.");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
4
14
|
const AWS = require('aws-sdk');
|
|
5
15
|
const GoogleTTS = require('@google-cloud/text-to-speech');
|
|
6
16
|
const GoogleTranslate = require('google-translate-tts'); // TTS without credentials, limited to 200 chars per row.
|
|
@@ -27,10 +37,7 @@ module.exports = function (RED) {
|
|
|
27
37
|
node.whoIsUsingTheServer = ""; // Client node.id using the server, because only a ttsultimate node can use the serve at once.
|
|
28
38
|
node.ttsservice = config.ttsservice || "googletranslate";
|
|
29
39
|
node.TTSRootFolderPath = (config.TTSRootFolderPath === undefined || config.TTSRootFolderPath === "") ? path.join(RED.settings.userDir, "sonospollyttsstorage") : path.join(config.TTSRootFolderPath, "sonospollyttsstorage");
|
|
30
|
-
|
|
31
|
-
// node.googleTTS = null;
|
|
32
|
-
// node.googleTranslateTTS = null;
|
|
33
|
-
// node.microsoftAzureTTS = null;
|
|
40
|
+
|
|
34
41
|
|
|
35
42
|
// 03/06/2019 you can select the temp dir
|
|
36
43
|
//#region "SETUP PATHS"
|
|
@@ -229,19 +236,19 @@ module.exports = function (RED) {
|
|
|
229
236
|
} else {
|
|
230
237
|
var sAddresses = "";
|
|
231
238
|
oiFaces[ifname].forEach(function (iface) {
|
|
232
|
-
if (iface.internal == false && iface.family.toString().includes("4")) sAddresses = iface.address;
|
|
239
|
+
if (iface.internal == false && iface.family !== undefined && iface.family.toString().includes("4")) sAddresses = iface.address;
|
|
233
240
|
});
|
|
234
241
|
if (sAddresses !== "") jListInterfaces.push({ name: ifname, address: sAddresses });
|
|
235
242
|
}
|
|
236
243
|
})
|
|
237
244
|
} catch (error) { }
|
|
238
245
|
if (jListInterfaces.length > 0) {
|
|
239
|
-
return(jListInterfaces[0].address); // Retunr the first usable IP
|
|
246
|
+
return (jListInterfaces[0].address); // Retunr the first usable IP
|
|
240
247
|
} else {
|
|
241
|
-
return("NO ETH INTERFACE FOUND");
|
|
248
|
+
return ("NO ETH INTERFACE FOUND");
|
|
242
249
|
}
|
|
243
250
|
}
|
|
244
|
-
|
|
251
|
+
|
|
245
252
|
// 20/03/2020 in the middle of coronavirus, get the sonos groups
|
|
246
253
|
RED.httpAdmin.get("/sonosgetAllGroups", RED.auth.needsPermission('TTSConfigNode.read'), function (req, res) {
|
|
247
254
|
var jListGroups = [];
|
|
@@ -285,7 +285,7 @@ module.exports = function (RED) {
|
|
|
285
285
|
// 30/03/2020 in the middle of coronavirus emergency. Group Speakers
|
|
286
286
|
for (let index = 0; index < node.oAdditionalSonosPlayers.length; index++) {
|
|
287
287
|
let element = node.oAdditionalSonosPlayers[index].oPlayer;
|
|
288
|
-
|
|
288
|
+
|
|
289
289
|
// 02/07/2021 Get the additional's player's volume set by app and the current track, to be set again in ungroupspealers
|
|
290
290
|
try {
|
|
291
291
|
element.additionalPlayerPreviousVolumeSetByApp = await element.getVolume();
|
|
@@ -366,29 +366,35 @@ module.exports = function (RED) {
|
|
|
366
366
|
|
|
367
367
|
|
|
368
368
|
// 27/11/2019 Check Sonos connection health
|
|
369
|
-
node.CheckSonosConnection = () => {
|
|
370
369
|
|
|
371
|
-
|
|
370
|
+
node.CheckSonosConnection = () => {
|
|
371
|
+
if (node.playertype !== "noplayer") {
|
|
372
|
+
node.SonosClient.getCurrentState().then(state => {
|
|
373
|
+
|
|
374
|
+
// 11/12/202020 The connection with Sonos is OK.
|
|
375
|
+
if (node.msg.connectionerror == true) {
|
|
376
|
+
node.flushQueue();
|
|
377
|
+
node.setNodeStatus({ fill: "green", shape: "dot", text: "Sonos is connected." });
|
|
378
|
+
node.msg.connectionerror = false;
|
|
379
|
+
node.send([null, { payload: node.msg.connectionerror }]);
|
|
380
|
+
}
|
|
381
|
+
node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 5000);
|
|
372
382
|
|
|
373
|
-
|
|
374
|
-
|
|
383
|
+
}).catch(err => {
|
|
384
|
+
node.setNodeStatus({ fill: "red", shape: "dot", text: "Sonos connection is DOWN: " + err.message });
|
|
375
385
|
node.flushQueue();
|
|
376
|
-
|
|
377
|
-
node.msg.connectionerror
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
node.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
node.send([null, { payload: node.msg.connectionerror }]);
|
|
389
|
-
}
|
|
390
|
-
node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 10000);
|
|
391
|
-
});
|
|
386
|
+
// 11/12/2020 Set node output to signal connectio error
|
|
387
|
+
if (node.msg.connectionerror == false) {
|
|
388
|
+
node.msg.connectionerror = true;
|
|
389
|
+
node.send([null, { payload: node.msg.connectionerror }]);
|
|
390
|
+
}
|
|
391
|
+
node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 10000);
|
|
392
|
+
});
|
|
393
|
+
} else {
|
|
394
|
+
node.setNodeStatus({ fill: "green", shape: "dot", text: "Sonos is connected." });
|
|
395
|
+
node.msg.connectionerror = false;
|
|
396
|
+
node.send([null, { payload: node.msg.connectionerror }]);
|
|
397
|
+
}
|
|
392
398
|
|
|
393
399
|
}
|
|
394
400
|
|
|
@@ -614,6 +620,7 @@ module.exports = function (RED) {
|
|
|
614
620
|
} else if (node.server.ttsservice === "googletranslate") {
|
|
615
621
|
node.setNodeStatus({ fill: 'green', shape: 'ring', text: 'Downloading from Google Translate...' });
|
|
616
622
|
// VoiceId is: code. SSML is not supported by google translate
|
|
623
|
+
if (node.voiceId === "cmn-Hant-TW") node.voiceId = "zh-CN"; // 06/08/2022 fix for a wrong voiceid sent by google translate as voice code
|
|
617
624
|
const params = {
|
|
618
625
|
text: msg,
|
|
619
626
|
voice: node.voiceId,
|
|
@@ -894,7 +901,7 @@ module.exports = function (RED) {
|
|
|
894
901
|
// *********************************
|
|
895
902
|
|
|
896
903
|
// In case of connection error, doesn't accept any message
|
|
897
|
-
if (node.msg.connectionerror) {
|
|
904
|
+
if (node.msg.connectionerror && node.playertype !== "noplayer") {
|
|
898
905
|
RED.log.warn("ttsultimate: Sonos is offline. The new msg coming from the flow will be rejected.");
|
|
899
906
|
node.setNodeStatus({ fill: 'red', shape: 'ring', text: "Sonos is offline. The msg has been rejected." });
|
|
900
907
|
return;
|