Jump to content
  • Advertisement
Sign in to follow this  
basementscientist

Convert MIDI DeltaTime to Milliseconds

This topic is 3494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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)))

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!