Raspi 5 and mp3 files

Hey All,
I just upgraded to a Raspberry Pi 5, Buster to Bookworm, and Node-Red 3.0.2 to 3.1.7.

I use sounds when motion sensors are triggered and timed events. In the past I used the exec node that called a bash file on the Pi that would play an mp3 using omxplayer like this

sudo omxplayer /home/pi/scripts/sounds/babble.mp3

omxplayer is no longer supported and vlc is recommended. So I set up my exec node like this

vlc /home/pi/scripts/sounds/babble.mp3

This works from the command line and when I put it in a bash file. But when I call it from nodered it doesn't play.

I've tried all the various "play audio" pallets available, some of them won't install, others don't work.

To complicate things further, these sounds used to be played through the 3.5mm audio jack on the Pi. The new Pi doesn't have an audio jack so I'm trying bluetooth. I have it setup so the pi pairs with the bluetooth speakers on reboot and working as intended.

How can I set this up to so node red will trigger the mp3 to play through bluetooth speakers?


PS The mp3 files and the folder they're in are chmod 777

        "id": "3c4e3b0d019f1a59",
        "type": "exec",
        "z": "b8a0bb5cf90ec045",
        "command": "sudo bash /home/pi/scripts/sounds/bash/babble.sh",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "babble",
        "x": 652.8958129882812,
        "y": 464.8888854980469,
        "wires": [

Are there any errors coming from the exec node? Use debug nodes set to output complete message and check all the outputs. You may need to specify the full path to vlc.
Use cvlc if it is installed, that is a command line version that does not require a display.

Isn't aplay available in the 5? That should be a lot lighter than vlc.

There's always been problems with playing sounds using exec functions - its something to do with the shell the exec function runs in, isn't the same as a normal terminal

It usually requires extra parameters adding

Bluetooth just makes things worse

And AFAIK Raspberry Towers also changed the underlying engine they use for sounds on Pi5/bookworm

Good Luck :slight_smile:

Still stuck.

  • No errors from the exec mode.
  • I tried the full path to vlc, no luck. - works from terminal
  • I tried the full path to cvlc, no luck. - works from terminal
  • I tried aplay, no luck - works from terminal
  • I tried sudo in various places, no luck, actually doesn't like sudo

With all the rage about Raspi 5 I didn't see this coming. What a disappointment. I guess I'll be a hat or a dongle or something...

Thanks Colin!

Do you get anything from the exec node?

Does it show a pid? Does the pid stay there?

nothing from the exec node.

I do get a pid which stays there until I try again and it updates the pid.

So if I were to get something like this
usb to 3.5mm dongle
Can I expect it to work with node red sending sounds to a wired speaker? Like it used to?

That means it is running.
If you set the exec node to Output while the command is running do you see anything on any output?

When I put the exec node in spawn mode I get the following 2 messages that repeat many times.

[000055564af67e60] alsa audio output error: cannot open ALSA device "default": Unknown error 524
[000055564af67e60] main audio output error: Audio output failed
[000055564af67e60] main audio output error: The audio device "default" could not be used:
Unknown error 524.
[000055564af67e60] main audio output error: module not functional
module not functional
[00007fffacc909d0] main decoder error: failed to create audio output

Note: I'm using pulseaudio on the Pi

I just received the usb to 3.5mm dongle and it behaves exactly like the bluetooth connection. I can play files from the command line but can't trigger these sounds with an exec node.

So, if anyone has suggestions on how to play mp3 files locally from Node red please let me know.

So disappointed in the new raspi5.

Thanks for the help everyone!

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