Christmas lights to music

I have connected some LED christmas lights to GPIO outputs on a RPi with the intention of synchronizing them to music.

In the past I have used lightshowpi which did the job perfectly, however I was hoping to use nodered to do the same.

But thought a good idea would be first try calling lightshowpi from nodered when a button is clicked on the user interface dashboard. This gives the error "Need to setup SYNCHRONIZED_LIGHTS_HOME environment variable, see readme" when attempting to execute python3 /home/pi/lightshowpi/py/synchronized_lights.py in the exec node.

I have tried setting the environment variable in settings.js which hasn't resolved the situation.

Does anybody have any suggestions on how to resolve this?

My other consideration is to have a frequency sampler in node red and use that to trigger the gpio ports.

Have you tried using a MIDI track? I see there are MIDI nodes for node-red, and if you load the MIDI track at the same time as the music, you can easily use the MIDI to trigger certain events at the precise time.

MIDI was used traditionally for this kind of stuff, so it stands to reason it still works (should be even easier now).

1 Like

That’s an option I could try. I was looking at mp3 files but MIDI would be a alternative to see if it does the job

I have managed to make progress in that I created a bash script that declared the environment variable then calls the synchronized_lights.py file. That works perfectly although it does only run through the script once then exit as I expected.

I’m exploring the next step of running the script each time the script ends. I’ve managed that by creating a while true loop which works fine, trying to get the PID of the script and kill it and break out of the loop on a button click in the UI is the next step, although I’m considering just breaking out of the loop and letting the script run until conclusion instead.

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