Is there a CHOP that's like an operator (greater/less than, equal, etc)?

Is there a CHOP that evaluates to 1 if two input CHOPs are compared somehow, such as:

A     ==     B
A   > or <   B
A  <= or >=  B
A     !=     B

I know how to do this with python, but there are some logic steps I’d like to build more visually using a chop to do this step. My first guess would have been the Logic CHOP, but I don’t see how to do this kind of comparing with it.

Am I just missing something obvious?

Hiya mate :slight_smile:

Have you been using the expression chop previously for your python like this? me.inputVal will give you the first chop’s first channel and me.inputs[1][0] will get the second chop’s first channel.

Otherwise I also use the logic chop to check for things in bounds like this, but yea it’s harder to do the standard conditionals with this chop.

Hope that helps!
Jayson

1 Like

Hi Friends!

Remember - When in doubt, there’s always the Script CHOP! Here’s a .tox with a Script CHOP, with an “Operation” par in the “Custom” page. You can choose the comparison you want and it will output the result. ATM it only handles single samples, but you could expand the code to do these operations with channels

Logic_Operations.tox (1.0 KB)

2 Likes

For another approach, take your two samples, subtract them in a Math CHOP, then apply a Function CHOP set to “sign”
This will give -1 for less, 0 for equal, +1 for more.

You can then follow up with a Logic CHOP to select the ranges you want. (0 to 1) for >=

2 Likes