Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Sample Level Operators

samphold, downsamp, upsamp, interp, integ, diff

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

Description

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

Initialization

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.

iskip (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)

Performance

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 * Hz / 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.

Example

  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

Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Sample Level Operators