Delta times
[email protected] ("Noel Lairson") Fri, 25 Jul 2003 13:31:06 -0700
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <000d01c352eb$acf93030$b6e5fea9@fido> |
My next area to understand is the meaning of the parameters of the note_on event and how to convert "deltas" into note durations. How does the duration of the note (in ticks) relate to the Ticks paramater 192 at the header? ------------------------------------ Charles - Delta times are basically delay times expressed in terms of ticks. The Ticks parameter sets the number of ticks per quarter notes. Your program will need to read that number and then determine the note values based on proportion to that number - there are many valid values that the Ticks parameter can be set to, and few programs set them the same way. So here's your program's output: Track No: 0 3 events in the track set_tempo 0 500000 key_signature 0 1 0 time_signature 0 3 2 24 8 #a lot of programs relegate statistical information to track 0. This is not required or even neccessary, but common. You will notice all three events have a Delta time of '0' - so they pass their information on to whatever it is that is reading the data immediately upon starting. Track No: 1 64 events in the track a) note_on 0 0 67 64 b) note_on 89 0 67 0 c) note_on 7 0 71 64 d) note_on 89 0 71 0 note_on 7 0 74 64 note_on 89 0 74 0 note_on 7 0 79 64 note_on 89 0 79 0 note_on 7 0 69 64 note_on 89 0 69 0 note_on 7 0 78 64 note_on 89 0 78 0 #a - immediately upon starting (DT = '0'), play note #67 with a velocity of 64 #b - 89 ticks later, turn note a off. #c - 7 ticks later, play note #71 with a velocity of 64 #d - 89 ticks later, turn note c off #and so on. #this is actually a good example because the rhythmic information is not exact. You and I see that these are essentially eighth notes, but the computer is going to have to be taught to round values off to interpret them - i.e. ignore the 7 ticks of rest between each note and instead combine it with the 89 ticks the previous note lasted. Hope this helps. Noel