 #ifndef WIND
           lastNote = i;
 #endif
-        } else {
-          if (noteSet == 1) {
-            noteSet = 2;
-          } else {
-            noteSet = 1;
+        } else if (i == 4) {
+#ifndef WIND
+          if (lastNote != 314) {
+#endif
+            if (noteSet == 1) {
+              noteSet = 2;
+            } else {
+              noteSet = 1;
+            }
+#ifndef WIND
+            lastNote = 314;
           }
-#ifndef WIND
-          lastNote = 314;
 #endif
         }
 #ifndef WIND

  // Set instrument to trumpet
  // 0xC0 is the change instrument command
  // 0x39 is the instrument ID in hex
  Serial.write(CHANGEINSTRUMENT);
  Serial.write(INSTRUMENT);
}

// Function for playing note based on ID

  for (int i = 0; i <= LASTPORT; i++) {
    if(analogRead(i) > THRESHOLD) {
#ifndef WIND
      if (lastNote != i) {
#endif
        // Beam has been cut
        // i+1 is because i is 0 indexed, but the ID starts with 1
