Forums > MaxMSP

Does this patch make any sense? If so – what does it do?

December 8, 2007 | 8:32 pm

Thanks alot!

max v2;
#N vpatcher 15 55 929 648;
#P origin 8 -20;
#N comlet route: Outputs if Input Matches 0;
#P outlet 317 169 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 304 169 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 291 169 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 278 169 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 265 169 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 252 169 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 239 169 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 226 169 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 213 169 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 200 169 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 187 169 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 174 169 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 161 169 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 148 169 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 135 169 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 122 169 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 57 57 49 9109513 pak 0. 0.;
#P newex 57 117 50 9109513 pack 0 0.;
#P newex 57 87 89 9109513 / 2.;
#P newex 57 143 287 9109513 route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
#N comlet pak: float to be Element 2 in the list;
#P inlet 96 37 15 0;
#N comlet pak: float to be Element 1 in the list;
#P inlet 57 37 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 109 169 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 96 169 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 83 169 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 70 169 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 57 169 15 0;
#P connect 5 0 10 0;
#P connect 10 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 7 0;
#P connect 7 0 0 0;
#P connect 7 1 1 0;
#P connect 7 2 2 0;
#P connect 6 0 10 1;
#P connect 7 3 3 0;
#P connect 10 0 9 1;
#P connect 7 4 4 0;
#P connect 7 5 11 0;
#P connect 7 6 12 0;
#P connect 7 7 13 0;
#P connect 7 8 14 0;
#P connect 7 9 15 0;
#P connect 7 10 16 0;
#P connect 7 11 17 0;
#P connect 7 12 18 0;
#P connect 7 13 19 0;
#P connect 7 14 20 0;
#P connect 7 15 21 0;
#P connect 7 16 22 0;
#P connect 7 17 23 0;
#P connect 7 18 24 0;
#P connect 7 19 25 0;
#P connect 7 20 26 0;
#P pop;


December 10, 2007 | 10:11 am

wow! didnt know that one can do this…
if you say the first [pak] creates a list "x y" then the second [pak]
gives "(x/y) x"
the "2." in the [/ 2.] has no toher function than putting the object to
calculate with float precision
i guess you know what the route does ;)

p

check this out:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 379 530 108 196617 0 149.;
#P newex 377 506 14 196617 _;
#P flonum 478 200 74 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 447 179 27 196617 / 1.;
#P button 529 44 15 0;
#P message 549 339 108 196617 149. 503.;
#P newex 547 315 14 196617 _;
#P message 510 421 108 196617 0.296223;
#P newex 508 397 14 196617 _;
#N comlet route: Outputs if Input Matches 0;
#P outlet 716 482 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 703 482 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 690 482 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 677 482 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 664 482 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 651 482 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 638 482 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 625 482 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 612 482 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 599 482 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 586 482 15 0;
#N comlet route: Outputs if Input Matches 4;
#P outlet 573 482 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 560 482 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 547 482 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 534 482 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 521 482 15 0;
#P newex 456 272 49 196617 pak 0. 0.;
#P newex 456 430 50 196617 pack 0 0.;
#P newex 456 351 27 196617 / 1.;
#P newex 456 456 287 196617 route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20;
#N comlet route: Outputs if Input Matches 4;
#P outlet 508 482 15 0;
#N comlet route: Outputs if Input Matches 3;
#P outlet 495 482 15 0;
#N comlet route: Outputs if Input Matches 2;
#P outlet 482 482 15 0;
#N comlet route: Outputs if Input Matches 1;
#P outlet 469 482 15 0;
#N comlet route: Outputs if Input Matches 0;
#P outlet 456 482 15 0;
#P newex 524 90 70 196617 random 1000;
#P newex 424 112 27 196617 + 1;
#P newex 425 90 70 196617 random 1000;
#P number 424 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 12 0 10 0;
#P connect 12 0 11 1;
#P connect 12 0 31 0;
#P connect 10 0 11 0;
#P connect 10 0 29 0;
#P connect 11 0 36 0;
#P connect 11 0 9 0;
#P connect 36 0 37 0;
#P connect 33 0 1 0;
#P connect 33 0 3 0;
#P connect 1 0 2 0;
#P connect 3 0 34 1;
#P connect 3 0 12 1;
#P connect 0 0 34 0;
#P connect 0 0 12 0;
#P connect 34 0 35 0;
#P connect 31 0 32 0;
#P connect 29 0 30 0;
#P connect 9 0 4 0;
#P connect 9 1 5 0;
#P connect 9 2 6 0;
#P connect 9 3 7 0;
#P connect 9 4 8 0;
#P connect 9 5 13 0;
#P connect 9 6 14 0;
#P connect 9 7 15 0;
#P connect 9 8 16 0;
#P connect 9 9 17 0;
#P connect 9 10 18 0;
#P connect 9 11 19 0;
#P connect 9 12 20 0;
#P connect 9 13 21 0;
#P connect 9 14 22 0;
#P connect 9 15 23 0;
#P connect 9 16 24 0;
#P connect 9 17 25 0;
#P connect 9 18 26 0;
#P connect 9 19 27 0;
#P connect 9 20 28 0;
#P connect 2 0 0 0;
#P window clipboard copycount 38;

petterdass wrote:
> Thanks alot!
>
>
>
> max v2;
> #N vpatcher 15 55 929 648;
> #P origin 8 -20;
> #N comlet route: Outputs if Input Matches 0;
> #P outlet 317 169 15 0;
> #N comlet route: Outputs if Input Matches 4;
> #P outlet 304 169 15 0;
> #N comlet route: Outputs if Input Matches 3;
> #P outlet 291 169 15 0;
> #N comlet route: Outputs if Input Matches 2;
> #P outlet 278 169 15 0;
> #N comlet route: Outputs if Input Matches 1;
> #P outlet 265 169 15 0;
> #N comlet route: Outputs if Input Matches 0;
> #P outlet 252 169 15 0;
> #N comlet route: Outputs if Input Matches 4;
> #P outlet 239 169 15 0;
> #N comlet route: Outputs if Input Matches 3;
> #P outlet 226 169 15 0;
> #N comlet route: Outputs if Input Matches 2;
> #P outlet 213 169 15 0;
> #N comlet route: Outputs if Input Matches 1;
> #P outlet 200 169 15 0;
> #N comlet route: Outputs if Input Matches 0;
> #P outlet 187 169 15 0;
> #N comlet route: Outputs if Input Matches 4;
> #P outlet 174 169 15 0;
> #N comlet route: Outputs if Input Matches 3;
> #P outlet 161 169 15 0;
> #N comlet route: Outputs if Input Matches 2;
> #P outlet 148 169 15 0;
> #N comlet route: Outputs if Input Matches 1;
> #P outlet 135 169 15 0;
> #N comlet route: Outputs if Input Matches 0;
> #P outlet 122 169 15 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 57 57 49 9109513 pak 0. 0.;
> #P newex 57 117 50 9109513 pack 0 0.;
> #P newex 57 87 89 9109513 / 2.;
> #P newex 57 143 287 9109513 route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
> #N comlet pak: float to be Element 2 in the list;
> #P inlet 96 37 15 0;
> #N comlet pak: float to be Element 1 in the list;
> #P inlet 57 37 15 0;
> #N comlet route: Outputs if Input Matches 4;
> #P outlet 109 169 15 0;
> #N comlet route: Outputs if Input Matches 3;
> #P outlet 96 169 15 0;
> #N comlet route: Outputs if Input Matches 2;
> #P outlet 83 169 15 0;
> #N comlet route: Outputs if Input Matches 1;
> #P outlet 70 169 15 0;
> #N comlet route: Outputs if Input Matches 0;
> #P outlet 57 169 15 0;
> #P connect 5 0 10 0;
> #P connect 10 0 8 0;
> #P connect 8 0 9 0;
> #P connect 9 0 7 0;
> #P connect 7 0 0 0;
> #P connect 7 1 1 0;
> #P connect 7 2 2 0;
> #P connect 6 0 10 1;
> #P connect 7 3 3 0;
> #P connect 10 0 9 1;
> #P connect 7 4 4 0;
> #P connect 7 5 11 0;
> #P connect 7 6 12 0;
> #P connect 7 7 13 0;
> #P connect 7 8 14 0;
> #P connect 7 9 15 0;
> #P connect 7 10 16 0;
> #P connect 7 11 17 0;
> #P connect 7 12 18 0;
> #P connect 7 13 19 0;
> #P connect 7 14 20 0;
> #P connect 7 15 21 0;
> #P connect 7 16 22 0;
> #P connect 7 17 23 0;
> #P connect 7 18 24 0;
> #P connect 7 19 25 0;
> #P connect 7 20 26 0;
> #P pop;
>
>
>
>


http://pure.test.at

http://www.heartchamberorchestra.org


December 10, 2007 | 10:42 am

It’s not obvious to me at all that inputting a list into the left input ‘sprays’ the list, even for very basic objects. I only found out a couple months ago that this can even be used for things like ‘gate’. But things like these get messy real fast, they make your patch hard to read. And why would you need float input for a route in that example?

Came across something strange here, can anyone explain?

#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 305 71 113 196617 right inlet of ‘gate’ is not picky about input type , right? Why doesn’t this work?;
#P comment 177 71 93 196617 this works the same , input gets ‘sprayed’ in right-to-left order;
#P window linecount 1;
#P message 49 144 31 196617 1 34;
#P newex 49 204 41 196617 print 0;
#P newex 49 175 27 196617 +;
#P message 175 144 31 196617 1 34;
#P newex 175 204 41 196617 print 1;
#P message 211 144 31 196617 0 35;
#P newex 175 175 29 196617 gate;
#P message 306 144 47 196617 1 input2;
#P newex 306 204 41 196617 print 2;
#P message 355 144 47 196617 0 input1;
#P newex 306 175 29 196617 gate;
#P window linecount 2;
#P comment 49 71 82 196617 this works as in the original post;
#P connect 11 0 9 0;
#P connect 9 0 10 0;
#P connect 6 0 5 0;
#P connect 8 0 5 0;
#P connect 5 0 7 0;
#P connect 4 0 1 0;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P window clipboard copycount 14;



jln
December 10, 2007 | 11:47 am


December 10, 2007 | 12:00 pm

Bas van der Graaff wrote:
> Came across something strange here, can anyone explain?
>
>
> #P comment 305 71 113 196617 right inlet of ‘gate’ is not picky about input type , right? Why doesn’t this work?;
>

from the help file:

Left inlet: int;
Right inlet: anything;

though it works with floats as well. so it seems to work with everythign
except symbols

p


http://pure.test.at

http://www.heartchamberorchestra.org


December 10, 2007 | 3:09 pm

Jln, what you describe is expected behaviour as far as i can see, isn’t it? The list input is processed from right to left, that’s why it lags output. Of course this isn’t a feature, but it could be used theoretically if you want to allow for one more input after current…

example:

-> input 1 34
input 34 is blocked
then gate opens
-> input 1 34
input 34 is sent through
gate stays open
-> input 0 35
input 35 is sent through
gate closes
-> input 0 35
input 35 is blocked
gate stays closed

And as pure says, only symbols don’t seem to work correctly. Not that i would ever use anything like this in a patch, but i’m just wondering what could cause this. I’d expect a gate to not even look at the type of input, but apparently it does…?



jln
December 10, 2007 | 5:33 pm


December 11, 2007 | 6:04 am

Quote: Bas van der Graaff wrote on Mon, 10 December 2007 02:42
—————————————————-
> Came across something strange here, can anyone explain?
> …
> right inlet of ‘gate’ is not picky about input type , right? Why doesn’t this work?;

This is just a guess, but maybe objects that automatically "spray" a list from the left inlet only do so for list elements that are of a type compatible with the left inlet? A gate’s left inlet doesn’t support symbol, so it just gets ignored. I don’t think I would count on any of these behaviors in a "real" patch.

This is also pretty interesting and not what I expected:

#P button 146 217 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 337 66 45 196617 2 two 3;
#P message 268 63 52 196617 2 2 three;
#P message 190 62 52 196617 1 2 three;
#P newex 176 216 32 196617 print;
#P message 77 62 34 196617 2 2 3;
#P newex 178 176 40 196617 switch;
#P message 125 63 45 196617 1 two 3;
#P message 23 62 34 196617 1 2 3;
#P connect 2 0 8 0;
#P connect 2 0 4 0;
#P connect 6 0 2 0;
#P connect 7 0 2 0;
#P connect 5 0 2 0;
#P connect 1 0 2 0;
#P connect 0 0 2 0;
#P connect 3 0 2 0;
#P window clipboard copycount 9;

Adam


December 13, 2007 | 12:33 am

It is not objects that "automatically spray".

If an object does not have an explicit list message and it is sent a list, then the Max engine splits the list over the available inlets rather than posting • error: foo: doesn’t understand "list"" to the Max window.

I think this only works for lists arriving at the left inlet. I’m pretty sure I had to write explicit list handlers to get lp.sigma & Co. to distribute lists arriving at arbitrary inlets.

Again, the key point is the behavior you’ve noticed only kicks in _when_the_object_does_not_have_an_explicit_list_method_.

You can see which methods are explicitly defined for an object by a ctrl-opt-Mouse Down on the object box.

This is actually documented in one of the early Tutorials, but the significance of the behavior is unlikely to be apparent to anyone in the early stages of learning Max.

I’m not sure why your second gate example is not working as expected.


December 13, 2007 | 7:03 am

Quote: Peter Castine wrote on Wed, 12 December 2007 16:33
—————————————————-
> It is not objects that "automatically spray".

Whoops, bad terminology. I meant to say "auto unpack"

> If an object does not have an explicit list message and it is sent a list, then the Max engine splits the list over the available inlets

Sort of, but that explanation makes me think the message boxes in this patch should all behave the same way:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 278 60 60 196617 2 left right;
#P message 110 57 60 196617 2 left right;
#P newex 205 108 65 196617 unpack 0 s s;
#P message 192 59 60 196617 1 left right;
#P button 180 200 15 0;
#P newex 210 199 32 196617 print;
#P newex 212 159 40 196617 switch;
#P message 28 56 60 196617 1 left right;
#P connect 1 0 3 0;
#P connect 1 0 2 0;
#P connect 7 0 5 0;
#P connect 6 0 1 0;
#P connect 5 2 1 2;
#P connect 5 1 1 1;
#P connect 4 0 5 0;
#P connect 5 0 1 0;
#P connect 0 0 1 0;
#P window clipboard copycount 8;

Maybe there is a bug here, but this seems like a bad practice anyway. I’d always use an explicit unpack in these situations.

-Adam


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