Jaffe ExtensionsKarplusStrongPluckedString 1983
Jaffe ExtensionsKarplusStrongPluckedString 1983
JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide
range of content in a trusted digital archive. We use information technology and tools to increase productivity and
facilitate new forms of scholarship. For more information about JSTOR, please contact [email protected].
Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at
https://about.jstor.org/terms
The MIT Press is collaborating with JSTOR to digitize, preserve and extend access to Computer
Music Journal
In 1960, an efficient computational model for vi- The Karplus-Strong plucked-string algorithm is pre-
brating strings, based on physical resonating, was sented in this issue of Computer Music Journal.
proposed by McIntyre and Woodhouse (1960). This From our point of view, the algorithm consists of
model plays a crucial role in their recent work on a high-order digital filter, which represents the
bowed strings (McIntyre, Schumacher, and Wood- string; and a short noise burst, which represents
house 1981; 1983), and methods for calibrating the the "pluck." The digital filter is given by the dif-
model to recorded data have been developed (Smith ference equation
1983).
Independently, in 1978, Alex Strong devised an Yn = Yn
Xn += Yn-N
Yn-N+ YN+
+ yn-(N+1) (1)
2
efficient special case of the McIntyre-Woodhouse
string model that produces remarkably rich and re- where x. is the input signal amplitude at sample n,
alistic timbres despite its simplicity (Karplus and y, is the output amplitude at sample n, and N is
Strong 1983). Since then, Strong and Kevin Karplus the (approximate) desired pitch period of the note in
have explored several variations and refinements of samples. The noise burst is defined by
the algorithm, with an emphasis on small-system
Au, n = 0, 1, 2,...,N- 1
implementations. We have found that the Karplus- xn = 0, n N,
Strong algorithm can be used with equally impres-
sive results on fast, high-power equipment. The where A is the desired amplitude, and un, [-1,
availability of multiplies, for example, allows sev- the output of a random-number generator. The o
eral modifications and extensions that increase its put yn is taken beginning at time n = N in our
usefulness and flexibility. These extensions are de-implementation.
scribed in this paper. The developments were moti-
vated by musical needs that arose during the
composition of May All Your Children Be Acrobats Analysis of the String Simulator
(1981) for computer-generated tape, eight guitars,
and voice and Silicon Valley Breakdown (1982) for Before proceeding to practical extensions of the
four-channel, computer-generated tape, both writ-gorithm, we will describe the theory on which
ten by David Jaffe. Our theoretical approach and many of them are based. Various concepts from
the extensions based on it have also been applied todigital filter theory are employed. For a tutorial i
the McIntyre-Woodhouse algorithm (Smith 1983). troduction to digital filter theory, see the works
Smith (1982b) and Steiglitz (1974).
The input-output relation of Eq. (1) may be ex-
David A. Jaffe is also affiliated with the Music Department at
Stanford University, and Julius O. Smith is also affiliated with
the Electrical Engineering Department there.
1. In some situations, the sound more closely resembles a str
Computer Music Journal, Vol. 7, No. 2, struck with a hammer or mallet than one plucked with a pic
Summer 1983, 0148-9267/83/020056-14 $04.00/0, but we will always use the term pluck when referring to the
? 1983 Massachusetts Institute of Technology. excitation.
dkx A- Xn-k,
yn = dNy + dN+lyn
tor is the following set of difference equations:
Vn = Yn-N
=x+n L+ d 2
V= n + Vn-
Solving for yn yields 2
Xn1 yn = xn + Wn
Yn XI+d' (2)
1- dN The frequency response of a digital filter is de-
2
fined as the transfer function evaluated at z =
We can convert linear delay-operator equations e's = cos(oT,) + j sin(o Ts), where T, is the sam-
immediately to z-transform equations by replacing pling period in seconds (Ts is the inverse of the sam-
each time signal with its z-transform, and replacing pling rate fj, o = 27rf is radian frequency, f is
d with z-'. It is customary to denote a time signal frequency in Hz, and j = \-7. The frequency re-
in lowercase letters (e.g., x) and the corresponding sponse of the string simulator is then
z-transform in uppercase letters (e.g., X(z)). The 1
H(e,Ts) =
transfer function of a (linear, time-invariant) digital He ') 1 - Ha eiw sHb(e s)'
filter is the z-transform of the output signal divided
where
by the z-transform of the input. The transfer func-
tion of the string simulator is then found to be 1 + e- 'T T
H|(e 2Ts) = e e-' 2cos(coT,/2)
H(Z) AY(z)
Y = X_ 1
H X(z)x 1 l+z - = e-fTscos(rfTs)
2
Hb(es s ) = e- iN = e- if.NT
1
1 - Ha(z)Hb(z)' In this paper it is necessary to consider the am-
plitude response and phase delay of the feedback fil-
where ters separately. The amplitude response is defined
as the magnitude of the frequency response, and
1 + z-
Ha(z) Q 22 it gives the gain of the filter as a function of fre-
quency. The phase delay is defined as minus the
Hb(z) z-N complex angle of the frequency response divided
by radian frequency, and it gives the time delay
This form of the description is shown in Fig. 1. The(in seconds) experienced by a sinusoid at each
feedback loop consists of a length N delay line frequency.
Hb(z) in series with a two-point average Ha(z). Cor- The amplitude response of each component filter
responding to this breakdown of the string simula- is given by
Ga(f) A IHa(eiTs)I = cos(oT,/2)l = Icos(T7fT)l NTs + Ts/2 sec. Experience shows this to corre-
spond well with perceived pitch.
Gb(f) A IHblee ws)I 1.
Thus the delay line Hb is lossless, and the two-
point average Ha exhibits a gain that decreases with Decay of "Harmonics"
frequency according to the first quadrant of a co-
sine. We will assume hereafter that all frequencies Since the signal is only quasi-periodic, it does not
are restricted to the Nyquist limit, that is, If l consist of discrete sinusoids. Essentially, we have
fs/2. In this range, we have (cos(i7fTj) = cos(1rfTs).
many narrow "bands" of energy decaying to zero at
It is convenient to define phase delay in units different rates. When these energy bands are cen-
consisting of samples rather than seconds. The tered at frequencies that are an integer multiple of a
phase delays of Ha and Hb in samples are given by lowest frequency, they will be referred to as har-
monics. When the frequency components are not
Pa(f) - / H(e'2) =1
"- ~oT, 2' necessarily uniformly spaced, the term partial will
be used to emphasize the possibility of inharmo-
nicity. Consider, then, a partial at frequency f Hz
Pb(f) A - / Hb(e'S) = N.
PfT, circulating in the loop. On each pass through the
loop, it suffers an attenuation equal to the loop-
(Lz denotes the complex angle of z). The two-point
amplitude response, Ga(f)Gb(f) = cos(IrfTs); that is,
average has a phase delay equal to half a sample,
and the delay line has a phase delay equal to its one period's attenuation = cos(rfTs).
length.
Since the round-trip time in the loop equals N +
Since the total loop consists of Ha and Hb in se-
1/2 samples, the number of trips through the loop
ries, the loop gain and effective loop length are
after n samples (nTs sec) is equal to n/(N + 1/2) =
loop gain = G(f) Gb(f) = cos(rfT,), tfS/(N + 1/2). Thus the attenuation factor at time
and t = nT, is given by
tf5
loop length = Pa(f) + Pb(f) = N + 1/2 (samples)
af(t) A [cos(7rfTs)] N + 2. (3)
for each sinusoidal frequency f Hz. For example, an initial partial amplitude A at time
In synthesizing a single plucked-string note, we 0 becomes amplitude Aaf(t) at time t seconds,
feed in N samples of white noise at amplitude A where f is the frequency of the partial.
and listen to the output immediately afterward. It The time constant of an exponential decay is tra-
is equivalent to initialize the delay line Hb with ditionally defined as the time when the amplitude
sealed random numbers at time 0 and employ no has decayed to l/e - 0.37 times its initial value.
input signal. Since the two-point average Ha is con- The time constant at frequency f is found by equat-
stantly changing the contents of the loop, the out- ing Eq. (3) to e-'/f and solving for rf, which gives
put signal is not periodic. It is close to periodic,
however, and we use the term period in this loose Zs
t60(/) is accomplished by
_-t 1
k In ak(t) f In Tuning
cos(rfkT,) (secon
The fact that the delay-line
Figure 2 shows the spectral length N must be an
evaluation during
integer causes having
first 16 periods of a note tuning problems. Sincea the funda-
period of
samples. A 128 length mental
Fastfrequency is f, = f/(N + 1/2), the
Fourier allowed
Transform
pitches are quantized,
was computed every other especially at highEach
period. frequency. curve
For large
figure is interpreted as thevalues ofenvelope
N (low pitches), the difference
of the ha
- 20- H(z) A
) 1 - Ha(z)Hb(z)Hc(z)
The filter H, is a first-order allpass filter, and as
a -/ such it has a constant amplitude response. Indeed,
the amplitude response is simply
n
j
C2 sin(co1TJP,(f,) + cw,Tj + 2C sin(co,TPc(fA)) +
sin(co,TP,(fl) - coTj) = 0,
I. I I I ? I
0 Frequency F,/2
where co A_ 27rf. The solution is found, after some
manipulation (Mont-Reynaud 1982), to be
17 values of C equally spaced between -0.999 and
0.999. Note that delays between 0 and 1 sample can -sin(ol TsP(fL)) + sin(olTs)
be provided somewhat uniformly across the fre- sin(wol TsP(f ) + coTj )
quency axis. A delay of 0 samples corresponds to We have introduced an extra root by producing a
C = 1, where the pole and zero of Hc(z) cancel to quadratic equation. The previous approximation
give Hc(z) 1. However, pole-zero cancellation on Eq. (14) indicates that the + sign should be taken.
the unit circle is not a good thing in practice, since Therefore, the final solution is
round-off errors may yield an unstable filter. There-
fore, it is preferable to shift the range of one-sample - sin(c, Tj - sin(o, TsP,c(f))
delay control to the region s < Pc < (1 + e) for sin(cl TsPc(fl) + c Ts)
some small nonnegative e (0 < < 1). It is best not
to shift very far, since the phase-delay curves are -sin( co T - o, TsPc(fl)
less flat in the region beyond one sample's delay. (16)
Note that the delay curves below the one-sample = i( TT,+co, TsPff,
level in Fig. 4 correspond to slightly flattened up-
per partials, while the delay curves above the one- which can be approximated, at low frequencies, by
sample level correspond to slightly sharpened upper 1 - Pc(f,)
partials. The timbre change due to slight systemat- (17)
i + Pc(AM)
ic shifting of the upper partials, of an amount less
than one sample period, was found to be hardly no- Although this technique provides a precise funda-
ticeable. It may even be desirable as a source of sub- mental frequency, it does not guarantee an in-tune
tle timbral variation. In any case, it is important to percept, since the perceived pitch does not always
get the perceived pitch right. coincide with the fundamental frequency. An ad-
To tune the instrument precisely to a desired ditional mapping onto a perceptual tuning dimen-
fundamental frequency f, let P1 equal fs/f, the real sion may be needed for the very high notes. In our
value for the period of the first partial, in samples, case, it was found that tuning the octaves slightly
which would give perfect tuning. Then we desire stretched, as is done in piano tuning, gives a more
N + Pa(fi) + P,(fl) = P. The integer buffer length N satisfying in-tune percept.
61
Jaffe and Smith
(21)
Dynamics
fi = fA,
Simulation of a Moving Pick
where fk is the frequency of the kth partial of the
sympathetically resonating string, and f, is the fre- An effective means of simulating pick position is to
quency of the jth partial of the plucked string. introduce zeros uniformly distributed over the spec-
A problem can arise after several successive noise trum of the noise burst. This can quite accurately
bursts have excited the plucked string. The repeated simulate the effect of plucking a string at varying
reintroduction of energy into the sympathetic string distances from the bridge. The noise burst is fil-
may cause it to overflow. Therefore, it is essential tered with a comb filter, H,, having the difference
Summary
in the loop much more drastically than does the
one-zero, lowpass filter. A technique similar to that
Figure 7 shows a block diagram of the string simu-
used in dynamics simulation could be used to com-
lator with some of our revisions, where Ha is the
pensate for this trend.
feedback lowpass filter, Hb is the delay line, H, is
the allpass filter used for tuning, Hd is the lowpass
filter used to simulate dynamics, He is the comb fil-
Simulation of Stiff Strings
ter that simulates pick position, Hf is the filter that
simulates the difference between "up" and "down"
The spectral components of the basic algorithm
picking, and Hg is the allpass filter used to simulate
that have significant amplitude are almost perfectly
harmonic after the attack noise has been filtered string stiffness.
The simulator provides a high degree of flexibil-
away, corresponding, in the real world, to a per-
ity that begins to approach that of a skilled player
fectly flexible string. But since real strings always
performing on a real musical instrument. Many as-
have some degree of stiffness, it is desirable to alter
pects of a real string instrument have been simu-
the spectrum of the algorithm accordingly. The the-
lated. Pitch can be precisely specified, and articula-
ory of stiff strings (Morse 1976) indicates that stiff-
tion can be finely tuned. An expressive vocabulary
ness creates a stretching of the partials according to
is provided by a wide variety of performance nu-
the approximate formula
ances, including such "left-hand" techniques as
glissandi, slurs, and trills, as well as such "right-
fk = kfo 1 + 1 + k2 8
Tr 282) A kfos(k),
hand" techniques as variation in dynamic level,
4
pick position, and attack characteristics. These pa-
k = 1, 2,..., k2 < 2 rameters were found to be sufficient to create shaped
musical phrases. Furthermore, parameters such as
where fo is near the fundamental frequency,sustain and k time, body resonance, string flexibility,
is the partial number. The parameter 8 has been bridge and pick hardness, and degree of sympathetic
called the coefficient of inharmonicity; if 8string = 0, excitation, which, in the case of real instru-
then perfect harmonicity results. ments, are usually fixed at the time of instrument
This effect can be created, in principle, by construction,
intro- are available as performance parame-
ducing an allpass filter Hg(z) in the string loop ters. It is important to point out that this variety is
(Al-
len 1982) much as was done for the fine tuning at no time
of achieved at the expense of the integrity
pitch. The phase delay in samples desired for of an
the all-
basic sound. Rather, as is the case with a real
pass filter inserted in the feedback loop of a musicalharmonic instrument, the diversity exists within the
string simulator tuned to fl is given by solving bounds of a clearly defined sound domain.
The algorithm originated by Karplus and Strong McIntyre, M. E., R. T. Schumacher, and J. Woodhouse.
and extended by the methods outlined here has 1981. "Aperiodicity in Bowed-String Motion." Acusti
49(1): 13-32.
proven very useful as a computer instrument. In
McIntyre, M. E., R. T. Schumacher, and J. Woodhouse.
the process of composing May All Your Children
press. "On the Oscillations of Musical Instruments."
Be Acrobats and Silicon Valley Breakdown, it was Journal of the Acoustical Society of America.
found to be sufficiently flexible to allow for a wide Mont-Reynaud, B. 1982. Private communication.
range of musical expression and sufficiently idio- Morse, P. M. 1976. Vibration and Sound. New York:
syncratic to maintain a characteristic identity. We American Institute of Physics for the Acoustical So-
expect that new refinements of the algorithm will ciety of America. (Originally published in two editio
continue to arise. [1936 and 1948].)
Smith, J. 0. 1982a. "Synthesis of Bowed Strings." Pape
presented at the Acoustical Society of America Con-
References ference, Chicago, Illinois. (Reprints available upon
request.)
Smith, J. 0. 1982b. "Introduction to Digital Filters."
Abramowitz, M., and I. A. Stegun, eds. 1966. Handbook
Typescript. (Copies available upon request.)
of Mathematical Functions. Washington, D.C.: Na-
tional Bureau of Standards. Smith, J. 0. 1983. "Techniques for Digital Filter Design
and System Identification with Application to the Vio-
Allen, J. B. 1982. Private communication.
lin." Ph.D. Diss., Electrical Engineering Department,
Karplus, K., and A. Strong. 1983. "Digital Synthesis of
Stanford University.
Plucked-String and Drum Timbres." Computer Music
Steiglitz, K. 1974. An Introduction to Discrete Systems.
Journal 7(2): 43- 55.
New York: Wiley.
McIntyre, M. E., and J. Woodhouse. 1960. "On the Fun-
69
Jaffe and Smith