         selected_capo_id = (i < 8) ? i + 1 : 0;  //frets 9 and more removes capo
       }
     }
+  }
 
   if (stop_pressed) {
     //noteOff for all lasers

    //noteOn
    uint8_t note = get_note(l_idx);
    if (note != 0) {
      //midiEventPacket_t packet0 = {0x08, 0x80 | 0, played_notes[l_idx], 0};  //note off last played note
      //MidiUSB.sendMIDI(packet0);
      //MidiUSB.flush();
      //delay(2); //next midi command gets omitted if delay is not present, because midiusb is ignoring the fact, just change it
      played_notes[l_idx] = note;
      midiEventPacket_t packet = {0x09, 0x90 | 0, note, velocity};  //channel, pitch, velocity
      MidiUSB.sendMIDI(packet);

#define LASER_THOLD 1000 //[us]
#define STOP_THOLD 500000 //[us]
#define FRET_SLIDING_THOLD 500000 //[us]
#define PITCH_HALFTONE 12 * 4
#define VEL_TIME_OUT_OF_RANGE 200000 //[us]
#define VEL_TIME_MIN 6000
#define VEL_TIME_MAX 25000
