 //const int sensor4pin = 8; // connect the first sensor to pin 8 on the Arduino Mega
 //const int sensor5pin = 8; // connect the first sensor to pin 8 on the Arduino Mega
 
-// Original Melody--------------------------------------------------------------
-int melody1Code = 1;
-// notes in the melody:
-int melody1[] = {NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4};
-
-// note durations: 4 = quarter note, 8 = eighth note, etc.:
-int noteDurations1[] = {4, 8, 8, 4, 4, 4, 4, 4};
-
-int melody1Length = 8;
-int melody1Counter = 0;
-//-------------------------------------------------------------------------------
-
-// Hot Crossed Buns--------------------------------------------------------------
-int melody2Code = 2;
-int melody2[] =        {NOTE_E4, NOTE_D4, NOTE_C4, NOTE_E4, NOTE_D4, NOTE_C4, 
-                        NOTE_C4, NOTE_C4, NOTE_C4, NOTE_C4, 
-                        NOTE_D4, NOTE_D4, NOTE_D4, NOTE_D4, 
-                        NOTE_E4, NOTE_D4, NOTE_C4};
-// note durations: 4 = quarter note, 8 = eighth note, etc.:
-int noteDurations2[] = {4, 4, 2, 4, 4, 2, 
-                       8, 8, 8, 8, 8, 8, 8, 8, 
-                       4, 4, 2};
-int melody2Length = 17;
-int melody2Counter = 0;
-//-------------------------------------------------------------------------------
-
-// Jasmine Flower----------------------------------------------------------------
-int melody3Code = 2;
-int melody3[] = {NOTE_A4, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_F5, NOTE_F5, NOTE_D5, 
-                       NOTE_C5, NOTE_C5, NOTE_D5, NOTE_C5, 
-                       NOTE_A4, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_F5, NOTE_F5, NOTE_D5, 
-                       NOTE_C5, NOTE_C5, NOTE_D5, NOTE_C5,
-                       NOTE_C5, NOTE_C5, NOTE_C5, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_D5, NOTE_C5, 
-                       NOTE_A4, NOTE_A4, NOTE_G4, NOTE_A4, NOTE_C5, NOTE_G4, NOTE_A4, 
-                       NOTE_F4, NOTE_F4, NOTE_G4, NOTE_F4};
-
-int noteDurations3[] = {4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2, 
-                         4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2, 
-                         4, 4, 4, 8, 8, 4, 4, 2, 
-                         4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2};
-
-int melody3Length = 41;
-int melody3Counter = 0;
-//-------------------------------------------------------------------------------
-
-int long stepThreshholdRed = 3500;
-int long stepThreshholdGreen = 3000;
-int long stepThreshholdBlue = 2200;
+int allSongNotes[7][42] = {
+              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              },
+              {NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4, 0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              }, 
+              {NOTE_E4, NOTE_D4, NOTE_C4, NOTE_E4, NOTE_D4, NOTE_C4,
+               NOTE_C4, NOTE_C4, NOTE_C4, NOTE_C4,
+               NOTE_D4, NOTE_D4, NOTE_D4, NOTE_D4,
+               NOTE_E4, NOTE_D4, NOTE_C4, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               0, 0, 0, 0, 0, 0, 0
+              },
+              {NOTE_A4, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_F5, NOTE_F5, NOTE_D5, 
+               NOTE_C5, NOTE_C5, NOTE_D5, NOTE_C5,
+               NOTE_A4, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_F5, 
+               NOTE_F5, NOTE_D5,
+               NOTE_C5, NOTE_C5, NOTE_D5, NOTE_C5,
+               NOTE_C5, NOTE_C5, NOTE_C5, NOTE_A4, NOTE_C5, 
+               NOTE_D5, NOTE_D5, NOTE_C5, 
+               NOTE_A4, NOTE_A4, NOTE_G4, NOTE_A4, NOTE_C5,
+               NOTE_G4, NOTE_A4,
+               NOTE_F4, NOTE_F4, NOTE_G4, NOTE_F4, 0
+              },  
+              {NOTE_C4, NOTE_C4, NOTE_G4, NOTE_G4, NOTE_A4, NOTE_A4, NOTE_G4,
+               NOTE_F4, NOTE_F4, NOTE_E4, NOTE_E4, NOTE_D4,
+               NOTE_D4, NOTE_C4, 
+               NOTE_G4, NOTE_G4, NOTE_F4, NOTE_F4, NOTE_E4, 
+               NOTE_E4, NOTE_D4,
+               NOTE_G4, NOTE_G4, NOTE_F4, NOTE_F4, NOTE_E4,
+               NOTE_E4, NOTE_D4,
+               NOTE_C4, NOTE_C4, NOTE_G4, NOTE_G4, NOTE_A4,
+               NOTE_A4, NOTE_G4,
+               NOTE_F4, NOTE_F4, NOTE_E4, NOTE_E4, NOTE_D4, 
+               NOTE_D4, NOTE_C4
+              }, 
+              {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_C5, 
+               NOTE_A4, NOTE_C5, NOTE_G4,
+               NOTE_F4, NOTE_F4, NOTE_G4, NOTE_E4, NOTE_E4, 
+               NOTE_D4, NOTE_D4, NOTE_E4, NOTE_C4,
+               NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, 
+               NOTE_C5,
+               NOTE_A4, NOTE_C5, NOTE_G4,
+               NOTE_C5, NOTE_A4, NOTE_G4, NOTE_G4, 
+               NOTE_F4, NOTE_E4, NOTE_D4, NOTE_C4, 
+               0, 0, 0, 0, 0, 0, 0
+               }, 
+              { NOTE_E5, NOTE_E5, NOTE_E5, NOTE_C5, NOTE_E5,
+                NOTE_G5, NOTE_G4, 
+                NOTE_C5, NOTE_G4, NOTE_E4, 
+                NOTE_E4, NOTE_A4, NOTE_B4, NOTE_AS4, NOTE_A4, 
+                  NOTE_G4, NOTE_E5, NOTE_G5, NOTE_A5, NOTE_F5, 
+                NOTE_G5, 
+                NOTE_E5, NOTE_C5, NOTE_D5, NOTE_B4, 
+                  NOTE_C5, NOTE_G4, NOTE_E4, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              } 
+};
+
+
+int allNoteDurations[7][42] = {
+              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              },
+              {4, 8, 8, 4, 4, 4, 4, 4,
+               0, 0, 0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              }, 
+              {4, 4, 2, 4, 4, 2, 
+                             8, 8, 8, 8, 8, 8, 8, 8, 
+                             4, 4, 2,
+               0, 0, 0, 0, 
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               0, 0, 0, 0, 0, 0, 0
+              },
+              {4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2, 
+               4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2, 
+               4, 4, 4, 8, 8, 4, 4, 2, 
+               4, 8, 8, 8, 8, 8, 8, 4, 8, 8, 2,
+               0
+              },  
+              {4, 4, 4, 4, 4, 4, 2, 
+                   4, 4, 4, 4, 4, 4, 2, 
+               4, 4, 4, 4, 4, 4, 2,
+               4, 4, 4, 4, 4, 4, 2,
+               4, 4, 4, 4, 4, 4, 2,
+               4, 4, 4, 4, 4, 4, 2
+              }, 
+              {8, 8, 8, 8, 4, 4, 
+               4, 4, 2, 
+               4, 8, 8, 4, 4, 
+               4, 8, 8, 2, 
+               8, 8, 8, 8, 4, 4, 
+               4, 4, 2,
+               4, 8, 8, 8, 4, 
+               4, 4, 2,
+               0, 0, 0, 0, 0, 0, 0
+               }, 
+              {8, 4, 4, 8, 4, 
+               2, 2, 
+               4, 2, 4, 
+               8, 4, 4, 8, 4, 
+               8, 8, 8, 4, 8, 8, 
+               4, 8, 8, 2, 
+               4, 4, 4,
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+              } 
+};
+
+int long stepThreshholdRed = 2400;
+int long stepThreshholdGreen = 2500;
+int long stepThreshholdBlue = 2400;
 
 CapacitiveSensor   cs_green = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
 CapacitiveSensor   cs_red = CapacitiveSensor(13, 12);        // 10M resistor between pins 1 & 0, pin 0 is sensor pin, add a wire and or foil if desired


void loop() 
{
  int time = millis();

  // constantly monitor the player's input for minimal delay
  checkPlayerInput();
  
  // create a new Dance Move at a regular interval
  if (time - createDanceMoveTimer > DANCE_MOVE_CREATE_INTERVAL)
    createDanceMove();
  
  // update the strip
  if (time - updateTimer > UPDATE_INTERVAL)
  {
    processPlayerInput();
    updateStrip();
  }
}
boolean isSteppedOn(long pressurePlateValue) {
  return ((pressurePlateValue > stepThreshholdRed) || 
          (pressurePlateValue > stepThreshholdGreen) || 
          (pressurePlateValue > stepThreshholdBlue));
}

int playNextNote(int noteDurations[], int melodyCounter, int melody[], int melodyLength) {
      // to calculate the note duration, take one second
      // divided by the note type.
      //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
      int noteDuration = 1000 / noteDurations[melodyCounter];
      tone(sensor1pin, melody[melodyCounter], noteDuration); 
  
      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;

      if (melodyCounter < melodyLength){
        melodyCounter++;
      }
      else {
        melodyCounter = 0;
      }
      
      return melodyCounter;
}

void incrementWhichSong() {

         if (danceMoveArray[i]->isSteppedOn(RED))
         {
          Serial.println("Stepped on!");
          playNextNote();  
         }
         break;
       case 2:   // 0 1 0 (green)
         if (danceMoveArray[i]->isSteppedOn(GREEN))
         {
          Serial.println("Stepped on!");
          playNextNote();
         }
         break;
       case 1:   // 0 0 1 (blue)
         if (danceMoveArray[i]->isSteppedOn(BLUE))
         {
          Serial.println("Stepped on!");
          playNextNote();
         }
         break;
       case 6:   // 1 1 0 (yellow)
         if (danceMoveArray[i]->isSteppedOn(YELLOW))
         {
          Serial.println("Stepped on!");
          playNextNote();
         }    
         break;
       case 3:   // 0 1 1 (cyan)
         if (danceMoveArray[i]->isSteppedOn(CYAN))
         {
          Serial.println("Stepped on!");
          playNextNote();
         }       
         break;
       case 5:   // 1 0 1 (magenta)
         if (danceMoveArray[i]->isSteppedOn(MAGENTA))
         {
          Serial.println("Stepped on!");
          playNextNote();
         }    
         break;
       default:  // 0 0 0
