I'm having a hard time wrapping my head around a function like the one

I’m having a hard time wrapping my head around a function like the one showed in this video: https://youtu.be/ac4KmvQWTwY?t=2m

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

Nicely done! That works really well.

Drew, is the function you pasted in the original post represented in the video here?

@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

could you post the full code to your Radiate project?

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

@Drew_Andre Could you post an .ino to github with your project updates if you are updating it? or other msgeq7 projects you are doing!

@Tommy_Sciano here is the updated radiate code: https://gist.github.com/anonymous/cfc36648e85f40dcc20e467c6edf76a8

let me know if you have any trouble using it! “HALF_POS” is NUM_LEDS/2

@Drew_Andre could you post the main and setup? I really want to make that Aura light bar you have on your youtube page, looks great!

Hi @Tommy_Sciano . The light bar is 144led/meter WS2812b strip housed inside a diffuser channel bought from amazon: https://www.amazon.com/gp/product/B01J7O18F0/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1

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:

void INITIALIZE() {
InitWS2812B();
InitMSGEQ7();
}

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).

Check out my (not very clean) read_audio function: https://gist.github.com/drewthaboss/5b66121c6aa027912551e5b41d6d0fca

And the flex function: https://gist.github.com/drewthaboss/be32dda212f45f31cbbe12ab47450fa0

Let me know if you have any questions. Happy to help but I’m not the best at explaining everything perfectly clear.

Personal email is drewjamesandre@gmail.com

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?