scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.67k stars 642 forks source link

Enjoying the project, got it working on Pi - Would like to put an XMas Theme on it, looking for advice on visualization.py #306

Closed akameswaran closed 3 years ago

akameswaran commented 3 years ago

So I'd like to restrict the color scheme to red, white and greens. I'm looking through the visualization code, and was wondering if anyone has any tips on how best to do that. I'll post here as I try things out, but was hoping someone might have some pointers.

Thanks, AK

joeybab3 commented 3 years ago

Can't say for sure how to go about it but I'd imagine there might be some way to map the original colors to some sort of color ramp type deal in order to have it go between white green and red.

Txrossi commented 3 years ago

The easiest way to do that , is removing the blue color.

akameswaran commented 3 years ago

So removing the blue, doesn't really result in just red/green white, due to color mixing. Also just removing blue leaves the display somewhat lacking. The simplest route of removing blue just doesn't really cut it (Except for may a couple of Talking Heads songs that don't seem to end up with much blue in their visualization :)) This visualization stuff is pretty new to me, so not sure what a color ramp is, but I'll google and if anything good comes of it, I'll post back.

I plan to look into this a little more, but the past couple of days I've been putting a flask server on top of it to control the visualization, as well as integrate the fun little theater chases and wipes that are in strandtest.py.
At this point, I have a rest interface that can trigger various animations including this way cool visualization, change the speeds of the other animations, and turn the thing off.

Txrossi commented 3 years ago

For now I just removed the blue (very simple) for this Xmas. But i wanna to do everthing in ESP32 (ESP-IDF) using bluetooth.

There is my changes to remove the blue. But I will make more changes soon. But now i'm trying to add more than 256 pixels.

visualization.zip

What animations did you add? How you did?

akameswaran commented 3 years ago

So I'll clean up the code a little bit, but the way I added visualizations to the whole mix was I created a separate quick and dirty flask server. I also modified the strandtest.py from the library to make a quick and dirty strandcontrol.py. I basically added some more commandline args to control each of those strandtest animations.

Now the flask server based upon a rest call, launches a sub processess for either visualization.py or strandcontrol.py with the appropriate command line arguments. This would NOT work on an ESP32, but could probably be easily added to the PC. I am planning on adding command line args to visualization.py to let me switch between the three visualizations there. My first use for the visualization is for a christmas tree and frankly spectrum and energy don't look that good as tree lights, so it's lower on my list. It's an ugly hack way to do it, but it was taking too long to try and mung together visualization.py and a flask server and strandtest.py functions. Code that works today is "less" ugly than code that might work tomorrow!!

I can definitely clean up the code and attach a zip if you're interested, but 1) I have way too many commented out print statements ;) And the html has a bunch of potty humor that I'd rather strip out before sharing. What can I say, I have a 7 year old's sense of humor.