Node-Red v3.1.0 Exec node now causing an Error

Yes, -v or --verbose. You can add it more than once (up to 3 times I think) to get more detail.

Not that I am aware of.
I've now set sudo usermod -a -G audio your_username to the username of the RPI, but to no avail. Is there a specific username that Node Red has by default?

The default is the user that you were logged in as when you ran the bash <(curl command to install it. You can see from the startup log that it is using the user pi, unless you have modified the systemd script.

Try aplay -vvv ...

OK that is what I set it to above. Setting aplay --verbose doesn't produce any output in the Node Red console, since it fails to run. Nor does it change the output object messages from the the exec Node.

Aplay is running, it is producing that error message. Use -vvv and redirect both sysout and syserror to a file.

I think -vvv creates visual widgets on the command line. Try with -v first, then -vv.

Sorry need a bit more help with that instruction .
aplay -vvv in the terminal?

aplay -V --vumeter=TYPE

is that what you intended I enter in terminal......its for mono or stereo

no options for vv or vvv

Did you mean add -vvv to the extra input parameters of the exec node?

Solved the problem on the Raspberry Pi Zero 2W by making PulseAudio (as used by aplay) specifically available for Node Red.

Created a PulseAudio Configuration File by entering into the Terminal:
sudo nano /home/<node-red-username>/.config/pulse/client.conf
Replace <node-red-username> with the actual username of the Node-RED user. .

In the configuration file in nano add the following lines

autospawn = no
daemon-binary = <default location>

where the <default location> is determined from that viewable in /etc/pulse/client.conf` file.

This configuration prevents PulseAudio from starting automatically and ensures it runs with minimal resources.

You do need to initially run PulseAudio for the Node-RED user using the pulseaudio command:

sudo -u <node-red-username> pulseaudio --start

Replace <node-red-username> with the actual username of the Node-RED user.

For a Node Red Flow to play an audio file using aplay through PulseAudio using either the Terminal or via the Exec Node command use for e.g.

aplay -D pulse /path/to/audio.wav

In this command, -D pulse specifies the PulseAudio output device.

Appending -vv to the command produces a verbose output, which can be from stderr of the Exec node, which I found useful for testing. The command in the Terminal produced sound through my connected Bluetooth headphones, but not when it was issued from the Node red Exec node despite the stderr output showing everything was working without error. The solution was to be found in refreshing the connection to the headphones in speaker Device profiles from the Desktop in VNC.
Unfortunately the available profiles for connecting to the Amazon Echo don't appear to enable sound output over the bluetooth connection.

2 Likes

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