write this code (will pay)

I need a code for a hi hat controller to send midi messages. there are 2 parts, first the pedal itself triggers 2 notes, a note when the pedal is tapped down note #58 and a different note when the pedal is tapped down but then quickly released. The pedal also switches between 3 notes that are played on a designated pad. The pedal which is just a (FSR) will be connected to (A0) and the pad (piezo sensor) connected to (A1) so something like this.

if value of (A0) goes below threshold and stays for > 10 milliseconds play note #58 else
if value of (A0) goes below threshold and stays for < 10 milliseconds play note #59

if value of (A0) > 400 pad #4 (A1) plays note #60
if value of (A0) > 200 but 400 < pad #4 (A1) plays note #61
if value of (A0) < 200 pad #4 (A1) plays note #62

I would appreciate any suggestions or if you can write this as a working block of code I will compensate. If interested contact me and I'll provide more details.

Hi edrummer,

How are you interfacing with the MIDI? I assume you’re using a commercial shield rather than specialized custom circuitry?

I'm using a Teensy 3.6 board, it sends midi messages direct through USB