TYPE: CHOP
TITLE: Math CHOP

This CHOP allows you to perform a variety of arithmetic operations on and
between channels. Channels of a CHOP can be combined, and several CHOPs
can be combined.

Unary operations are performed on individual channels. Unary operations are:

~c(
        Off       - Don't do anything to the channel.
        Negate    - Take the negative value of each sample of the channel.
        Positive  - Make negative values of the channel positive (absolute).
        Root      - Take the square root of all values in the channel.
        Square    - Square all the values in the channel.
        Inverse   - Take the inverse (1/x) of all values in the channel.
~c)

Operations between channels can be done within an input or between inputs.
The operations are done on a sample by sample basis:

~c(
        Off       - Don't combine the channels.
        Add       - Sum all the channels.
        Subtract  - Subtract all the channels from the first.
        Multiply  - Take the product of all the channels.
        Divide    - Divide the first channel by all the rest.
        Average   - Take the average of all the channels.
        Maximum   - Take the maximum value of all the channels.
        Minimum   - Take the minimum value of all the channels.
        Length    - Assume the channels are a vector and compute its length.
~c)

The operations are executed in a very specific order. The four OP steps are
performed in the following order: pre-op, combine channels, combine CHOPs, and
post-op. Next come the three Mult-Add steps, which are performed in the
order: pre-add, multiply, and post-add. Finally, computing the range is the
last step prior to output.

This CHOP has Sample Rate Match options in the Common page.

Parameters
OP
    Channel Pre OP   - A menu of unary operations that are performed on
		       single channels as they come in to the Math CHOP.
    Combine Channels - A menu of operations that is performed between the
		       channels of a single input CHOP, for each input.
    Combine CHOPs    - A menu of operations that is performed between the
		       input CHOPs, combining several CHOPs into one.
    Channel Post OP  - A menu of more unary operations that is performed
		       on the channels resulting from the above operations.
    Match By         - Match channels between inputs by name or number.

    Align            - The alignment to use when aligning channels from
		       different inputs. See the help for the Merge CHOP.
Mult-Add
    Pre-Add         - First, add value to each new channel.   /preoff
    Multiply        - Then multiply by this value.            /gain
    Post-Add        - Then add this value.                    /postoff
Range
    From/To Range   - Another way to multiply/add. Converts   /fromrange1,2 /torange1,2
                      from one low-high range to another range.

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

See also: Logic, Function
