     delay(DELAY);
   }
 }
-
-// Function to write notes over serial
-void noteOn(int cmd, int pitch, int velocity) {
-  Serial.write(cmd);
-  Serial.write(pitch);
-  Serial.write(velocity);
-}
-

    noteOn(NOTEOFF, note8, 0x7F);
    break;
  default:
    noteOn(NOTEOFF, note1, 0x00);
    break;
  }
}

void loop()
{
  // Main loop
  // 5 ports, from 0 to 4
  for (int i = 0; i <= LASTPORT; i++) {
    if(analogRead(i) > THRESHOLD) {
#ifndef WIND
      if (!(lastNote & (laserArray[i]))) {
#endif
        // Beam has been cut
        // i+1 is because i is 0 indexed, but the ID starts with 1
        musicOn(i);
#ifndef WIND
        lastNote |= (laserArray[i]);

    noteOn(NOTEON, note8, VOLUME);
    break;
  default:
    // WTF? It shouldn't reach here, because that's an invalid ID
    noteOn(NOTEOFF, note1, 0x00);
    break;
  }
