Logic CHOP

From TouchDesigner 099 Wiki

Summary

The Logic CHOP first converts channels of all its input CHOPs into binary (0 = off, 1 = on) channels and then combines the channels using a variety of logic operations.

NOTE: The Logic CHOP is superceded by more convenient operators like the CHOP Execute DAT or the Text DAT which will run their scripts when CHOP channels change.

The Logic CHOP performs logic operations on the samples in CHOP channels. The channels of a CHOP can be combined into one channel, and several CHOPs can be combined into one CHOP.

With one input CHOP, you can invert the values of each sample. You can also do logic operations on the samples of one channel by the samples in the other channels, reducing N channels down to one. You can combine by applying an "or", "and", etc..

With two or more CHOP inputs, you can combine the channels in one CHOP with the channels in all the other CHOPs, reducing N CHOPs to 1.

To do math operations (add, multiply, ...) between channels or CHOPs, use the Math CHOP.

PythonIcon.png logicCHOP_Class

Parameters - Logic Page

Convert Input - This menu determines the method to convert inputs to binary:

  • Off When Zero - Returns a logical 0 when channel value is zero;
    Non zero values return 1.
  • Off When Zero or Less - Returns a logical 0 when a channel value is zero or less; and 1 when values are positive.
  • Off When Outside Bounds - Returns 0 when channel value is outside the bounds set by the Bounds parameter below.
  • On When Value Changed - Returns 1 when the channel value changes.
  • On When Channel Name Changed - Returns 1 when the channel name changes.

TouchChannels92.gif

Channel Pre Op - Once converted by the Convert Input stage, Channel Pre OP defines a unary operation on each input sample:

  • Invert - Changes 0 to 1; and 1 to 0.
  • Toggle - Causes each 0 to 1 transition of the input channel to switch the current state between 0 and 1.
  • Radio Button - Only one channel per input can be on at once. If another channel turns on, the previously "on" channel is turned off.
  • Last Two On - This is like Radio Button, but it keeps up to two channels on. If followed by a Lag CHOP, it is useful for blending between pairs of poses.
  • Rising Edge - On for one sample only, at each place where a channel goes from off to on.
  • Falling Edge - On for one sample only, at each place where a a channel goes from on to off.

Combine Channels - Takes the first input and combines its channels, then the second input and combines its channels, and so on.

Combine CHOPs - Combine CHOPs combines the first channels of each CHOP, the second channels of each CHOP, etc.. Channels between inputs can be combined by number or name. Combining (Logic) Operations are:

  • And - On if all inputs are on, otherwise off.
  • Or - On if at least one input is on, otherwise off.
  • Exclusive Or - On if one input on, but not more than one.
  • Not And - Off if all inputs are on, otherwise on.
  • Not Or - Off if at least one input is on, otherwise on.
  • Equivalence - On if inputs are equal (all on or off), otherwise off.
  • Lowest Index On - Gives the lowest index of the channel that is currently on,
    or -1 if no channels are on.
  • Highest Index On - Gives the highest index of the channel that is currently on on,
    or -1 if no channels are on.

TouchChannels93.gif

Match By - Channels are matched between inputs by Channel Name or Channel Number.

Align - Inputs that don't start at the same frame can be aligned. Se the section, Align Options.

Bounds - set lower and upper bounds for when Convert Input is set to Off When Outside Bounds.


Result of Channel and CHOP Input Operations

Combine Channels Combine CHOPs Result (Number of Channels in Output)
Off Off Total number of channels in all inputs
Off On Number of channels in the first input
On Off Same as the number of inputs
On On One channel


Standard Options and Local Variables