Pattern CHOP

From TouchDesigner 099 Wiki


The Pattern CHOP generates a sequence of samples in a channel. Unlike the Wave CHOP its purpose is generating arrays of samples that have no reference to time (seconds or frames).

It is useful for curve generation like lookup tables, simple shapes that can be converted to SOPs, generating channels that are passed to the Geometry COMP to generate instances, and other non-time-based curve-generation, with as little need to make expressions in Python.

All defaults are in samples, not seconds or frames (though like all CHOPs, it carries with it a sample rate). There is no start-end, just Length in samples.

Tip: To display a CHOP viewer in the units of samples, make the Viewer Active and change RMB -> Units to be Samples.

The Pattern CHOP optionally takes one input CHOP to match the length and sample rate, and, choosing via the Combine Channels menu, Appends or Inserts the new channel(s), Replaces the incoming channels, Adds to the incoming channels or Multiplies the incoming channels.

The Pattern CHOP defaults to one cycle of the curve over the length of the CHOP, no matter how many samples long.

Tip: Customizing each channel: The python object for Pattern has a chanIndex member, so if Pattern generates three channels you can put something like [1, 3, 7][me.chanIndex] in any parameter to customize its value for each channel.

PythonIcon.png patternCHOP_Class

Parameters - Pattern Page

Type type - The shape of one cycle of the pattern.

  • Constant (1)
  • Sine (-1 to 1)
  • Cosine (-1 to 1)
  • Triangle (-1 to 1)
  • Ramp (0-1)
  • Ramp Samples (0 to numSamples-1)
  • Square (-1 to -1)
  • Pulse (0-1)
  • Random (0-1)
  • Random per Cycle

Length length - Set the number of samples for this CHOP.

Number of Cycles numcycles - Set the number of repeating cycles of the Type shapes over teh Length, except for Random.

Seed seed - The seed for the random Types.

Bias bias - Makes Triangle type into a sawtooth wave, and sets the Square type variable-width.

Phase phase - Shifts the cycle.

Phase Step phasestep - Increases the phase for each channel. A Phase Step of .25 when there are 2 channels will shift the second channel to be 1/4 cycle later phase than the first phase, where if the 2 channels are used for x and y, will draw a circle when passed to a CHOP to SOP.

Taper taper1 taper2 - Two parameters to multiply by a line from taper1 at the start to taper2 at the end. The default of (1 1) has no effect.

Taper Decay Rate taperdecay - An exponent that is applied to the result of the taper.

Amplitude amp - See also the Range.

Offset offset - See also the Range.

From Range fromrange1 fromrange2 - A value at each From Range will become its corresponding To Range value.

To Range torange1 torange2 - A value at each From Range will become its corresponding To Range value.

Integer integer - A round-off menu to convert all numbers to integers.

Reverse reverse - Reverses the final order of the samples as in the Stretch CHOP.

Parameters - Channel Page

Channel Name /name - You can creates many channels with simple patterns like chan[1-20], which generates 20 channels from chan1 to chan20, or t[xyz] which generates tx, ty and tz. See the section, Common CHOP Parameters for a description of this and all Options. See Scope and Channel Name Matching Options.

Combine Channels - combine - If an input CHOP is attached, it adopts the length and sample rate of the input CHOP, and

  • Off - it only adopts the length and sample rate of the input.
  • Append - it appends the new Pattern CHOP channels after the last incoming channel.
  • Insert - it inserts the new channels before the first incoming channel.
  • Replace - it replaces the incoming channels using channel-name-matching.
  • Multiply - it multiplies incoming channels with the generated channels, matching by channel-name-matching.
  • Add - it adds incoming channels to the generated channels, matching by channel-name-matching.

. Sample Rate /rate - The sample rate of the channels, in samples per second.

Extend Left, Extend Right - The left and right extend conditions (before/after range).

Default Value /defval - The default value for extend conditions.

Parameters - Common Page