TYPE: CHOP
TITLE: Envelope CHOP

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. 

In time slice mode, only the "Exponential Decay" envelope type is used, and it
does not gradually increase to higher features; it jumps. It can also take
advantage of Minimal Time Slice Cooks (see Time Slice Preferences in Options).

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. 

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 of this method:
                      envelope 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 is found. The maximum value
                      of the window is used as the envelope value. Pros of this
		      method: Good shape. Cons: signal sometimes jumps outside
		      the envelope. The signal is quantized, so pulses can be
		      off by as much as N/2.

    Envelope Bounds - Determines which values are used to compute
                      the envelope: magnitude, power, maximum or
                      minimum values.
    Envelope Width  - The width of the window to use in the         /width
                      envelope calculation. Adjust this width
                      to capture as many features of the input
                      as needed. Lower values capture more detail,
                      while higher values create a smoother 
                      envelope. It is expressed in Units.
    Interpolate     - In Local Maximum window mode, this provides
                      interpolation options for the windowed values.
    Normalize Power Envelope - Keeps the total power in the signal constant
                      when adjusting the Envelope Width.
    Resample Envelope        - If on, the envelope is resampled down to the
                      rate listed in the next parameter. This is
                      very useful for audio. 
    Sample Rate     - The sample rate used to resample the          /samplerate
                      envelope after it is calculated.

Local Variables
        C       - current channel index (0 to NC-1)
        NC      - total number of channels

See also: Math
