Forums > MaxMSP

expr. calculation, please help!

July 4, 2007 | 2:47 pm

i know this might be a bit wierd but i?m not a math genius and i need some help with a calculation.i would be very thankful.

basically it?s a patch from the f0.abs library which converts milliseconds to hours-minutes-seconds. i want this patch to put out single seconds,tenth of seconds frames and even subframes with a framerate of 25fps. i cant figure out the last expression to calculate the subframes (80 subs) per fps.
i marked the expr. (pink) which needs to be done.
any help would be great.
here?s the patch.

max v2;
#N vpatcher 77 44 1020 442;
#P origin 7 0;
#P window setfont "Sans Serif" 9.;
#P comment 730 337 53 196617 subframes;
#N comlet subframes/bit;
#P outlet 748 322 15 0;
#P newex 748 200 117 196617 expr ($i1%1000)/12.5;
#B color 14;
#P comment 565 337 36 196617 fps 10;
#N comlet fps. 10s;
#P outlet 573 322 15 0;
#P newex 634 264 32 196617 * 10;
#P number 634 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 634 224 31 196617 / 10;
#P newex 572 286 72 196617 expr $i1 -$i2;
#P newex 634 200 108 196617 expr ($i1%1000)/40;
#N comlet fps. 1s;
#P outlet 609 322 15 0;
#P comment 604 337 29 196617 fps 1;
#P comment 0 336 27 196617 h 10;
#N comlet h. 10s;
#P outlet 5 321 15 0;
#N comlet h. 1s;
#P outlet 41 321 15 0;
#P comment 39 336 20 196617 h 1;
#P newex 73 263 32 196617 * 10;
#P number 73 243 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 73 223 31 196617 / 10;
#P newex 11 285 72 196617 expr $i1 -$i2;
#P comment 208 337 36 196617 min 10;
#N comlet min. 10s;
#P outlet 216 322 15 0;
#N comlet min. 1s;
#P outlet 252 322 15 0;
#P comment 247 337 30 196617 min 1;
#P newex 284 264 32 196617 * 10;
#P number 284 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 284 224 31 196617 / 10;
#P newex 222 286 72 196617 expr $i1 -$i2;
#P comment 436 337 36 196617 sec 10;
#N comlet sec. 10s;
#P outlet 444 322 15 0;
#P newex 505 264 32 196617 * 10;
#P number 505 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 505 224 31 196617 / 10;
#P newex 443 286 72 196617 expr $i1 -$i2;
#P newex 11 200 255 196617 expr ($i1-(($i1%3600000)-($i1%60000)))/3600000;
#P newex 284 200 215 196617 expr (($i1%3600000)-($i1%60000))/60000;
#P newex 505 200 124 196617 expr ($i1%60000)/1000;
#N comlet sec. 1s;
#P outlet 480 322 15 0;
#N comlet ms.;
#P inlet 11 33 15 0;
#P comment 554 89 63 196617 /fO O1O113;
#P comment 475 337 29 196617 sec 1;
#P comment 29 33 19 196617 ms;
#P fasten 24 0 28 0 0 258 0 313 10 313;
#P connect 3 0 7 0;
#P connect 7 0 22 0;
#P fasten 22 0 27 0 16 311 46 311;
#P connect 7 0 23 0;
#P connect 23 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 22 1;
#P fasten 16 0 20 0 215 259 215 316 221 316;
#P connect 6 0 14 0;
#P fasten 14 0 19 0 227 310 257 310;
#P fasten 3 0 6 0 16 80 289 80;
#P connect 6 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 14 1;
#P connect 5 0 8 0;
#P fasten 10 0 12 0 438 259 438 318 449 318;
#P fasten 8 0 4 0 448 309 485 309;
#P fasten 3 0 5 0 16 76 510 76;
#P connect 5 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 8 1;
#P connect 32 0 33 0;
#P fasten 35 0 37 0 567 259 567 318 578 318;
#P fasten 33 0 31 0 577 309 614 309;
#P fasten 3 0 32 0 16 71 639 71;
#P connect 32 0 34 0;
#P connect 34 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 33 1;
#P connect 3 0 39 0;
#P connect 39 0 40 0;
#P pop;



f
July 4, 2007 | 3:49 pm

hi loook,
hope this works for you…

max v2;
#N vpatcher 10 59 459 490;
#P window setfont "Sans Serif" 9.;
#P flonum 15 102 53 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 115 392 68 196617 frames 0-24;
#P flonum 152 366 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 152 339 27 196617 i;
#P newex 168 290 27 196617 t f f;
#P flonum 196 366 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 243 54 22 196617 fps;
#P inlet 227 54 15 0;
#P toggle 15 50 15 0;
#P newex 15 76 67 196617 clocker 99.5;
#P flonum 168 252 49 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 227 138 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 227 89 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 270 54 66 196617 loadmess 25;
#P newex 168 209 128 196617 expr ($f1%$f2)/$f2*$f3;
#B color 14;
#P newex 227 113 49 196617 !/ 1000.;
#P comment 197 392 125 196617 subframes in percent 0-1;
#P newex 196 339 31 196617 % 1.;
#P connect 9 0 8 0;
#P connect 8 0 17 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 8 0 3 0;
#P connect 3 0 7 0;
#P connect 7 0 13 0;
#P connect 13 1 0 0;
#P connect 0 0 12 0;
#P connect 10 0 5 0;
#P connect 4 0 5 0;
#P connect 5 0 2 0;
#P connect 2 0 6 0;
#P connect 6 0 3 1;
#P connect 5 0 3 2;
#P pop;

Quoting loook1 :

>
> i know this might be a bit wierd but i?m not a math genius and i
> need some help with a calculation.i would be very thankful.
>
> basically it?s a patch from the f0.abs library which converts
> milliseconds to hours-minutes-seconds. i want this patch to put out
> single seconds,tenth of seconds frames and even subframes with a
> framerate of 25fps. i cant figure out the last expression to
> calculate the subframes (80 subs) per fps.
> i marked the expr. (pink) which needs to be done.
> any help would be great.
> here?s the patch.


July 4, 2007 | 4:35 pm

thank you ..but this won?t work as the subframes need to reset after counting from 0-79 and all other times like hour,min.,sec have to respond to that.

so if anyone knows… help me!


July 5, 2007 | 7:29 am

loook1 schrieb:
> thank you ..but this won?t work as the subframes need to reset after
> counting from 0-79 and all other times like hour,min.,sec have to
> respond to that.

no expr needed, I do it usually like that:

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 327 193 91 196617 get the fractional part of the frames;
#P window linecount 1;
#P comment 307 165 74 196617 get the frames;
#P newex 292 109 50 196617 !/ 1000.;
#P flonum 292 84 40 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 289 207 34 196617 * 80.;
#P message 109 262 168 196617 00:00:01:02:38;
#P newex 289 186 34 196617 % 1.;
#P message 375 59 21 196617 30;
#P message 338 59 35 196617 29.969999;
#P message 315 59 21 196617 25;
#P message 292 59 21 196617 24;
#P comment 298 42 69 196617 frames/sec;
#P newex 244 163 58 196617 / 40.;
#P newex 109 228 190 196617 sprintf set %.2d:%.2d:%.2d:%.2d:%.2d;
#P number 199 59 85 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 154 187 37 196617 % 60;
#P newex 109 187 37 196617 / 60;
#P newex 199 187 37 196617 % 60.;
#P newex 154 164 37 196617 / 60;
#P newex 244 141 47 196617 % 1000.;
#P newex 199 141 43 196617 / 1000.;
#P comment 198 39 36 196617 ms;
#P connect 17 0 8 4;
#P connect 15 0 17 0;
#P fasten 9 0 15 0 249 183 294 183;
#P connect 9 0 8 3;
#P connect 2 0 9 0;
#P connect 19 0 9 1;
#P connect 18 0 19 0;
#P fasten 14 0 18 0 380 79 297 79;
#P fasten 13 0 18 0 343 79 297 79;
#P fasten 12 0 18 0 320 79 297 79;
#P connect 11 0 18 0;
#P connect 7 0 1 0;
#P connect 7 0 2 0;
#P fasten 1 0 3 0 204 161 159 161;
#P connect 1 0 4 0;
#P connect 5 0 8 0;
#P fasten 3 0 5 0 159 184 114 184;
#P connect 3 0 6 0;
#P connect 8 0 16 0;
#P connect 4 0 8 2;
#P connect 6 0 8 1;
#P window clipboard copycount 22;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


Viewing 4 posts - 1 through 4 (of 4 total)