Forums > MaxMSP

"permatoggle" object

May 15 2012 | 5:22 pm

I need an object that sends 1 (or a bang) when a given condition is satisfied but a 0 (or nothing) if the condition is ever violated and continues to send zero until it is reset by a different condition (even if the first condition is satisfied again). Isn’t onebang supposed to do this? If so I am not using it right.

May 15 2012 | 5:48 pm

Here’s a way of doing it with onebang.

-- Pasted Max Patch, click to expand. --

May 15 2012 | 6:15 pm

Didnt even know that sel could have multiple arguments – very cool

May 15 2012 | 6:22 pm

Silly that there’s no other way to do this tho.

May 15 2012 | 7:09 pm

There are actually other ways of doing it. What you’re describing is an AND sort of process where the outcome is dependent on the state of two things. Here’s how to do it using &&. (you could also change togedge to sel 1)

-- Pasted Max Patch, click to expand. --

May 15 2012 | 8:05 pm

You’d think that there’d be an object that does this in one step, is all I’m saying. I’ve built a patch that seems to do a relatively simple thing (will post later on)but is IMO inordinately complex as it is. I’m starting to see the limits of trading flexibility for speed.

May 15 2012 | 10:34 pm

Whenever I hear a request for an object to do one specific thing I get suspicious. There isn’t a word for every thought, sometimes you have to use sentences. Do you need to do this sort of thing very often?

Do you _really_ need the speed that a native object would give for this? An abstraction would get you the same clarity of intent as an external object would.

May 17 2012 | 12:21 pm

finding different solutions for it depending on the concrete situation is the way to go.

to find out if one of up to 8 conditions are met

[expr (condition 1) * (condition 2) * (condition 3) * (condition 4) * (condition 5)]

should be the most straightforward solution.

and if you make bigger projects, you will eventually need to analyze the state of
buttons or things like that which are all but linear and contain various serial and
paralell processes- then the use of a bunch of basic objects like &&, >, route and
gate can be the best way.

in jamessons problem from above, [gate] would be the first object i´d put in my patch.


May 17 2012 | 7:14 pm

Roman’s multiplication idea is great – saves on complex && newroks

May 17 2012 | 7:42 pm

You can also use things like: vexpr $i1!=0 –> zl sum –> == (list length–use zl len)
if you want to evaluate whole lists of conditions.

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

Forums > MaxMSP