Convert MIDI DeltaTime to Milliseconds

Started by
2 comments, last by basementscientist 14 years, 11 months ago
Can somebody please give me a formula to convert a midi deltatime into milliseconds. I've looked all over the internet and keep finding theories and explanations, but no actual formula given.
Advertisement
Here is an answer to the question. It was worded almost identically, so Google found it easily. The links in their answer seem like it is simple enough.

The midi standard itself is quite clear on it. There are two types of time divisions (either tick length or beats-per-second) in the header along with a tempo. You need a single multiply to convert between them, choose your favorite format. Multiply by the delta time, and convert to milliseonds. The conversion is very basic algebra.
Thanks for the reply.

I've already been to that website, and still can't figure it out.

I know that:

bpm = MICROSECONDS_PER_MINUTE / tempo

division represents pulses per quarter note

tempo represents microseconds per quarter-note

I'm sure it is a very simple formula, but I just can't make the leap.

[Edited by - basementscientist on May 20, 2009 11:43:54 PM]
This is what i've come up with after looking through the documentation. Can somebody please verify it.


THINKING OUT LOUD:
MICROSECONDS_PER_MINUTE = 60000000
BPM = MICROSECONDS_PER_MINUTE / Tempo
Division = Ticks Per Beat


TicksPerMinute = BPM * Division

"60 ticks per minute = 1 second dur."
TickDuration = 60 / TicksPerMinute

"compute duration in Milliseconds"
TickDurationMS = 1000.0 * tickDuration



"convert deltaTime to milliseconds"

DeltaMS = DeltaTime * (1000.0 * (60.0 / ((MICROSECONDS_PER_MINUTE / Tempo) * Division)))

This topic is closed to new replies.

Advertisement