Forums > MaxMSP

greater than, less than control object

August 21, 2008 | 2:30 am

This is probably a pretty dumb question, but is there a max object that bangs one outlet if the input is less than a particular value and the other if it is more?


August 21, 2008 | 3:04 am

It’s not a dumb question since there are too many objects and features for one person to keep track of without going insane or perhaps losing track of the rest of their life, hehe, but the answer is no.

You would create this object yourself quite easily doing something like this:

– Pasted Max Patch, click to expand. –

August 21, 2008 | 3:11 am

and if you want exactly what you asked for (one outlet bangs if , nothing if ==), it’s easy as well:

– Pasted Max Patch, click to expand. –

August 21, 2008 | 10:24 am

And a Max4, floating point, 2 object version:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 251 68 58 196617 comparison;
#P comment 90 68 72 196617 number to test;
#P comment 388 154 25 196617 less;
#P comment 230 154 43 196617 greater;
#P button 371 153 15 0;
#P button 212 153 15 0;
#P button 51 153 15 0;
#P flonum 51 67 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 212 67 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 212 128 169 196617 if $f1>$f2 then bang else out2 bang;
#P newex 51 105 171 196617 if $f1==$f2 then bang else out2 $i1;
#P comment 68 153 30 196617 equal;
#P connect 2 1 7 0;
#P connect 2 0 6 0;
#P connect 1 0 5 0;
#P connect 4 0 1 0;
#P connect 3 0 1 1;
#P fasten 3 0 2 1 217 94 376 94;
#P connect 1 1 2 0;
#P window clipboard copycount 12;


August 22, 2008 | 2:12 am

Thanks, guys! That was pretty simple, but I fail to see a functional difference between the first two patches.

By the way, Zachary, I’m thinking of attending one or both of your classes next week at Harvestworks.


August 22, 2008 | 2:19 am

If you mean the difference between my patch and Zachary’s, I think Zachary was saying that you might not want anything to be output when the exact value is selected. Whereas mine would bang at "less-than OR equal" and then also out the other bang at "greater-than", Zachary’s would bang at "less than", "greater than" but not when it is "equal".


August 22, 2008 | 2:29 am

and just for the record, I think I like the third patch the best(separate bangs for everything), i’m gonna use it.
Thanks, fairesigneaumachiniste!


August 22, 2008 | 2:38 am

Ah, yes. I actually was going for the "or equals to," but thought I had to change the < to <= to do that. Turns out it's all in the subtlety of the sel object.


August 23, 2008 | 6:15 am

Zach,

Would love to see you at either!

best,
Zachary


August 23, 2008 | 6:18 am

I will be out of the office from August 7 until August 25 and will not
have access to my email account. If you need assisitance while I am away
please contact Ana Varas at 754-321-2050 or ana.varas@browardschools.com

Thank you


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