It’s similar to Stefan Petrick’s “DJ light” effect with msgeq7-dependent colors pushed out from the center of a strip, but with those bands moving at different speeds.
I imagine the function would act similarly to rolling your hand once over three objects with different weights. Each band moves at different speeds because of its weight. Where I’m lost is where/how to apply this weight to each led[i].r / g / b data piece. I tried setting the center led (NUM_LEDS/2) to CRGB(band[0], band[3], band[6]) and then only moving the red data down the strip every 2 or so milliseconds, green every millisecond or so, and blue with each loop (0 milliseconds). That didn’t seem to work…
Anyone have any thoughts here? Here’s what I’m working with. I took out the EVERY_N_MILLISECONDS stuff because it wasn’t working, but I imagine the solution is buried somewhere right here. This is a really cool effect, I think it looks pretty dynamic and I’d love to add it to my arsenal/share it here for all.
void radiate() {
leds[HALF_POS] = CRGB(mono[0] * 0.25, mono[3] * 0.25, mono[6] * 0.25);
// 10-bit data mapped down to 0-255 range
for (int i = NUM_LEDS - 1; i > HALF_POS; i–) {
// move red data out from center of strip
// i WAS doing something like only move the red data down every 2 milliseconds or so… didn’t work
leds[i].red = leds[i - 1].red
// mirror it to the other side of the strip
leds[HALF_POS - (i - HALF_POS)].red = leds[i - 1].red;
// same for green…
leds[i].green = leds[i - 1].green;
leds[HALF_POS - (i - HALF_POS)].green = leds[i - 1].green;
// blue…
leds[i].blue = leds[i - 1].blue;
leds[HALF_POS - (i - HALF_POS)].blue = leds[i - 1].blue;
}
leds[HALF_POS].fadeToBlackBy(100);
FastLED.show();
}
Scrolling the different RGB channels at different speeds with integer LED position is easy, you just shift the red/green/blue channels at different intervals. You could do it with a different for() loop for each color, and trigger those at different times; every 20ms, 30ms, 40ms, etc.
With enough memory, you can instead implement this as objects or struct arrays, each object getting its own velocity. Then you could render the objects to the strip in one shot, with smooth LED aliasing etc based on fractional positions. Then you could do cool stuff like having a bunch of bars scroll across the strip at a constant speed, but the width of the bars pulses along with the sound level.
@Garrett_Mace thanks for the help. separate objects for each channel took up too much memory but scrolling through at different ms-based intervals works perfectly. here’s a video of the function running: https://youtu.be/LWdBe5LUckk
@Bobby_Zuiss nope, it’s missing the interval-based RGB channel scrolling (i.e. moving leds[i].red down the strip EVERY_N_MILLISECONDS). Here is a link to the updated code: http://pastebin.com/yB8UNHGX
I think this effect looks pretty cool but I’m trying to figure out a way to “layer” the red, blue, and green on top of one another instead of having them all blend down the strip. Red (bass) will always be on top of the other colors, followed by mids (green), and underneath everything everything will be the highs. Or maybe that wouldn’t look as good, who knows. For what it’s worth adding a little blur to the strip creates a pretty cool effect with the colors fading to black before they reach the end of the strip
You would either need to create object for the pulses or have a duplicate of the LED array. Since if you render it such that any pixel with red sets green and blue to zero, you now lose the information you were shifting for the green and blue colors.
@Garrett_Mace , thanks for your input. I really like this effect as is anyway, and I think applying that sort of ducking math would make it look choppy. @Tommy_Sciano here is the function, minus the main loop and setup: http://pastebin.com/jGJJxuDa
I have a few effects running through it with all audio-reactive functions taking in data from a pair of msgeq7 chips. The setup code isn’t anything special, I just call an “INITIALIZE()” function in my setup to set everything up like this:
Within each of those is your regular ol’ setup stuff.
For the radiate function, the only extra term you should declare is HALF_POS, which is just (NUM_LEDS/2) - 1.
The flex function requires additional setup, but the function basically takes each band from the MSGEQ7 and makes it into a percentage of half the strip length: left_factor = float(HALF_POS) / left_volume;
After that, each band volume (from 0-255) is multiplied by its percentage (by left_factor).
Heres my code: http://pastebin.com/E7AXe4fK
Running it, I am getting blue when it should be black, so I think I have errors in the declaration of
uint8_t band;
int left[7];
int right[7];
int mono[7];
int mapped[7];
uint8_t zero;
uint8_t three;
uint8_t six;
could you give me some tips on how I can fix this?