How do I calculate time divisions for MIDI files?

https://github.com/ZILtoid1991/pixelperfectengine/blob/117ffcf785b5fadf4324902d4944238d34668e65/pixelperfectengine/src/pixelperfectengine/audio/base/midiseq.d#L125

I have some issues with understanding the documentation on how set tempo events and time divisions work, so it's really not well calculated, and thus causes my code to just zoom through the MIDI file I'm throwing at it. Maybe there's some other chunks I'm not processing at the function that should be processing MIDI events here, so I don't really know.

4 points · 2 comments · view on lemmy.world

2 Comments

VeeSilverball@kbin.social · 2 pts · 3y

An overview of PPQN:

http://midi.teragonaudio.com/tech/midifile/ppqn.htm

Some reference code I've used, which might help with architectural issues: https://github.com/triplefox/minimidi/tree/master/minimidi

ZILtoid1991@kbin.social · 1 pts · 3y

Potential solution: It seems like multiplying the time by 10 solved it, at least now it doesn't zooms through the MIDI track in an instant.

https://github.com/ZILtoid1991/pixelperfectengine/blob/5cc5834f931783b5553d9959cfe66fe8f9ea6cfe/pixelperfectengine/src/pixelperfectengine/audio/base/midiseq.d#L125