Exec node can't execute the command but terminal does

I can run in terminal: "./speech.sh hello" all ok but in exec node runs with no error, i didn't hear "hello" from speakers and the output message is: Terminal type `unknown' is not defined.
Can anyone help me i tried everything.
Is it possible to run this command from node-red?

Where is the speech.sh file? and What exactly did you put into the exec node?

Also what is the first line of the script?

the file

say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en"; }
say $*

The file is in the home folder and i try to execute the command with whole path of the file from exec same result
Exec node edit: command: ./speech and the payload is: hello
I use google tts language (text to speech)
RPi 4 raspbian

the flow

[{"id":"ba75182c1bcff601","type":"exec","z":"f10a1076.cc20b","command":" ./speech.sh","addpay":"payload","append":"","useSpawn":"false","timer":"20","winHide":false,"oldrc":false,"name":"","x":760,"y":1020,"wires":[["02e1579a7bcba2fa"],[],[]]},{"id":"b8b3791d832ef9cf","type":"inject","z":"f10a1076.cc20b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello","payloadType":"str","x":560,"y":1040,"wires":[["ba75182c1bcff601"]]}]

The exec node doesn't know where " ./speech.sh" is. you need to put the full path to
speech.sh in the node.

I try it with full path same result

[{"id":"ba75182c1bcff601","type":"exec","z":"f10a1076.cc20b","command":" /home/pi/speech.sh ","addpay":"payload","append":"","useSpawn":"false","timer":"20","winHide":false,"oldrc":false,"name":"","x":780,"y":1020,"wires":[["02e1579a7bcba2fa"],[],[]]},{"id":"b8b3791d832ef9cf","type":"inject","z":"f10a1076.cc20b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hello","payloadType":"str","x":560,"y":1040,"wires":[["ba75182c1bcff601"]]}]

i also copy the file in node-red folder

When you are in the folder where the command line command "./speech.sh hello" works for you, what does the command "pwd" show?

pi@raspberrypi:~ $ pwd
pi@raspberrypi:~ $ cd /home/pi/.node-red/
pi@raspberrypi:~/.node-red $ pwd
pi@raspberrypi:~/.node-red $ ls
flows_raspberrypi_cred.json  lib           package-lock.json     speech.sh
flows_raspberrypi.json       node_modules  settings.js
hourglass                    package.json  sonospollyttsstorage

So the command should be /home/pi/.node-red/speech.sh not /home/pi/speech.sh

It might not be a file path problem but make sure you've tested that all out 1st

When running audio stuff from the exec node - you sometimes have to be explict about specifying what audio hardware to use.

I play an mp3 via an exec node and had to add in lots of stuff to get it work

mpg123  -a plughw:1,0 alexa.mp3

You might have to do something similar to hear your speech

It took a lot of googling to find out how to get mine to work

I try with /home/pi/.node-red/speech.sh and gives error.
I think Cymplecy is right i must put something in the command about the audio.
I was googling but i didn't find somethin similar.

Is an other way to execute this command via node-red?
Or an other way to make my RPi speak in foreign language for example Greek via node-red text-to-speech?
To complete my project i need only this and i will be pleased if someone find me a solution.

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