Closed wsidaw closed 1 year ago
I think some spec of ssml usage might be changed. I’ll research in a few days. (ATM I’m not in front of my console, so can’t)
At a glance, your ssml might have invalid syntax.
SSML should have <speak>
tag as a root node.
ref this: https://cloud.google.com/text-to-speech/docs/ssml-tutorial
You can check your syntax here;
http://garrettvargas.com/ssml.html
Would you confirm your syntax first?
I could have sworn I added the full code in the issue creation.
Here is the code again:
return “
I checked the syntax and it looks fine.
The module is still not working for type ssml
I also sent it a regular message like so “hi there” and it does bot work with ssml type.
btw. Looks like every time I add a comment with ‘speak’ it gets filtered out.
Just want you to know that I do have the speak in there but for some reason github is removing the word. Not sure how you were able to add it in your comment.
maybe the picture will help
From where does this code come? I can't figure out the context of this. Is it notification Hook
? Or did you modify the source?
Anyway, what does payload
deliver?
For example; payload
is "The Beauty"; the whole value returned are;
<speak> <break time="1s"/> Looking good </speak> The Beauty
And it's an invalid format. <speak>
should be the most top-level node, but "The Beauty" string is outside of it.
I think this would be your intention.
return `<speak><break time="1s"/> Looking good ${payload}</speak>`
Thanks for the response. I should provide more context. So the error happens only with the ssml type in the config in 3 different manners (upon module start, when I send a command via notification trigger module, and with telegram message)
While the error happens only with the ssml type in the MMM-GoogleTTS config, with whatever payload (normal or ssml) I send it or it starts with, it's the the same error.
Here's the config (type: ssml)
{ module: "MMM-GoogleTTS", classes: 'always', config: { sourceType: "ssml" } },
here are the 3 different manners that it fails on:
1) Here's what happens when the module starts (with the default message the module comes with 'may the force be with you')
sudo cat /proc/30426/fd/1 | grep "TTS"
[25.06.2023 18:28.30.290] [LOG] Module helper loaded: MMM-GoogleTTS
[25.06.2023 18:28.32.284] [LOG] Connecting socket for: MMM-GoogleTTS
[25.06.2023 18:28.55.336] [LOG] [GGLTTS] Initialized.
[25.06.2023 18:28.55.899] [LOG] [GGLTTS] Today's quota used: 423
[25.06.2023 18:29.26.493] [LOG] [GGLTTS] Synthesize Error: Error: 3 INVALID_ARGUMENT: Invalid SSML. Newer voices like Neural2 require valid SSML.
at Object.callErrorFromStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:190:52)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
at ServiceClientImpl.makeUnaryRequest (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:160:30)
at ServiceClientImpl.
2) Using the MMM-Notificationtrigger module
MMM-NotificationTrigger setup (I updated it with the syntax sample you gave me)
{ module: "MMM-NotificationTrigger", classes: 'always', debug: true, config: { triggers:[ { trigger: "USERS_LOGIN", fires: [ { fire:"TTS_SAY", delay: 2000, payload: (payload) => { console.log("show alert is working?") if (payload == 'wsidaw') { return '<speak><break time="1s"/> Looking good ${payload}</speak>' } else { return '<speak> <voice language=\"es-US\"> Hi there <break time=\"1s\"/> who are you </voice></speak>' } }, }, ], }, }, }
and here's the error:
[25.06.2023 18:42.28.927] [LOG] [GGLTTS] Synthesize Error: Error: 3 INVALID_ARGUMENT: Invalid SSML. Newer voices like Neural2 require valid SSML.
at Object.callErrorFromStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:190:52)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
at ServiceClientImpl.makeUnaryRequest (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:160:30)
at ServiceClientImpl.
3) This is what I send using telegram
/tts hi
here's the error right after I send that message in telegram
[25.06.2023 18:40.07.127] [LOG] [GGLTTS] Synthesize Error: Error: 3 INVALID_ARGUMENT: Invalid SSML. Newer voices like Neural2 require valid SSML.
at Object.callErrorFromStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:190:52)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
at ServiceClientImpl.makeUnaryRequest (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:160:30)
at ServiceClientImpl.
Hoping the code and errors made it to the comment
Here's the config (type: ssml)
{ module: "MMM-GoogleTTS", classes: 'always', config: { sourceType: "ssml" } },
here are the 3 different manners that it fails on:
- Here's what happens when the module starts (with the default message the module comes with 'may the force be with you')
Welcome message "may the force be with you" itself is not a ssml content. (By default, sourceType
is assumed as text
)
So it should be configured like this when you set default sourceType
to ssml
;
sourceType: `ssml`,
welcome: `<speak>May the force be with you</speak>`,
This is what I send using telegram
/tts hi
This is the same case; you set your default sourceType to ssml
, but "hi" is not a valid ssml content. you should send <speak>hi</speak>
.
I couldn't guess the context of this code(where the notification would come from and what is delivered on payload); anyway, here is my test version for notificationTrigger
and ssml
{
module: "MMM-NotificationTrigger",
config: {
triggers: [
{
trigger: "USER_LOGIN",
fires: [
{
fire: "TTS_SAY",
delay: 2000,
payload: (payload) => {
let result = ''
console.log("original payload", payload)
if (payload == 'Harry Potter') {
result = `<speak><break time="1s"/> Looking good ${payload}</speak>` // Be careful with the quotes.
} else {
result '<speak> <voice language="es-US"> Hi there <break time="1s"/> who are you </voice></speak>'
}
console.log('The delivery', result)
return result
},
},
],
},
]
},
}
// In my test module;
this.sendNotification("USER_LOGIN", "Harry Potter");
// or
this.sendNotification("USER_LOGIN", "Lucius Malfoy");
Especially, be careful to use quotation marks. (`, ", ') Each has its own meaning. Anyway, it works.
Well...all your examples worked :)
I understand the reasoning and now I will be using the syntax the correct way.
The reason I had submitted the issue was because things were working as I showed in my examples for the past year.
I didn't change any of that config and all of a sudden I started getting those errors.
My guess is that I was doing it wrong (while still working) this whole time and the backend google api was allowing it. I can't explain why it had been working before honestly. Guessing google changed how they verify the ssml syntax?
In any case, I will use the correct way from now on. Thanks so much!
Good to hear. I’ll close this issue.
Hi there! I've recently started getting an invalid ssml error message from the module. The module had been working fine since I started using it last year.
Here's my config:
{ module: "MMM-GoogleTTS", classes: 'always', config: { sourceType: "ssml"
} },
Here's the error I get when sending both a regular message or ssml type of message with the above config.
sample message "hi there" sample ssml message " <break time=\"1s\"/> Looking good '"
sudo cat /proc/30040/fd/1 | grep "TTS" [25.06.2023 10:10.41.987] [LOG] Module helper loaded: MMM-GoogleTTS [25.06.2023 10:10.43.803] [LOG] Connecting socket for: MMM-GoogleTTS [25.06.2023 10:11.03.849] [LOG] [GGLTTS] Initialized. [25.06.2023 10:11.04.261] [LOG] [GGLTTS] Today's quota used: 0 [25.06.2023 10:11.33.992] [LOG] [GGLTTS] Synthesize Error: Error: 3 INVALID_ARGUMENT: Invalid SSML. Newer voices like Neural2 require valid SSML. at Object.callErrorFromStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call.js:31:19) at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:190:52) at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141) at Object.onReceiveStatus (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181) at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78 at ServiceClientImpl.makeUnaryRequest (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/client.js:160:30) at ServiceClientImpl. (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/@google-cloud/text-to-speech/build/src/v1/text_to_speech_client.js:167:29
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
at repeat (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/normalCalls/retries.js:80:25)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/normalCalls/retries.js:118:13
at OngoingCall.call (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/call.js:67:27)
at NormalApiCaller.call (/home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
at /home/pi/MagicMirror/modules/MMM-GoogleTTS/node_modules/google-gax/build/src/createApiCall.js:81:30
[25.06.2023 10:11.42.869] [INFO] Checking git for module: MMM-GoogleTTS
Regular messages work fine only if sourcetype is 'text'. - does not work if it's 'ssml'.
sample message: "hi there"
{ module: "MMM-GoogleTTS", classes: 'always', config: { sourceType: "text"
} },