QUICK-REF - CsoundManual - Top of this section - Previous - Contents - Index - Next 

specaddm, specdiff, specscal, spechist, specfilt

   wsig   specaddm   wsig1, wsig2[, imul2]
   wsig   specdiff   wsigin
   wsig   specscal   wsigin, ifscale, ifthresh
   wsig   spechist   wsigin
   wsig   specfilt   wsigin, ifhtim

INITIALIZATION

imul2 (optional) - if non-zero, scale the wsig2 magnitudes before adding. The default value is 0.

PERFORMANCE

specaddm - do a weighted add of two input spectra. For each channel of the two input spectra, the two magnitudes are combined and written to the output according to: magout = mag1in + mag2in * imul2. The operation is performed whenever the input wsig1 is sensed to be new. This unit will (at Initialization) verify the consistency of the two spectra (equal size, equal period, equal mag types).

specdiff - find the positive difference values between consecutive spectral frames. At each new frame of wsigin, each magnitude value is compared with its predecessor, and the positive changes written to the output spectrum. This unit is useful as an energy onset detector.

specscal - scale an input spectral datablock with spectral envelopes. Function tables ifthresh and ifscale are initially sampled across the (logarithmic) frequency space of the input spectrum; then each time a new input spectrum is sensed the sampled values are used to scale each of its magnitude channels as follows: if ifthresh is non-zero, each magnitude is reduced by its corresponding table-value (to not less than zero); then each magnitude is rescaled by the corresponding ifscale value, and the resulting spectrum written to wsig.

spechist - accumulate the values of successive spectral frames. At each new frame of wsigin, the accumulations-to-date in each magnitude track are written to the output spectrum. This unit thus provides a running histogram of spectral distribution.

specfilt - filter each channel of an input spectrum. At each new frame of wsigin, each magnitude value is injected into a 1st-order lowpass recursive filter, whose half-time constant has been initially set by sampling the ftable ifhtim across the (logarithmic) frequency space of the input spectrum. This unit effectively applies a persistence factor to the data occurring in each spectral channel, and is useful for simulating the energy integration that occurs during auditory perception. It may also be used as a time-attenuated running histogram of the spectral distribution.

EXAMPLE:

   wsig2    specdiff wsig1      ; sense onsets 
   wsig3    specfilt wsig2, 2   ; absorb slowly 
   specdisp wsig2, .1           ; & display both spectra 
   specdisp wsig3, .1


QUICK-REF - CsoundManual - Top of this section - Previous - Contents - Index - Next 

HTML Csound Manual - © Jean Piché & Peter J. Nix, 1994-97