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

samphold, downsamp, upsamp, interp, integ, diff, samphold

     kr   downsamp  asig[, iwlen]
     ar   upsamp    ksig 
     ar   interp    ksig[, istor]
     kr   integ     ksig[, istor]
     ar   integ     asig[, istor]
     kr   diff      ksig[, istor]
     ar   diff      asig[, istor]
     kr   samphold  xsig, kgate[, ival, ivstor]
     ar   samphold  asig, xgate[, ival, ivstor]


Modify a signal by up- or down-sampling, integration, and differentiation.


iwlen (optional) - window length in samples over which the audio signal is averaged to determine a downsampled value. Maximum length is ksmps; 0 and 1 imply no window averaging. The default value is 0.

istor (optional) - initial disposition of internal save space ( see reson). The default value is 0.

ival, ivstor (optional) - controls initial disposition of internal save space. If ivstor is zero the internal "hold" value is set to ival ; else it retains its previous value. Defaults are 0,0 (i.e. init to zero)


downsamp converts an audio signal to a control signal by downsampling. It produces one kval for each audio control period. The optional window invokes a simple averaging process to suppress foldover.

upsamp, interp convert a control signal to an audio signal. The first does it by simple repetition of the kval, the second by linear interpolation between successive kvals. upsamp is a slightly more efficient form of the assignment, `asig = ksig'.

integ, diff perform integration and differentiation on an input control signal or audio signal. Each is the converse of the other, and applying both will reconstruct the original signal. Since these units are special cases of low-pass and high-pass filters, they produce a scaled (and phase shifted) output that is frequency-dependent. Thus diff of a sine produces a cosine, with amplitude 2 * sin(pi * cps / sr) that of the original (for each component partial); integ will inversely affect the magnitudes of its component inputs. With this understanding, these units can provide useful signal modification.

samphold performs a sample-and-hold operation on its input according to the value of gate. If gate > 0, the input samples are passed to the output; If gate >= 0, the last output value is repeated. The controlling gate can be a constant, a control signal, or an audio signal.


  asrc   buzz      10000,440,20, 1     ; band-limited pulse train
  adif   diff      asrc                ; emphasize the highs
  anew   balance   adif, asrc          ;   but retain the power
  agate  reson     asrc,0,440          ; use a lowpass of the original
  asamp  samphold  anew, agate         ;   to gate the new audiosig
  aout   tone      asamp,100           ; smooth out the rough edges

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

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