 void musicOn(int ID) {
   if (noteSet == 0) {
     switch (ID) {
-    case 0:
-      noteOn(NOTEON, note1, VOLUME);
-      break;
-    case 1:
-      noteOn(NOTEON, note2, VOLUME);
-      break;
-    case 2:
-      noteOn(NOTEON, note3, VOLUME);
-      break;
-    case 3:
-      noteOn(NOTEON, note4, VOLUME);
-      break;
-    case 4:
-      noteOn(NOTEON, note5, VOLUME);
-      break;
-    case 5:
-      noteOn(NOTEON, note6, VOLUME);
-      break;
-    case 6:
-      noteOn(NOTEON, note7, VOLUME);
-      break;
-    case 7:
-      noteOn(NOTEON, note8, VOLUME);
-      break;
-    default:
-      // WTF? It shouldn't reach here, because that's an invalid ID
-      noteOn(NOTEOFF, note1, 0x00);
-      break;
+      case 0:
+        noteOn(NOTEON, note1, VOLUME);
+        break;
+      case 1:
+        noteOn(NOTEON, note2, VOLUME);
+        break;
+      case 2:
+        noteOn(NOTEON, note3, VOLUME);
+        break;
+      case 3:
+        noteOn(NOTEON, note4, VOLUME);
+        break;
+      case 4:
+        noteOn(NOTEON, note5, VOLUME);
+        break;
+      case 5:
+        noteOn(NOTEON, note6, VOLUME);
+        break;
+      case 6:
+        noteOn(NOTEON, note7, VOLUME);
+        break;
+      case 7:
+        noteOn(NOTEON, note8, VOLUME);
+        break;
+      default:
+        // WTF? It shouldn't reach here, because that's an invalid ID
+        noteOn(NOTEOFF, note1, 0x00);
+        break;
     }
   } else if (noteSet == 1) {
     switch (ID) {
-    case 0:
-      noteOn(NOTEON, note9, VOLUME);
-      break;
-    case 1:
-      noteOn(NOTEON, note10, VOLUME);
-      break;
-    case 2:
-      noteOn(NOTEON, note11, VOLUME);
-      break;
-    case 3:
-      noteOn(NOTEON, note12, VOLUME);
-      break;
-    case 4:
-      noteOn(NOTEON, note13, VOLUME);
-      break;
-    case 5:
-      noteOn(NOTEON, note14, VOLUME);
-      break;
-    case 6:
-      noteOn(NOTEON, note15, VOLUME);
-      break;
-    case 7:
-      noteOn(NOTEON, note16, VOLUME);
-      break;
-    default:
-      // WTF? It shouldn't reach here, because that's an invalid ID
-      noteOn(NOTEOFF, note1, 0x00);
-      break;
+      case 0:
+        noteOn(NOTEON, note9, VOLUME);
+        break;
+      case 1:
+        noteOn(NOTEON, note10, VOLUME);
+        break;
+      case 2:
+        noteOn(NOTEON, note11, VOLUME);
+        break;
+      case 3:
+        noteOn(NOTEON, note12, VOLUME);
+        break;
+      case 4:
+        noteOn(NOTEON, note13, VOLUME);
+        break;
+      case 5:
+        noteOn(NOTEON, note14, VOLUME);
+        break;
+      case 6:
+        noteOn(NOTEON, note15, VOLUME);
+        break;
+      case 7:
+        noteOn(NOTEON, note16, VOLUME);
+        break;
+      default:
+        // WTF? It shouldn't reach here, because that's an invalid ID
+        noteOn(NOTEOFF, note1, 0x00);
+        break;
     }
   }
 }
-  
-  // Function for turning off a specific note based on ID
-  // Just a slightly modified version of musicOn()
+
+// Function for turning off a specific note based on ID
+// Just a slightly modified version of musicOn()
 void musicOff(int ID) {
   if (noteSet == 0) {
     switch (ID) {
-    case 0:
-      noteOn(NOTEOFF, note1, 0x7F);
-      break;
-    case 1:
-      noteOn(NOTEOFF, note2, 0x7F);
-      break;
-    case 2:
-      noteOn(NOTEOFF, note3, 0x7F);
-      break;
-    case 3:
-      noteOn(NOTEOFF, note4, 0x7F);
-      break;
-    case 4:
-      noteOn(NOTEOFF, note5, 0x7F);
-      break;
-    case 5:
-      noteOn(NOTEOFF, note6, 0x7F);
-      break;
-    case 6:
-      noteOn(NOTEOFF, note7, 0x7F);
-      break;
-    case 7:
-      noteOn(NOTEOFF, note8, 0x7F);
-      break;
-    default:
-      // WTF? It shouldn't reach here, because that's an invalid ID
-      noteOn(NOTEOFF, note1, 0x00);
-      break;
+      case 0:
+        noteOn(NOTEOFF, note1, 0x7F);
+        break;
+      case 1:
+        noteOn(NOTEOFF, note2, 0x7F);
+        break;
+      case 2:
+        noteOn(NOTEOFF, note3, 0x7F);
+        break;
+      case 3:
+        noteOn(NOTEOFF, note4, 0x7F);
+        break;
+      case 4:
+        noteOn(NOTEOFF, note5, 0x7F);
+        break;
+      case 5:
+        noteOn(NOTEOFF, note6, 0x7F);
+        break;
+      case 6:
+        noteOn(NOTEOFF, note7, 0x7F);
+        break;
+      case 7:
+        noteOn(NOTEOFF, note8, 0x7F);
+        break;
+      default:
+        // WTF? It shouldn't reach here, because that's an invalid ID
+        noteOn(NOTEOFF, note1, 0x00);
+        break;
     }
   } else if (noteSet == 1) {
     switch (ID) {
-    case 0:
-      noteOn(NOTEOFF, note9, VOLUME);
-      break;
-    case 1:
-      noteOn(NOTEOFF, note10, VOLUME);
-      break;
-    case 2:
-      noteOn(NOTEOFF, note11, VOLUME);
-      break;
-    case 3:
-      noteOn(NOTEOFF, note12, VOLUME);
-      break;
-    case 4:
-      noteOn(NOTEOFF, note13, VOLUME);
-      break;
-    case 5:
-      noteOn(NOTEOFF, note14, VOLUME);
-      break;
-    case 6:
-      noteOn(NOTEOFF, note15, VOLUME);
-      break;
-    case 7:
-      noteOn(NOTEOFF, note16, VOLUME);
-      break;
-    default:
-      // WTF? It shouldn't reach here, because that's an invalid ID
-      noteOn(NOTEOFF, note1, 0x00);
-      break;
+      case 0:
+        noteOn(NOTEOFF, note9, VOLUME);
+        break;
+      case 1:
+        noteOn(NOTEOFF, note10, VOLUME);
+        break;
+      case 2:
+        noteOn(NOTEOFF, note11, VOLUME);
+        break;
+      case 3:
+        noteOn(NOTEOFF, note12, VOLUME);
+        break;
+      case 4:
+        noteOn(NOTEOFF, note13, VOLUME);
+        break;
+      case 5:
+        noteOn(NOTEOFF, note14, VOLUME);
+        break;
+      case 6:
+        noteOn(NOTEOFF, note15, VOLUME);
+        break;
+      case 7:
+        noteOn(NOTEOFF, note16, VOLUME);
+        break;
+      default:
+        // WTF? It shouldn't reach here, because that's an invalid ID
+        noteOn(NOTEOFF, note1, 0x00);
+        break;
     }
   }
 }

      // Button is no longer pressed, so reset the button state.
      noteButtonState = 0;
    }
#ifdef SENSOR_FIX
    int threshold = (i == 3) ? 950 : THRESHOLD;
    if(analogRead(0) > threshold) {
#else
    if(analogRead(0) > THRESHOLD) {
#endif
      /* Apply the AND operator to the lastNote indicator and the
       * corresponding value from the laser array to check if the
       * laser bit has been set or not
       *
       * If it returns a non zero value, then that means it is set.
       * If it is a zero, then the bit has not been set yet */
      if (!(lastNote & (laserArray[i]))) {
        // Beam has been cut
        musicOn(i);
        /* Set the bit using the OR operator between lastNote and
         * the corresponding value from the laser array */
        lastNote |= (laserArray[i]);
      }
    } else {
      /* Check if the last note bit has been set or not using the
       * AND operator. This won't always be true because this section
       * of the code runs even if the beam hasn't been cut yet */
      if ((lastNote & (laserArray[i]))) {
        /* Unset the flag using the AND and invert operators */
        lastNote &= ~(laserArray[i]);
      }
      // Hand is gone. Stop the sound
      musicOff(i);
    }
    #ifndef NODELAY
    // Delay 10 to prevent weird analog readings
    delay(DELAY);
    #endif
  }
}

/* Code for laser guzheng
   Copyright (C) 2016 Jason Lu

   Licensed under the MIT License
   This code has NO WARRANTY! You are
   responsible for anything that happens
*/

// Port I/O defines
#define THRESHOLD 700
