Wave CHOP

From TouchDesigner 099 Wiki

Summary

The Wave CHOP makes repeating waves with a variety of shapes. It is by default 10-seconds of 1-second sine waves, a total of 600 frames. You can adjust period (frequency), phase, shape, amplitude and offset.

The Wave CHOP gives a set of waves in channels of a specifiable length. See the LFO CHOP to get an endless stream of waves that is Time Sliced. The Audio Oscillator CHOP also creates waveforms that are continually repeated, but its defaults are for higher-frequency waves at higher (audio) sample rates.

Because the Extend Conditions are set to Repeat, the wave will repeat outside the 10-second range.

Applied to the actual waveform can be an offset, decay and ramp.

Multiple channels can be generated in the Channel Name parameter using Pattern Expansion. A few examples of name pattern name expansion:

  • tx ty tz
  • t[xyz] - expands to tx ty tz
  • chan[1-4] - expands to chan1 chan2 chan3 chan4
  • c[xyz][1-5:2] - expands to cx1 cx3 cx5 cy1 cy3 cy5 cz1 cz3 cz5

See also: LFO CHOP, Audio Oscillator CHOP.

PythonIcon.png waveCHOP_Class

Parameters - Waveform page

Type - There is a choice of waveforms shapes:

TouchChannels69.gif Constant (1) A constant-valued "wave".
TouchChannels71.gif Sine (-1 to 1) A Sine wave.
TouchChannels74.gif Gaussian (0 to 1) A Gaussian (also known as a bell or normal) curve.
TouchChannels76.gif Triangle (-1 to 1) A ramp-up to 1 and ramp-down to 0 that can be shaped with the Bias parameter.
TouchChannels78.gif Ramp (0 to 1) A ramp from 0 to 1.
TouchChannels80.gif Square (-1 to 1) Step-up/step-down, with Bias control to make it rectangular.
TouchChannels82.gif Pulse (0 to 1) Produces a 1 for one sample, 0 otherwise.
Expression - A user defined expression.

The Sine formula is:

out = Amplitude * (Offset + sin ((Period*index - Phase)*360))

Period /period - The period is the number of seconds, frames or samples that the waveform repeats in. It is expressed in the chop's Units (default is Seconds), found on the Common page.

Phase /phase - The phase shifts the waveform in time, and is expressed as a fraction of a period, usually between 0 and 1.

Bias /bias - You can vary the shape of some of the waveform types by changing the bias within the range -1 to +1.

Offset /offset - The waveform's value can be offset. A sine wave can remain always positive by setting Offset to 1.

Amplitude /amp - The wave's value can be scaled.

Decay Rate /decay - The wave's amplitude can be reduced over time with an "exponential decay". For example, if the Decay is 0.2 and the Units are seconds, then the amplitude will decay to 0.8 after 1 second, and 0.8 of 0.8 (or 0.64) after 2 seconds.

Ramp Slope /ramp - Then a ramp is added to the result with a slope of Ramp. The channel increases by the Ramp Slope value every Unit of time. For example, if Ramp is 1.2, the channel increases by 1.2 every second, in addition to the shape of the wave.

Expression /exprs - If the waveform type is Expression, the Expression parameter is used to input a math expression. Some local variables are available: $I (Index), $L (the loop variable over the period 0 to 1), $C (the cycle variable, the integer number of cycles the waveform has passed at the current index).

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. See the section, Common CHOP Parameters for a description of this and all Options. See Scope and Channel Name Matching Options.

Start, End /start, /end - Start and end of the interval, expressed in Units (seconds, frames or samples).

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.

Standard Options and Local Variables

Local Variables

$I - The current index.
$C - The current channel (0 to NC-1).
$NC - The number of channels.
$L - The current loop index, which is reset every period. It is the location of the current index within the current cycle. It ranges between 0 and the Period-1, in samples.
$N - The current period count, starting at zero, which is the number of complete cycles that have occurred up to the current index.
$P - The value of the period parameter, in samples.
$PH - The value of the phase parameter, in samples.
$B - The value of the bias parameter, in samples.