No sound from exec play audio command

Hello, I have a problem with bluetooth audio output. I try to play sounds with diffrends commands "aplay, cvlc and mpg123" which I installed. From Raspberry pi Zero 2 w with the help of the command line it works fine. But from the Node-red exec command it works only with hdmi sound. Sound plays only on the monitor. Then I connected the bluetooth device "JBL " speaker and tried to play sounds it providing only provides stange sounds, like chirping.
Question:
How can i force it to play sounds from bluetooth device not from hdmi device?

  1. What version of NR and node.js are you running? (see the startup log)
  2. What command do you use from the command line that works?
  3. What is the input to the exec node?
  4. please supply a copy of your flow

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Node-RED version: v3.0.2
Node.js version: v16.18.1
For terminal im using simple command like "mpg123 Desktop/10.mp3" or "cvlc Desktop/10.mp3;
For exec I use the same command as in the terminal. In the command line I write "mpg123" and in extra input parameters I write the location of the music file "Desktop/10.mp3".
Found in forums and try this one. It plays from the exec, but also, I don't hear any sounds from the bluetooth speaker.
"DISPLAY=:0 ffplay Dekstop/10.mp3 >/dev/null 2>&1 -vn -autoexit -nodisp"
I tried to do the same with raspberry pi 4, but now it play only with analog output. Still can't force it to play from node-red exec command to play from bluetooth output my mp3 audio file.

My Raspberry pi Zero 2w is set up headless using VNC.

  • In VNC Add Device

  • Set your Bluetooth Audio device to pairing mode
  • Then Add New Device
    image

image

  • Then in VNC set the Audio output to the Alexa device

To connect to a bluetooth speaker or earbuds such as QY7, from VNC bluetooth /Add Device and pair. Then from VNC Volume Control select Audio output and choose device.

image

To output an mp3 to the Bluetooth Audio Device from Node Red I use an EXEC node with ffmpeg to convert it to a wav and output to aplay.

image

I have the same issue with Bluetooth audio, can play a mp3 file using both mpg123 and the ffmpeg -I statements in the terminal, but running the same commands in NR results in no sound output.

Put a debug node (set to display the complete msg object) on each of the exec nodes outputs and show us what comes out. Please copy and paste the results to your reply.

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi