Hi, I'm using the exec node in Node-RED. I want to play a sound clip when I give input to the exec node. When I run the command manually via the command line in Putty, everything works fine. However, when I run the same command in the exec node, nothing happens. There are no error messages, and in debug 3, it shows 'code 0'.
You need to enable your public thing in the settings file for node-red
so the sound file has to be in that directory.
eg: from my working one.
(This is in a template node to build the message) /home/pi/.node-red/public/Sounds/{{payload}}
and my exec node uses the payload
(settings file change needed)
// When httpAdminRoot is used to move the UI to a different root path, the
// following property can be used to identify a directory of static content
// that should be served at http://localhost:1880/.
//httpStatic: '/home/nol/node-red-static/',
httpStatic: '/home/pi/.node-red/public', // <-- this line here
//httpStatic: '/home/pi',
I work directly with a mouse and keyboard on the Raspberry Pi.
So why do you need to use putty to get to it?
First off:
mkdir public
Then edit the settings.js file.
eg: nano settings.js
Then scroll down and find the line httpStatic
Change the line and save.
then put a copy of the file you want to play in that directory.
I am making a kind of Steady Hand Game with a Siemens Logo. When the spiral is touched, a buzzer sounds, which is controlled by the Logo. At the end of the game, the ring makes contact with a separate input on the Logo.
After that, a hoho.mp3 sound clip should play.
I already tried this with the 'Audio Out' in Node-RED, but it played through my PC speakers instead of the Raspberry Pi.
I’m almost at my wit’s end, and I’m not very experienced with programming in Putty yet.