The Alternative Csound Reference Manual
Previous |  | Next

# specsum

specsum -- Sums the magnitudes across all channels of the spectrum.

## Description

Sums the magnitudes across all channels of the spectrum.

## Syntax

ksum specsum wsig [, interp]

## Initialization

interp (optional, default-0) -- if non-zero, interpolate the output signal (koct or ksum). The default value is 0 (repeat the signal value between changes).

## Performance

ksum -- the output signal.

wsig -- the input spectrum.

Sums the magnitudes across all channels of the spectrum. At each new frame of wsig, the magnitudes are summed and released as a scalar ksum signal. Between frames, the output is either repeated or interpolated at the k-rate. This unit produces a k-signal summation of the magnitudes present in the spectral data, and is thereby a running measure of its moment-to-moment overall strength.

## Examples

      ksum     specsum   wsig,  1                    ; sum the spec bins, and ksmooth
               if        ksum < 2000   kgoto  zero   ; if sufficient amplitude
      koct     specptrk  wsig                        ;    pitch-track the signal
               kgoto      contin
    zero:
      koct    =     0                                ; else output zero
    contin:

## See Also

specdisp

Previous | Home | Next
specscal | Up | spectrum