Skip to content

Commit

Permalink
Bass strip polishing
Browse files Browse the repository at this point in the history
 - Default to 144-long bass strips again
 - Strip hue waver is now configurable
 - The position on the bass strip that effects start at (edges or center) is now also configurable
 - Bass strip hue shift config tweaked, now allows for more granularity (hue shift went from short to float)
  • Loading branch information
48productions committed Feb 24, 2021
1 parent f4cbb20 commit d16744b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
8 changes: 4 additions & 4 deletions 01_Main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void loop() {
#ifdef USE_PRESET_PALETTES //If using preset color palettes, check if we recently swapped between palettes
if (curMillis <= lastPaletteSwap + 150) { //If so, we should be fading between the old and the new colors
short transProgress = ((float)(curMillis - lastPaletteSwap) / 150) * 255;
Serial.println(transProgress);
//Serial.println(transProgress);
for (int i = 0; i <= 3; i++) {
curPalette[i] = blend(lastPalette[i], palettes[curPaletteIndex][i], transProgress); //Blend between the last and current palettes over the course of our fade duration (100ms)
}
Expand All @@ -105,10 +105,10 @@ void loop() {
int targetAnimLength = bassKickLengthAverage.getAverage() * 2; //First find out how long this waver should last (2x length between bass kicks)
float waverPos = ((float)(curMillis - lastHueWaverMillis) / targetAnimLength) * PI; //Next, our position into the waver sine wave...
if (waverPos >= 2 * PI) { lastHueWaverMillis = curMillis; } //(Also set the last time we completed a waver if we've just completed a waver)
short waverVal = sin(waverPos) * 2; //...and finally use sine to calculate how much we should offset the hue
Serial.print(waverPos);
short waverVal = sin(waverPos) * HUE_WAVER_STRENGTH; //...and finally use sine to calculate how much we should offset the hue
/*Serial.print(waverPos);
Serial.print(" ");
Serial.println(waverVal);
Serial.println(waverVal);*/
for (int i = 0; i <= 3; i++) {
curPalette[i].h += waverVal; //Now modify the current palette's hue based on our calculated value
}
Expand Down
15 changes: 12 additions & 3 deletions 02_Update_Funcs.ino
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,21 @@ void updateIdle() {
//Serial.println(bassLEDSize);
fadeToBlackBy(ledsBass, STRIP_BASS_LENGTH, 150); //Fade out the last update from the strip a bit

short hueOffset = 0;
float hueOffset = 0;
#if INVERT_BASS_STRIP_POS //Bass strip inverted: Start effects in center (for strip wrapped around sub with strip ends at top of sub)
for (int i = 0; i < bassLEDSize; i++) {
ledsBass[STRIP_BASS_HALF - i - 1] = CHSV(curPalette[0].h - hueOffset, curPalette[0].s, curPalette[0].v);
ledsBass[STRIP_BASS_HALF + i] = CHSV(curPalette[0].h - hueOffset, curPalette[0].s, curPalette[0].v);
ledsBass[STRIP_BASS_HALF - i - 1] = CHSV((int)(curPalette[0].h - hueOffset), curPalette[0].s, curPalette[0].v);
ledsBass[STRIP_BASS_HALF + i] = CHSV((int)(curPalette[0].h - hueOffset), curPalette[0].s, curPalette[0].v);
hueOffset += BASS_DELTA; //Offset the hue for a slight gradient across the bass LED strip
}

#else //Bass strip normal: Start effects at the edges (for strip wrapped around sub with ends at bottom of sub)
for (int i = 1; i <= bassLEDSize; i++) {
ledsBass[i - 1] = CHSV((int)(curPalette[0].h - hueOffset), curPalette[0].s, curPalette[0].v);
ledsBass[STRIP_BASS_LENGTH - i] = CHSV((int)(curPalette[0].h - hueOffset), curPalette[0].s, curPalette[0].v);
hueOffset += BASS_DELTA; //Offset the hue for a slight gradient across the bass LED strip
}
#endif


} else { //Unnammed Bass VE 1: Bass kicks fade in/out on the strip
Expand Down
14 changes: 10 additions & 4 deletions IceBeats.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
/*****************
* CONFIGURATION *
****************/
#define STRIP_LENGTH 90 //Number of LEDs in the strip
#define STRIP_LENGTH 90 //Number of LEDs in the strip (warning: Adding many LEDs slows updates)
#define STRIP_DATA 5 //Pin connected to the LED strip

#define STRIP_BASS_LENGTH 60 //Number of LEDs in our bass neon strip
#define STRIP_BASS_LENGTH 144 //Number of LEDs in our bass neon strip
#define STRIP_BASS_DATA 9 //Pin connected to the bass neon strip

//Set this next option to true to make bass strip effects start in the center and wipe outwards (instead of starting at the edges and wiping inwards)
//IceBeats was designed for the bass strip to be wrapped around a subwoofer with effects starting at the bottom of the sub and climbing towards the top
//This value compensates for whether the ends of this strip are mounted at the top (true) or bottom (false) of the sub
#define INVERT_BASS_STRIP_POS false

#define DEBUG_FFT_BINS true //Set true to test FFT section responsiveness - bin sections are mapped to the brightness of specific pixels

#define DEBUG_BURNIN false //Set to true to enable the light test at boot and disable timing out of it
Expand All @@ -45,6 +50,7 @@
#define PIN_LIGHTS_DAT 4

#define USE_PRESET_PALETTES true //Set whether to use pre-set or base palettes off of the music. Pre-set is more visually pleasing, music-based may reflect changes in music better
#define HUE_WAVER_STRENGTH 1.5 //When using preset palettes, the hue of the current palette will "waver" slightly to the beat of the music. This controls how strong this waver is (0 - none, 2 - strong)

//const int pinLightsMarquee[4] = {20, 21, 22, 23}; //PWM-able pins for the 4 marquee lights, disabled at this time

Expand All @@ -71,8 +77,8 @@ const int STRIP_8TH = STRIP_LENGTH / 8;
const int STRIP_16TH = STRIP_LENGTH / 16;
const int STRIP_32ND = STRIP_LENGTH / 32;

const int STRIP_BASS_HALF = STRIP_BASS_LENGTH / 2;
const short BASS_DELTA = 75 / STRIP_BASS_HALF;
const int STRIP_BASS_HALF = STRIP_BASS_LENGTH / 2; //Half length of the bass strip
const float BASS_DELTA = 65.0 / STRIP_BASS_HALF; //Controls strip-wide hue shifts for bass visualizations (higher number = more rainbow for bass kicks)

const int PULSE_MAX_SIZE_BASS = STRIP_LENGTH / 6; //Maximum section sizes for VE Pulse (based on strip length)
const int PULSE_MAX_SIZE_LOW = STRIP_LENGTH / 8;
Expand Down

0 comments on commit d16744b

Please sign in to comment.