[SOLVED]Not hearing sound using aplay via exec when running as service

Following on from how to get Node-RED to run as a service on a Pi I'm having trouble playing a sound via exec node

So I'm trying to play a wav file out thru the Pi audio jack

It works fine when I run Node-RED directly from a terminal

As I was typing this I suddenly thought that the sound is probably defaulting to going out thru HDMI and with a bit of googling and experimenting I came up with this as my solution

image

which tells it to explicitly use the audio jack and all good :slight_smile: :smiley:

2 Likes

You could also define the headphone jack as the default in your asound.conf file.
Although that can be a little bit confusing too :see_no_evil:

1 Like