Help with TEMPLATE node

I am wanting to inject something like this:

volume=-12dB

When it is put through the template node I am getting this (extract)
-af "volume=0db"

The - is replaced with &#x3D'
(or is it the =- that is messing things up?)

Not really wanted.

Sorry, but I can't find/remember how to do this exactly.

Hi @Trying_to_learn

Without seeing the template content, I think you need to use 3 brackets, instead of 2

{{payload}} vs {{{payload}}}

3 brackets stops it from escaping special characters

I could be wrong of course

1 Like

(Guess on what I am working.) :wink:

I'm nearly there now.

But still not sure it will work.

I am only at getting the template correct.

What the exec node will make of it is an entirely different/new thing.

1 Like

(This isn't fair)

Not you.

But how it all works.

I am stuck between a rock and hard place.

Arcing back to my TTS problem.

I've found the command options to control the volume of ffmpeg when playing a file.
(I hope)
So the command looks sound (pardon the pun) but I am not getting it to work.
Putting a debug node on the output it looks alright.
But I don't hear anything.

I can't really (or don't know how to) test it from the terminal of the remote (headless) machine.

This is what I have now.

[{"id":"5c18a1879c3fb946","type":"ttsultimate","z":"235f16ee6e459f2c","name":"","voice":"en-AU","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"30","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"","speakingpitch":"","unmuteIfMuted":false,"elevenlabsStability":"","elevenlabsSimilarity_boost":"","x":3350,"y":1150,"wires":[["e0d1d13cca74b4e5"],[]]},{"id":"49fe9520d7455acf","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello there","payloadType":"str","x":3280,"y":1220,"wires":[["5c18a1879c3fb946"]]},{"id":"e0d1d13cca74b4e5","type":"switch","z":"235f16ee6e459f2c","name":"","property":"filesArray","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":3500,"y":1150,"wires":[["6dcf944e40d84d7f"]]},{"id":"6dcf944e40d84d7f","type":"change","z":"235f16ee6e459f2c","name":"-12","rules":[{"t":"set","p":"volume","pt":"msg","to":"-12","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":3630,"y":1150,"wires":[["180cac7d01f18109"]]},{"id":"180cac7d01f18109","type":"function","z":"235f16ee6e459f2c","name":"function 15","func":"msg.payload = msg.filesArray[0].file;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3800,"y":1040,"wires":[["aeb8a5ea2cedced4","89ae14c79347b072"]]},{"id":"dc5b0685e89a38fd","type":"change","z":"235f16ee6e459f2c","name":"0db","rules":[{"t":"set","p":"volume","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":3640,"y":1060,"wires":[["180cac7d01f18109"]]},{"id":"e4ad0d971cae4654","type":"change","z":"235f16ee6e459f2c","name":"+3","rules":[{"t":"set","p":"volume","pt":"msg","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":3630,"y":1260,"wires":[["180cac7d01f18109"]]},{"id":"aeb8a5ea2cedced4","type":"template","z":"235f16ee6e459f2c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} -af \"volume={{volume}}dB\" -f wav - | DISPLAY=:0 aplay","output":"str","x":3970,"y":1020,"wires":[["8629bda419932c92"]]},{"id":"89ae14c79347b072","type":"exec","z":"235f16ee6e459f2c","command":"ffmpeg -i","addpay":"payload","append":"-f wav - | DISPLAY=:0 aplay ","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":3980,"y":1110,"wires":[[],[],[]]},{"id":"fcf61de15ab84c8e","type":"switch","z":"235f16ee6e459f2c","name":"","property":"filesArray","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":3510,"y":1040,"wires":[["dc5b0685e89a38fd"]]},{"id":"ef63e2bf8cb30c92","type":"switch","z":"235f16ee6e459f2c","name":"","property":"filesArray","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":3500,"y":1260,"wires":[["e4ad0d971cae4654"]]},{"id":"8629bda419932c92","type":"debug","z":"235f16ee6e459f2c","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":4140,"y":1020,"wires":[]},{"id":"4fd53652fa2a7941","type":"ttsultimate","z":"235f16ee6e459f2c","name":"","voice":"en-AU","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"30","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"","speakingpitch":"","unmuteIfMuted":false,"elevenlabsStability":"","elevenlabsSimilarity_boost":"","x":3360,"y":1040,"wires":[["fcf61de15ab84c8e"],[]]},{"id":"922d332ef377b798","type":"ttsultimate","z":"235f16ee6e459f2c","name":"","voice":"en-AU","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"30","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"","speakingpitch":"","unmuteIfMuted":false,"elevenlabsStability":"","elevenlabsSimilarity_boost":"","x":3350,"y":1260,"wires":[["ef63e2bf8cb30c92"],[]]},{"id":"c41a891876e7e97d","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello there","payloadType":"str","x":3290,"y":1110,"wires":[["4fd53652fa2a7941"]]},{"id":"7f3abb61038637e5","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello there","payloadType":"str","x":3280,"y":1330,"wires":[["922d332ef377b798"]]},{"id":"0966946ed06cc3f8","type":"exec","z":"235f16ee6e459f2c","command":"ffmpeg -i","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":4140,"y":1070,"wires":[[],[],[]]},{"id":"bf61456b0ab0b571","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"something","v":"-12","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"payload","payloadType":"str","x":3850,"y":1290,"wires":[["bb8467bab5e8a033"]]},{"id":"bb8467bab5e8a033","type":"template","z":"235f16ee6e459f2c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{{payload}}} -af \"volume={{something}}dB\"","output":"str","x":4050,"y":1290,"wires":[["1d75070cea065d29"]]},{"id":"1d75070cea065d29","type":"debug","z":"235f16ee6e459f2c","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":4290,"y":1290,"wires":[]},{"id":"afa186a13b1df202","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello there","payloadType":"str","x":3300,"y":990,"wires":[["23ca465dc505edb7"]]},{"id":"23ca465dc505edb7","type":"ttsultimate","z":"235f16ee6e459f2c","name":"","voice":"en-AU","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"30","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"","speakingpitch":"","unmuteIfMuted":false,"elevenlabsStability":"","elevenlabsSimilarity_boost":"","x":3370,"y":920,"wires":[["b5987bbb64a341d2"],[]]},{"id":"b5987bbb64a341d2","type":"switch","z":"235f16ee6e459f2c","name":"","property":"filesArray","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":3520,"y":920,"wires":[["3dcee35ef0f08cb1"]]},{"id":"3dcee35ef0f08cb1","type":"function","z":"235f16ee6e459f2c","name":"function 14","func":"msg.payload = msg.filesArray[0].file;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3660,"y":920,"wires":[["9ef912cce16e2209"]]},{"id":"9ef912cce16e2209","type":"exec","z":"235f16ee6e459f2c","command":"ffmpeg -i","addpay":"payload","append":"-af \"volume=-12dB\" -f wav - | DISPLAY=:0 aplay ","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":3830,"y":920,"wires":[[],[],[]]},{"id":"557d8082.eb5a8","type":"ttsultimate-config","name":"googletranslate","noderedipaddress":"127.0.0.1","noderedport":"1980","purgediratrestart":"leave","ttsservice":"googletranslate","TTSRootFolderPath":""}]

Picture:

The base line works. But no sound/volume control.
Quick trip to the YELLOW nodes.
This modifies the command and includes the volume part. (See outputs in debug)
But when I change the exec node from the working one to the RED one, I hear silence.

I don't know how to PROVE the new command structure/syntax works, but see:

It maybe nice if I know how to invoke the TTS from the other machine's CLI and make sure it works at that level.

Sorry if this is getting OFF TOPIC for the thread, but as I said: I'm stuck between a rock and hard place as I know SFA about what I am doing.

SORRY!

I just found the mistake.

I forgot to the the 3 {} around the payload.

Working now.

SO SORRY @marcus-j-davies.

1 Like

Sadly, I don’t do much (anything) with ffmpeg.

So my attempt at understanding it, will be an all in bet of making it worse.

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