I have researched the subject for some time now and still haven\'t figure it out. I use midas3 library (Midi-actionscript3) to import midi to flash. I get each note-item on
If I understand your question correctly, you basically want to convert the ticks for each MIDI note into a millisecond value so you can display the notes visually along a timeline.
So first, you need to use the division and the tempo to determine the value of an individual tick. That conversion basically looks like:
[ 1 min 60 sec 1 beat Z clocks ]
| ------- * ------ * -------- * -------- | = seconds
[ X beats 1 min Y clocks 1 ]
So, in the above conversion, X
is the tempo, Y
is the division, and Z
is the number of clocks from the incoming event. You can see how all of the units cancel out, giving you a value in seconds. The condensed version of that conversion is therefore:
(60 * clocks) / (tempo * division) = seconds
Keep in mind that the value given here in seconds
is the number of seconds since the previous MIDI event, not from the sequence start. You will need to keep a running total of this value to construct a coherent sequence.