Forums > MaxMSP

logic circuit

June 23, 2010 | 8:21 pm

I have a dual system running. At a certain moment the two toggles can be on zero and the system stops. What can I use to send a bang in case of two toggles arrive at zero?


June 23, 2010 | 8:32 pm

If you add the output of 2 toggles together, and the result of that addition is 0, then you know both toggles will be on 0…….

– Pasted Max Patch, click to expand. –

June 23, 2010 | 8:45 pm

wouldn’t the following modification of Tim’s solution be more intention revealing:

– Pasted Max Patch, click to expand. –

?


June 23, 2010 | 8:50 pm

Yes, but then you have to know what the bitwise && and ! mean…….and if the OP did they would probably have been able to work out how to do it :P

and I also didn’t think of doing it like that in the if object……. :P


June 23, 2010 | 8:52 pm

that’s logical &&, not bitwise, otherwise point taken :-)


June 23, 2010 | 8:53 pm

haha right you are


June 24, 2010 | 9:28 am

Thank you very much for your brain power!! This patch integrated and the system keeps going!
Well done!


June 24, 2010 | 10:09 am

of course the funny thing now is that I can’t switch it off anymore…


June 24, 2010 | 11:05 am

could use a gate to interrupt the triggering to turn it off


June 24, 2010 | 11:25 am

what do you mean "can’t switch it off"?


June 24, 2010 | 11:38 am

one toggle is the master qmetro for the system. The other a sub toggle metro object. When the two are zero they receive a bang now and therefore I can’t turn it off anymore.


June 24, 2010 | 12:41 pm

Gate is a good solution. Thanks.


July 1, 2010 | 5:10 pm

Could you help me once more with your logic please?
What do we write if we want this to be for three toggles?
I tried this but it does not work.

– Pasted Max Patch, click to expand. –

July 1, 2010 | 5:40 pm

In that patch you’re only really checking for 4 conditions:

0 0 0 – 1 (bang)
1 0 0 – 0
0 1 1 – 0 (because you’re sending 1 toggle to 2 inlets)
1 1 1 – 0

It needs to be checking for:

0 0 0 – 1 (bang)
1 0 0 – 0
0 1 0 – 0
0 0 1 – 0
1 1 1 – 0

Like this:

– Pasted Max Patch, click to expand. –

July 1, 2010 | 6:24 pm

Thank you Tim!!
That’s very well done.


July 1, 2010 | 7:37 pm

You’ll have to take those truth tables with a pinch of salt, they’re incomplete :)


July 2, 2010 | 1:04 pm

Here’s how I’d do it:

– Pasted Max Patch, click to expand. –

July 2, 2010 | 5:24 pm

Thanks Tim and Psycho!
Tim, I use your suggestion at the moment. Now, I need it the other way around. What do I write when I want bang when all the toggles are on?!


July 2, 2010 | 5:56 pm

In general, I’d use pak instead of triggers:

– Pasted Max Patch, click to expand. –

July 2, 2010 | 6:12 pm

Now that ^^ is a much neater way of doing it! Like in Ben’s example, you just need to remove ! from the if statement. ! means logical "not", so using ! in the if object is like using a NAND gate, and you remove it if you just want an AND…..which is what && means.


July 2, 2010 | 6:36 pm

Many thanks to everyone!! This way I can keep the CPU away from 100%….


July 4, 2010 | 6:39 pm

hello logic circuit minds!
Thanks to your help, I can prevent the system from stopping or from cpu overload.
Listening to my patch made me want to do one more thing with the logic circuit.
Here is the situation:
I have connected the following circuit to five vst instrument to prevent them to stop

– Pasted Max Patch, click to expand. –

Listening to the patch made me want to add one more circuit. I would like to build a second one which in case of only one instrument is playing will give a bang. So "if only one of five is on->bang.
I want to send the bang to a random object with argument 5 attached to a gate of five attached to the five vst’s.

Now the catch is that it can happen to send the band to the one which is on and would turn it off. That is the worst case, but how can I tell gate, or any other object which of the five is on and in that case to send the bang to one which is off?
It needs something that updates the state of the five vst’s…..


July 4, 2010 | 9:08 pm

I’ve had a go so hopefully I understood what you need. It’s not the best way of doing it either, I know that; but someone else will chip in with a better solution which I look forward to! I’ve not got enough time to patch about for a while till it works.

– Pasted Max Patch, click to expand. –

July 5, 2010 | 11:00 am

Hi Tim,
you are a real wizzard! It is exactly what I was thinking of. Thanks.
This gives a very high probability that another instrument will be turned on.
Maybe there is one more logical step to be done to say ‘if the random output equals the sending output take another one’
This way it would always work.


July 5, 2010 | 11:20 am

Tim,
two more things came to my mind.
I could live without a random object too. As long as a second instrument will be switched on avoiding to switch off the remaining, it will be fine.

What interests me a lot about this patch is the fact that it seems to ‘be conscious’ about it’s own state and I would like to explore that a little bit more. Maybe building a sort of ‘consciousness object’……


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