I'm c开发者_开发知识库urrently using this code (specifically the matrix2midi.m file) to write a MIDI file in Matlab. All is fine except that my tempo does not match what I specified.
I currently have what I want the tempo to be in BPM. I then use the following formula to convert into a tempo format used by MIDI files (taken from): Tempo = 60,000,000/BPM I then also have to set the pulses per quarter note (PPQN): PPQN = Tempo/TimeBase
I've no idea what the time base refers to and how to get it. Is the PPQN something which is by the hardware?
MIDI clock sends a tick 96 times per quarter note.
120 BPM = 120 Quarter Notes per Minute
60 / 120 = 0.5 seconds per beat
500ms / 96 = 5.208333ms per clock tick.
精彩评论