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.
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.