Physical Modeling Using Digital Waveguides Julius O. Smith III
Physical Modeling Using Digital Waveguides Julius O. Smith III
Physical Modeling Using Digital Waveguides Julius O. Smith III
Introduction
Music synthesis based on a physical model promises the highest quality when it comes to imitating
natural instruments. Because the articial instrument can have the same control parameters as
the real instrument, expressivity of control is unbounded.
Historically, physical models have led to prohibitively expensive synthesis algorithms, and com-
mercially available synthesizers do not yet appear to make use of them. These days, most syn-
thesizers use either processed digital recordings (\sampling synthesis") or an abstract algorithm
such as Frequency Modulation (FM). However, as computers become faster and cheaper, and as
algorithms based on physical models become more ecient, we may expect to hear more from
them.
Most attempts to synthesize sounds based on a physical model have been based on numerical
integration of the wave equation (covered in any textbook on acoustics). These methods generally
require at least one operation (multiply and/or addition) for each point on a grid which permeates
the instrument. In principle, the grid spacing must be less than half a wavelength at the highest
audio frequency. This is essentially why the computational costs are so high in \brute force"
numerical solutions to the wave equation.
More recently developed \digital waveguide" methods follow a dierent path to the physical
model: the wave equation is rst solved in a general way to obtain traveling waves in the medium
interior. The traveling waves are explicitly simulated in the waveguide model, in contrast to
computing a physical variable. (The traveling waves must be summed together to produce a
physical output.) In the lossless case, a traveling wave between two points in the medium can
be simulated using nothing but a digital delay line. In the general linear case, in which there are
frequency-dependent losses and dispersion, the commutativity of linear time-invariant systems
allows the losses and dispersion to be lumped at discrete points such that most of the simulation
still consists multiply-free delay lines. This is essentially why computational costs are so low in
\waveguide synthesis" algorithms.
Computer-music programmers know very well that a delay line can be implemented by a single
fetch, store, and pointer update for each sample of output. If the delay line is, say, 500 samples
long, (corresponding to a pitch of 44100=500 = 88 Hz in a CD-quality string or bore model), com-
putational requirements relative to \brute force" numerical integration on the grid are reduced
by three orders of magnitude. As a result, for very simple physical models, several CD-quality
voices can be sustained in real time on a single DSP chip costing only a few dollars.
1
This paper develops waveguide synthesis beginning with the wave equation for vibrating strings.
Transverse waves on a string are taken as the primary example due to the relative clarity of
the underlying physics, but the formulation for string simulation is unied with that of the
acoustic tube. The technique of lumping losses at discrete points in the waveguide, replacing
more expensive distributed losses, is described.
The wave equation for the ideal (lossless, linear,
exible) vibrating string, depicted in Fig. 1, is
given by
Ky00 = y
where
K = string tension y = y(t; x)
= linear mass density @ y(t; x)
y_ = @t
y = string displacement @ y(t; x)
y0 = @x
means \is dened as." The wave equation is fully derived in (Morse 1936) and in
where \="
most elementary textbooks on acoustics. It can be interpreted as a statement of Newton's law,
\force = mass acceleration," on a microscopic scale. Since we are concerned with transverse
vibrations on the string, the relevant restoring force (per unit length) is given by the string
tension times the curvature of the string (Ky00); the restoring force is balanced at all times by
the inertial force per unit length of the string which is equal to mass density times transverse
acceleration (y).
The same wave equation applies to any perfectly elastic medium which is displaced along one
dimension. For example, the air column of a clarinet or organ pipe can be modeled using the
one-dimensional wave equation, substituting air pressure deviation for string displacement, and
longitudinal volume velocity of air in the bore for transverse velocity on the string. We refer
to the general class of such media as one-dimensional waveguides. Extensions to two and three
dimensions (and more, for the mathematically curious), are also possible.
2
Traveling-Wave Solution
It can be readily checked that thepwave equation is solved by any string shape which travels to
the left or right with speed c = K=. If we denote right-going traveling waves by yr (x , ct)
and left-going traveling waves by yl (x + ct), where yr and yl are arbitrary twice-dierentiable
functions, then the general class of solutions to the lossless, one-dimensional, second-order wave
equation can be expressed as
y(x; t) = yr (x , ct) + yl (x + ct)
Note that yr = c2 yr00 and yl = c2 yl00 which shows that the wave equation is obeyed regardless of
the traveling wave shapes yr and yl . (But note that the derivation of the wave equation itself
assumes the string slope is much less than 1 at all times and positions.) The traveling-wave
solution of the wave equation was rst published by d'Alembert in 1747.
An example of the appearance of the traveling wave components shortly after plucking an in-
nitely long string at three points is shown in Fig. 2.
p
String Shape at
String Shape at time t0
time 0
c c
Traveling Wave
... ...
p Components p
at time t0
Figure 2. An innitely long string, \plucked" simultaneously at three points, labeled \p" in the
gure, so as to produce an initial triangular displacement. The initial displacement is modeled
as the sum of two identical triangular pulses which are exactly on top of each other at time 0. At
time t0 shortly after time 0, the traveling waves have begun to separate, and their sum gives the
physical string displacement at time t0 which is also shown. Note that only three short string
segments are in motion at that time: the
at top segment which is heading to zero where it will
halt forever, and two short pieces on the left and right which are the leading edges of the left-
and right-going traveling waves. The string is not moving where the traveling waves overlap at
the same slope. When the traveling waves fully separate, the string will be at rest everywhere
but for two half-amplitude triangular pulses heading o to plus and minus innity at speed c.
+
y (n)
+
y (n-1)
+
y (n-2)
+
y (n-3)
... z -1 z -1 z -1 ...
y (nT,0) y (nT,3X)
+
y (n)
+
y (n-M)
... M samples delay ...
y (nT,0) y (nT,)
y-(n) y-(n+M)
... M samples delay ...
(x = 0) (x = ) (x = McT)
Any ideal one-dimensional waveguide can be simulated in this way. It is important to note that
the simulation is exact at the sampling instants, to within the numerical precision of the samples
themselves, provided that the waveshapes traveling along the string are initially bandlimited to less
than half the sampling frequency. In other words, the highest frequencies present in the signals
yr (t) and yl (t) may not exceed half the temporal sampling frequency fs = 1=T ; equivalently, the
highest spatial frequencies in the shapes yr (x=c) and yl (x=c) may not exceed half the spatial sampling
frequency s = 1=X .
Bandlimited spatial interpolation may be used to construct a displacement output for an arbitrary x
not a multiple of cT , as suggested by the output drawn in Fig. 4. Similarly, bandlimited interpolation
across time serves to evaluate the waveform at an arbitrary time not an integer multiple of T .
Ideally, bandlimited interpolation is carried out by convolving a continuous \sinc function" sinc(x) =
sin(x)=x with the signal samples. Specically, convolving a sampled signal x(tn) with sinc[(tn ,
t0 )=T ) \evaluates" the signal at an arbitrary continuous time t0 . The sinc function is the impulse
response of the ideal lowpass lter which cuts o at half the sampling rate.
In practice, the interpolating sinc function must be windowed to a nite duration. This means the
associated lowpass lter must be granted a \transition band" in which its frequency response is
allowed to \roll o" to zero at half the sampling rate. The interpolation quality in the \pass band"
can always be made perfect to within the resolution of human hearing by choosing a suciently large
product of window-length times transition-bandwidth. Given \audibly perfect" quality in the pass
band, increasing the transition bandwidth reduces the computational expense of the interpolation.
This is one reason why oversampling at rates higher than twice the highest audio frequency is helpful.
This topic is described further in (Smith and Gossett 1984).
5
Alternative Wave Variables
We have thus far considered discrete-time simulation of traveling displacement waves y in the ideal
string. It is equally valid to choose traveling velocity v = y_ , acceleration a = y , or slope
waves y00, or perhaps some other derivative or integral of displacement with respect to time and/or
position.
Conversion between various time derivatives can be carried out by means integrators or dierentia-
tors, as depicted in Fig. 5. Since integration and dierentiation are linear operators, and since the
traveling wave arguments are in units of time, the same conversion formulas hold for the traveling
wave components y; v ; a .
In discrete time, integration and dierentiation can be accomplished using digital lters (Rabiner
and Gold 1975). Commonly used approximations are shown in Fig. 6.
z -1
Figure 6. Simple approximate conversions between time derivatives in the discrete-time case:
a) The rst-order dierence. b) The rst-order \leaky" integrator with loss factor g (slightly less
than 1) used to avoid innite DC build-up.
These rst-order approximations are accurate (though scaled by T ) at low frequencies relative to half
the sampling rate, but they are not \best" approximations in any sense other than being most like
the denitions of integration and dierentiation in continuous time. Much better approximations can
be obtained by approaching the problem from a digital lter design viewpoint (Loy 1988; Parks and
Burrus 1987; Rabiner and Gold 1975; Smith 1985a). Arbitrarily better approximations are possible
using higher order digital lters. In principle, a digital dierentiator is a lter whose frequency
response H (ej!T ) optimally approximates j! for ! between ,=T and =T . Similarly, a digital
integrator must match 1=j! along the unit circle in the z plane. The reason an exact match is not
possible is that the ideal frequency responses j! and 1=j!, when wrapped along the unit circle in
the z plane, (which is the frequency axis for discrete time systems), are not \simple" functions any
more. As a result, there is no lter with a rational transfer function (i.e., nite order) that can
match the desired frequency response exactly.
6
Spatial Derivatives
In addition to time derivatives, we may apply any number of spatial derivatives to obtain yet more
wave variables to choose from. The rst spatial derivative of string displacement yields slope waves:
y0 (tn; xm ) = y0(nT; mX ) = yr0 [(n , m)T ] + yl0 [(n + m)T ] = y0+(n , m) + y0, (n + m)
= , 1c y_ + (n , m) + 1c y_ ,(n + m) =
, 1 v+(n , m) + 1 v,(n + m)
c c
1 , +
= c v (n + m) , v (n , m)
From this we conclude that v, = cy0, and v+ = ,cy0+ . That is, traveling slope waves can be
computed from traveling velocity waves by dividing by c and negating in the right-going case.
Physical string slope can thus be computed from a velocity-wave simulation by subtracting the
upper rail from the lower rail and dividing by c.
By the wave equation, curvature waves, y00 = y=c2, are essentially identical to acceleration waves.
In the eld of acoustics, the state of a vibrating string at any instant of time t0 is normally specied by
the displacement y(t0 ; x) and velocity y_ (t0; x) for all x. Since displacement is the sum of the traveling
displacement waves and velocity is proportional to the dierence of the traveling displacement waves,
one state description can be readily obtained from the other.
In summary, all traveling-wave variables can be computed from any one, as long as both the left-
and right-going component waves are available. Alternatively, any two linearly independent physical
variables, such as displacement and velocity, can be used to compute all other wave variables. Wave
variable conversions requiring dierentiation or integration are relatively expensive since a large-
order digital lter is necessary to do it right. Slope waves can be computed from velocity waves by
a simple scaling, and vice versa, and curvature waves are the same as acceleration waves to within
a scale factor.
In the absence of other factors dictating a choice, velocity waves are a good overall choice because (1)
it is numerically easier to perform digital integration to get displacement than it is to dierentiate
displacement to get velocity, (2) slope waves are immediately computable from velocity waves. Why
are slope waves important? This is the subject of the next section.
7
Force Waves
K sin( )
K
K cos( )
K cos( )
y (t,x) K
Displacement K sin( )
0
0 Position x
Power Waves
Basic courses in physics teach us that power is work per unit time, and work is a measure of energy
which is typically dened as force times distance. Therefore, power is in physical units of force times
distance per unit time, or force times velocity. It therefore should come as no surprise that traveling
power waves are dened as
P + (n) = f + (n)v+(n)
P ,(n) = ,f , (n)v,(n)
Note that P + (n) = f + (n)v+(n) = R[v+ (n)]2 = [f + (n)]2=R, and P , (n) = ,f , (n)v,(n) =
R[v, (n)]2 = [f ,(n)]2 =R. Thus both the left- and right-going components are nonnegative. The
sum of the traveling powers at a point thus gives the total power at that point on the string:
P (tn ; xm ) = P +(n , m) + P ,(n + m)
If we had left out the minus sign in the denition of left-going power waves, the sum would instead
be a net power
ow.
Power waves are important for several reasons. They correspond to the actual ability of the wave to
do work on the outside world, such as on a violin bridge at the end of the string. Because energy is
conserved in closed systems, power waves sometimes give a simpler, more fundamental view of wave
phenomena, such as in the case of conical acoustic tubes.
9
Energy Density Waves
The vibrational energy per unit length along the string, or wave energy density (Morse 1936) is given
by the sum of potential and kinetic energy densities:
, , , , 2
W ,(n) = P c(n) = , f (n)cv (n) = v,(n) 2 = [f K(n)]
Thus, traveling power waves (energy per unit time) can be converted to energy density waves (energy
per unit length) by simply dividing by c, the speed of propagation. Quite naturally, the total wave
energy in the string is given by the integral along the string of the energy density:
Z 1 1
E (t) = W (t; x)dx
X
W (t; xm )X
x=,1 m=,1
In practice, of course, the string length is nite, and the limits of integration are from the x coordinate
of the left endpoint to that of the right endpoint, e.g., 0 to L.
The digital simulation diagram for the lossy waveguide is shown in Fig. 8.
+
y (n) g g g
... z -1 z -1 z -1 ...
y (nT,0) y (nT,2cT)
y-(n)
... z -1 z -1 z -1 ...
g g g
Figure 8. Discrete simulation of the ideal, lossy waveguide. The loss factor g = e,T=2
summarizes the distributed loss incurred in one sampling period.
Again note that the simulation of the decaying traveling-wave solution is exact at the sampling
positions and instants, even though losses are admitted in the wave equation. Note also that the
losses which are distributed in the continuous solution have been consolidated, or lumped, at dis-
crete intervals of cT meters in the simulation. The lumping of distributed losses does not introduce
an approximation error at the sampling points. Furthermore, bandlimited interpolation can yield
arbitrarily accurate reconstruction between samples. The only restriction is again that all initial
conditions and excitations be bandlimited to half the sampling rate.
y (nT,0) y (nT,2cT)
y-(n)
... z -1 z -1 z -1 ...
g2 g
Figure 9. Discrete simulation of the ideal, lossy waveguide. Each per-sample loss factor g
is \pushed through" delay elements and combined with other loss factors until an input or
output is encountered which inhibits further migration. If further consolidation is possible
on the other side of a branching node, a loss factor can be pushed through the node by
pushing a copy into each departing branch. If there are other inputs to the node, the
inverse of the loss factor must appear on each of them. Similar remarks apply to pushing
backwards through a node.
Frequency-Dependent Losses
In nearly all natural wave phenomena, losses increase with frequency. The largest losses in a real
stringed instrument occur at the bridge, particularly at frequencies which couple to body resonances.
There are also losses due to air drag and internal bulk losses in the string which increase monoton-
ically with frequency. Similarly, air absorption increases with frequency, providing an increase in
propagation loss for sound waves in air (Morse and Ingard 1968).
The solution to the lossy wave equation can be generalized to the frequency-dependent case. Instead
of factors g distributed throughout the diagram, the factors are now G(!). These loss factors,
implemented as digital lters, may also be consolidated at a minimum number of points in the
waveguide without introducing an approximation error.
In an ecient digital simulation, each lumped loss factor G(!) is to be approximated by a rational
frequency response G^ (ej!T ). In general, the coecients of the optimal rational loss lter are obtained
by minimizing jj G(!) , G^ (ej!T ) jj with respect to the lter coecients or the poles and zeros of
the lter. To avoid introducing frequency-dependent delay, the loss lter should be a zero-phase,
nite-impulse-response (FIR) lter (Rabiner and Gold 1975). Restriction to zero phase requires the
impulse response g^(n) to be nite in length (i.e., an FIR lter) and it must be symmetric about time
zero, i.e., g^(,n) = g^(n). For real-time implementations, the zero-phase FIR lter can be converted
into a causal linear phase lter by \stealing" delay from the loop delay lines in an amount equal to
half the impulse response duration.
Rigid Terminations
A rigid termination is the simplest case of a string termination. It imposes the constraint that the
string cannot move at all at the termination. If we terminate a length L ideal string at x = 0 and
x = L, we then have the \boundary conditions"
y(t; 0) 0 y(t; L) 0
where \" means \identically equal to," i.e., equal for all t.
Since y(t; 0) = yr (t) + yl (t) = y+ (t=T ) + y, (t=T ) and y(t; L) = yr (t , L=c) + yl (t + L=c), the
constraints on the sampled traveling waves become
y+ (n) = ,y,(n)
y, (n + N=2) = ,y+ (n , N=2)
where N = 2L=X is the time in samples to propagate from one end of the string to the other and
back, or the total \string loop" delay. The loop delay is also equal to twice the number of spatial
13
samples along the string. A digital simulation diagram for the terminated ideal string is shown in
Fig. 10. A \pick-up" is shown at the arbitrary location x = .
+
y (n) N/2 samples delay +
y (n-N/2)
(x = 0) (x = L = NX/2 = NcT/2)
Figure 10. The rigidly terminated ideal string, with a position output indicated at x = . Rigid
terminations re
ect traveling displacement, velocity, or acceleration waves with a sign inversion.
Slope or force waves re
ect with no sign inversion.
y(t0,x)
c c
String Shape at
time t0
Traveling Wave
Components
0
Position x
x=L
x=0
Figure 11. A doubly terminated string, \plucked" at one fourth its length.
An example of an initial \pluck" excitation in a digital waveguide string model is shown in Fig.
12. There is one ne point to note for the discrete-time case: We cannot admit a sharp corner in
the string since that would have innite bandwidth which would alias when sampled. Therefore,
for the discrete-time case, we dene the ideal pluck to consist of an arbitrary shape as in Fig. 12
14
lowpass ltered to half the sampling rate (or less). Alternatively, we can simply require the initial
displacement shape to be bandlimited to spatial frequencies less than fs =2c. Since all real strings
have some degree of stiness which prevents the formation of perfectly sharp corners, and since real
plectra are never in contact with the string at only one point, and since the frequencies we do allow
span the full range of human hearing, the bandlimited restriction is not a binding one. So, given
proper bandlimiting of the initial shape, it is valid to replace the continuous curve with its samples
without changing the information content.
+
y (n)
+
y (n-N/2)
y-(n) y-(n+N/2)
(x = 0) (x = L)
Figure 12. Initial conditions for the ideal plucked string. The initial contents of the
sampled, traveling-wave delay lines are in eect plotted inside the delay-line boxes.
The amplitude of each traveling-wave delay line is half the amplitude of the initial
string displacement. The sum of the upper and lower delay lines gives the actual
initial string displacement.
Note that acceleration (or curvature) waves are a simple choice for plucked string simulation, since
the ideal pluck corresponds to an initial impulse in the delay lines at the pluck point. Of course,
since we require a bandlimited excitation, the initial acceleration distribution will be replaced by
the impulse response of the anti-aliasing lter. If the anti-aliasing lter chosen is the ideal lowpass
lter cutting o at fs =2, the initial acceleration a(0; x) = y(0; x) for the ideal pluck becomes
A sinc x , xp
a(0; x) = X X
where A is amplitude, xp is the pick position, and sinc[(x , xp)=X ] is the ideal, bandlimited impulse,
centered at xp and having a rectangular spatial frequency response extending from ,X to X .
Division by X normalizes the area under the initial shape curve. If xp is chosen to lie exactly on a
spatial sample xm = mX , the initial conditions for the ideal plucked string are as shown in Fig. 13
for the case of acceleration or curvature waves. All initial samples are zero except one in each delay
line.
More generally, bowed string models involving a string with a periodic plucking excitation (Smith
1983) can be calibrated to recorded data by means of linear predictive coding (LPC) which has been
very successful in speech modeling (Makhoul 1975; Markle and Gray 1976).
15
c
a+(n) a+(n-N/2)
Bridge -1 -1 Nut
c
a- (n) a-(n+N/2)
(x = 0) (x = L)
Figure 13. Initial conditions for the ideal plucked string when the wave variables are
chosen to be proportional to acceleration or curvature. If the bandlimited ideal pluck
position is centered on a spatial sample, there is only a single nonzero sample in each
of the initial delay lines.
c
v+(n) v+(n-N/2)
c
v-(n) v-(n+N/2)
(x = 0) (x = L)
Figure 14. Initial conditions for the ideal struck string in a velocity wave simulation.
Since v = f =R = cy0, the initial velocity distribution can be integrated with
respect to x from x = 0, divided by c, and negated in the upper rail to obtain equivalent
initial displacement waves (Morse 1936).
Output (non-physical)
+
y (n-N/2) g
N/2
+
y (n) N/2 samples delay, N/2 loss factors g
Bridge -1 -1 Nut
Rigid Termination Rigid Termination
y-(n) y-(n+N/2) g
-N/2
N/2 samples delay, N/2 loss factors g
(x = 0) (x = L)
Figure 15. Discrete simulation of the rigidly terminated string with resistive losses. The N loss
factors g are embedded between the delay-line elements.
In this string simulator, there is a loop of delay containing N = 2L=X = fs =f1 samples where f1 is
the desired pitch of the string. Because there is no input/output coupling, we may lump all of the
losses at a single point in the delay loop. Furthermore, the two re
ecting terminations (gain factors
of ,1) may be commuted so as to cancel them. Finally, the right-going delay may be combined with
the left-going delay to give a single, length N , delay line. The result of these inaudible simplications
is shown in Fig. 16.
+ +
Output y (n) N samples delay y (n-N)
gN
Figure 16. Discrete simulation of the rigidly terminated string with consolidated losses
(frequency-independent). All N loss factors g have been \pushed" through delay elements
and combined at a single point.
If the sampling rate is fs = 50 kHz and the desired pitch is f1 = 100 Hz, the loop delay equals
N = 500 samples. Since delay lines are eciently implemented as circular buers, the cost of
17
implementation is normally dominated by the loss factors, each one requiring a multiply every
sample, in general. (Losses of the form 1 , 2,k , 1 , 2,k , 2,l , etc., can be eciently implemented
using shifts and adds.) Thus, the consolidation of loss factors has reduced computational complexity
by three orders of magnitude, i.e., by a factor of 500 in this case. However, the physical accuracy of
the simulation has not been compromised. In fact, the accuracy is improved because the N round-o
errors arising from repeated multiplication by g have been replaced by a single round-o error in
gN .
The Plucked String with Frequency-Dependent Damping
As discussed previously, damping should increase at higher frequencies for better realism. This
means the loss factors g of the previous section are replaced by digital lters having gains which
decrease with frequency and never exceeding 1. These lters commute with delay elements because
they are time invariant. Thus, following the reasoning of the previous section, they can be lumped at
a single point in the digital waveguide. Let G^ (z) denote the resulting string loop lter. We have the
constraint jG^ (ej!T )j 1, and making it zero or linear phase will restrict consideration to symmetric
FIR lters only.
G^ (z)
In the simplest case of a rst-order lowpass loss lter, G^ (z) = b0 +b1 z,1 , the linear-phase requirement
imposes b0 = b1. Assuming the damping approaches zero at frequency zero implies b0 + b1 = 1.
Thus, two equations in two unknowns uniquely determine the coecients to be b0 = b1 = 1=2 which
gives a string loop frequency response equal to G^ (ej!T ) = cos (!T=2) ; j!j fs.
The simulation diagram for the ideal string with the simplest frequency-dependent loss lter is
shown in Fig. 17. Readers of the computer music literature will recognize this as the structure of
the Karplus-Strong algorithm (Karplus and Strong 1983; Jae and Smith 1983; Sullivan 1990).
+ +
Output y (n) N samples delay y (n-N)
1/2
1/2
z -1
Figure 17. Rigidly terminated string with the simplest frequency-dependent loss
lter. All N loss factors (possibly including losses due to yielding terminations) have
been consolidated at a single point and replaced by a one-zero lter approximation.
The Karplus-Strong algorithm, per se, is obtained when the initial conditions used to \pluck" the
string are obtained by lling the delay line with random numbers, or \white noise." We know the
initial shape of the string is obtained by adding the upper and lower delay lines of Fig. 15, i.e.,
y(tn ; xm ) = y+ (n , m) + y, (n + m). It was also noted earlier how the initial velocity distribution
along the string is determined by the dierence between the upper and and lower delay lines. Thus,
in the Karplus-Strong algorithm, the string is \plucked" by a completely random initial displacement
and initial velocity distribution. This is a very energetic excitation, and usually in practice a lowpass
lter is applied to the white noise to subdue it.
18
Single-Reed Instruments
A simplied model for a single-reed instrument is shown in Fig. 18.
Embouchure
p+ ( n )
Mouth
Pressure Reed Bore Tone-Hole Lattice Bell
p ( n )
19
Bowed Strings
A general block diagram for bowed strings is shown in Fig. 19. The bow divides the string into two
sections, so the bow model is a nonlinear two-port, in contrast with the reed which was a one-port
terminating the bore at the mouthpiece. In the case of bowed strings, the primary control variable
is bow velocity, so velocity waves are the natural choice for the delay lines.
v+ ( n )
-1 String Bow String Bridge Body
v ( n )
The theory of bow-string interaction is described in (McIntyre and Woodhouse 1979; McIntyre,
Schumacher, and Woodhouse 1983). The basic operation of the bow is to reconcile the bow-string
friction curve with the string state and string wave impedance. In a bowed string simulation as
in Fig. 19, a velocity input (which is injected equally in the left- and right-going directions) must
be found such that the transverse force of the bow against the string is balanced by the reaction
force of the moving string. If bow-hair dynamics are neglected, the bow-string interaction can also
be simulated using a memoryless table lookup or segmented polynomial (Smith 1986). An overall
model for the violin is developed in (Smith 1983).
Conclusions
Starting with the traveling-wave solution to the wave equation and sampling across time and space,
we obtained a modeling framework known as the \digital waveguide" approach. Its main feature is
computational economy in the context of a true physical model. Successful computational models
have been obtained for several musical instruments of the string and wind families, and more are on
the way.
While physics-based synthesis can provide extremely high quality and expressivity in a very compact
algorithm, new models must be developed for each new kind of instrument, and for many instruments,
no suciently concise algorithm is known. Sampling synthesis, on the other hand is completely gen-
eral since it involves only playing back and processing natural recorded sound. However, sampling
synthesis demands huge quantities of memory for the highest quality and multidimensional control.
It seems reasonable therefore to expect that many musical instrument categories now being imple-
mented via sampling synthesis will ultimately be upgraded to parsimonious, computational models
based on musical acoustics. As this evolution proceeds, the traditional instrument quality available
from a given area of silicon should increase dramatically.
20
Appendix A | Programming Example for the Plucked String
/* pluck.c - elementary waveguide simulation of plucked strings - JOS 6/6/92 */
#import <libc.h>
/* lg_dl_update(dl, insamp);
* Places "nut-reflected" sample from upper delay-line into
* current lower delay-line pointer location (which represents
* x = 0 position). The pointer is then incremented (i.e. the
* wave travels one sample to the left), turning the previous
* position into an "effective" x = L position for the next
21
* iteration.
*/
static inline void lg_dl_update(DelayLine *dl, short insamp) {
register short *ptr = dl->pointer;
*ptr = insamp;
ptr++;
if (ptr > dl->end)
ptr = dl->data;
dl->pointer = ptr;
}
/* rg_dl_update(dl, insamp);
* Decrements current upper delay-line pointer position (i.e.
* the wave travels one sample to the right), moving it to the
* "effective" x = 0 position for the next iteration. The
* "bridge-reflected" sample from lower delay-line is then placed
* into this position.
*/
static inline void rg_dl_update(DelayLine *dl, short insamp) {
register short *ptr = dl->pointer;
ptr--;
if (ptr < dl->data)
ptr = dl->end;
*ptr = insamp;
dl->pointer = ptr;
}
/* dl_access(dl, position);
* Returns sample "position" samples into delay-line's past.
* Position "0" points to the most recently inserted sample.
*/
static inline short dl_access(DelayLine *dl, int position) {
short *outloc = dl->pointer + position;
while (outloc < dl->data)
outloc += dl->length;
while (outloc > dl->end)
outloc -= dl->length;
return *outloc;
}
/*
* Right-going delay line:
* -->---->---->---
* x=0
* (pointer)
* Left-going delay line:
* --<----<----<---
* x=0
* (pointer)
*/
22
/* rg_dl_access(dl, position);
* Returns spatial sample at location "position", where position zero
* is equal to the current upper delay-line pointer position (x = 0).
* In a right-going delay-line, position increases to the right, and
* delay increases to the right => left = past and right = future.
*/
static inline short rg_dl_access(DelayLine *dl, int position) {
return dl_access(dl, position);
}
/* lg_dl_access(dl, position);
* Returns spatial sample at location "position", where position zero
* is equal to the current lower delay-line pointer position (x = 0).
* In a left-going delay-line, position increases to the right, and
* delay DEcreases to the right => left = future and right = past.
*/
static inline short lg_dl_access(DelayLine *dl, int position) {
return dl_access(dl, position);
}
upper_rail = initDelayLine(rail_length);
lower_rail = initDelayLine(rail_length);
#ifdef DEBUG
initial_shape[pickSample] = 1;
#else
for (i = 0; i < pickSample; i++)
initial_shape[i] = upslope * i;
for (i = pickSample; i < rail_length; i++)
initial_shape[i] = downslope * (rail_length - 1 - i);
#endif
/*
* Initial conditions for the ideal plucked string.
* "Past history" is measured backward from the end of the array.
*/
23
setDelayLine(lower_rail, initial_shape, 0.5);
setDelayLine(upper_rail, initial_shape, 0.5);
return outsamp;
}
24
for (i = 0; i < sampleCount; i++)
data[i] = soundData[i];
err = SNDWriteSoundfile(name,sound);
if(err)
fprintf(stderr,"*** Could not write sound file %s\n",name);
else
printf("File %s written.\n",name);
return err;
}
if (argc != 8) {
fprintf(stderr, "Usage: %s amp(<1.0) pitch(Hz) pickPosition(<1.0) "
"pickupPosition(<1.0) duration(sec) writeSamp out.snd\n",
argv[0]);
fprintf(stderr, "example: %s .5 100 .1 .2 1 -1 test.snd\n", argv[0]);
exit(1);
}
sscanf(argv[1],"%lf",&);
sscanf(argv[2],"%lf",&pitch);
sscanf(argv[3],"%lf",&pick);
sscanf(argv[4],"%lf",&pickup);
sscanf(argv[5],"%lf",&duration);
sscanf(argv[6],"%lf",&writesample);
25
pickupSample = initString(amp, pitch, pick, pickup);
References
A. H. Benade, \Equivalent Circuits for Conical Waveguides," J. Acoust. Soc. Amer., vol. 83, no. 5,
pp. 1764{1769, May 1988.
P. R. Cook, \Identication of Control Parameters in an Articulatory Vocal Tract Model, with
Applications to the Synthesis of Singing," Ph.D. Dissertation, Elec. Eng. Dept., Stanford University,
Dec. 1990.
\TBone: An Interactive WaveGuide Brass Instrument Synthesis Workbench for the NeXT Machine,"
Proc. 1991 International Computer Music Conference,, pp. 297{300, Montreal.
L. Cremer, The Physics of the Violin, MIT Press, Cambridge MA, 1984.
L. Hiller and P. Ruiz, \Synthesizing Musical Sounds by Solving the Wave Equation for Vibrating
Objects," J. Audio Eng. Soc., Part I: vol. 19, no. 6, June 1971; Part II: vol. 19, no. 7, July/Aug.
1971.
A. Hirschberg, \A Quasi-Stationary Model of Air Flow in the Reed Channel of Single-Reed Wood-
wind Instruments," Acustica, vol. 70, pp. 146{154, 1990.
S. Hirschman, P. R. Cook, and J. O. Smith, \Digital Waveguide Modelling and Simulation of Reed
Woodwind Instruments," Eng. Dissertation, Elec. Eng. Dept., Stanford University, May 1991.
K. Karplus and A. Strong, \Digital Synthesis of Plucked String and Drum Timbres," Computer
Music J., vol. 7, no. 2, pp. 43{55, 1983.
D. H. Keefe, \Theory of the Single Woodwind Tone Hole," \Experiments on the Single Woodwind
Tone Hole," J. Acoust. Soc. Amer., vol. 72, no. 3, pp. 676{699, Sep. 1982.
N. J. Loy, An Engineer's Guide to FIR Digital Filters, Prentice-Hall Inc., Englewood Clis, NJ,
1988.
J. Makhoul, \Linear Prediction: A Tutorial Review," Proc. IEEE, vol. 63, pp. 561{580, Apr. 1975.
J. D. Markel and A. H. Gray, Linear Prediction of Speech, Springer-Verlag, New York, 1976.
M. E. McIntyre and J. Woodhouse, \On the Fundamentals of Bowed String Dynamics," Acustica,
vol. 43, no. 2, pp. 93{108, Sep. 1979.
M. E. McIntyre, R. T. Schumacher, and J. Woodhouse, \On the Oscillations of Musical Instruments,"
J. Acoust. Soc. Amer., vol. 74, no. 5, pp. 1325{1345, Nov. 1983.
P. M. Morse, Vibration and Sound, published by the American Institute of Physics for the Acoustical
Society of America, 1976 (1st ed. 1936, 2nd ed. 1948).
P. M. Morse and K. U. Ingard, Theoretical Acoustics, McGraw-Hill, New York, 1968.
T. W. Parks and C. S. Burrus, \Digital Filter Design," John Wiley and Sons, Inc., New York, June
1987.
A. D. Pierce, Acoustics, Amer. Inst. Physics for Acoust. Soc. Amer., (516)349-7800 x 481, 1989.
L. R. Rabiner and B. Gold, Theory and Application of Digital Signal Processing, Prentice-Hall Inc.,
Englewood Clis, NJ, 1975.
C. Roads and J. Strawn, eds., Foundations of Computer Music, MIT Press, Cambridge MA, 1985.
C. Roads, ed., The Music Machine, MIT Press, Cambridge MA, 1989.
P. M. Ruiz, \A Technique for Simulating the Vibrations of Strings with a Digital Computer," M.
Music Diss., Univ. Ill., Urbana, 1969.
J. O. Smith, \Techniques for Digital Filter Design and System Identication with Application to
the Violin," Ph.D. Dissertation, Elec. Eng. Dept., Stanford University, June 1983.
27
J. O. Smith and P. Gossett, \A Flexible Sampling-Rate Conversion Method," Proc. IEEE Conf.
Acoust. Sp. and Sig. Proc., vol. 2, pp. 19.4.1-19.4.2, San Diego, March 1984.
J. O. Smith, \Introduction to Digital Filter Theory," In J. Strawn, ed., Digital Audio Signal Pro-
cessing: An Anthology. William Kaufmann, Inc., Los Altos, California, 1985. A shortened version
appears in The Music Machine, , Roads, C., ed., MIT Press, 1989.
J. O. Smith, \A New Approach to Digital Reverberation using Closed Waveguide Networks," Proc.
1985 International Computer Music Conference, Vancouver Canada, Computer Music Association,
1985. Music Dept. Tech. Rep. STAN{M{31, Stanford University, July 1985.
J. O. Smith, \Ecient Simulation of the Reed-Bore and Bow-String Mechanisms," Proc. 1986 In-
ternational Computer Music Conference, The Hague, Netherlands.
J. O. Smith, \Music Applications of Digital Waveguides," (A compendium containing four related
papers and presentations.) CCRMA Tech. Rep. STAN{M{67, Stanford University, 1987, (415)723-
4971.
J. O. Smith, \Ecient Yet Accurate Models for Strings and Air Columns using Sparse Lumping
of Distributed Losses and Dispersion," Proc. Colloquium on Physical Modeling,, Grenoble, 1990.
CCRMA Tech. Rep. STAN{M{67, Stanford University.
J. O. Smith, \Waveguide Simulation of Non-Cylindrical Acoustic Tubes," Proc. 1991 International
Computer Music Conference,, pp. 304{307, Montreal.
R. D. Strum and D. E. Kirk, First Principles of Discrete Systems and Digital Signal Processing,
Addison-Wesley, Reading MA, 1988.
C. R. Sullivan, \Extending the Karplus-Strong Algorithm to Synthesize Electric Guitar Timbres
with Distortion and Feedback," Computer Music J., vol. 14, no. 3, pp. 26{37, Fall 1990.
28