How's this for a different FastLED toy?

How’s this for a different FastLED toy?

Wow, that’s cool!

That’s super Jay! Thanks for sharing.

That’s pretty neat!!!

@Jay_Converse Looks really cool. You need to sell this to all of the college marching bands.

What’s the best way to draw those heart shapes that grow with the volume?

  1. I have an Excel spreadsheet with all the 224 LED numbers in the grid. I’m a business programmer, so I use familiar tools. :slight_smile:
  2. I add multiple tabs for each of the heart shapes, so I can Ctrl-page-up and Ctrl-page-down to see how it looks.
  3. There are Excel formulas that create the arrays.
  4. The Audio shield reads the peak sound levels from the lavalier microphone that runs down inside the bell
  5. The main Loop calls my LoopMaster subroutine as “LoopMaster(PROG_HEART, 11); break;”
  6. Here’s the code snippet

void LoopMaster(int iProgram, int iMaxPeak) {
elapsedMillis iCounter;

if (msecs > 0) {
if (bProgChanged) return;
if (peak1.available()) {
msecs = 0;
float leftNumber = peak1.read();
int iPeak = leftNumber * iMaxPeak;
BlankStrip();
GetSwitchMode(false);

  switch (iProgram) {
    case PROG_HEART:
      if (bSwitchColor) { strip.Color(iLastRed, iLastGreen, iLastBlue); iColor = iRed;}  // I have a toggle switch for changing the color mode, and 3 different pots for red, green and blue levels
      switch(iPeak) {                  
        //case 1: for (byte i = 0; i < sizeof(iHeart1); i++) { strip.setPixelColor(iHeart1[i], iColor); }; break;  // I turned off 1 and 2 for the last basketball game, was getting ambient noise from the other instruments
        //case 2: for (byte i = 0; i < sizeof(iHeart2); i++) { strip.setPixelColor(iHeart2[i], iColor); }; break;
        case 3: for (byte i = 0; i < sizeof(iHeart3); i++) { strip.setPixelColor(iHeart3[i], iColor); }; break;
        case 4: for (byte i = 0; i < sizeof(iHeart4); i++) { strip.setPixelColor(iHeart4[i], iColor); }; break;
        case 5: for (byte i = 0; i < sizeof(iHeart5); i++) { strip.setPixelColor(iHeart5[i], iColor); }; break;
        case 6: for (byte i = 0; i < sizeof(iHeart6); i++) { strip.setPixelColor(iHeart6[i], iColor); }; break;
        case 7: for (byte i = 0; i < sizeof(iHeart7); i++) { strip.setPixelColor(iHeart7[i], iColor); }; break;
        case 8: for (byte i = 0; i < sizeof(iHeart8); i++) { strip.setPixelColor(iHeart8[i], iColor); }; break;
        case 9: for (byte i = 0; i < sizeof(iHeart9); i++) { strip.setPixelColor(iHeart9[i], iColor); }; break;
        }
      break; // Switch Hearts
}

}

Here are the constant arrays
const byte iHeart0[]={};
const byte iHeart1[]={96};
const byte iHeart2[]={79,97,96,95,110,111,112,129,127};
const byte iHeart3[]={64,78,79,80,98,97,96,95,94,109,110,111,112,113,130,129,128,127,126,142,144};
const byte iHeart4[]={48,65,64,63,77,78,79,80,81,99,98,97,96,95,94,93,108,109,110,111,112,113,114,131,130,129,128,127,126,125,140,141,142,144,145,146,162,161,159,158};
const byte iHeart5[]={35,47,48,49,66,65,64,63,62,76,77,78,79,80,81,82,99,98,97,96,95,94,93,107,108,109,110,111,112,113,114,115,132,131,130,129,128,127,126,125,124,139,140,141,142,143,144,145,146,147,164,163,162,161,159,158,157,156,171,172,173,175,176,177};
const byte iHeart6[]={21,36,35,34,46,47,48,49,50,67,66,65,64,63,62,61,75,76,77,78,79,80,81,82,83,100,99,98,97,96,95,94,93,92,106,107,108,109,110,111,112,113,114,115,116,133,132,131,130,129,128,127,126,125,124,123,138,139,140,141,142,143,144,145,146,147,148,165,164,163,162,161,160,159,158,157,156,155,170,171,172,173,175,176,177,178,192,191,190,188,187,186};
const byte iHeart7[]={11,20,21,22,37,36,35,34,33,45,46,47,48,49,50,51,68,67,66,65,64,63,62,61,60,74,75,76,77,78,79,80,81,82,83,84,101,100,99,98,97,96,95,94,93,92,91,105,106,107,108,109,110,111,112,113,114,115,116,117,134,133,132,131,130,129,128,127,126,125,124,123,122,137,138,139,140,141,142,143,144,145,146,147,148,149,166,165,164,163,162,161,160,159,158,157,156,155,154,168,169,170,171,172,173,174,175,176,177,178,179,180,194,193,192,191,190,188,187,186,185,184,197,198,199,203,204,205};
const byte iHeart8[]={2,12,11,10,19,20,21,22,23,38,37,36,35,34,33,32,44,45,46,47,48,49,50,51,52,68,67,66,65,64,63,62,61,60,74,75,76,77,78,79,80,81,82,83,84,102,101,100,99,98,97,96,95,94,93,92,91,90,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,168,169,170,171,172,173,174,175,176,177,178,179,180,181,195,194,193,192,191,190,188,187,186,185,184,183,182,196,197,198,199,203,204,205,206,207,217,216,210,209,208};
const byte iHeart9[]={2,12,11,10,19,20,21,22,23,38,37,36,35,34,33,32,44,45,46,47,48,49,50,51,52,68,67,66,65,64,63,62,61,60,74,75,76,77,78,79,80,81,82,83,84,102,101,100,99,98,97,96,95,94,93,92,91,90,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,168,169,170,171,172,173,174,175,176,177,178,179,180,181,195,194,193,192,191,190,188,187,186,185,184,183,182,196,197,198,199,203,204,205,206,207,217,216,210,209,208};

Oops, the snippet is missing strip.show(); at the end.

My question was more about the coding practices… Is it better to have a pattern defined as a mask or using math to draw the heart shape? Following a similar design approach, I did my own patterns and have it working nicely.

Small comment re your constants, you should diff them and add them when printing: level2 should be equal to heart0 + heart1 + heart2.

Thanks for the ideas! Like I said, I’m a business programmer, I’m used to doing discrete processes like accounting and SQL server queries, not complex math. Since the Teensy has tons of memory, I can be wasteful using byte arrays instead of 0x0a0b0c0d bitmaps.