Bilbao Acustica r2
Bilbao Acustica r2
Bilbao Acustica r2
Vol. 98 (2012)
ACUSTICA
Acoustics and Audio Group, Kings Buildings, University of Edinburgh, Edinburgh, United Kingdom.
sbilbao@staffmail.ed.ac.uk
2)
Institute of Music Acoustics, University of Music and Performing Arts, Vienna, Austria
Summary
Collisions play an important role in many aspects of the physics of musical instruments. The striking
action of a hammer or mallet in keyboard and percussion instruments is perhaps the most important
example, but others include reed-beating effects in wind instruments, the string/neck interaction in
fretted instruments such as the guitar as well as in the sitar and the wire/membrane interaction in
the snare drum. From a simulation perspective, whether the eventual goal is the validation of musical
instrument models or sound synthesis, such highly nonlinear problems pose various difficulties, not
the least of which is the risk of numerical instability. In this article, a novel finite difference time
domain simulation framework for such collision problems is developed, where numerical stability
follows from strict numerical energy conservation or dissipation, and where a power law formulation
for collisions is employed, as a potential function within a passive formulation. The power law serves
both as a model of deformable collision, and as a mathematical penalty under perfectly rigid, nondeformable collision. Various numerical examples, illustrating the unifying features of such methods
across a wide variety of systems in musical acoustics are presented, including numerical stability and
energy conservation/dissipation, bounds on spurious penetration in the case of rigid collisions, as well
as various aspects of musical instrument physics.
PACS no. 43.75.Zz
1. Introduction
Various mechanisms of sound production in musical
instruments rely on collisions; the obvious examples
are the interaction of a striking object, such as a hammer with a string, or a drum stick or mallet with a percussive instrument, but more subtle examples include
reed-beating effects in wind instruments, string/neck
interactions along the fretboard of a guitar, and also
in the sitar and tambura, and most dramatically, the
wire/membrane interaction in a snare drum. In all
cases, the collision interaction is necessarily strongly
nonlinear, and simulation design becomes a challenging problem.
Such collisions may be grouped into two types. In
the first, one of the two objects involved in the collision is modelled as lumpedi.e., it is characterized
by a single position/velocity pair. Such is the case for
most models of the hammer-string [1, 2], mallet-bar
[3] and mallet-membrane interactions [4], even if the
colliding object occupies a finite interaction region.
Received 27 October 2012,
accepted 6 December 2012.
ACUSTICA
d2 u
= f
dt2
f=
d
d du
=
/
du
dt dt
(1)
K[u]+1
+
0
+1
f = K[u]
+ . (2)
ACTA ACUSTICA
et un = un1 .
(7)
Forward, backward and centered difference approximations to a first time derivative may thus be defined
as
t+ =
et+ 1
k
1 et
k
t =
t =
et+ et
,(8)
2k
et+ 2 + et
.
k2
(9)
et+ + 1
2
t =
1 + et
2
t =
et+ + et
.(10)
2
The collision model presented above is energy conserving [13]. Multiplying (1) by du/dt leads to
du
du d
d
du d2 u
= f =
=
,
M
2
dt dt
dt
dt du
dt
(3)
(5)
Note that the procedure above, involving multiplication by the velocity, leads to a construction of the
energy conservation law, and can be viewed as the reverse of the procedure employed in the derivation of
equations of motion from expressions for the energy
using Hamiltons equations [34].
For the particular choice of the power law potential
function = K, from (2), the conservation law
implies bounds on both u(t) and du/dt at any time
t, in terms of the initial energy H(0). These may be
arrived at by noting that, as the individual terms of
H in (4) are both non-negative, both are bounded
individually by H(0), leading to:
1
du r 2H(0)
( + 1) H(0) +1
, u(t)
. (6)
dt
M
K
M tt un = f n ,
(11a)
fn =
t n+ 2
t un
n+ 2 = t+ (un )
(11b)
M t un tt un = t un f n = t n+ 2 .
(12)
1
2
t (t+ un )
2
(13)
ACUSTICA
t h
=0
n+ 12
= const. 0 , (14)
f=
M
1
2
=
(t+ un ) + n+ 2 0 .
2
(15)
Bounds on the solution size follow as in the continuous case, under the choice of a power law nonlinearity
K, :
|t+ un |
2h
M
un
2 ( + 1) h
K
1
+1
,(16)
m
((r + a) (a)) + b = 0 , (17)
r
(18)
m = k /M a = u
n1
b = 2u + 2u
n1
(19)
(20)
(21)
fn =
t n+ 2
+ t un n ,
t un
(23)
At each time step, once r is determined, the next displacement un+1 may be determined from r and un1 .
The function G(r), as defined in (17), as well as certain generalized forms, play a central role in all the
algorithms to be described subsequently here in the
distributed case. It has recently been shown [14] that
G(r) = 0 possesses a unique solution for one-sided potentials of power law form. An iterative method such
as the Newton-Raphson algorithm may be employed,
but conditions for global convergence are not obvious.
See Appendix A for more discussion.
d du
+
(u) ,
du
dt
t hn+ 2 = qn
, qn = (t un ) n 0 , (24)
and thus energy is monotonically decreasing, and solution bounds hold as before. The nonlinear equation
to be solved at each time step must be generalized to
G(r) = (1 + c) r +
m
((r + a) (a)) + b = 0 (25)
r
u (mm)
= 1.5
=2
= 2.5
10
20
t (ms)
15
x 10
2
0
2
0
50
100
150
time step n
200
250
10
0
ACTA ACUSTICA
300
Consider real-valued functions (x, t) and (x, t) defined over a d-dimensional domain, with x D Rd ,
and for time t R+ . Particular domains of interest
in the present setting are, for a given length L, a 1D
interval DL and the 2D square domain DL,L , defined
as
DL = {x R|0 x L} , DL,L = DL DL ,(26)
where indicates a Cartesian product. The L2 spatial
inner product and norm are defined as
Z
p
h, iD =
dx , kkD = h, iD 0 , (27)
D
d 1
kk2D = h, t iD ,
(28)
dt 2
where t and d/dt represent partial and total differentiation with respect to t, respectively.
Integration by parts (or Greens first identity) may
be written as
Z
h, iD = h, iD +
n d (29)
D
u (mm)
=0
= 0.5
=1
0
5
10
Energy (J)
t (ms)
0.5
50
100
150
time step n
200
250
300
dN = {l Z, 0 l N }
In the case of a completely rigid collision, some spurious penetration (here u > 0) is inevitable. Considering again the system under the choice of parameters given in Figure 1. Using values of K = 1016 and
= 1.2, approximating such a rigid collision, the penetration is under 8108 m, which is negligible in any
acoustics application.
(30)
(31)
unl ,
A 1D grid function
defined over l d, for some
1D domain d, and for integer n represents an approximation to u(x, t) at t = nk and x = lh.
Similarly, a 2D discrete domain dN,N corresponding
to the square region DL,L may be written as
dN,N = dN dN ,
(32)
(33)
ACUSTICA
(34)
Here and henceforth, a reference to a grid point outside of the domain dN or dN,N indicates a "ghost
point," the value of which will be set subsequently
in terms of values over the interior through an appropriate boundary condition.
Forward, backward and centered difference approximations to a first spatial derivative may be defined
in terms of these shifts as
x+ =
ex+ 1
1 ex
ex+ ex
, x =
, x =
,(35)
h
h
2h
xx =
xxxx
(36a)
(36b)
ex+ + 1
1 + ex
, x =
, xx = x+ x . (37)
2
2
ex unl,m = unl1,m
ey+ unl,m
ey unl,m
unl,m+1
unl,m1
(38)
, (39)
(40)
n
For 2D grid functions nl,m and l,m
, defined over a
domain d, the inner product and norm may be defined
as
X
p
n
h, id =
h2 nl,m l,m
, kkd = h, id 0 .(42)
(l,m)d
(44)
k2
kt uk2d .
4
(45)
(46a)
(46b)
n0 x xx 0n + x+ n0 xx 0n
n
n
+nN x+ xx N
x nN xx N
(43)
kxx ukdN
(47)
Similarly, in 2D, summation by parts in the two directions x and y, may be written as
hn , xx n idN,N = hx+ n , x+ n idN ,N (48a)
+
N
X
m=0
n
n
h2 nN,m x+ N,m
n0,m x 0,m
N
X
l=0
n
n
h2 nl,N y+ l,N
nl,0 y l,0
,
ky+ ukdN,N
2
kukdN,N . (49)
h
ACTA ACUSTICA
(50)
x u = 0
(52)
d
, = uh hg, uiDL .
d
(53)
d
d
hu, giDL =
(uh ) ,
dt
dt
(55)
, H = Hs + Hh .
(56)
(57c)
(57d)
(58)
ACUSTICA
the
PN grid function gl is chosen normalized such that
l=0 hgl = 1.
The operator ls is an approximation to Ls :
hs
(65c)
bns,0
fn =
t n+ 2
, n = unh hg, un idN ,
t n
(60)
kgk2dN
1
+
s (1 + s,0 k) M
b = 2(unh un1
)+
h
where
a = n1
k2
hg, n idN ,
1 + s,0 k
(61)
(62)
(66)
ACTA ACUSTICA
20
hammer velocity 0.5 m/s
hammer velocity 1.5 m/s
hammer velocity 4 m/s
0.03
Energy (J)
f (N)
15
10
0.01
0
0
0.5
1.5
2.5
t (ms)
20
hammer width 3 mm
hammer width 10 mm
hammer width 20 mm
f (N)
15
10
0.5
1.5
t (ms)
2.5
0.5
1.5
t (ms)
2.5
15
x 10
Energy variation
string energy
hammer energy
0.02
0
5
10
0
Figure 5. Top: time evolution of the energy partition between the hammer and string, for the system as given
in the caption to Figure 3, under lossless conditions (i.e.,
with s,0 = s,1 = 0). Bottom: normalized variation in
numerical energy for the combined system.
(69)
30
0
0.5
1.5
2.5
t (ms)
Numerical energy conservation is illustrated in Figure 5, under lossless conditions; as in the case of the
lumped collision, numerical energy is conserved to machine accuracy (here double precision floating point
arithmetic).
As a demonstration of the risk of not using a conservative method in modeling such collisions, consider a
comparison between the results of the scheme (58) using the numerically conservative force definition from
(60), with a simpler non-conservative (and fully explicit) scheme. The simplest possible design employs
f (N)
conservative
nonconservative
20
10
0
0.5
1.5
2.5
t (ms)
Figure 6. Force history, for the system as given in the caption to Figure 3, under lossless and non-stiff conditions,
and under a hammer velocity of 1.5 m/s, using a conservative scheme, and a nonconservative scheme.
ACUSTICA
(70)
(71)
(74)
10
(76)
(77)
ACTA ACUSTICA
(84)
unin = x S0 x n0
(85a)
n
n
ub = x+ SN x+ N , (85b)
n+ 1
(92)
n+ 1
1
t n+ 2
fn =
, n+ 2 = t+ ( n ) ,
t
(87)
(88)
In contrast with the case of the hammer string interaction, due to the presence of two distinct nonlinearities, namely the Bernoulli effect and collision,
there is now a pair of nonlinear equations to be solved
simultaneously. To this end, note that when evaluated
at l = 0, the scheme (84) leads to an instantaneous
relationship between pnin and unin :
pnin = cn0 + c1 unin ,
(89)
(90)
(94)
11
ACUSTICA
50
50
0
100
200
300
400
x (mm)
500
600
y (mm)
0
0.2
0.4
335
340
345
350
t (ms)
355
360
365
340
345
350
t (ms)
355
360
365
y (mm)
0
0.2
0.4
335
Figure 7. Top: clarinet-like bore profile. Middle: steadystate oscillation of the reed position y, under a mouth
pressure of pm = 2000 Pa, for which the reed oscillates
without beating against the lay (illustrated as a grey region at y = 0.4 mm). Bottom: reed position under a
higher pressure of pm = 2500 Pa, illustrating beating effects. The sample rate is 88.2 kHz.
y (mm)
= 1.3
0.4
338
339
340
t (ms)
341
342
y (mm)
= 1.8
0.38
0.4
337
338
339
340
t (ms)
341
342
difference (mm)
s tt u = Ls u + F ,
x 10
(96)
339
340
t (ms)
341
342
Figure 8. Detail of the collision interaction of the reed under beating conditions, using a penalty potential K, , for
K = 1013 and for two different values of the exponent , as
indicated, at top and middle. Bottom: difference between
the two simulation results, in mm.
(99)
12
(95)
0.38
337
n+ 12
, l
ACTA ACUSTICA
(102)
where ln is as defined in (63). In this case, existence and uniqueness follow immediately from the
scalar case, as the nonlinear equations to be solved
are uncoupledwhich is not the case in more complex scenarios where two distributed objects are in
contact. See Section 8.
In this case, where the string and barrier are assumed perfectly rigid, the penalty formulation allows
some spurious penetration. This may be bounded, numerically, by noting that, because the barrier poten1
n+ 1
tial hb satisfies 0 hb 2 hn+ 2 when the scheme is
stable (i.e., under condition (68)), the penetration ln
may be bounded, at all times, by
2 ( + 1) h1/2
Kh
1
+1
(105)
0.2
0.4
x (m)
t =1ms
10
0.2
0.4
x (m)
t =2ms
10
0.2
0.4
x (m)
t =3ms
0.2
0.4
x (m)
0.6
0.2
0.4
x (m)
t =2.5ms
0.6
0.2
0.4
x (m)
t =3.5ms
0.6
0.2
0.4
x (m)
0.6
10
0
10
0.6
10
0
10
0.2
0.4
x (m)
t =1.5ms
0
10
0.6
0
10
10
0
10
0
10
0.6
u (mm)
10
k
k2
, al = et ln , bl =
n , (104)
s (1+s,0 k)
1+s,0 k l
ln
(103)
with
m=
0
10
t =0.5ms
10
u (mm)
m
((rl + al ) (al )) + bl ,
Gl = rl +
rl
t =0ms
10
u (mm)
= hn+ 2 , 1idN 0 ,
u (mm)
n+ 12
hb
u (mm)
n+ 1
u (mm)
n+ 1
(101)
u (mm)
chosen, for illustration). In this case, the string is initialized using a triangular distribution. The potential
K, is employed here, with K = 1013 and = 1.3.
Plots of the time evolution of the string are shown
in Figure 9. Notice in particular the intermittent contact/recontact phenomena in evidence over the collision region, signaling that analysis or synthesis approaches based on a model of such a colliding string in
terms of a moving end point may pose some difficulties, due to the non-contiguity of the freely vibrating
portions of the string [49, 11].
u (mm)
0.6
0
10
13
ACUSTICA
40
umax = 0.1 mm
umax = 1 mm
umax = 10 mm
|
uo | (dB)
20
0
20
40
200
400
600
f (Hz)
800
1000
1200
Figure 10. Spectrum of string response, for the string collision as in Figure 9, under lossless conditions, and under
a triangular excitation of amplitude as indicated.
u (mm)
employed here are questions of the amount of penetration, and also of convergence to an exact solution
across a range of different choices of the penalty potential itself. See Figure 11, showing the preservation
of fine features of the string profile, after undergoing a
collision with the barrier for different values of ; the
difference between the two simulations is also shown,
which is small, and has an oscillatory character (as is
to be expected) concentrated near the barrier interaction region. For = 1.3, and under these conditions,
the maximum penetration of the string into the obstacle can be bounded, from (105), by ln 2.6105 m.
In fact, this bound is rather conservativefor the simulation results shown in Figure 9, the maximum penetration over all grid locations, and over the length of
the simulation is under 3 microns. It should be noted
that it is not claimed here that the existence of an exact solution to the model problem has been proved
rather, it is illustrated that differences among solutions become small, independently of the parameters
which define the collision, for sufficiently large values
of the stiffness K when a rigid barrier is considered.
=1.3
1
0
1
2
u (mm)
difference (mm)
0.1
0.2
0.3
x (m)
0.4
0.5
0.6
0.2
0.3
x (m)
0.4
0.5
0.6
=1.5
1
0
1
2
0
0.1
d2 wh
=f.
(106)
dt2
Here, w = w(x, y, t) is the transverse displacement of
a square membrane, defined for coordinates (x, y)
DL,L , and for t R+ . m is membrane density, in
kg/m2 , and g = g(x, y) represents the region of contact between the mallet
and the membrane, again norR
malized such that DL,L gdxdy = 1. wh represents the
vertical position of the mallet, of mass M . The operator Lm , incorporating effects of tension and simple
frequency-independent loss, is defined as
0
0.05
Lm = Tm 2m,0 m t ,
2
2
+ 2,
2
x
y
(108)
over
DL,L ,
0.1
0.2
0.3
x (m)
(109)
Hm =
0
(107)
Here,
0.05
0.4
0.5
0.6
Figure 11. String profile, for the string collision as in Figure 9, after 2.5 ms, under a penalty potential K, with
K = 1013 , and for two different values of as indicated,
as well as the difference between the two simulations.
14
The interaction of a mallet with a membrane is a generalization to 2D of the hammer string interaction described in Section 4, and may be written as
m tt w = Lm w gf , M
60
80
Qm = 2m,0 m kt wk2DL,L
Bm = Tm t wn w ,
(112a)
(112b)
(112c)
(112d)
ACTA ACUSTICA
7.2. Simulations
n
n
m tt wl,m
= lm wl,m
gl,m f n
M tt whn = f n , (113)
n
where wl,m
, whn and f n are approximations to w (now
defined over the 2D discrete domain dN,N ), wh and
f , respectively, and where lm is an approximation to
Lm :
lm = Tm 2m,0 m t
(114)
fn =
t n+ 2
, n = hg, wn idN,N whn ,(115)
t n
150
(x ,y )dN,N
100
50
0
6
t (ms)
10
12
Energy (J)
3
membrane energy
mallet energy
2
1
0
6
t (ms)
10
12
6
t (ms)
10
12
14
x 10
Energy variation
f (N)
where n+ 2 = t+ ( n ).
As previously, updating scheme (113) requires the
solution of a nonlinear equation of the form (17),
where
!
kgk2dN,N
1
2
m=k
+
a = et n (116)
m (1 + m,0 k) M
kTm
2k
n
b = 2kt wh
hg, t+
wn idN,N .
1+m,0 k
2m
2
0
2
0
(118d)
Here, the notation b+ indicates a spatial first difference operation in the direction normal to the boundary. At corner points in the domain dN,N , it is to be
applied in both directions and summed. Under the
n
condition that wl,m
is zero at the boundary, corresponding to a fixed termination (109), the system is
again dissipative.
A stability condition for scheme (113) follows again
from the non-negativity of hm . Using bounds (45) and
(49) leads to the condition
s
2Tm
h hmin = k
,
(119)
m
which is the same as the bound obtained using frequency domain techniques for the membrane scheme
in isolation.
15
ACUSTICA
t
, = u hg, wiDLm ,Lm .
t
(121)
s tt unl
ls unl
Fln
(122a)
(122b)
Fln
t l
=
t ln
ln = unl (ims wn )l .
(123)
Ultimately, the finite difference scheme can be updated by solving a non-linear equation in the vector
r:
G(r) = r + M + b = 0 ,
(125)
l =
et ln
(rl + al ) (al )
. (126)
rl
As before, al =
and b depend only on known
values of w and u. In contrast with the previous cases,
16
values of the solution r are now coupled by the presence of a square matrix M defined as:
k2
k2
M=
1+
Ims Ism ,(127)
s (1+s,0 k)
m (1+m,0 k)
where 1 represents the identity matrix. Ism and Ims
are the matrix forms of the operators ism and ims ,
respectively, and are required to be the transposes of
one another for energy conservation reasons (see Section 5.2.4 of [17]). Therefore, M is positive definite,
which guarantees existence and uniqueness of the solution (see Appendix A). ) The size of M is the same
as the number of points in the snare involved in the
collisions with the membrane. For example, a string of
25 cm with a typical grid spacing of 5 mm requires 51
points. In a snare drum simulation (see below), this
number must be multiplied by the total number of
snares (generally 10-20).
8.3. Boundary conditions
Boundary conditions for the membrane have been discussed in Section 7. For the string, one possibility is
to use fixed termination at both ends. In real snare
drums, however, the snares are held in contact with
the membrane by two bridges attached to the rim of
the drumhead. In a numerical simulation, this complex termination can be modelled, as a first crude
approximation, by attaching the strings directly to
the membrane. In this case, additional force terms resolved at the boundaries of the string must be added
to the equation for the membrane:
(0)
(L )
n
n
m tt wl,m
= lm wl,m
+ gl,m f (0) + gl,ms f (Ls ) (128)
+ (ism F n )l,m ,
where g (0) and g (Ls ) are suitable distribution functions (e.g., 2D Dirac delta functions) for = 0, Ls .
Energy analysis can be applied to find stable boundary conditions at = 0 (and similarly at = Ls ):
D
E
(129)
u0 = g (0) , w
dNm ,Nm
ACTA ACUSTICA
10
E ne rgy (J )
10
10
10
10
x 10
t (ms)
10
t (ms)
10
14
4
0
Figure 15. Top: energy partition among the various components of the snare drum (solid line: upper membrane,
bold dashed: mallet, dotted: lower membrane, dashed:
air, dot-dashed: snares). Bottom: normalized energy variations.
Figure 13. Diagram of snare drum geometry, illustrating
the various components. A finite enclosure with absorbing
conditions at the walls surrounds the system.
9. Concluding Remarks
This article has explored basic features of time domain numerical simulation of collision interactions
in musical instruments, with a focus on an energy-
17
ACUSTICA
18
(130)
G(r)
= M1 r + + M1 b = 0 .
(131)
ACTA ACUSTICA
19
ACUSTICA
[23] J. O. Smith III: Physical audio signal procesing. Stanford, CA, 2004. Draft version. Available online at
http://ccrma.stanford.edu/jos/pasp04/.
[42] T. Wilson, G. Beavers: Operating modes of the clarinet. J. Acoust. Soc. Am. 64 (1974) 15661569.
[43] P. Guillemain: A digital synthesis model of doublereed wind instruments. EURASIP J. Appl. Sig. Proc.
2004 (2004) 9901000.
[44] S. Karkar, C. Vergez, B. Cochelin: Numerical tools
for musical instruments acoustics: Analysing nonlinear physical models using continuation of periodic solutions. Proc. Acoustics 12, Nantes, France, April
2012.
[45] S. Stewart, W. Strong: Functional model of a simplified clarinet. J. Acoust. Soc. Am. 68 (1980) 109120.
[46] F. Avanzini, M. van Walstijn: Modeling the mechanical response of the reed-mouthpiece-lip system of a
clarinet. Part I. A one-dimensional distributed model.
Acta Acustica united with Acustica 90 (2004) 537
547.
[47] P. Morse, U. Ingard: Theoretical acoustics. Princeton
University Press, Princeton, New Jersey, 1968, 1927.
[48] M. van Walstijn, F. Avanzini: Modeling the mechanical response of the reed-mouthpiece-lip system of a
clarinet. Part II: A lumped model approximation.
Acta Acustica united with Acustica 93 (2007) 435
446.
[49] J. K. R. Burridge, C. Morshedi: The sitar string, a
vibrating string with a one-sided inelastic constraint.
SIAM J. Appl. Math. 42 (1982) 12311251.
[50] M. Schatzman: A hyperbolic problem of second order
with unilateral constraints: The vibrating string with
a concave obstacle. J. Math. Anal. Appl. 73 (1980)
138191.
[51] C. Kelley: Iterative methods for linear and nonlinear
equations. SIAM, Philadelphia, USA, 1995, 1166.
[52] G. Evans, J. Blackledge, P. Yardley: Numerical methods for partial differential equations. Springer, London, UK, 1999, 1290.
[35] K. Hunt, F. Crossley: Coefficient of restitution interpreted as damping in vibroimpact. ASME J. Appl.
Mech. (June 1975) 4405.
[54] J. Ortega, W. Rheinboldt: Iterative solution of nonlinear equations in several variables. SIAM, New
York, 1970, 1572.
20