Audio problems using exec node

Are you starting NR using sudo? you were in another issue...
I'm just looking to find differences in my setup vrs yours

Those two appear to be in conflict with each other.

Also, when you say it works, make sure it is clear exactly what works.

Sorry I made a mistake in an earlier post.
this is the situation

It runs fine from remote ssh shell
It runs fine from native terminal on RPI.
It does not run from exec mode.
I dont use sudo to start node red

What works? When you say it works, make sure it is clear exactly what it is that works. Running the command directly, running via exec, starting node red with node-red, starting node red with node-red-start or something else.

OK if I start with node-red-start:
SSH terminal from my PC plays mp3 files successfully
VNC into RPI native terminal plays files successfully
Exec mode in node red DOES NOT play but shows no errors (outputs no sound)

If I start with node-red:
SSH terminal from my PC plays mp3 files successfully
VNC into RPI native terminal plays files successfully
Exec mode in node red PLAYS FILE OK.

Sorry, still not clear. You mean that if you ssh in from the PC and in the ssh shell run node-red-start it plays ok?

Have you tried it with the DISPLAY var setting yet?

From my PC in SSH shell
node-red-stop
then
node-red-start
then
mpg123 /home/pi/recordings/blue_bin_gets_collected_on_friday.mp3

then it outputs sound but exec node in node red does not.

from my PC in SSH shell
node-red-stop
then
node-red
Everything works

I don't know what Display var setting is.

From my post 4 hours ago

If that doesn't help (and I don't expect it to) then run your usual command in the terminal window, but include the flag -v in the command (see mpg123(1): play audio MPEG 1.0/2.0/2.5 stream - Linux man page) to get more verbose logging. Then run that same command in the exec node and compare the outputs to see what difference there is.

In fact before that check that without the verbose flag you see exactly the same output in the terminal window and coming out of the exec node.

without verbose debug output from exec and return message from ssh in terminal are identical.

Running
DISPLAY=:0 mpg123 /home/pi/...`
now produces an output !!!!!
I'm way out of my depth here and don't know what is happening.

Possibly relevant thread (albeit about Ubuntu rather than RaspiOS) but underlying cause is probably similar. Play sound *on* remote machine via ssh on Ubuntu / Linux - Super User

that post relates to problems running mpg123 via ssh.
I have no problem with that only with exec node in node red.

Are you trying to get it to play the audio in the browser from another device that is accessing the Node-RED editor, or from a speaker hooked directly to the device running Node-RED?

The post is showing that the environment that the command is running in may not be correct. And in that case adding the DISPLAY setting also is a possible fix

1 Like

Speaker connected to the RPI and using node red on same device.

I have been running this for a couple of years without problems and don't know what has changed.

I don't think you answered my earlier question

Possibly using apt upgrade for example.

I have to say, I didn't expect the DISPLAY option to work, because the command works in a remote ssh shell without it. Usually if DISPLAY is going to fix it then it won't work in a remote ssh shell. Can I ask exactly how you start the remote shell.

What the DISPLAY=:0 does, as far as I am aware, is to make the command think that it has a display available, which suggests that mpg123 relies on that in some way. Why that should be I don't know.

Colin
I really appreciate your patience in this matter.
I have a couple of PIs and this main one, because of the amount of stuff on there, Grafana, nginx etc etc etc, I rarely meddle with it. Having said that I can't be sure if I didn't do some upgrades. Just thinking about it and your mention of display I wonder did I enable VNC for a project recently. I'll check.....
BTW remote shell is just putty on my windows pc

just checked VNC makes no difference.

You may just have to put it down as one of the great unsolved mysteries of life. Keep the DISPLAY spec in the command and be happy. :slight_smile:

Colin thanks again for all your help. Lets just hope that nothing else rears its head. I'm still confused as to why loading node red with "node red" works fine.
cheers
John