int velocity = map(piezo, thresholdMin, 1023, 80, 127);
You want peak not piezo here.
You're taking the last reading instead of the maximum reading... as it's likely below the threshold min and map doesn't deal...
int velocity = map(peak, thresholdMin, 1023, 1, 127);
Serial.println (velocity);
usbMIDI.sendNoteOn(note, velocity, channel);
Yeah, how can you be getting those values at all? If you are then the MIDI...
I've not been following the form closely of late... but I recall seeing something where the host wasn't packaging MIDI efficiently and a fix is in the works??? (looking to see if I've imagined this...)
rummage...
I was hoping someone qualified would reply. I think you should not use digitalWriteFast as I believe it's meant for compatibility only in Teensyduino.
I think you need not worry too much about the serial exchange...