Problems with basic animation in Jitter

Jul 11, 2006 at 9:17pm

Problems with basic animation in Jitter

Hi,
I’ve posted this problem a couple times but am still struggling with
it. I am trying again to see if anyone could provide some insight. I
am just trying to animate a straight line like a cursor in jitter, but
for some reason I cannot get the animation smooth it is always jittery.
I’ve also tried this with LCD and got the same results. Could it be
something to do with my CPU set up? I have a 17″ 1.5ghz powerbook with
2gb ram. Below is the patch that has two different modes one is an
audio rate animator and the other just using the line object. I would
really appreciate some help with this one as it is a pretty fundamental
thing for a lot of my current work.

Thanks,
Justin Yang

max v2;
#N vpatcher 0 44 1078 863;
#P origin -172 37;
#P window setfont “Sans Serif” 9.;
#P newex 268 40 60 196617 loadmess 1;
#P button 329 541 35 0;
#P window setfont “Sans Serif” 14.;
#P window linecount 2;
#P comment 125 536 198 196622 Animate using line ; turn off dac and
bang —>;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 48 578 48 196617 loadbang;
#P newex 566 91 60 196617 loadmess 1;
#P newex 525 65 78 196617 loadmess 7000;
#P message 231 608 79 196617 -1.6 , 1.6 7000;
#P newex 231 628 40 196617 line 0.;
#P toggle 346 624 16 0;
#P toggle 525 624 16 0;
#N vpatcher 415 286 1002 901;
#P origin -22 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 17 279 52 196617 route 0 1;
#P window linecount 1;
#P message 11 312 22 196617 -1.;
#P window linecount 0;
#P message 38 309 17 196617 1.;
#N comlet forward/backward;
#P inlet 78 203 15 0;
#N comlet toggle on off;
#P inlet 50 205 15 0;
#N comlet Toggle to mute.;
#P inlet 447 33 15 0;
#P newex 308 192 50 196617 mute~;
#P newex 124 288 210 196617 switch 2;
#P newex 124 253 115 196617 r MastermatorSelector;
#P newex 324 253 77 196617 r Mastermator;
#N comlet x-coordinate stream.;
#P outlet 124 441 15 0;
#P window setfont “Myriad Roman” 12.;
#P flonum 167 334 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#N comlet Origin as x coordinate: usually positive number.;
#P inlet 428 33 15 0;
#N comlet Destination as x coordinate: usually negative number;
#P inlet 408 33 15 0;
#N comlet How often is the animated object redrawn in ms?;
#P inlet 376 33 15 0;
#N comlet Time in ms for one voyage across the screen.;
#P inlet 356 33 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 124 380 34 196617 * -1.;
#P window setfont “Myriad Roman” 12.;
#P flonum 124 403 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 212 334 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P newex 124 357 98 196617 zmap 0. 1. -1.6 1.6;
#P comment 412 193 170 196617 How often is cursor redrawn (ms)?;
#P number 361 192 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 250 253 70 196617 snapshot~ 50;
#P window linecount 3;
#P comment 241 66 73 196617 set time (ms) for one voyage across screen;
#P number 250 109 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 250 138 49 196617 !/ 1000.;
#P flonum 250 175 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 242 162 86 196617 or set Frequency;
#P newex 250 216 46 196617 phasor~;
#P connect 28 0 27 0;
#P connect 25 0 28 0;
#P connect 28 1 26 0;
#P connect 20 0 21 0;
#P connect 21 0 9 0;
#P connect 9 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 18 0;
#P connect 26 0 12 1;
#P connect 27 0 12 1;
#P fasten 15 0 17 0 413 322 172 322;
#P fasten 17 0 9 3 172 353 195 353;
#P fasten 16 0 10 0 433 328 217 328;
#P connect 10 0 9 4;
#P fasten 6 0 21 1 255 279 229 279;
#P fasten 13 0 4 0 361 105 255 105;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P fasten 22 0 0 0 313 212 255 212;
#P connect 2 0 0 0;
#P connect 0 0 6 0;
#P fasten 23 0 22 0 452 178 313 178;
#P lcolor 3;
#P connect 7 0 6 1;
#P connect 19 0 21 2;
#P fasten 14 0 7 0 381 183 366 183;
#P pop;
#P newobj 361 644 134 196617 p AudioRateAnimator;
#B color 1;
#P window setfont “Myriad Roman” 12.;
#P number 402 624 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 484 624 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 443 624 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 361 624 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P user hint 485 624 525 638 “Origin as x coordinate: usually positive
number.” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P user hint 444 625 484 639 “Destination as x coordinate: usually
negative number” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P user hint 403 625 443 639 “How often is the animated object redrawn
in ms?” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P user hint 362 625 402 639 “Time in ms for one voyage across the
screen.” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P window setfont “Sans Serif” 18.;
#P window linecount 5;
#P message 48 604 147 196626 reset , glcolor 1 0.5 0.1 1 , moveto 0
0.83 , gllinewidth 4 , line 0 -1.66 0;
#P window setfont “Sans Serif” 9.;
#P flonum 439 669 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 400 669 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 361 669 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 322 688 128 196617 pak position 0. 0. 0.;
#P newex 322 715 192 196617 jit.gl.sketch Notater @smooth_shading 1;
#P newex 262 920 47 196617 s draw2;
#P window setfont “Myriad Roman” 12.;
#P number 525 120 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P user hint 526 120 566 134 “Time in ms for one voyage across the
screen.” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P number 566 120 42 12 0 0 32 4019 0 0 0 221 221 221 222 222 222 0 0 0;
#P user hint 567 120 607 134 “How often is the animated object redrawn
in ms?” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P toggle 510 120 16 0;
#P window setfont “Sans Serif” 9.;
#N vpatcher 20 74 620 474;
#N comlet How often is the animated object redrawn in ms?;
#P inlet 427 98 15 0;
#N comlet Time in ms for one voyage across the screen.;
#P inlet 368 98 15 0;
#N comlet Toggle Mastermator: 1=ON ; 0=OFF;
#P inlet 226 98 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 348 296 29 196617 gate;
#P newex 226 320 115 196617 s MastermatorSelector;
#P newex 348 320 77 196617 s Mastermator;
#P number 427 246 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 367 270 70 196617 snapshot~ 50;
#P newex 226 296 27 196617 + 1;
#P number 368 155 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 368 184 49 196617 !/ 1000.;
#P flonum 368 221 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 368 246 46 196617 phasor~;
#P connect 10 0 4 0;
#P connect 4 0 8 0;
#P connect 10 0 9 0;
#P connect 9 0 7 0;
#P connect 0 0 5 0;
#P connect 5 0 9 1;
#P connect 11 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 0 0;
#P connect 12 0 6 0;
#P connect 6 0 5 1;
#P pop;
#P newobj 510 139 77 196617 p Mastermator;
#P number 211 95 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 461 576 505 609 0;
#P message 347 241 70 196617 size 500 200;
#P message 251 240 49 196617 border 1;
#P window setfont Times 10.;
#P comment 156 103 40 1310730 Display;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 136 228 53 1441802 loadbang;
#P message 136 253 82 1441802 name Notater;
#P toggle 136 103 15 0;
#P newex 136 194 286 1441802 jit.gl.render Notater @erase_color 1. 1.
1. 1.;
#P newex 136 154 76 1441802 t b b erase;
#P newex 136 126 63 1441802 qmetro 33;
#P user jit.pwindow 135 278 502 202 1 1 0 0 1 0;
#X name Notater;
#P user hint 345 624 363 642 reverse 1000 100 0 65535 65535 52428 9 3 0
1 0 0 0;
#P window setfont “Sans Serif” 14.;
#P comment 507 582 273 196622 < -- Audio Rate animation turn on DAC;
#P connect 42 0 26 0;
#P connect 45 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 4 0;
#P connect 4 2 5 0;
#P connect 4 1 5 0;
#P connect 8 0 7 0;
#P connect 7 0 2 0;
#P connect 10 0 2 0;
#P connect 11 0 2 0;
#P connect 13 0 3 1;
#P connect 44 0 39 0;
#P connect 39 0 38 0;
#P connect 4 0 10 0;
#P connect 22 0 21 0;
#P connect 26 0 21 0;
#P connect 35 0 23 0;
#P connect 38 0 23 0;
#P connect 23 0 22 1;
#P connect 37 0 35 1;
#P connect 24 0 22 2;
#P connect 31 0 35 2;
#P connect 34 0 35 3;
#P connect 25 0 22 3;
#P connect 32 0 35 4;
#P connect 33 0 35 5;
#P connect 36 0 35 6;
#P connect 45 0 15 0;
#P connect 15 0 14 0;
#P connect 40 0 19 0;
#P connect 19 0 14 1;
#P connect 41 0 17 0;
#P connect 17 0 14 2;
#P pop;

#26762
Jul 11, 2006 at 10:54pm

interesting question

it seems that for these simple animations you need a higher framerate to make it look smooth. Only from 85 frames/sec did it look ok for me. (maybe this has to do with interference with the refresh frequency of my/your (non tft/lcd) monitor?)

any thoughts on this?

anyway,
I played a bit with your patch and the first thing I did was to extend your audio chain so that the actual snapshot is almost the last thing to do (I think it helped a bit) and that you don’t have two clocks possible interfering (your qmetro and the snapshot object).

also try if turning on overdrive makes any difference on your system

what is the max framerate you get btw? (I added an object for that)

Try my code below.
I deleted some things in the patch for clarity (not that yours wasn’t clear, you even made these highlight txts!)

good luck

Timo

max v2;
#N vpatcher 25 70 939 677;
#P origin -172 104;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 361 506 79 9109513 t 1500 -1.66 1.66;
#P newex 362 609 51 9109513 snapshot~;
#P user jit.fpsgui 44 114 60 9109513 0;
#P newex 136 1 60 9109513 loadmess 1;
#P newex 48 511 48 9109513 loadbang;
#P toggle 346 557 16 0;
#P toggle 485 556 16 0;
#N vpatcher 322 79 909 694;
#P origin -22 0;
#P window setfont “Sans Serif” 9.;
#P user number~ 158 404 236 419 9 139 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 0;
#N vpatcher 15 55 615 455;
#P outlet 166 463 15 0;
#P inlet 38 84 15 0;
#P window setfont “Sans Serif” 9.;
#P flonum 213 228 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 152 211 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 298 176 27 9109513 f;
#P newex 188 140 40 9109513 t f b f;
#P window linecount 0;
#P newex 257 209 27 9109513 – 0.;
#P newex 257 140 27 9109513 t f b;
#P newex 257 174 27 9109513 f;
#P window linecount 1;
#P newex 239 318 28 9109513 *~ 0.;
#P inlet 257 84 15 0;
#P inlet 188 84 15 0;
#P window linecount 0;
#P newex 167 402 29 9109513 +~ 0.;
#P fasten 7 0 9 0 193 185 157 185;
#P connect 0 0 12 0;
#P fasten 3 0 0 0 172 337;
#P connect 7 0 0 1;
#P connect 1 0 7 0;
#P connect 6 0 10 0;
#P fasten 11 0 3 0 42 100 42 281 244 281;
#P connect 2 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 3 1;
#P fasten 7 2 4 1 223 168 279 168;
#P fasten 8 0 6 1 303 202 279 202;
#P fasten 7 1 8 0 208 167 303 167;
#P fasten 5 1 8 0 279 160 303 160;
#P pop;
#P newobj 125 355 60 9109513 p audiozmap;
#P newex 11 280 52 9109513 route 0 1;
#P window linecount 1;
#P message 11 312 22 9109513 -1.;
#P window linecount 0;
#P message 38 309 17 9109513 1.;
#N comlet forward/backward;
#P inlet 11 35 15 0;
#N comlet Toggle to mute.;
#P inlet 447 35 15 0;
#P newex 308 192 50 9109513 mute~;
#N comlet x-coordinate stream.;
#P outlet 124 441 15 0;
#P window setfont “Sans Serif” 12.;
#P flonum 151 334 42 12 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#N comlet Origin as x coordinate: usually positive number.;
#P inlet 428 35 15 0;
#N comlet Destination as x coordinate: usually negative number;
#P inlet 408 35 15 0;
#N comlet How often is the animated object redrawn in ms?;
#P inlet 376 35 15 0;
#N comlet Time in ms for one voyage across the screen.;
#P inlet 356 35 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 124 380 31 9109513 *~ -1.;
#P window setfont “Sans Serif” 12.;
#P flonum 204 334 42 12 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 241 66 73 9109513 set time (ms) for one voyage across screen;
#P number 250 109 51 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 250 138 49 9109513 !/ 1000.;
#P flonum 250 175 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 242 162 86 9109513 or set Frequency;
#P newex 250 216 46 9109513 phasor~;
#P connect 16 0 19 0;
#P connect 19 0 18 0;
#P connect 19 1 17 0;
#P connect 20 0 7 0;
#P connect 7 0 13 0;
#P fasten 0 0 20 0 255 285 130 285;
#P fasten 18 0 7 1 16 378 150 378;
#P fasten 17 0 7 1 43 371 150 371;
#P connect 12 0 20 1;
#P fasten 10 0 12 0 413 322 156 322;
#P fasten 7 0 21 0 129 401 163 401;
#P fasten 6 0 20 2 209 353 180 353;
#P fasten 11 0 6 0 433 328 209 328;
#P fasten 8 0 4 0 361 105 255 105;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P fasten 14 0 0 0 313 212 255 212;
#P connect 2 0 0 0;
#P fasten 15 0 14 0 452 178 313 178;
#P lcolor 3;
#P pop;
#P newobj 361 577 134 9109513 p AudioRateAnimator;
#B color 1;
#P window setfont “Sans Serif” 12.;
#P flonum 444 557 42 12 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 403 556 42 12 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 361 557 42 12 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user hint 445 556 485 570 “Origin as x coordinate: usually positive
number.” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P user hint 404 557 444 571 “Destination as x coordinate: usually
negative number” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P user hint 362 558 402 572 “Time in ms for one voyage across the
screen.” 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P window setfont “Sans Serif” 18.;
#P window linecount 5;
#P message 48 537 147 9109522 reset , glcolor 1 0.5 0.1 1 , moveto 0 0.83 , gllinewidth 4 , line 0 -1.66 0;
#P window setfont “Sans Serif” 9.;
#P flonum 459 610 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 420 610 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 339 637 91 9109513 pak position 0. 0. 0.;
#P newex 339 673 192 9109513 jit.gl.sketch Notater @smooth_shading 1;
#P newex 262 853 47 9109513 s draw2;
#P number 211 36 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 461 509 505 542 0;
#P message 347 174 70 9109513 size 500 200;
#P message 66 178 49 9109513 border 1;
#P window setfont “Proportional Serif” 10.;
#P comment 156 36 40 9175050 Display;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 135 165 53 9240586 loadbang;
#P message 136 186 82 9240586 name Notater;
#P toggle 136 36 15 0;
#P newex 217 123 286 9240586 jit.gl.render Notater @erase_color 1. 1. 1. 1.;
#P newex 136 87 92 9240586 t b b b erase;
#P newex 136 59 62 9240586 qmetro 11;
#P user jit.pwindow 135 211 502 202 1 1 0 0 1 0;
#X name Notater;
#P user hint 345 557 363 575 reverse 1000 100 0 65535 65535 52428 9 3 0 1 0 0 0;
#P window setfont “Sans Serif” 14.;
#P comment 507 515 273 9109518 < -- Audio Rate animation turn on DAC;
#P fasten 4 0 31 0 141 110 49 110;
#P connect 29 0 19 0;
#P fasten 4 0 10 0 141 160 71 160;
#P connect 30 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 4 0;
#P connect 8 0 7 0;
#P connect 7 0 2 0;
#P fasten 10 0 2 0 71 211 141 211;
#P fasten 11 0 2 0 352 211 141 211;
#P fasten 13 0 3 1 216 55 193 55;
#P connect 4 3 5 0;
#P fasten 4 1 5 0 168 119 222 119;
#P fasten 19 0 15 0 53 664 344 664;
#P connect 16 0 15 0;
#P fasten 29 0 33 0 333 530 333 496 366 496;
#P connect 33 0 23 0;
#P connect 28 0 26 0;
#P connect 26 0 32 0;
#P fasten 4 2 32 0 193 106;
#P connect 32 0 16 1;
#P connect 23 0 26 1;
#P connect 17 0 16 2;
#P connect 33 1 24 0;
#P connect 18 0 16 3;
#P connect 24 0 26 3;
#P connect 33 2 25 0;
#P connect 25 0 26 4;
#P connect 27 0 26 5;
#P pop;

#80421
Jul 11, 2006 at 11:14pm

This is better for the Jitter forum, but if you search the jitter
archives, you should see some discussion of using cpuclock or the
date object to use “walltime” to drive realtime animation under
varying framerates rather than line, or counter.

For example:

http://www.cycling74.com/forums/index.php?t=msg&goto=66285#msg_66312

-Joshua

#80422
Jul 11, 2006 at 11:45pm

good tip thanks,
recipe 31 of the jitter recipe book is quite useful for smooth animations

#80423
Jul 11, 2006 at 11:45pm

Hi Timo,
This was a great help, thanks. Your version is certainly better. I’m
wondering if I can get it even smoother. For some reason my frame rate
seems to be topped out at 60fps. Turning on the overdrive makes it
worse.
Thanks

Justin

#80424

You must be logged in to reply to this topic.