# More audio problems using exec node

**URL:** <https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [3 January 2024 22:08 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263 "2024-01-03T22:08:45Z")\
**Posts on this page:** 13\
**Page:** 1

<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:** [3 January 2024 22:08 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/1 "2024-01-03T22:08:45Z")

</div>

Hi  
I've raised this issue before and Colin very kindly found a resolution. I've now completely rebuilt my PI4 around "Bookworm" and problem has arisen again. Using ssh to the PI if I enter:  
mpg123 /home/pi/recordings/testFile.mp3 ... it plays without error.

If I run same command in an node red exec I get this:  
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3  
version 1.31.2; written and copyright by Michael Hipp and others  
free software (LGPL) without any warranty but with best wishes  
Cannot connect to server socket err = No such file or directory  
Cannot connect to server request channel  
jack server is not running or cannot be started  
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock  
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

I've tried the old solution "DISPLAY=:1 mpg123 /home/pi/recordings/testFile.mp3" and it still fails.  
Similar to before if I node-red-stop and then node-red, then it works.

Any help please...

---

<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:** [4 January 2024 17:58 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/2 "2024-01-04T17:58:11Z")

</div>

Further to this:  
node-red-contrib-play-audio-file also won't play files unless I stop node red and start it again using "node-red" instead of "node-red-start"

I don't know what is the difference between the 2 methods of starting node red. Is it possible to auto start it in the mode "node-red"

---

<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:** [4 January 2024 19:19 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/3 "2024-01-04T19:19:14Z")

</div>

Open a CLI to the Pi running NR and then run this command:  
`cat /lib/systemd/system/nodered.service`  
look at the first couple lines and find the `[Service`] section. Is the user named there the same user name you are using when you use 'node-red' to start?

If they are different run `groups xx` (replacing 'xx' with the user id) and compare the output of the two.  
Are there any differences? (like one has `sudo` and the other doesn't)

---

<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:** [4 January 2024 20:15 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/4 "2024-01-04T20:15:08Z")

</div>

Both scenarios seem to be identical:

# systemd service file to start Node-RED

[Unit]  
Description=Node-RED graphical event wiring tool  
Wants=network.target  
Documentation=[Redirecting…](http://nodered.org/docs/hardware/raspberrypi.html)

[Service]  
Type=simple

# Run as normal pi user - change to the user name you wish to run Node-RED as

User=pi  
Group=pi  
WorkingDirectory=/home/pi

Environment="NODE\_OPTIONS=--max\_old\_space\_size=512"

# define an optional environment file in Node-RED's user directory to set custom variables externally

EnvironmentFile=-/home/pi/.node-red/EnvironmentFile

# uncomment and edit next line if you need an http proxy

#Environment="HTTP\_PROXY=my.httpproxy.server.address"

# uncomment the next line for a more verbose log output

#Environment="NODE\_RED\_OPTIONS=-v"

# uncomment next line if you need to wait for time sync before starting

#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.\* Synchronized to time server"'

ExecStart=/usr/bin/env node-red-pi $NODE\_OPTIONS $NODE\_RED\_OPTIONS  
#ExecStart=/usr/bin/env node $NODE\_OPTIONS red.js $NODE\_RED\_OPTIONS

# Use SIGINT to stop

KillSignal=SIGINT

# Auto restart on crash

Restart=on-failure  
RestartSec=20

# Tag things in the log

SyslogIdentifier=Node-RED  
#StandardOutput=syslog

[Install]  
WantedBy=multi-user.target

---

<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:** [4 January 2024 20:53 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/5 "2024-01-04T20:53:09Z")

</div>

> [@muggins](#):
>
> I don't know what is the difference between the 2 methods of starting node red.

There are multiple differences. For a start, when you run node-red the command is associated with a display. The environment variables (PATH etc) are also going to be different. Didn't we go over all this the first time round?

Have you tried `DISPLAY=:0` instead of `:1`?

---

<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:** [4 January 2024 21:27 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/6 "2024-01-04T21:27:22Z")

</div>

Colin  
Yes I have referred back to our previous posts. On that occasion DISPLAY=:0 sorted it.  
Yes I have tried DISPLAY=:1 to no avail.  
It seems strange (to me) that the well tested "node-red-contrib-play-audio-file" also won't play. Am I the only one having this issue? This is a completely fresh Bookworm os.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 January 2024 08:14 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/7 "2024-01-05T08:14:37Z")

</div>

> [@muggins](#):
>
> This is a completely fresh Bookworm os.

Is the clue to why your the only one having problems  
Its a new Pi OS and your probably the only person trying to do this

---

<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:** [5 January 2024 08:34 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/8 "2024-01-05T08:34:32Z")

</div>

Part of the issue may be that audio and the display system changed with bookworm. Prior to this it used ASLA and X1, with Bookworm it uses PulseAudio an Wayland.

> **[Bookworm — the new version of Raspberry Pi OS - Raspberry Pi](https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/)**
>
> It's an odd-numbered year, so there is a new major Debian release, and we are now releasing the corresponding version of Raspberry Pi OS.

---

<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:** [5 January 2024 09:10 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/9 "2024-01-05T09:10:09Z")

</div>

Probably explains why I cannot seem to find anything that will play mp3 files from the Bookworm PI.  
I've spent a lot of time on this so probably best to go back to Bullseye for now.  
Thanks for your help.

---

<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:** [5 January 2024 10:55 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/10 "2024-01-05T10:55:21Z")

</div>

Actually before I give up I would be very appreciative of anyone who can tell me how to play locally stored mp3 files out of the headphone socket via Node red Bookworm.

---

<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:** [6 January 2024 08:15 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/11 "2024-01-06T08:15:24Z")

</div>

> [@cymplecy](#):
>
> Is the clue to why your the only one having problems  
> Its a new Pi OS and your probably the only person trying to do this

Hi  
Bookworm was released 7 months ago and I, like lots of others was keen to not let my install get stale. I would be surprised if I am the only one trying to play audio files from my PI. Is it the case that most people just stick with their older working OS when it is stable. Was I wrong to upgrade?  
thanks.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 January 2024 08:47 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/12 "2024-01-06T08:47:14Z")

</div>

Sorry \_ I thought it only came out on the Pi in October - didn't realise it'd been out that long

> [@muggins](#):
>
> I would be surprised if I am the only one trying to play audio files from my PI.

I meant your probably the only one trying to do it using NR using bookworm

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 March 2024 08:47 UTC](https://discourse.nodered.org/t/more-audio-problems-using-exec-node/84263/13 "2024-03-06T08:47:14Z")

</div>

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