Table of contents |
2 Tuning the string 3 Refinements to the algorithm |
|
The period of the resulting signal is the period of the delay line plus the average group delay of the filter; the frequency, as usual, is the reciprocal of the period. The required delay D for a given fundamental frequency F1 is therefore calculated according to D = Fs/F1 where Fs is the sampling frequency.
Digital delay lines are available only with lengths that are whole-number multiples of the sampling period. In order obtain a fractional delay, interpolating filters are used with parameters selected to obtain an appropriate group delay at the fundamental frequency. Either IIR or FIR filters may be used, however FIR have the advantage that transients are supressed if the fractional delay is changed over time. The most elementary fractional delay is the linear interpolation between two samples (e.g., s(4.2) = s(4)*0.8 + s(5)*0.2). If the group delay varies too much with frequency, harmonics may be sharpened or flattened relative to the fundamental frequency.
A demonstration of the Karplus-Strong algorithm can be heard by downloading the following Vorbis file. The algorithm used a loop gain of 0.98 with increasingly attenuating first order lowpass filters. The pitch of the note was A2, or 220 Hz.
Julius O. Smith III and others realized that the Karplus-Strong algorithm was physically analogous to a sampling of the transversal wave on a string instrument, with the filter in the feedback loop representing the total string losses over one period. Generalization of the algorithm lead to digital waveguide synthesis, which could also be used to model acoustic waves in tubes and on drum membranes.Tuning the string
Holding the period (=length of the delay line) constant produces vibrations similar to those of a string or bell. Increasing the period sharply after the transient input produces drum-like sounds.Refinements to the algorithm