naztronaut / dancyPi-audio-reactive-led

Real-time WS2812b LED strip music visualization using Python and the ESP8266 or Raspberry Pi.
https://www.easyprogramming.net/raspberrypi/audio_reactive_holiday_leds.php
MIT License
239 stars 87 forks source link

RGBW help #17

Closed pbywater closed 4 years ago

pbywater commented 4 years ago

Firstly - this is such a great library and is already looking very cool as it is on my RGBW strip. Thank you so much!

I was hoping you might be able to point me in the right direction to adapt this for an rgbw Neopixels strip. I'm obviously getting some quite weird colour results as I need that extra 'W' value. This may also be why not all my pixels are lighting up (I've changed the numbers in the config and that hasn't done the job).

Any pointers you can give would be massively appreciated!!

naztronaut commented 4 years ago

Glad you have it working! Thanks for the kind words.

This project uses the WS2812x library which in turn uses the Adafruit_Neopixel library. I took a look at their documentation and it does look like that RGBW is supported. I don't have any RGBW strips to test with but if you want to give it a go, it might be fun. I think the only two places you need to make changes is visualization.py and led.py.

In visualization.py there's this line:

p = np.tile(1.0, (3, config.N_PIXELS // 2))

I think If you change the value from 3 to 4, it'll add a "W' tile. You'll also have to look at the different visualizations and add the 'w' - for example in visualize_scroll there's this:

p[0, 0] = r
p[1, 0] = g
p[2, 0] = b

I think adding a p[3,0] = w will add that channel.

There are also a lot of places where you need to add the 'w' code. And you need to make changes to led.py for the leds to update properly.

This is a very rough look at this process. Without the led strip (and time needed), I won't be able to provide any specific update to the repo. Maybe one day I'll get myself an RGBW NeoPixel strip and give it a go.

Hope this helps a little, good luck!

pbywater commented 4 years ago

This is super helpful - thanks so much for the quick response!

I was trying to do something along the lines of what you've outlined here last night but thought I'd check in and see if you'd done it previously or had some tips. I've also just noticed there's a closed issue where someone else seems to have got rgbw working so will drop him a message if needs be!

Hopefully will work it out and let you know!