Envelope CHOP

From TouchDesigner 099 Wiki

Summary

The Envelope CHOP outputs the maximum amplitude in the vicinity of each sample of the input. It takes the absolute value of the input, and uses a sliding window of a number of samples to find the maximum amplitude near each sample.

Tip: The loudness levels of an audio track can be kept roughly constant by computing an envelope of the audio with a wide window, and then passing the original audio and the envelope to a Math CHOP and selecting Combine CHOPs - Divide. This will make the amplitude approximately 1.

PythonIcon.png envelopeCHOP_Class

Parameters

Type - The two methods of calculating the envelope:

  • Exponential Decay - For each sample, the value is compared to the previous sample. If it is greater than the previous, the value of the envelope is equal to the value of that sample, and that sample is stored as the current peak. If it is less than, the value of the envelope decays exponentially from the last peak to the current value (as more samples pass that are smaller than the peak, the envelope decays toward the waveform). Pros: Always encloses the data. Cons: Slope can be discontinuous, making the output look bumpy.
  • Local Maximum Window - The channel is separated into windows of N samples determined by the Envelope Width. In each window, the maximum amplitude (or power) is found. The maximum value of the window is placed as a data point in the center of the window, and these points are cubically interpolated together to form the output envelope. Pros: Produces Good shapes. Cons: Signal sometimes jumps outside the envelope. The signal is quantized, so pulses can be off by as much as N/2.

Envelope Width - The width of the window to use in the envelope calculation. Adjust this width to capture as many features of the input as needed. It is expressed in Units.

Power Envelope - Computes the power envelope of the signal. The power, here refers to the square of the amplitude - often used to measure the energy of a signal. This option squares the amplitude first.

Normalize Power Envelope - Keeps the total power in the signal constant when adjusting the Envelope Width.


NOTE: With Time Slicing on, only the Exponential Decay envelope method is usable. The Normalize Power Envelope is not available, since normalization cannot be done accurately on small segments of data.

Standard Options and Local Variables

Local Variables: $C, $NC