Function CHOP

From TouchDesigner Documentation
Jump to: navigation, search


The Function CHOP provides more complicated math functions than found in the Math CHOP : trigonometic functions, logarithmic functions and exponential functions, and also audio decibels (dB)-power-amplitude conversions.

Most of the functions require only one parameter, and they are applied as a unary operator to each input channel. Some functions take two parameters, and these require the use of the second input. The first parameter, X, is always a value from a channel in the first input. The second parameter, Y, is a value from a corresponding channel in the second input. Channels from each input are paired by name or index.

Since many of these functions can produce math errors, an error handling tab is provided for error handling and recovery. Errors can be handled by replacing the bad sample with a pre-defined value or by using the value of the previous sample. Alternatively, cooking can be aborted upon error for debugging networks.

Function types in decibels: as you would employ for audio or other signal strengths. -10dB means 1/10 the power, -20dB means 1/100 the power. It turns out that each 3dB means almost exactly double the power, so +12dB is 2*2*2*2 = 16 times the power. Power is proportional to the square of the amplitude. So -20dB means 1/10 the amplitude, and 6dB is double the amplitude.


Parameters - Function Page

Function func - - Which math function to apply to the channels. All of the functions are unary functions except for the binary functions 'arctan (Input1/Input2)' and 'Input1 ^ Input2'. In the cases of power functions, a negative base is inverted first to avoid imaginary numbers, and the result is negated.

  • sqrt(x) Square Root sqrt - Square Root of Input 1.
  • abs(x) Absolute Value abs - Absolute Value of Input 1.
  • sign(x) Sign sign - Sign of Input 1.
  • cos(x) Cosine cos - Cosine of Input 1.
  • sin(x) Sine sin - Sine of Input 1.
  • tan(x) Tangent tan - Tangent of Input 1.
  • acos(x) Arccosine acos - Arccosine of Input 1.
  • asin(x) Arcsine asin - Arcsine of Input 1.
  • atan(x) Arctan( Input1 ) atan - Arctan of Input 1.
  • atan2(y,x) Arctan( Input1 / Input2 ) atan2 - Arctan of (Input 1 / Input 2).
  • cosh(x) Hyperbolic Cosine cosh - Hyperbolic Cosine of Input 1.
  • sinh(x) Hyperbolic Sine sinh - Hyperbolic Sine of Input 1.
  • tanh(x) Hyperbolic Tangent tanh - Hyperbolic Tangent of Input 1.
  • log10(x) Log base 10 log - Log base 10 of Input 1.
  • logN(x) Log base N logb - Log base Base Value of Input 1.
  • ln(x) Natural Log ln - Natural Log of Input 1.
  • pow(10,x) 10 ^ Input1 pow10 - 10 to the power of Input 1.
  • exp(x) e ^ Input1 exp - e to the power of Input 1.
  • pow(x) Base ^ Input1 powe - Base value to the power of Input 1. If Base value is negative result is -((-Base Value) ^ Input 1)
  • pow(x) Input1 ^ Exponent powb - Input 1 to the power of Exponent value. If Input 1 is negative result is -((-Input 1) ^ Exponent Value).
  • pow(x,y) Input1 ^ Input2 pow - ((-Input 1) ^ Input 2)
  • dB to Power dbtopower - Decibel (Input 1) to amplitude.
  • Power to dB powertodb - Amplitude (Input 1) to decibel.
  • dB to Amplitude dbtoamp - Decibel (Input 1) to amplitude.
  • Amplitude to dB amptodb - Amplitude (Input 1) to decibel.

Base Value baseval - The value of the base for 'Log base N' and 'Base ^ Input1'. parameter name /baseval

Exponent Value expval - The value of the exponent for 'Input1 ^ Exponent'. channel name /expval

Angle Units angunit - - For trigonometric functions, the angles can be measured in Degrees, Radians, or Cycles (0 to 1).

  • Degrees deg -
  • Radians rad -
  • Cycles cycle -

Match by match - - How to pair channels together from the two inputs for the binary functions, by name or by channel index.

  • Channel Number index -
  • Channel Name name -

Parameters - Error Page

Error Handling error - - How to correct samples with math errors:

  • Abort With Error Message abort - Cooking aborts.
  • Replace With Specified Values replace - Values specified below.
  • Use The Previous Value useprev - Uses the last good result.

+ Infinity Value pinfval - Value to use when an infinity error occurs. Caused by sinh(), cosh() and tan().

- Infinity Value ninfval - Value to use when a negative infinity error occurs. Caused by sinh() and tan().

Domain Error Value domval - Value to use when a domain error occurs. Caused by asin(), acos(), log10(), logN(), ln() and sqrt().

Divide Error Value divval - Value to use when a divide by zero error occurs. Caused by pow(x,y).

Parameters - Common Page

Time Slice timeslice - Turning this on forces the channels to be "Time Sliced". A Time Slice is the time between the last cook frame and the current cook frame.

Scope scope - To determine which channels get affected, some CHOPs use a Scope string on the Common page.

Sample Rate Match srselect - - Handle cases where multiple input CHOPs' sample rates are different. When Resampling occurs, the curves are interpolated according to the Interpolation Method Option, or "Linear" if the Interpolate Options are not available.

  • Resample At First Input's Rate first - Use rate of first input to resample others.
  • Resample At Maximum Rate max - Resample to the highest sample rate.
  • Resample At Minimum Rate min - Resample to the lowest sample rate.
  • Error If Rates Differ err - Doesn't accept conflicting sample rates.

Export Method exportmethod - - This will determine how to connect the CHOP channel to the parameter. Refer to the Export article for more information.

  • DAT Table by Index datindex - Uses the docked DAT table and references the channel via the index of the channel in the CHOP.
  • DAT Table by Name datname - Uses the docked DAT table and references the channel via the name of the channel in the CHOP.
  • Channel Name is Path:Parameter autoname - The channel is the full destination of where to export to, such has geo1/transform1:tx.

Export Root autoexportroot - This path points to the root node where all of the paths that exporting by Channel Name is Path:Parameter are relative to.

Export Table exporttable - The DAT used to hold the export information when using the DAT Table Export Methods (See above).

Operator Inputs

  • Input 0 -
  • Input 1 -

TouchDesigner Build:

Ableton Link • Analyze • Angle • Attribute • Audio Band EQ • Audio Device In • Audio Device Out • Audio Dynamics • Audio File In • Audio File Out • Audio Filter • Audio Movie • Audio NDI • Audio Oscillator • Audio Para EQ • Audio Play • Audio Render • Audio Spectrum • Audio Stream In • Experimental:Audio Stream In • Audio Stream Out • Beat • Bind • BlackTrax • Blend • Blob Track • Bullet Solver • Clip Blender • Clip • Clock • Composite • Constant • Copy • Count • CPlusPlus • Cross • Cycle • DAT to • Delay • Delete • DMX In • Experimental:DMX In • DMX Out • Envelope • EtherDream • Event • Expression • Extend • Fan • Feedback • File In • File Out • Filter • Experimental:Filter • Experimental:FreeD • Function • Gesture • Handle • Helios DAC • Hog • Hokuyo • Hold • Import Select • In • Info • Interpolate • Introduction To CHOPs id • Inverse Curve • Inverse Kin • Join • Joystick • Keyboard In • Keyframe • Kinect Azure • Experimental:Kinect Azure • Kinect • Lag • Laser • Leap Motion • Leuze ROD4 • LFO • Limit • Logic • Lookup • LTC In • LTC Out • Math • Experimental:Math • Merge • MIDI In • MIDI In Map • MIDI Out • Mouse In • Mouse Out • NatNet In • Noise • Null • Object • Oculus Audio • Oculus Rift • OpenVR • Experimental:OpenVR • OSC In • OSC Out • Out • Override • Panel • Pangolin • Parameter • Pattern • Perform • Experimental:Phaser • Pipe In • Pipe Out • PosiStageNet • Pulse • RealSense • Experimental:RealSense • Record • Rename • Render Pick • Reorder • Replace • Resample • S Curve • Scan • Script • Select • Sequencer • Serial • Shared Mem In • Shared Mem Out • Shift • Shuffle • Slope • SOP to • Sort • Speed • Splice • Spring • Stretch • Stype • Switch • Sync In • Sync Out • Tablet • Time Slice • Timeline • Timer • TOP to • Experimental:TOP to • Touch In • Touch Out • Trail • Transform • Transform XYZ • Trigger • Trim • Warp • Wave • Experimental:WrnchAI • ZED

An Operator Family which operate on Channels (a series of numbers) which are used for animation, audio, mathematics, simulation, logic, UI construction, and many other applications.

TouchDesigner is a hierarchy of components. "root" is the top-most network in the hierarchy. The Path is simply /. A typical path is /project1/moviein1.

A Time Slice is the time from the last cook frame to the current cook frame. In CHOPs it is the set of short channels that only contain the CHOP channels' samples between the last and the current cook frame.

A parameter in most CHOPs that restricts which channels of that CHOP will be affected. Normally all channels of a CHOP are affected by the operator.

samples-per-second of a CHOP. Each CHOP in your network has a sample rate, whether it is used or not. The overall timeline has a "frame rate", which is the number of animation frames per second, generally your monitor display frequency.

Exporting is the connection of CHOP channels to parameters of operators. The output of each exporting CHOP is one or more channels, active only while the CHOP Viewer is on. The current value of a channel can be exported to a parameter of any operator, overriding that parameter's value. See Parameter.

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.

The location of an operator within the TouchDesigner environment, for example, /geo1/torus1, a node called torus1 in a component called geo1. The path / is called Root. To refer instead to a filesystem folder, directory, disk file or http: address, see Folder.

Parameters in TouchDesigner are an operator's settings (numbers, menus, flags, strings, paths) which the user can alter. Parameters for any operator can be opened by right-clicking on the operator and selecting "Parameters..." A currently selected operator's parameters can be viewed in a Network Editor by pressing the keyboard shortcut 'p'.