maxabsaccum — Accumulates the maximum of the absolute values of audio signals.


maxabsaccum compares two audio-rate variables and stores the maximum of their absolute values into the first.


maxabsaccum aAccumulator, aInput


aAccumulator -- audio variable to store the maximum value

aInput -- signal that aAccumulator is compared to

The maxabsaccum opcode is designed to accumulate the maximum value from among many audio signals that may be in different note instances, different channels, or otherwise cannot all be compared at once using the maxabs opcode. maxabsaccum is identical to maxaccum except that it takes the absolute value of aInput before the comparison. Its semantics are similar to vincr since aAccumulator is used as both an input and an output variable, except that maxabsaccum keeps the maximum absolute value instead of adding the signals together. maxabsaccum performs the following operation on each pair of samples:

            if  (abs(aInput) > aAccumulator)  aAccumulator = abs(aInput)

aAccumulator will usually be a global audio variable. At the end of any given computation cycle (k-period), after its value is read and used in some way, the accumulator variable should usually be reset to zero (perhaps by using the clear opcode). Clearing to zero is sufficient for maxabsaccum, unlike the maxaccum opcode.

See Also

minabsaccum, maxaccum, minaccum, max, min, maxabs, minabs, vincr, clear


Author: Anthony Kozar
March 2006

New in Csound version 5.01