Forums > MaxMSP

or gate

May 13, 2008 | 4:06 pm

is there a logical or gate with more than 2 inputs?


May 13, 2008 | 4:27 pm

[switch] ?
To find ideas: gate -> help file -> See also menu
J-F.

>
> is there a logical or gate with more than 2 inputs?
> –


May 13, 2008 | 5:16 pm

This is an abstraction called Vote8, which has eight inputs, and is true if > thresh inputs are high. It defaults to a thresh of 5, but has an input to set that. If you set the thresh to 2, it is like an eight-input OR gate. You could use multiples of these for a larger number of inputs.

max v2;
#N vpatcher 29 112 513 727;
#P origin 0 2;
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 244 460 211 196617 To make a vote with more than eight inputs , chain multiple Vote8 objects with the Cascade I/O , and set the thresh on the final Vote8 in the chain.;
#B frgb 21 110 62;
#P window linecount 1;
#P comment 413 569 41 196617 Cascade;
#P comment 414 35 41 196617 Cascade;
#P comment 300 35 41 196617 Thresh;
#N comlet Cascade Out;
#P outlet 397 567 15 0;
#N comlet Cascade In;
#P inlet 397 35 15 0;
#P window setfont Verdana 9.;
#P newex 44 452 27 472055817 t b i;
#P newex 33 474 27 472055817 +;
#P window setfont "Sans Serif" 9.;
#P number 33 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden comment -1 587 60 196617 bottom left;
#P window setfont Verdana 9.;
#P newex 248 103 27 472055817 t b i;
#P newex 237 125 27 472055817 +;
#P newex 214 152 27 472055817 t b i;
#P newex 203 174 27 472055817 +;
#P newex 180 201 27 472055817 t b i;
#P newex 169 223 27 472055817 +;
#P newex 146 250 27 472055817 t b i;
#P newex 135 272 27 472055817 +;
#P newex 112 299 27 472055817 t b i;
#P newex 101 321 27 472055817 +;
#P newex 78 348 27 472055817 t b i;
#P newex 67 370 27 472055817 +;
#P newex 44 397 27 472055817 t b i;
#N comlet Result;
#P outlet 33 567 15 0;
#N comlet Majority Thresh;
#P inlet 341 35 15 0;
#P newex 33 419 27 472055817 +;
#P newex 33 545 34 472055817 >= 5;
#P newex 271 67 27 472055817 > 0;
#N comlet Vote In 8;
#P inlet 271 35 15 0;
#P newex 237 67 27 472055817 > 0;
#N comlet Vote In 7;
#P inlet 237 35 15 0;
#P newex 203 67 27 472055817 > 0;
#N comlet Vote In 6;
#P inlet 203 35 15 0;
#P newex 169 67 27 472055817 > 0;
#N comlet Vote In 5;
#P inlet 169 35 15 0;
#P newex 135 67 27 472055817 > 0;
#N comlet Vote In 4;
#P inlet 135 35 15 0;
#P newex 101 67 27 472055817 > 0;
#N comlet Vote In 3;
#P inlet 101 35 15 0;
#P newex 67 67 27 472055817 > 0;
#N comlet Vote In 2;
#P inlet 67 35 15 0;
#P newex 33 67 27 472055817 > 0;
#N comlet Vote In 1;
#P inlet 33 35 15 0;
#P window setfont Verdana 18.;
#P comment 0 3 62 472055826 Vote8;
#P window setfont "Sans Serif" 9.;
#P hidden comment 64 4 72 196617 by Chris Muir;
#P comment 65 12 127 196617 Eight input majority logic.;
#P comment 70 546 134 196617 Default to majority of eight;
#P connect 4 0 5 0;
#P connect 5 0 21 0;
#P connect 24 0 21 0;
#P connect 40 0 39 0;
#P connect 21 0 39 0;
#P connect 39 0 38 0;
#P connect 38 0 20 0;
#P connect 20 0 23 0;
#P connect 25 0 24 0;
#P fasten 41 0 40 0 402 446 49 446;
#P lcolor 7;
#P connect 24 1 21 1;
#P connect 40 1 39 1;
#P fasten 22 0 20 1 143 375 97 531 62 531;
#P connect 6 0 7 0;
#P connect 7 0 25 0;
#P connect 26 0 25 0;
#P connect 27 0 26 0;
#P connect 26 1 25 1;
#P connect 8 0 9 0;
#P connect 9 0 27 0;
#P connect 28 0 27 0;
#P connect 29 0 28 0;
#P connect 28 1 27 1;
#P connect 10 0 11 0;
#P connect 11 0 29 0;
#P connect 30 0 29 0;
#P connect 31 0 30 0;
#P connect 30 1 29 1;
#P connect 12 0 13 0;
#P connect 13 0 31 0;
#P connect 32 0 31 0;
#P connect 33 0 32 0;
#P connect 32 1 31 1;
#P connect 14 0 15 0;
#P connect 15 0 33 0;
#P connect 34 0 33 0;
#P connect 35 0 34 0;
#P connect 34 1 33 1;
#P connect 16 0 17 0;
#P connect 17 0 35 0;
#P connect 36 0 35 0;
#P fasten 19 0 36 0 276 94 253 94;
#P connect 36 1 35 1;
#P connect 18 0 19 0;
#P fasten 38 0 42 0 38 519 402 519;
#P lcolor 7;
#P pop;


May 14, 2008 | 2:45 pm

thanx

btw chris
you might want to update the result when majoritythresh changes

#P window setfont Verdana 9.;
#P window linecount 1;
#P newex 401 109 27 472055817 t b i;
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 304 520 211 196617 To make a vote with more than eight inputs , chain multiple Vote8 objects with the Cascade I/O , and set the thresh on the final Vote8 in the chain.;
#B frgb 21 110 62;
#P window linecount 1;
#P comment 473 629 41 196617 Cascade;
#P comment 474 87 41 196617 Cascade;
#P comment 360 87 41 196617 Thresh;
#N comlet Cascade Out;
#P outlet 457 627 15 0;
#N comlet Cascade In;
#P inlet 457 87 15 0;
#P window setfont Verdana 9.;
#P newex 104 512 27 472055817 t b i;
#P newex 93 534 27 472055817 +;
#P window setfont "Sans Serif" 9.;
#P number 93 555 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden comment 59 647 60 196617 bottom left;
#P window setfont Verdana 9.;
#P newex 308 163 27 472055817 t b i;
#P newex 297 185 27 472055817 +;
#P newex 274 212 27 472055817 t b i;
#P newex 263 234 27 472055817 +;
#P newex 240 261 27 472055817 t b i;
#P newex 229 283 27 472055817 +;
#P newex 206 310 27 472055817 t b i;
#P newex 195 332 27 472055817 +;
#P newex 172 359 27 472055817 t b i;
#P newex 161 381 27 472055817 +;
#P newex 138 408 27 472055817 t b i;
#P newex 127 430 27 472055817 +;
#P newex 104 457 27 472055817 t b i;
#N comlet Result;
#P outlet 93 627 15 0;
#N comlet Majority Thresh;
#P inlet 401 87 15 0;
#P newex 93 479 27 472055817 +;
#P newex 93 605 34 472055817 >= 5;
#P newex 331 127 27 472055817 > 0;
#N comlet Vote In 8;
#P inlet 331 87 15 0;
#P newex 297 127 27 472055817 > 0;
#N comlet Vote In 7;
#P inlet 297 87 15 0;
#P newex 263 127 27 472055817 > 0;
#N comlet Vote In 6;
#P inlet 263 87 15 0;
#P newex 229 127 27 472055817 > 0;
#N comlet Vote In 5;
#P inlet 229 87 15 0;
#P newex 195 127 27 472055817 > 0;
#N comlet Vote In 4;
#P inlet 195 87 15 0;
#P newex 161 127 27 472055817 > 0;
#N comlet Vote In 3;
#P inlet 161 87 15 0;
#P newex 127 127 27 472055817 > 0;
#N comlet Vote In 2;
#P inlet 127 87 15 0;
#P newex 93 127 27 472055817 > 0;
#N comlet Vote In 1;
#P inlet 93 87 15 0;
#P window setfont Verdana 18.;
#P comment 60 63 62 472055826 Vote8;
#P window setfont "Sans Serif" 9.;
#P hidden comment 124 64 72 196617 by Chris Muir;
#P comment 125 72 127 196617 Eight input majority logic.;
#P comment 130 606 134 196617 Default to majority of eight;
#P connect 47 0 5 0;
#P connect 47 0 7 0;
#P connect 47 0 9 0;
#P connect 47 0 11 0;
#P connect 47 0 13 0;
#P connect 47 0 15 0;
#P connect 47 0 17 0;
#P connect 47 0 19 0;
#P connect 47 1 20 1;
#P connect 22 0 47 0;
#P connect 38 0 20 0;
#P fasten 38 0 42 0 98 579 462 579;
#P lcolor 7;
#P connect 18 0 19 0;
#P connect 36 1 35 1;
#P fasten 19 0 36 0 336 154 313 154;
#P connect 17 0 35 0;
#P connect 36 0 35 0;
#P connect 16 0 17 0;
#P connect 34 1 33 1;
#P connect 35 0 34 0;
#P connect 15 0 33 0;
#P connect 34 0 33 0;
#P connect 14 0 15 0;
#P connect 32 1 31 1;
#P connect 33 0 32 0;
#P connect 13 0 31 0;
#P connect 32 0 31 0;
#P connect 12 0 13 0;
#P connect 30 1 29 1;
#P connect 31 0 30 0;
#P connect 11 0 29 0;
#P connect 30 0 29 0;
#P connect 10 0 11 0;
#P connect 28 1 27 1;
#P connect 29 0 28 0;
#P connect 9 0 27 0;
#P connect 28 0 27 0;
#P connect 8 0 9 0;
#P connect 26 1 25 1;
#P connect 27 0 26 0;
#P connect 7 0 25 0;
#P connect 26 0 25 0;
#P connect 6 0 7 0;
#P connect 40 1 39 1;
#P connect 24 1 21 1;
#P fasten 41 0 40 0 462 506 109 506;
#P lcolor 7;
#P connect 25 0 24 0;
#P connect 20 0 23 0;
#P connect 39 0 38 0;
#P connect 40 0 39 0;
#P connect 21 0 39 0;
#P connect 5 0 21 0;
#P connect 24 0 21 0;
#P connect 4 0 5 0;
#P window clipboard copycount 48;


May 14, 2008 | 4:55 pm

On May 14, 2008, at 7:45 AM, don malone wrote:
> you might want to update the result when majoritythresh changes

OK, and as long as I was modifying it, I made it take an argument for
the thresh:

max v2;
#N vpatcher 29 112 513 727;
#P origin 0 2;
#P window setfont Verdana 9.;
#P window linecount 1;
#P newex 85 528 80 472055817 patcherargs 5;
#P newex 50 528 27 472055817 t b i;
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 244 460 211 196617 To make a vote with more than eight
inputs , chain multiple Vote8 objects with the Cascade I/O , and set
the thresh on the final Vote8 in the chain.;
#B frgb 21 110 62;
#P window linecount 1;
#P comment 413 574 41 196617 Cascade;
#P comment 414 35 41 196617 Cascade;
#P comment 300 35 41 196617 Thresh;
#N comlet Cascade Out;
#P outlet 397 572 15 0;
#N comlet Cascade In;
#P inlet 397 35 15 0;
#P window setfont Verdana 9.;
#P newex 44 452 27 472055817 t b i;
#P newex 33 474 27 472055817 +;
#P window setfont "Sans Serif" 9.;
#P number 33 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden comment -1 587 60 196617 bottom left;
#P window setfont Verdana 9.;
#P newex 248 103 27 472055817 t b i;
#P newex 237 125 27 472055817 +;
#P newex 214 152 27 472055817 t b i;
#P newex 203 174 27 472055817 +;
#P newex 180 201 27 472055817 t b i;
#P newex 169 223 27 472055817 +;
#P newex 146 250 27 472055817 t b i;
#P newex 135 272 27 472055817 +;
#P newex 112 299 27 472055817 t b i;
#P newex 101 321 27 472055817 +;
#P newex 78 348 27 472055817 t b i;
#P newex 67 370 27 472055817 +;
#P newex 44 397 27 472055817 t b i;
#N comlet Result;
#P outlet 33 572 15 0;
#N comlet Majority Thresh;
#P inlet 341 35 15 0;
#P newex 33 419 27 472055817 +;
#P newex 33 550 44 472055817 >=;
#P newex 271 67 27 472055817 > 0;
#N comlet Vote In 8;
#P inlet 271 35 15 0;
#P newex 237 67 27 472055817 > 0;
#N comlet Vote In 7;
#P inlet 237 35 15 0;
#P newex 203 67 27 472055817 > 0;
#N comlet Vote In 6;
#P inlet 203 35 15 0;
#P newex 169 67 27 472055817 > 0;
#N comlet Vote In 5;
#P inlet 169 35 15 0;
#P newex 135 67 27 472055817 > 0;
#N comlet Vote In 4;
#P inlet 135 35 15 0;
#P newex 101 67 27 472055817 > 0;
#N comlet Vote In 3;
#P inlet 101 35 15 0;
#P newex 67 67 27 472055817 > 0;
#N comlet Vote In 2;
#P inlet 67 35 15 0;
#P newex 33 67 27 472055817 > 0;
#N comlet Vote In 1;
#P inlet 33 35 15 0;
#P window setfont Verdana 18.;
#P comment 0 3 62 472055826 Vote8;
#P window setfont "Sans Serif" 9.;
#P hidden comment 64 4 72 196617 by Chris Muir;
#P comment 65 12 127 196617 Eight input majority logic.;
#P comment 169 531 134 196617 Default to majority of eight;
#P connect 4 0 5 0;
#P connect 24 0 21 0;
#P connect 5 0 21 0;
#P connect 21 0 39 0;
#P connect 40 0 39 0;
#P connect 39 0 38 0;
#P connect 38 0 20 0;
#P connect 47 0 20 0;
#P connect 20 0 23 0;
#P connect 25 0 24 0;
#P fasten 41 0 40 0 402 446 49 446;
#P lcolor 7;
#P connect 24 1 21 1;
#P connect 40 1 39 1;
#P fasten 22 0 47 0 183 413 83 524 55 524;
#P connect 6 0 7 0;
#P connect 26 0 25 0;
#P connect 7 0 25 0;
#P connect 47 1 20 1;
#P fasten 48 0 20 1 90 547 72 547;
#P connect 27 0 26 0;
#P connect 26 1 25 1;
#P connect 8 0 9 0;
#P connect 28 0 27 0;
#P connect 9 0 27 0;
#P connect 29 0 28 0;
#P connect 28 1 27 1;
#P connect 10 0 11 0;
#P connect 30 0 29 0;
#P connect 11 0 29 0;
#P connect 31 0 30 0;
#P connect 30 1 29 1;
#P connect 12 0 13 0;
#P connect 32 0 31 0;
#P connect 13 0 31 0;
#P connect 33 0 32 0;
#P connect 32 1 31 1;
#P connect 14 0 15 0;
#P connect 34 0 33 0;
#P connect 15 0 33 0;
#P connect 35 0 34 0;
#P connect 34 1 33 1;
#P connect 16 0 17 0;
#P connect 36 0 35 0;
#P connect 17 0 35 0;
#P fasten 19 0 36 0 276 94 253 94;
#P connect 36 1 35 1;
#P connect 18 0 19 0;
#P fasten 38 0 42 0 38 516 402 516;
#P lcolor 7;
#P pop;

Chris Muir
cbm@well.com

http://www.xfade.com


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