inspired by some of stefan petrick’s work with rice paper lamps.
msgeq7 values correspond to brightness and are smoothed out using a low pass filter. all the math is calculated center to top and just mirrored to the lower half of the strip (240 ws2812b leds wrapped around a 3" diameter pole).
each band value is compared to the overall volume at that moment and converted to a percentage of that volume. when the bass kick hits for example, i write that band from the center of the strip out to, say, 30% of the upper half of the strip (30% of 120 leds in my case) and mirror it on the lower half. the next band then starts at 31% of the strip. if any of the bands values are low or nonexistent, they just get eaten up by the more prominent frequencies instead of leaving those leds blank. pretty excited about this one because it looks really good with all genres of music, especially jazz! https://www.instagram.com/p/BMourF6hJto/
@Andrew_Tuline Here is my low pass filter-ish way of smoothing msgeq7 data:
for(each band…) {
prev_value = left[band]; (previous iteration’s saved value for that particular band)
read in the current band’s data, save it as a new variable, and constrain/map the guy
left_value = analogRead(left_in);
left_value = constrain(left_value, filter_min, filter_max);
left_value = map(left_value, filter_min, filter_max, value_floor, value_ceiling);
then apply a sort of low pass filter to the band using the band’s previous value. lowPass_audio is a floating value of 0.18 in my sketch:
left[band] = prev_value + (left_value - prev_value) * lowPass_audio;
now left[band] is saved as that smoothed data, and will be read in and saves as prev_value in the next iteration of ReadAudio().
if the previous value is 100, the current is 123, and if lowPass_audio is .18, it would write that band as ~105, instead of 123. a higher lowPass_audio value = more responsive, but brightness is less smooth. i know that sounds like a big loss in data but i find that everything still looks very responsive but way smoother!
how does that sound? think there’s an easier way to go about that? seems to me like a pretty fair approach to smoothing msgeq7 data
here is a pastebin (i have never used this before, i hope it works/i love it already) of my commented readAudio function which has some math required for the effect + some smoothing: http://pastebin.com/xs3FL7sp
Hello Drew, I am confused about the variables used for scaling. What is the “f” at the end of the float variables? For example, float lowPass_audio = 0.18f;
Here is where I am with putting the puzzle together creating Drew’s Flex Radiate sketch. I’ve got the ReadAudio() function working fine, but I’d appreciate some help with solving the problem I’m having with my version of flex_radiate(). Right now it goes twice through the for() loop and then exits on a watchdog timer (wdt reset). I’m using an ESP8266 with Arduino IDE 1.6.8.
Thank you! http://pastebin.com/U0MciGEf
Hi @Garrett_Durland , from what I was taught, adding “f” to the end of a floating value in arduino truncates the value at that decimal place. After looking into it… it looks like this actually doesn’t do anything…? I don’t think it’s super necessary in this sketch either. Yes, “HALF_POS” is just NUM_LEDS/2, the halfway point at the strip. I’m not too familiar with watchdog timers, but after reading through your pastebin code, nothing sticks out to me. In terms of blur2d not compiling, it could be due to the fact that kMatrixWidth * kMatrixHeight doesn’t add up to the size of your led array, which you have set at 360?