## Newbie with simple max pathcer need help !!!

May 2, 2007 at 8:32am

# Newbie with simple max pathcer need help !!!

Hi,

I need to create a patch. There will be 5 number coming at the same time. I need to compare those 5 numbers and make decision for 5 different results. For example, if over 3 of those 5 numbers are below 100 I need to run “spring mode”. If over 3 of those 5 numbers are between 100~200 then I need to run “summer mode”….etc. If those 5 numbers are all in different range (I set four different ranges which is below 100, 100~200, 200~300, above 300) then I just don’t do anything.

The first problem is I have two methods of counting those 5 numbers (as you can see in my patch logical part). One is just i++ method, the other one is using counter object. I don’t know which one is better. If I use i++ method, when I try to rest 0 to i every time I finish compare those 5 numbers it will cause “stack over flow” error.

The second problem is I don’t know how to reset i or counter to 0 every time I finish comparing those 5 numbers. Because those 5 numbers come in at the same time so when next 5 numbers come in again, my counter and i are supposed to set to 0 already.

I hope I can get some help on this one. I am very appreciate any advice. Again, I am newbie and this is supposed to be a very simple patch………just I don’t know what’s going on.

thank you so much

Here is my patch:

max v2;
#N vpatcher 115 216 1439 997;
#P origin 0 -19;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N counter 0 1 5;
#X flags 0 0;
#P newobj 721 322 71 196617 counter 0 1 5;
#P window linecount 3;
#P comment 758 264 161 196617 problem , I need to reset i to 0 everytime I finish compare those 5 numbers but I don’t know how;
#P comment 552 263 161 196617 problem , I need to reset i to 0 everytime I finish compare those 5 numbers but I don’t know how;
#P comment 1651 266 161 196617 problem , I need to reset i to 0 everytime I finish compare those 5 numbers but I don’t know how;
#P comment 995 266 161 196617 problem , I need to reset i to 0 everytime I finish compare those 5 numbers but I don’t know how;
#P window linecount 1;
#P comment 663 45 100 196617 test number set 3;
#P comment 500 47 100 196617 test number set 2;
#P button 663 76 15 0;
#P message 773 112 26 196617 340;
#P message 745 113 26 196617 220;
#P message 715 114 26 196617 130;
#P message 687 115 26 196617 220;
#P message 663 115 26 196617 210;
#P button 499 74 15 0;
#P message 609 110 26 196617 340;
#P message 581 111 26 196617 220;
#P message 551 112 26 196617 130;
#P message 523 113 26 196617 120;
#P message 499 113 26 196617 110;
#P user ubumenu 324 662 100 196617 0 1 1 0;
#X prefix_set 0 0 0;
#P button 324 71 15 0;
#P message 423 108 26 196617 240;
#P message 395 109 26 196617 120;
#P message 371 109 20 196617 30;
#P message 348 110 20 196617 20;
#P message 324 110 20 196617 10;
#P button 305 269 15 0;
#P button 381 306 15 0;
#P message 570 330 14 196617 0;
#P newex 513 356 27 196617 i;
#P newex 513 322 27 196617 +;
#P message 381 340 14 196617 0;
#P newex 324 366 27 196617 i;
#P newex 324 331 27 196617 +;
#P number 939 579 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 721 578 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 513 593 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 939 546 114 196617 if \$i1==1 then 4 else 0;
#P newex 721 544 114 196617 if \$i1==1 then 3 else 0;
#P newex 513 551 114 196617 if \$i1==1 then 2 else 0;
#P number 324 592 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 324 556 114 196617 if \$i1==1 then 1 else 0;
#P number 939 508 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 721 507 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 513 509 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 324 514 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 939 477 27 196617 > 3;
#P newex 721 475 27 196617 > 3;
#P newex 513 475 27 196617 > 3;
#P number 721 421 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 721 276 32 196617 sel 1;
#P number 939 420 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter 0 1 5;
#X flags 0 0;
#P newobj 939 323 71 196617 counter 0 1 5;
#P newex 939 275 32 196617 sel 1;
#P number 513 423 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 324 482 27 196617 > 3;
#P number 324 430 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 939 237 134 196617 if (\$f1>=300) then 1 else 0;
#P newex 721 236 203 196617 if (\$f1<300) && (\$f1>=200) then 1 else 0;
#P newex 513 236 203 196617 if (\$f1<200) && (\$f1>=100) then 1 else 0;
#P newex 324 237 128 196617 if (\$f1<100) then 1 else 0;
#P window linecount 5;
#P comment 100 654 178 196617 in this patch , if those 5 different numbers are all in different range then just don’t do anything. Or it will run 4 different modes (spring , summer , fall and winter modes);
#P window linecount 1;
#P comment 348 49 100 196617 test number set 1;
#P window linecount 3;
#P comment 828 50 100 196617 5 different number will comiing at the same time.;
#P window linecount 2;
#P comment 113 195 170 196617 logic part in those 5 numbers and count them depend on their amount;
#P window linecount 5;
#P comment 93 371 201 196617 I have two different kinds of counting mathods (i++ and counter) but don’t know which one is better , it seems the first counting mathods will cause stack over flow problem;
#P window linecount 3;
#P comment 339 266 161 196617 problem , I need to reset i to 0 everytime I finish compare those 5 numbers but I don’t know how;
#P connect 6 0 40 0;
#P connect 46 0 41 0;
#P fasten 58 0 6 0 778 173 329 173;
#P fasten 57 0 6 0 750 168 329 168;
#P fasten 56 0 6 0 720 169 329 175;
#P fasten 55 0 6 0 692 169 329 169;
#P fasten 54 0 6 0 668 170 329 170;
#P fasten 52 0 6 0 614 175 329 175;
#P fasten 51 0 6 0 586 170 329 170;
#P fasten 50 0 6 0 556 176 329 176;
#P fasten 49 0 6 0 528 173 329 173;
#P fasten 48 0 6 0 504 171 329 171;
#P fasten 45 0 6 0 428 171 329 171;
#P fasten 44 0 6 0 400 174 329 174;
#P fasten 43 0 6 0 376 175 329 175;
#P fasten 42 0 6 0 353 177 329 177;
#P connect 41 0 6 0;
#P connect 6 0 33 0;
#P connect 33 0 34 0;
#P fasten 35 0 34 0 386 360 329 360;
#P connect 34 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 21 0;
#P connect 21 0 25 0;
#P connect 25 0 26 0;
#P fasten 32 0 47 0 944 619 329 619;
#P fasten 31 0 47 0 726 626 329 626;
#P fasten 30 0 47 0 518 630 329 630;
#P connect 26 0 47 0;
#P fasten 34 0 33 1 329 391 364 391 364 320 346 320;
#P fasten 46 0 42 0 329 94 353 94;
#P fasten 46 0 43 0 329 94 376 94;
#P connect 39 0 35 0;
#P fasten 46 0 44 0 329 93 400 93;
#P fasten 46 0 45 0 329 92 428 92;
#P connect 53 0 48 0;
#P fasten 58 0 7 0 778 171 518 171;
#P fasten 57 0 7 0 750 175 518 175;
#P fasten 56 0 7 0 720 169 518 169;
#P fasten 55 0 7 0 692 166 518 172;
#P fasten 54 0 7 0 668 168 518 168;
#P fasten 52 0 7 0 614 172 518 172;
#P fasten 51 0 7 0 586 169 518 169;
#P fasten 50 0 7 0 556 172 518 172;
#P fasten 49 0 7 0 528 172 518 172;
#P fasten 48 0 7 0 504 171 518 171;
#P fasten 45 0 7 0 428 174 518 174;
#P fasten 44 0 7 0 400 174 518 174;
#P fasten 43 0 7 0 376 178 518 178;
#P fasten 42 0 7 0 353 176 518 176;
#P fasten 41 0 7 0 329 180 518 180;
#P connect 7 0 36 0;
#P fasten 38 0 37 0 575 350 518 350;
#P connect 36 0 37 0;
#P connect 37 0 12 0;
#P connect 12 0 18 0;
#P connect 18 0 22 0;
#P connect 22 0 27 0;
#P connect 27 0 30 0;
#P fasten 53 0 49 0 504 97 528 97;
#P fasten 37 0 36 1 518 381 553 381 553 310 535 310;
#P fasten 53 0 50 0 504 97 556 97;
#P fasten 53 0 51 0 504 96 586 96;
#P fasten 53 0 52 0 504 95 614 95;
#P connect 59 0 54 0;
#P fasten 59 0 55 0 668 99 692 99;
#P fasten 59 0 56 0 668 99 720 99;
#P fasten 58 0 8 0 778 169 726 169;
#P fasten 57 0 8 0 750 177 726 177;
#P fasten 56 0 8 0 720 172 726 172;
#P fasten 55 0 8 0 692 172 726 172;
#P fasten 54 0 8 0 668 173 726 173;
#P fasten 52 0 8 0 614 178 726 178;
#P fasten 51 0 8 0 586 173 726 173;
#P fasten 50 0 8 0 556 173 726 173;
#P fasten 49 0 8 0 528 173 726 173;
#P fasten 48 0 8 0 511 176 726 176;
#P fasten 45 0 8 0 428 169 726 169;
#P fasten 44 0 8 0 400 175 726 175;
#P fasten 43 0 8 0 376 176 726 176;
#P fasten 42 0 8 0 353 180 726 180;
#P fasten 41 0 8 0 329 180 726 180;
#P connect 8 0 16 0;
#P connect 16 0 66 0;
#P connect 66 0 17 0;
#P connect 17 0 19 0;
#P connect 19 0 23 0;
#P connect 23 0 28 0;
#P connect 28 0 31 0;
#P fasten 59 0 57 0 668 98 750 98;
#P fasten 59 0 58 0 668 97 778 97;
#P fasten 58 0 9 0 778 170 944 170;
#P fasten 57 0 9 0 750 170 944 170;
#P fasten 56 0 9 0 720 174 944 174;
#P fasten 55 0 9 0 694 132 694 170 944 170;
#P fasten 54 0 9 0 668 168 944 176;
#P fasten 52 0 9 0 614 172 944 172;
#P fasten 51 0 9 0 586 173 944 173;
#P fasten 50 0 9 0 556 172 944 172;
#P fasten 49 0 9 0 528 176 944 176;
#P fasten 48 0 9 0 504 170 944 170;
#P fasten 45 0 9 0 428 172 944 172;
#P fasten 44 0 9 0 400 172 944 172;
#P fasten 43 0 9 0 376 179 944 179;
#P fasten 42 0 9 0 353 176 944 176;
#P fasten 41 0 9 0 329 178 944 178;
#P connect 9 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 20 0;
#P connect 20 0 24 0;
#P connect 24 0 29 0;
#P connect 29 0 32 0;
#P pop;

#31708
May 2, 2007 at 9:09am

Hi.

These kind of things are a PITA in Max. You need lots of objects to do something that’s actually quite simple.
I made a patch with a js in it, hope that’s ok with you.
Note that the patch is quite specific (input needs to be between -100 and 499), but you can probably change things like number of seasons easily yourself.
Good luck!

here’s the patch:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 293 66 91 196617 110 120 130 450;
#P number 96 204 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 176 66 115 196617 220 20 280 30 240 20;
#P newex 79 94 27 196617 t b l;
#P newex 96 183 68 196617 js counter.js;
#P newex 96 116 25 196617 iter;
#P newex 96 159 94 196617 prepend inputValue;
#P newex 96 137 37 196617 / 100;
#P message 79 66 94 196617 10 20 30 120 240;
#P comment 136 205 100 196617 mode;
#P fasten 9 0 6 0 298 87 84 87;
#P connect 5 0 8 0;
#P fasten 7 0 6 0 181 87 84 87;
#P fasten 6 0 5 0 84 179 101 179;
#P connect 3 0 5 0;
#P connect 2 0 3 0;
#P connect 6 1 4 0;
#P connect 1 0 6 0;
#P connect 4 0 2 0;
#P window clipboard copycount 10;

and here’s the js, save as counter.js in the same directory:

autowatch = 1;
outlets = 1;
var store = [0,0,0,0,0];

function bang()
{
for (var i=4; i > -1; i–)
{
if (store[i] >= 3)
{
outlet(0,i+1);
break;
}
}
store = [0,0,0,0,0];
}
function inputValue(v)
{
store[v]++;
}

#103326
May 2, 2007 at 9:58am

At 2:32 AM -0600 5/2/07, UCDMSRA wrote:
>this is supposed to be a very simple patch.

Famous last words. You were trying for something like:

#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 147 528 292 196617 Note that this menu starts out at “Don’t do anything” for every data set , then gets changed to what the data set dictates.;
#P window linecount 1;
#P comment 513 73 100 196617 test number set 4;
#P button 497 72 15 0;
#P message 607 111 26 196617 340;
#P message 579 111 26 196617 220;
#P message 549 111 26 196617 100;
#P message 521 111 14 196617 2;
#P message 497 111 14 196617 1;
#P newex 253 389 89 196617 if \$i1 >= 3 then 4;
#P newex 183 413 89 196617 if \$i1 >= 3 then 3;
#P newex 113 433 89 196617 if \$i1 >= 3 then 2;
#P user ubumenu 43 528 100 196617 0 1 1 0;
#X prefix_set 0 0 0;
#P newex 43 457 89 196617 if \$i1 >= 3 then 1;
#P newex 43 237 25 196617 iter;
#P newex 43 215 52 196617 t l b;
#P newex 43 189 55 196617 zl group 5;
#P message 85 291 14 196617 0;
#P number 253 372 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 253 330 15 0;
#N counter;
#X flags 0 0;
#P newobj 253 349 66 196617 counter;
#P number 183 372 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 183 330 15 0;
#N counter;
#X flags 0 0;
#P newobj 183 349 66 196617 counter;
#P number 113 372 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 113 330 15 0;
#N counter;
#X flags 0 0;
#P newobj 113 349 66 196617 counter;
#P number 43 372 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 43 330 15 0;
#N counter;
#X flags 0 0;
#P newobj 43 349 66 196617 counter;
#P newex 183 307 80 196617 split 200 299;
#P newex 113 284 80 196617 split 100 199;
#P newex 43 261 80 196617 split 0 99;
#P number 43 167 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 363 73 100 196617 test number set 3;
#P comment 203 73 100 196617 test number set 2;
#P button 347 72 15 0;
#P message 457 111 26 196617 340;
#P message 429 111 26 196617 220;
#P message 399 111 26 196617 130;
#P message 371 111 26 196617 220;
#P message 347 111 26 196617 210;
#P button 187 72 15 0;
#P message 297 111 26 196617 340;
#P message 269 111 26 196617 220;
#P message 239 111 26 196617 130;
#P message 211 111 26 196617 120;
#P message 187 111 26 196617 110;
#P button 43 72 15 0;
#P message 142 111 26 196617 240;
#P message 114 111 26 196617 120;
#P message 90 111 20 196617 30;
#P message 67 111 20 196617 20;
#P message 43 111 20 196617 10;
#P comment 59 73 100 196617 test number set 1;
#P fasten 51 0 46 0 502 99 502 99;
#P fasten 51 0 47 0 502 99 526 99;
#P fasten 51 0 48 0 502 99 554 99;
#P fasten 51 0 49 0 502 99 584 99;
#P fasten 51 0 50 0 502 99 612 99;
#P fasten 18 0 13 0 352 99 352 99;
#P fasten 18 0 14 0 352 99 376 99;
#P fasten 18 0 15 0 352 99 404 99;
#P fasten 18 0 16 0 352 99 434 99;
#P fasten 18 0 17 0 352 99 462 99;
#P fasten 12 0 7 0 192 99 192 99;
#P fasten 12 0 8 0 192 99 216 99;
#P fasten 12 0 9 0 192 99 244 99;
#P fasten 12 0 10 0 192 99 274 99;
#P fasten 12 0 11 0 192 99 302 99;
#P connect 37 0 42 0;
#P lcolor 6;
#P connect 37 0 25 3;
#P lcolor 6;
#P connect 37 0 28 3;
#P lcolor 6;
#P connect 37 0 31 3;
#P lcolor 6;
#P connect 37 0 34 3;
#P lcolor 6;
#P fasten 50 0 21 0 612 146 48 146;
#P fasten 49 0 21 0 584 146 48 146;
#P fasten 48 0 21 0 554 146 48 146;
#P fasten 47 0 21 0 526 146 48 146;
#P fasten 46 0 21 0 502 146 48 146;
#P fasten 6 0 1 0 48 99 48 99;
#P fasten 6 0 2 0 48 99 72 99;
#P fasten 6 0 3 0 48 99 95 99;
#P fasten 6 0 4 0 48 99 119 99;
#P fasten 6 0 5 0 48 99 147 99;
#P fasten 17 0 21 0 462 146 48 146;
#P fasten 16 0 21 0 434 146 48 146;
#P fasten 15 0 21 0 404 146 48 146;
#P fasten 14 0 21 0 376 146 48 146;
#P fasten 13 0 21 0 352 146 48 146;
#P fasten 11 0 21 0 302 146 48 146;
#P fasten 10 0 21 0 274 146 48 146;
#P fasten 9 0 21 0 244 146 48 146;
#P fasten 8 0 21 0 216 146 48 146;
#P fasten 7 0 21 0 192 146 48 146;
#P fasten 5 0 21 0 147 146 48 146;
#P fasten 4 0 21 0 119 146 48 146;
#P fasten 3 0 21 0 95 146 48 146;
#P fasten 2 0 21 0 72 146 48 146;
#P fasten 1 0 21 0 48 146 48 146;
#P connect 21 0 38 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 22 0;
#P connect 22 0 26 0;
#P connect 26 0 25 0;
#P connect 25 0 27 0;
#P connect 27 0 41 0;
#P connect 39 1 37 0;
#P lcolor 6;
#P connect 22 1 23 0;
#P connect 23 0 29 0;
#P connect 29 0 28 0;
#P connect 28 0 30 0;
#P connect 30 0 43 0;
#P connect 45 0 42 0;
#P connect 44 0 42 0;
#P connect 43 0 42 0;
#P connect 41 0 42 0;
#P connect 23 1 24 0;
#P connect 24 0 32 0;
#P connect 32 0 31 0;
#P connect 31 0 33 0;
#P connect 33 0 44 0;
#P connect 24 1 35 0;
#P connect 35 0 34 0;
#P connect 34 0 36 0;
#P connect 36 0 45 0;
#P window clipboard copycount 54;

-C

Chris Muir | “There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,

#103327
May 2, 2007 at 10:13am

#103328
May 3, 2007 at 8:38am

Bas van der Graaff schrieb:
> These kind of things are a PITA in Max. You need lots of objects to
> do something that’s actually quite simple.

Is my version below a lots of objects? ;-)
For generalising the rule to “if more than half of the elements is in a
range” it needed only two objects more…

> I made a patch with a js in it, hope that’s ok with you.

To name a js “counter” is asking for trouble and a very bad idea for
advice to newbies, it might run them into seemingly unsolvable problems,
suddenly the counter object doesn’t work anymore…

Better rename it to something like “maxlist.counter.js”

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 160 30 62 196617 more than 5;
#P message 132 49 135 196617 220 202 280 30 240 20 10;
#P message 24 49 103 196617 101 20 30 120 240;
#N vpatcher 10 59 313 353;
#P window setfont “Sans Serif” 9.;
#P newex 176 173 31 196617 sel 1;
#P newex 130 173 31 196617 sel 1;
#P window linecount 0;
#P newex 84 173 31 196617 sel 1;
#P window linecount 1;
#P newex 50 53 41 196617 thresh;
#P newex 176 194 24 196617 t 3;
#P newex 176 152 24 196617 > 3;
#P newex 130 194 24 196617 t 2;
#P newex 130 152 24 196617 > 3;
#P newex 84 194 24 196617 t 1;
#P newex 190 123 36 196617 >> 1;
#P newex 190 101 36 196617 zl len;
#P newex 84 152 24 196617 > 3;
#P newex 142 101 44 196617 zl sub 2;
#P newex 96 101 44 196617 zl sub 1;
#P newex 50 101 44 196617 zl sub 0;
#P newex 50 74 84 196617 vexpr \$i1 / 100;
#P inlet 50 33 15 0;
#P outlet 84 222 15 0;
#P connect 1 0 14 0;
#P connect 14 0 2 0;
#P connect 2 0 3 0;
#P connect 3 1 6 0;
#P connect 6 0 15 0;
#P connect 15 0 9 0;
#P fasten 13 0 0 0 181 216 89 216;
#P fasten 11 0 0 0 135 216 89 216;
#P connect 9 0 0 0;
#P fasten 2 0 4 0 55 95 101 95;
#P fasten 8 0 6 1 195 147 103 147;
#P connect 4 1 10 0;
#P connect 10 0 16 0;
#P connect 16 0 11 0;
#P fasten 2 0 5 0 55 95 147 95;
#P fasten 8 0 10 1 195 147 149 147;
#P connect 5 1 12 0;
#P connect 12 0 17 0;
#P connect 17 0 13 0;
#P fasten 2 0 7 0 55 95 195 95;
#P connect 7 0 8 0;
#P connect 8 0 12 1;
#P pop;
#P newobj 75 173 168 196617 p more than half of it is in a range;
#P button 75 263 15 0;
#P button 353 100 15 0;
#P message 465 139 26 196617 340;
#P message 437 139 26 196617 220;
#P message 409 139 26 196617 130;
#P message 381 139 26 196617 220;
#P message 353 139 26 196617 210;
#P button 209 100 15 0;
#P message 321 139 26 196617 340;
#P message 293 139 26 196617 220;
#P message 265 139 26 196617 130;
#P message 237 139 26 196617 120;
#P message 209 139 26 196617 110;
#P user ubumenu 75 235 100 196617 0 1 1 0;
#X prefix_set 0 0 0;
#P button 75 101 15 0;
#P message 174 140 26 196617 240;
#P message 146 140 26 196617 120;
#P message 122 140 20 196617 30;
#P message 99 140 20 196617 20;
#P message 75 140 20 196617 10;
#P number 75 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 4;
#P comment 181 219 100 196617 it will never move to “do nothing” because
it does nothing…. (watch the bang);
#P window linecount 1;
#P comment 28 30 62 196617 does nothing;
#P connect 21 0 16 0;
#P fasten 21 0 17 0 358 123 386 123;
#P fasten 21 0 18 0 358 123 414 123;
#P fasten 21 0 19 0 358 123 442 123;
#P fasten 21 0 20 0 358 123 470 123;
#P connect 15 0 10 0;
#P fasten 15 0 11 0 214 123 242 123;
#P fasten 15 0 12 0 214 123 270 123;
#P fasten 15 0 13 0 214 123 298 123;
#P fasten 15 0 14 0 214 123 326 123;
#P connect 8 0 3 0;
#P fasten 8 0 4 0 80 128 104 128;
#P fasten 8 0 5 0 80 128 127 128;
#P fasten 8 0 6 0 80 128 151 128;
#P fasten 8 0 7 0 80 128 179 128;
#P connect 25 0 23 0;
#P connect 24 0 23 0;
#P fasten 20 0 23 0 470 164 80 164;
#P fasten 19 0 23 0 442 164 80 164;
#P fasten 18 0 23 0 414 164 80 164;
#P fasten 17 0 23 0 386 164 80 164;
#P fasten 16 0 23 0 358 164 80 164;
#P fasten 14 0 23 0 326 164 80 164;
#P fasten 13 0 23 0 298 164 80 164;
#P fasten 12 0 23 0 270 164 80 164;
#P fasten 11 0 23 0 242 164 80 164;
#P fasten 10 0 23 0 214 164 80 164;
#P fasten 7 0 23 0 179 164 80 164;
#P fasten 6 0 23 0 151 164 80 164;
#P fasten 5 0 23 0 127 164 80 164;
#P fasten 4 0 23 0 104 164 80 164;
#P connect 3 0 23 0;
#P connect 23 0 2 0;
#P connect 9 0 22 0;
#P connect 2 0 9 0;
#P window clipboard copycount 27;

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

#103329
May 3, 2007 at 10:05am

Good one Stefan,

Your patch is quite beautiful, if i may say so. But making patches like these takes me much more time than writing a js which does the same. The 16 objects aren’t ‘a lot’, but it’s unthinkable (for me) that one could create only those 16 straightaway. In js, those 9 lines require much less thought, and don’t even require testing. But maybe that’s just a difference in experience…

And of course you are correct, naming a js isn’t the bestest of ideas (I never use the counter object myself). But I just tried putting it in a patch with a counter object, there doesn’t be a problem amongst the two of them. When do these things conflict?

#103330
May 3, 2007 at 3:37pm

Thank you and thanks for everybody. I have a good lesson of Max !!! Your patches are all work and so awesome. I don’t know how to say but I know I still need more and more time (don’t know how much more) to become your level.

js is also very nice but it makes me feel so sad because I don’t know how to write java (maybe I should say I don’t know anything about programming). I only have “a little bit” visual basic programming experiences and it really doesn’t mean anything. God I think I need to start from the scratch if I want to play Max/MSP good.

I never think I need to learn programming as an artist……… 3 years ago I really HATE programming but I know it is time to face it. can anybody give me some advice if I need to learn programming stuff lie java, c++ or something? maybe flash motion script?

thanks

#103331
May 3, 2007 at 4:16pm

#103332
May 3, 2007 at 5:24pm

Bas van der Graaff schrieb:
> Your patch is quite beautiful, if i may say so. But making patches
> like these takes me much more time than writing a js which does the
> same. The 16 objects aren’t ‘a lot’, but it’s unthinkable (for me)
> that one could create only those 16 straightaway. In js, those 9
> lines require much less thought, and don’t even require testing. But
> maybe that’s just a difference in experience…

For me js would take more time, and thats definitely a difference in
experience… (and finding a patch solution is more fun for me, its a
bit like sports, dive into a thread which is running for days and still
find a more elegant solution… ;-)

> And of course you are correct, naming a js isn’t the bestest of ideas
> (I never use the counter object myself). But I just tried putting it
> in a patch with a counter object, there doesn’t be a problem amongst
> the two of them. When do these things conflict?

Max seems to try to be intelligent and assumes extensions, if they are
not typed in. But this depends on what is found first. If the wrong one
is found first it will conflict, if the correct one is found first, you
won’t notice…

I mad an update to my previous solution by the way, it will be able to
deal with more than 3 zones (unlimited) and does only need 1 object more…
This is recursive and a bit less easy to understand, than the previous
one, but thats the nature of recursion, it might help to get into
patching recursion…

Its prepared to be turned into a real abhaXion…

Stefan

#P window setfont “Sans Serif” 9.;
#P number 247 180 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 75 223 27 196617 + 1;
#P number 149 76 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 271 49 69 196617 520 502 280;
#P comment 160 30 62 196617 more than 5;
#P message 132 49 135 196617 220 202 280 30 240 20 10;
#P message 24 49 103 196617 101 20 30 120 240;
#N vpatcher 10 59 355 471;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 143 44 111 196617 loadmess scalarmode 1;
#P newex 141 66 72 196617 loadmess 100;
#P inlet 124 23 15 0;
#P window linecount 0;
#P newex 161 184 26 196617 < 1;
#P newex 45 229 66 196617 gate;
#P newex 101 203 25 196617 b;
#P newex 45 278 180 196617 zl reg;
#N counter;
#X flags 0 0;
#P newobj 116 231 54 196617 counter;
#P newex 161 138 26 196617 t b i;
#P newex 161 162 42 196617 accum;
#P newex 84 256 42 196617 int;
#P newex 50 87 175 196617 t l 0 l 0 0 l;
#P newex 84 182 42 196617 sel 1 0;
#P window linecount 1;
#P newex 50 44 41 196617 thresh;
#P newex 116 138 36 196617 >> 1;
#P newex 116 112 36 196617 zl len;
#P newex 84 160 42 196617 > 3;
#P newex 50 112 44 196617 zl sub 0;
#P newex 50 66 84 196617 vexpr \$i1 / \$i2;
#P inlet 50 23 15 0;
#P outlet 84 301 15 0;
#P newex 143 23 94 196617 patcherargs 100;
#P fasten 18 0 17 0 166 225 50 225;
#P connect 17 0 15 0;
#P connect 2 0 8 0;
#P connect 8 0 3 0;
#P fasten 21 0 3 0 148 63 55 63;
#P connect 3 0 10 0;
#P connect 10 0 4 0;
#P fasten 15 0 4 0 50 299 40 299 40 108 55 108;
#P fasten 14 0 4 1 121 251 74 251 74 108 89 108;
#P connect 10 1 4 1;
#P connect 4 1 5 0;
#P connect 5 0 9 0;
#P connect 9 0 11 0;
#P connect 11 0 1 0;
#P connect 9 1 16 0;
#P connect 16 0 17 1;
#P connect 10 2 6 0;
#P connect 6 0 7 0;
#P connect 7 0 5 1;
#P connect 16 1 14 0;
#P connect 14 0 11 1;
#P connect 19 0 3 1;
#P connect 20 0 3 1;
#P connect 10 3 14 3;
#P fasten 4 1 13 0 89 134 166 134;
#P connect 13 0 12 0;
#P fasten 10 4 12 0 187 158 166 158;
#P connect 12 0 18 0;
#P connect 13 1 12 1;
#P connect 6 0 18 1;
#P connect 10 5 15 1;
#P pop;
#P newobj 75 179 168 196617 p more than half of it is in a range;
#P button 58 203 15 0;
#P button 353 100 15 0;
#P message 465 139 26 196617 340;
#P message 437 139 26 196617 220;
#P message 409 139 26 196617 130;
#P message 381 139 26 196617 220;
#P message 353 139 26 196617 210;
#P button 209 100 15 0;
#P message 321 139 26 196617 340;
#P message 293 139 26 196617 220;
#P message 265 139 26 196617 130;
#P message 237 139 26 196617 120;
#P message 209 139 26 196617 110;
#P user ubumenu 75 252 100 196617 0 1 1 0;
#X prefix_set 0 0 0;
#P button 75 101 15 0;
#P message 174 140 26 196617 240;
#P message 146 140 26 196617 120;
#P message 122 140 20 196617 30;
#P message 99 140 20 196617 20;
#P message 75 140 20 196617 10;
#P number 75 203 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 28 30 62 196617 does nothing;
#P comment 286 181 117 196617 range size (default 100);
#P comment 272 31 72 196617 higher ranges;
#P fasten 22 0 21 0 358 123 470 123;
#P fasten 22 0 20 0 358 123 442 123;
#P fasten 22 0 19 0 358 123 414 123;
#P fasten 22 0 18 0 358 123 386 123;
#P connect 22 0 17 0;
#P connect 16 0 11 0;
#P fasten 16 0 12 0 214 123 242 123;
#P fasten 16 0 13 0 214 123 270 123;
#P fasten 16 0 14 0 214 123 298 123;
#P fasten 16 0 15 0 214 123 326 123;
#P connect 31 0 24 1;
#P connect 9 0 4 0;
#P fasten 9 0 5 0 80 128 104 128;
#P fasten 9 0 6 0 80 128 127 128;
#P fasten 9 0 7 0 80 128 151 128;
#P fasten 9 0 8 0 80 128 179 128;
#P connect 30 0 10 0;
#P connect 3 0 30 0;
#P connect 24 0 23 0;
#P connect 24 0 3 0;
#P connect 4 0 24 0;
#P fasten 5 0 24 0 104 164 80 164;
#P fasten 6 0 24 0 127 164 80 164;
#P fasten 7 0 24 0 151 164 80 164;
#P fasten 8 0 24 0 179 164 80 164;
#P fasten 11 0 24 0 214 164 80 164;
#P fasten 12 0 24 0 242 164 80 164;
#P fasten 13 0 24 0 270 164 80 164;
#P fasten 14 0 24 0 298 164 80 164;
#P fasten 15 0 24 0 326 164 80 164;
#P fasten 17 0 24 0 358 164 80 164;
#P fasten 18 0 24 0 386 164 80 164;
#P fasten 19 0 24 0 414 164 80 164;
#P fasten 20 0 24 0 442 164 80 164;
#P fasten 21 0 24 0 470 164 80 164;
#P connect 25 0 24 0;
#P connect 26 0 24 0;
#P connect 28 0 24 0;
#P connect 29 0 24 0;
#P window clipboard copycount 32;

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

#103333
May 3, 2007 at 5:27pm

UCDMSRA schrieb:
> I never think I need to learn programming as an artist……… 3
> years ago I really HATE programming but I know it is time to face it.
> can anybody give me some advice if I need to learn programming stuff
> lie java, c++ or something? maybe flash motion script?

With Max you don’t need to get into line level programming, though I
would call Max a programming language. I started with Modula II long ago
and never did too much of other text based languages, though I can do
it. I prefer patching mostly…

Stefan

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

#103334

You must be logged in to reply to this topic.