 /* Code for laser guzheng
  * Copyright (C) 2016 Jason Lu
  * 
+ * Licensed under the MIT License
  */ 
+ 
+/* Uncomment the define if you are using a wind instrument, such
+ * as a trumpet or flute. It will disable several things that
+ * are specific to string and percussion instruments. DO NOT
+ * uncomment it if you are using a piano or string instrument! */
+// #define WIND
 
-// Some defines
+// Port I/O defines
 #define THRESHOLD 500
+#define LASTPORT 4
+
+// MIDI property defines
 #define VOLUME 0x7F
-#define LASTPORT 4
 #define DELAY 10
 
 // MIDI command defines

#define NOTEOFF 0x80
#define CHANGEINSTRUMENT 0xC0

// Values for different notes
int note8 = 0x48;
int note7 = 0x47;
int note6 = 0x45;

  // 5 ports, from 0 to 4
  for (int i = 0; i <= LASTPORT; i++) {
    if(analogRead(i) > THRESHOLD) {
#ifndef WIND
      if (lastNote != i || lastNote != 314) {
#endif
        // Beam has been cut
        // i+1 is because i is 0 indexed, but the ID starts with 1
        if (i < 4) {
          musicOn(i + 1);
#ifndef WIND
          lastNote = i;
#endif
        } else {
          if (noteSet == 1) {
            noteSet = 2;
          } else {
            noteSet = 1;
          }
#ifndef WIND
          lastNote = 314;
#endif
        }
#ifndef WIND
      }
#endif
    } else {
#ifndef WIND
      if (lastNote == i) {
        lastNote = -1;
      }
#endif
      // Hand is gone. Stop the sound
      musicOff(i + 1);
    }
