logic, testing multiple toggles

Jan 28, 2011 at 3:52pm

logic, testing multiple toggles

Hello all.

I know there is an elegant way to do this, but I don’t have any idea how to do it well, and my basic effort has failed. I’ll bet there is an object that does it.

I have 7 toggles and I want to see if any one of them is on. If any are, set output to 1. If not, 0.

I tried this and it did not work:
if $i1 !=0 || $i2 !=0 || $i3 !=0 || $i4 !=0 || $i5 !=0 || $i6 !=0 || $i7 !=0 then 1 else 0


Jan 28, 2011 at 3:59pm
– Pasted Max Patch, click to expand. –

Note that using (a[0] || a[1]) is saying,
if a[0] is not zero OR a[1] is not zero,
then the expression in parentheses is not zero

Also, giving jstrigger more than one expression in parentheses will give it more than one output, so you can have one jstrigger object interpreting complex combinations of quantities in more than one way to give you different analysis results fromt he same set.

Jan 28, 2011 at 4:06pm

One way:

– Pasted Max Patch, click to expand. –
Jan 28, 2011 at 4:15pm

Well, I have come up with a way to do it. This might not be the ideal solution, but it is simple and it works.

– Pasted Max Patch, click to expand. –
Jan 28, 2011 at 4:18pm

Patrick, I didn’t refresh before posting mine. It’s great that we were thinking along the same track! Thanks so much folks for getting back on this one, very helpful.


Jan 29, 2011 at 2:21am

the oft-overlooked [decode] object might also interest you, especially if you plan to expand to other logic tests. great for things like solo/mute of multiple channels/toggles.


You must be logged in to reply to this topic.