Dmaxer
09-16-2005, 06:20 AM
Sorry for posting again on this subject . I have read a few posts in this forum regarding
Timing and the clock (ticks) max runs at and this post
http://forums.cgsociety.org/showthread.php?t=266473&highlight=ticks (http://forums.cgsociety.org/showthread.php?t=266473&highlight=ticks)
did help me but Im still stuck so here goes
Im reading data from a midi ,writing that data to a text file .then reading the
text file in to max. that part works fine, but I cant get the timing right. if I play a wave
rendered from the same midi file I use to animate my objects in max
You see and hear that the animation is way out
all the timing data in the text file is in microseconds
I read the a value into the variable Tempo
Then read a value into the variable Div
Then I get the variable PPQN by Tempo / Div
So if Tempo = 500 000 and Div = 480, PPQN will be 1041 and this
variable tells me the length in microseconds each click should represent
I then go on to read my Click variable and rotate an object at that time
So right now part of my code looks like
PPQN = Tempo / Div
ani = PPQN/4800
T2 = ani*click
at time (execute(T2 as string + "t")) rotate theObj rot_key
can anyone tell me if theres a better way to do this ?? Im still learning Max
script so please forgive me if its something simple Im missing
I do know I must be doing this wrong but
Im not sure how to go about fixing it
I found if I multiyply ani by 23 it seems the timing is a
lot closer but it driffs off the longer the animation runs
so the error is adding up with each click
Thanks for reading
All the best Danny
Timing and the clock (ticks) max runs at and this post
http://forums.cgsociety.org/showthread.php?t=266473&highlight=ticks (http://forums.cgsociety.org/showthread.php?t=266473&highlight=ticks)
did help me but Im still stuck so here goes
Im reading data from a midi ,writing that data to a text file .then reading the
text file in to max. that part works fine, but I cant get the timing right. if I play a wave
rendered from the same midi file I use to animate my objects in max
You see and hear that the animation is way out
all the timing data in the text file is in microseconds
I read the a value into the variable Tempo
Then read a value into the variable Div
Then I get the variable PPQN by Tempo / Div
So if Tempo = 500 000 and Div = 480, PPQN will be 1041 and this
variable tells me the length in microseconds each click should represent
I then go on to read my Click variable and rotate an object at that time
So right now part of my code looks like
PPQN = Tempo / Div
ani = PPQN/4800
T2 = ani*click
at time (execute(T2 as string + "t")) rotate theObj rot_key
can anyone tell me if theres a better way to do this ?? Im still learning Max
script so please forgive me if its something simple Im missing
I do know I must be doing this wrong but
Im not sure how to go about fixing it
I found if I multiyply ani by 23 it seems the timing is a
lot closer but it driffs off the longer the animation runs
so the error is adding up with each click
Thanks for reading
All the best Danny
