# Raspi 5 and mp3 files

**URL:** <https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482>\
**Category:** Hardware\
**Created:** [17 March 2024 00:14 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482 "2024-03-17T00:14:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [17 March 2024 00:14 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/1 "2024-03-17T00:14:28Z")

</div>

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

```auto
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

```auto
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?

Thanks!

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

```auto
[
    {
        "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": [
            [],
            [],
            []
        ]
    }
]

```

---

<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:** [17 March 2024 09:00 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/2 "2024-03-17T09:00:05Z")

</div>

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.

---

<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:** [17 March 2024 09:32 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/3 "2024-03-17T09:32:57Z")

</div>

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

---

<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:** [17 March 2024 12:12 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/4 "2024-03-17T12:12:52Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [17 March 2024 20:32 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/5 "2024-03-17T20:32:51Z")

</div>

> [@Colin](#):
>
> 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.

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!

---

<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:** [17 March 2024 20:53 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/6 "2024-03-17T20:53:06Z")

</div>

> [@richiep](#):
>
> No errors from the exec mode.

Do you get anything from the exec node?

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

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [17 March 2024 22:50 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/7 "2024-03-17T22:50:37Z")

</div>

nothing from the exec node.

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

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [18 March 2024 00:04 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/8 "2024-03-18T00:04:13Z")

</div>

> [@richiep](#):
>
> I guess I'll be a hat or a dongle or something...

So if I were to get something like this  
[usb to 3.5mm dongle](https://www.amazon.com/BENGOO-External-Headphone-Microphone-Desktops/dp/B0BQBT2LCV/ref=sr_1_22?dib=eyJ2IjoiMSJ9.pp1GxnJDWSd1HGcKT718p8dZG5dljJ5R2O06hnL2jdO1NSVEc9kD-ccEkNjxPwvaPhIKp_dHdSjTHrtF5O0eqbU2nGIyLE7hkovlU7cXn-9BVYR99P0ydVoZzFt3Es2n6bdtGjeC4GnUE53MQIEjN5jREjJQXQhOcJBrIL1pGi_pflFcJtoGGcHBQMW0e-4EgqmtVBPAj_1wcOPinHSfutOiqhRLBF3t7VRRS4NiBHQ.aRLQ7MTbEocwQqSM2rPcDK6xAatrPyOoEUovq74as1Y&dib_tag=se&keywords=JSAUX+USB+to+3.5mm+Jack+Audio+Adapter%2C+TRRS+4-pole+Stereo+External+USB+Sound+Card+Aux+Headset+Microphone+Converter+with+DAC+Chip+Compatible+for+Headphone+Mac+PS4+PC+Laptop+Desktops+-Red&qid=1710719920&sr=8-22)  
Can I expect it to work with node red sending sounds to a wired speaker? Like it used to?  
Thx  
R

---

<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:** [18 March 2024 16:37 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/9 "2024-03-18T16:37:51Z")

</div>

> [@richiep](#):
>
> I do get a pid which stays there

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?

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [18 March 2024 18:34 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/10 "2024-03-18T18:34:11Z")

</div>

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

```auto
[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

```

```auto
module not functional
[00007fffacc909d0] main decoder error: failed to create audio output

```

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [18 March 2024 18:46 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/11 "2024-03-18T18:46:47Z")

</div>

Note: I'm using pulseaudio on the Pi

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [22 March 2024 21:44 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/12 "2024-03-22T21:44:22Z")

</div>

UPDATE:  
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!  
Rich

---

<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:** [21 May 2024 21:44 UTC](https://discourse.nodered.org/t/raspi-5-and-mp3-files/86482/13 "2024-05-21T21:44:35Z")

</div>

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