Use Non-Frames Version Previous Page Next Page
Signal Generators: Waveguide Physical Modeling


  ar      pluck      kamp, kcps, icps, ifn, imeth[, iparm1, iparm2]


Audio output is a naturally decaying plucked string or drum sound based on the Karplus-Strong algorithms.


icps – intended pitch value in Hz, used to set up a buffer of 1 cycle of audio samples which will be smoothed over time by a chosen decay method. icps normally anticipates the value of kcps, but may be set artificially high or low to influence the size of the sample buffer.

ifn – table number of a stored function used to initialize the cyclic decay buffer. If ifn = 0, a random sequence will be used instead.

imeth – method of natural decay. There are six, some of which use parameters values that follow.

  1. simple averaging. A simple smoothing process, uninfluenced by parameter values.
  2. stretched averaging. As above, with smoothing time stretched by a factor of iparm1 (=1).
  3. simple drum. The range from pitch to noise is controlled by a 'roughness factor' in iparm1 (0 to 1). Zero gives the plucked string effect, while 1 reverses the polarity of every sample (octave down, odd harmonics). The setting .5 gives an optimum snare drum.
  4. stretched drum. Combines both roughness and stretch factors. iparm1 is roughness (0 to 1), and iparm2 the stretch factor (=1).
  5. weighted averaging. As method 1, with iparm1 weighting the current sample (the status quo) and iparm2 weighting the previous adjacent one. iparm1 + iparm2must be <= 1.
  6. 1st order recursive filter, with coefs .5. Unaffected by parameter values.

iparm1, iparm2 (optional) – parameter values for use by the smoothing algorithms (above). The default values are both 0.


An internal audio buffer, filled at i-time according to ifn, is continually resampled with periodicity kcps and the resulting output is multiplied by kamp. Parallel with the sampling, the buffer is smoothed to simulate the effect of natural decay.

Plucked strings (1,2,5,6) are best realized by starting with a random noise source, which is rich in initial harmonics. Drum sounds (methods 3,4) work best with a flat source (wide pulse), which produces a deep noise attack and sharp decay.

The original Karplus-Strong algorithm used a fixed number of samples per cycle, which caused serious quantization of the pitches available and their intonation. This implementation resamples a buffer at the exact pitch given by kcps, which can be varied for vibrato and glissando effects. For low values of the orch sampling rate (e.g. sr = 10000), high frequencies will store only very few samples (sr / icps). Since this may cause noticeable noise in the resampling process, the internal buffer has a minimum size of 64 samples. This can be further enlarged by setting icps to some artificially lower pitch.

Use Non-Frames Version Previous Page Next Page
Signal Generators: Waveguide Physical Modeling