# Audio problems using exec node

**URL:** <https://discourse.nodered.org/t/audio-problems-using-exec-node/77706>\
**Category:** General\
**Created:** [19 April 2023 07:35 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706 "2023-04-19T07:35:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 April 2023 14:12 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/21 "2023-04-19T14:12:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 14:19 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/22 "2023-04-19T14:19:56Z")

</div>

> [@muggins](#):
>
> When I use ssh from my PC it does not

> [@muggins](#):
>
> It runs fine from remote ssh shell

Those two appear to be in conflict with each other.

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

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 14:49 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/23 "2023-04-19T14:49:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 15:00 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/24 "2023-04-19T15:00:54Z")

</div>

> [@muggins](#):
>
> It runs fine from remote ssh shell  
> It runs fine from native terminal on RPI.  
> It does not run from exec mode.

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.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 15:53 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/25 "2023-04-19T15:53:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 16:03 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/26 "2023-04-19T16:03:09Z")

</div>

> [@muggins](#):
>
> OK if I start with node-red-start:  
> SSH terminal from my PC plays mp3 files successfully

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?

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 16:09 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/27 "2023-04-19T16:09:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 16:24 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/28 "2023-04-19T16:24:07Z")

</div>

From my post 4 hours ago

> [@Colin](#):
>
> try using the command  
> `DISPLAY=:0 mpg123 /home/pi/...`  
> or  
> `DISPLAY=:1 mpg123 /home/pi/...`

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 16:41 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/29 "2023-04-19T16:41:28Z")

</div>

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](https://linux.die.net/man/1/mpg123)) 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.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 17:03 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/30 "2023-04-19T17:03:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [19 April 2023 17:47 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/31 "2023-04-19T17:47:27Z")

</div>

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](https://superuser.com/questions/823904/play-sound-on-remote-machine-via-ssh-on-ubuntu-linux)

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 18:01 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/32 "2023-04-19T18:01:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [19 April 2023 18:36 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/33 "2023-04-19T18:36:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [19 April 2023 18:40 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/34 "2023-04-19T18:40:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 18:51 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/35 "2023-04-19T18:51:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 18:52 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/36 "2023-04-19T18:52:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 19:30 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/37 "2023-04-19T19:30:49Z")

</div>

I don't think you answered my earlier question

> [@Colin](#):
>
> Did you update any OS packages recently?

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.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 19:49 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/38 "2023-04-19T19:49:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 19:57 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/39 "2023-04-19T19:57:22Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [19 April 2023 20:20 UTC](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706/40 "2023-04-19T20:20:51Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706.md?page=1)

[Next page](https://discourse.nodered.org/t/audio-problems-using-exec-node/77706.md?page=3)
