Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

midi files replay(tempo)

12 views
Skip to first unread message

nokturnal

unread,
May 7, 2012, 2:08:14 PM5/7/12
to
Hello,
I'm writing midi replay for Atari ST (and compatible) and I've stuck
with setting proper tempo handling. Anyone has managed to translate
midi delta times to proper mfp freqency?
I wrote midi 0,1,2 parser and put all the data in custom structure.
And I track midi ticks for each midi track (in timer b interrupt) and
send events at proper delta relative to previous events (I write
directly to midi port without bios and put all the events collected
from all tracks in buffer to send all the data at once ), but I don't
know if it is good enough. My tempo calculation is wrong, the files
are replayed too slowly.

To calculate tempo I get PPQN from midi file, quaternote duration (500
000 by default and I am handling set tempo event) and use this (for
sure there is something wrong with it):

float freq=quaternote duration/1000000.0f;
freq=freq/PPQN

//calculate freq in [hz]
freq=1.0f/freq;

After that I pass freq to function which translates frequency to MFP
data and mode (it's ok for sure).
Any thoughts on this topic? Is there other way for replaying midi
files?

Regards,
Pawel Goralski
nokt...@nokturnal.pl
0 new messages