# Google TTS node - problem. Something weird happening with output

**URL:** https://discourse.nodered.org/t/google-tts-node-problem-something-weird-happening-with-output/89419
**Category:** General
**Created:** [11 July 2024 09:23 UTC](https://discourse.nodered.org/t/google-tts-node-problem-something-weird-happening-with-output/89419 "2024-07-11T09:23:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 July 2024 09:23 UTC](https://discourse.nodered.org/t/google-tts-node-problem-something-weird-happening-with-output/89419/1 "2024-07-11T09:23:21Z")

</div>

Hi again folks.

Ongoing from my other quest I have found this _problem_ with the google TTS node.

Scenario:  
I got bitten by the cuteness of a site which gives _Quotes of the day_ and so I got inventive and was/am/still am trying to get it working 100%.

After the problem from yesterday, there is a new one.  
(Of course)

## code:

```auto
[{"id":"b0b9889d3818a108","type":"inject","z":"60d0e3e966d484ae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"this is a test","payloadType":"str","x":4240,"y":2160,"wires":[["59ccb687dfcfc704"]]},{"id":"810634a27dc413d1","type":"inject","z":"60d0e3e966d484ae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Eckhart Tolle says The present moment has always been available to spiritual seekers, but as long as you are seeking you are not available to the present moment. Seeking implies that you are looking to the future for some answer, or for some achievement, spiritual or otherwise.","payloadType":"str","x":4260,"y":2120,"wires":[["59ccb687dfcfc704"]]},{"id":"41a8b8ef84a6be13","type":"inject","z":"60d0e3e966d484ae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Eckhart Tolle says The present moment has always been available to spiritual seekers, but as long as you are seeking you are not available to the present moment. Seeking implies that you are looking to the future for some answer, or for some achievement, spiritual or otherwise. Everybody is in the seeking mode, seeking to add something to who they are, whether it be money, relationships, possessions, knowledge, status.. or spiritual attainment","payloadType":"str","x":4260,"y":2080,"wires":[["59ccb687dfcfc704"]]},{"id":"59ccb687dfcfc704","type":"ttsultimate","z":"60d0e3e966d484ae","name":"TTS-Ultimate","voice":"en-AU","ssml":false,"sonosipaddress":"","sonosvolume":"20","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"1","speakingpitch":"0","unmuteIfMuted":true,"elevenlabsStability":"0.5","elevenlabsSimilarity_boost":"0.5","x":4440,"y":2020,"wires":[["eddc469dd44ddef0","921cfd903b789ce2"],[]]},{"id":"eddc469dd44ddef0","type":"function","z":"60d0e3e966d484ae","name":"get voice message","func":"msg.payload = msg.filesArray[0].file;\n\nmsg.volume = 1\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":4565,"y":2020,"wires":[["4fc8e8dcbbe54ad3","1c329421b6c8dbbe"]],"l":false},{"id":"4fc8e8dcbbe54ad3","type":"template","z":"60d0e3e966d484ae","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{{payload}}} -af \"volume={{volume}}\" -f wav - | DISPLAY=:0 aplay","output":"str","x":4670,"y":2020,"wires":[["a90e3d865b2d6f42","26334f9ce96ae3fd"]]},{"id":"a90e3d865b2d6f42","type":"exec","z":"60d0e3e966d484ae","command":"ffmpeg -i","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":4840,"y":2020,"wires":[[],[],[]]},{"id":"557d8082.eb5a8","type":"ttsultimate-config","name":"googletranslate","noderedipaddress":"127.0.0.1","noderedport":"1980","purgediratrestart":"leave","ttsservice":"googletranslate","TTSRootFolderPath":""}]

```

And sorry I didn't name the `inject` nodes.

## Problem:

If they quote is _short_ it works.  
But this one doesn't work.

If I press `this is a test` it works.  
This is establishing the base line. 😉

After the `TTS` node, there is a `function` node.  
This _parses_ the message and puts things ready for the next bit.  
`msg.payload = msg.filesArray[0].file;`  
As the _magic stuff_ is in `msg.filesArray[0].file`

And it sets the volume (not shown here but needed later on)

So then I have the other two `inject` nodes.  
They have the FULL message and the other one (lower of the two) has a _snip of_ the bigger message.

NEITHER get through the google TTS node.

And - interestingly - sometimes the smaller one DOES get an output but the message sent out of the TTS node is different in structure to how it normally is.

## Bad example

 ![Screenshot from 2024-07-11 19-10-41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3b010ba351322eb8b26ad31add4974b40d294b0.png)

## Good example

 ![Screenshot from 2024-07-11 19-13-32](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a90e3c78a6a710017ea15d26c5dbb7c6d6b4c00.png)

So that _got through_ and you see the `message` going into the `exec` node.

## So?

The `test` one works. Well, it gets to send a message to the `exec` node correctly.  
**EITHER** of the other two `inject` nodes, it just fails.

While doing this, I heard a fairly long _QOTD_ come through and work.  
So that kind of invalidates my theory that it is too long.  
There were `"` in the original one too, and I took them out just to be sure of other problems from yesterday.

Anyway: the question stands to why the `test` message gets through and it output in the expected structure and why (the top of the two) the `inject` node that sends a briefer message than the bottom one (or is that the other way around?) (Doesn't really matter)  
It sends a differently structured message out.

Of course the code will fail with the different structure.  
But if you look closely at even the good one, the TTS node spits out an incorrectly formatted message.  
You can just see it at the top of the picture. But then it spits out a correctly structured one and all is good.

The other thing which is kind of annoying.  
This i done my my BIG machine.  
Testing on the RasPi is _cruel_ as it already has a job and takes a while to DEPLOY.  
But the sound plays, and all is otherwise good.

THIS machine no sound is played.  
If I open a terminal and do the command as presented to the `exec` node: it plays.  
So that is another problem. Not sure it is relevant to the problem, but I'm mentioning it anyway.

Someone - please?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 October 2024 09:24 UTC](https://discourse.nodered.org/t/google-tts-node-problem-something-weird-happening-with-output/89419/2 "2024-10-09T09:24:12Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
