Code for MIDI-audio alignment