Content uploaded by Stefan Bilbao
Author content
All content in this area was uploaded by Stefan Bilbao on Sep 02, 2019
Content may be subject to copyright.
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
LARGE-SCALE REAL-TIME MODULAR PHYSICAL MODELING SOUND SYNTHESIS
Stefan Bilbao
Acoustics and Audio Group
University of Edinburgh, Edinburgh, UK
sbilbao@ed.ac.uk
Michele Ducceschi ∗
Acoustics and Audio Group
University of Edinburgh, Edinburgh, UK
michele.ducceschi@ed.ac.uk
Craig J. Webb
Physical Audio Ltd.,
London, UK
craig@physicalaudio.co.uk
ABSTRACT
Due to recent increases in computational power, physical modeling
synthesis is now possible in real time even for relatively complex
models. We present here a modular physical modeling instrument
design, intended as a construction framework for string- and bar-
based instruments, alongside a mechanical network allowing for
arbitrary nonlinear interconnection. When multiple nonlinearities
are present in a feedback setting, there are two major concerns.
One is ensuring numerical stability, which can be approached us-
ing an energy-based framework. The other is coping with the com-
putational cost associated with nonlinear solvers—standard itera-
tive methods, such as Newton-Raphson, quickly become a compu-
tational bottleneck. Here, such iterative methods are sidestepped
using an alternative energy conserving method, allowing for great
reduction in computational expense or, alternatively, to real-time
performance for very large-scale nonlinear physical modeling syn-
thesis. Simulation and benchmarking results are presented.
1. INTRODUCTION
One goal of physical modeling synthesis is the emulation of exist-
ing musical instruments, perhaps with extensions in terms of de-
sign and functionality not easily realisable in the real world. An-
other is the design of new instruments, without a real-world ref-
erent. The hope is that through adherence to the laws of physics,
synthetic sound of a natural acoustic character can be produced. In
this setting, modularity is an important concept—the idea is to give
the user control over instrument design through the interconnec-
tion of semi-independent modules. In this contribution, a modular
network, consisting of a set of string- or bar-like elements coupled
through an auxiliary nonlinear connection network is presented.
Modularity in physical modeling synthesis is not new. The ear-
liest attempt at a complete synthesis system, due to Cadoz [1], had
such a modularity principle explicitly built in—the basic elements
were masses and springs, through the interconnection of which
more elaborate instruments could be constructed. The MOSAIC
(later Modalys) system [2] uses the same notion, now employing
modal synthesis [3]. Modular networks have also been proposed
using wave-based methods [4] and time-stepping schemes—see,
e.g., [5, 6]. The main difficulty is in simulating a network con-
nected in a feedback configuration—a problem compounded when
nonlinearities, essential for any musically-interesting sound out-
put, are present. The complications are similar to those which oc-
∗M. Ducceschi was supported by an Early Career Fellowship from the
Leverhulme Trust.
Copyright: c
2018 Stefan Bilbao et al. This is an open-access article distributed
under the terms of the Creative Commons Attribution 3.0 Unported License, which
permits unrestricted use, distribution, and reproduction in any medium, provided the
original author and source are credited.
cur in virtual analog modeling, but now in a mechanical setting,
where individual elements have a distributed character.
Two main technical concerns emerge: one is ensuring numeri-
cal stability, as numerical methods for nonlinear systems are prone
to explosive unstable solution growth. Another is computational
efficiency; iterative methods (such as, e.g., Newton-Raphson [7])
commonly used in nonlinear ODE/PDE solvers, can lead to large
increases in computational cost. For the problem of numerical
stability, energy techniques are probably the only known method.
Such methods, in different guises, have been popular in virtual
analog applications (port-Hamiltonian approaches [8], wave dig-
ital filtering [9, 10], and used in PDE solvers [11]). For general
nonlinearities, however, including those involving collision or in-
termittent contact, energy methods are available, but usually re-
quire the use of iterative methods. See, e.g., [12, 13, 14].
Recently, a new class of methods mas been proposed in the
context of virtual analog modeling, relying on energy quadratisa-
tion [15], leading to numerical methods which are resolvable with-
out recourse to iterative methods, and which maintain the notion
of an energy balance leading to a numerical stability guarantee—
see [16, 17], as well as [18] in the context of audio systems. Such
an approach reduces computational costs by as much as an order
of magnitude, and allows for the simulation of relatively complex
nonlinear systems in real time on standard hardware.
In Section 2, a modular physical modeling synthesis system
is presented, consisting of an interconnection of string- or bar-
like primitives, and with nonlinear connections which allow in-
termittent contact. A numerical discretisation scheme is presented
in Section 3, allowing for energy-stable non-iterative simulation.
Simulation results, illustrating characteristic behaviour of such a
modular synthesis system appear in Section 4. Performance re-
sults for a C implementation are presented in Section 5, demon-
strating the possibility of real-time operation of relatively complex
instrument designs. Some perspectives appear in Section 6.
2. A MODULAR INSTRUMENT MODEL
The canonical building block here is the linear bar or string (re-
ferred to henceforth here as a stiff string), of circular cross section,
assumed to vibrate transversely in a single polarisation. The basic
equation of motion (see, e.g., [11], as well as other closely-related
forms [19, 20]), under unforced conditions, is of the form
Lu= 0 (1)
where the linear partial differential operator Lis defined as
L=ρA∂2
t−T ∂2
x+EI ∂4
x+ 2ρAσ0∂t−2ρAσ1∂t∂2
x(2)
Here, u(x, t)is the transverse displacement of the stiff string, in
m, as a function of time t≥0, in s, and spatial coordinate x∈
DAFX-1
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
D= [0, L], for some string length Lin m. ∂tand ∂xrepresent
partial differentiation with respect to tand x, respectively.
The various parameters which define the stiff string are the
material density ρ, in kg·m−3, Young’s modulus Ein Pa, tension
Tin N, and string radius rin m, from which follow the cross-
sectional area A=πr2and moment of inertia I=1
4πr4.σ0and
σ1are loss parameters, allowing for a simple frequency-dependent
loss characteristic (though much more realistic loss models are
available [21]). The symbol γis used here to represent the set
of parameters defining a particular string; its minimal form is:
γ={ρ, E, r, T , σ0, σ1, L}(3)
Two boundary conditions must be supplied at each end of the
string; many choices are possible (see [11]), but in this work, sim-
ply supported conditions will be enforced, so that
u=∂2
xu= 0 at x= 0, L (4)
The equation (1) requires two initial conditions: u(x, 0) and ∂tu(x, 0).
In a synthesis setting, initial conditions are usually set to zero, but
will be maintained here in order to examine energetic behaviour
under unforced conditions.
System (1) satisfies an energy balance. Multiplying (1) by
∂tu, and integrating over Dgives
ZD
∂tuLu dx = 0 (5)
Defining the L2norm of a function f(x)over the domain Das
kfkD=sZD
f2dx (6)
and using integration by parts, as well as the boundary conditions
(4) leads to the energy balance
dHs/dt +Qs= 0 (7)
where
Hs=ρA
2k∂tuk2
D+T
2k∂xuk2
D+EI
2k∂2
xuk2
D(8a)
Qs= 2ρAσ0k∂tuk2
D+ 2ρAσ1k∂x∂tuk2
D(8b)
Hsis the total stored energy for the string, and Qsis the power
loss. Given that Hs≥0and Qs≥0, under unforced conditions,
this implies that dHs/dt ≤0, and thus energy is monotonically
non-increasing, and may be used to bound the growth of the state u
itself—such a balance may be employed in discrete time to arrive
at energy-based numerical stability conditions. See Section 3.
2.1. Excitation
For system (1), an excitation may be added as
Lu=δ(x−xe)fe(t)(9)
where here, fe(t)is an externally-supplied force signal (in N), and
δ(x−xe), is a spatial Dirac delta function selecting the excitation
location xe∈[0, L]. The pointwise character of the excitation can
be easily extended to the case of distributed contact (as in, e.g.,
the case of a piano hammer [19] or bow [22]). Simple choices of
the excitation function, if intended to model a strike or pluck, are
raised cosine distributions of the form
fe(t) = (1
2fe,max 1−cos qπ(t−te)
Te, te≤t≤te+Te
0,otherwise .
(10)
where teis the starting time of the excitation, Teis the duration,
fe,max is the maximum force, in N, and where q= 1 for a pluck
and q= 2 for a strike. See Figure 1.
Figure 1: Excitation functions fe(t)for a pluck (left) and strike
(right), as per the form given in (10).
From an energetic standpoint, one may again multiply (9) by
∂tu, and then integrate over Dto obtain the energy balance:
d
dt Hs+Qs=∂tu(xe)fe
| {z }
,P
(11)
where Hsand Qsare as in (8), and where Pis the instantaneous
input power due to the excitation. Thus the rate of growth of en-
ergy in the system may be bounded in terms of supplied power.
2.2. Connection to a Lumped Object
Consider now a coupled system of a string under excitation, and
in pointwise contact, at location x=xc, with a lumped object
of mass Mwhich is constrained to travel parallel to the plane of
polarisation of the string, and with displacement w=w(t):
Lu=−δ(x−xc)fc+δ(x−xe)feMd2w
dt2=fc(12)
Here, fc=fc(η)is the connection force, assumed dependent on
η=u(xc, t)−w(t)(13)
the relative displacement between the lumped object and the string
at the connection point. See Figure 2.
Figure 2: Stiff string, under an excitation force and coupled to a
lumped object, as per (12).
Many choices for the interaction force fcare possible. A basic
linear/cubic restoring force served as a basis for the modular net-
work presented in [5]. A more general choice, allowing for inter-
mittent loss of contact (or collisions), and considerably widening
DAFX-2
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
the range of possible sound output, is the following choice:
fc(η) = K[|η| − ]α
+sgn (η)(14)
Such a force law is parameterised by K≥0, a stiffness constant,
α≥1, a nonlinearity exponent inspired by models in contact dy-
namics [23, 19], and ≥0, an effective length of the lumped
object, which is now able to rattle, and which allows for a dead
zone where no force is exerted by the lumped object on the string
and vice versa. The notation [·]+indicates the “positive part of."
See Figure 3. Note that when = 0, so that the lumped mass and
string are always in contact, the force (14) reduces to a linear con-
nection when α= 1, and a cubic nonlinear force when α= 3. It is
also possible to go further here, and introduce a model of contact
loss, as per similar models in contact dynamics (see, e.g., [23]),
and employed in musical instrument modeling [13].
Figure 3: Nonlinear force characteristics of the form given in (14).
Left: with K= 106,α= 1 and = 0.001, and right: with
K= 1012,α= 3 and = 0.001. The dead zone, over which
there is no connection force, is shown as a blue shaded region.
At this point, we introduce the potential φ(η), such that
φ(η)≥0fc=dφ/dη (15)
and note that, through the chain rule,
dφ/dt =fcdη/dt (16)
Given the non-negativity of φ, it is also possible to define ψas
ψ=p2φ fc=ψdψ/dη (17)
This quadratisation of the potential energy has been employed in
the context of virtual analog modeling and musical acoustics in
[17, 24, 16], and also, recently, in much more general numerical
settings, where it is referred to as invariant energy quadratisation—
see, e.g., [15]. In the case of the force characteristic given in (14),
the corresponding forms of φand ψare
φ(η) = K
α+ 1 [|η| − ]α+1
+ψ(η) = r2K
α+ 1 [|η| − ]
α+1
2
+
(18)
Though the forms in (15) and (17) are equivalent, in the nu-
merical context, they lead to distinct energy-conserving methods—
in particular, the form in (15) leads to a form requiring iterative
solution, and that in (17) to one which may be resolved explicitly.
For a direct comparison of this distinction in a simplified case, see
the companion paper [18].
From an energetic standpoint, multiplying the first of (12) by
∂tuand integrating over Dyields
dHs/dt +Qs=P − fc∂tu(xc)(19)
Multiplying the second by dw/dt gives
d
dt M
2dw
dt 2!=dw
dt fc(20)
Adding (19) and (20) gives, then
d
dt Hs+Qs+d
dt M
2dw
dt 2!+fc∂tu(xc)−dw
dt =P
(21)
But, using
dη/dt =∂tu(xc)−dw/dt (22)
as well as (16) leads to the energy balance
dH/dt +Qs=P(23)
where
H=Hs+Hc≥0Hc=M
2dw
dt 2
+φ≥0(24)
Thus the total energy Hof the system may be decomposed into the
energy of the stiff string Hsand that of the connection mechanism
Hc, and as before is non-negative—its rate of growth may again
be bounded in terms of the input power P. Such a connection
mechanism is passive (and furthermore lossless).
2.3. A Complete Modular Network
The step to constructing an arbitrary network is relatively straight-
forward, using the model above as a starting point.
Suppose a network is defined with Nsstiff string elements,
each characterised by a parameter set γ(q),q= 1,...,Ns, of the
form given in (3). For each element, the associated transverse dis-
placement is u(q)=u(q)x(q), t, for x(q)∈ D(q)= [0, L(q)],
and the associated partial differential operator is L(q). Suppose
also that there are Nmlumped objects, of mass M(j)kg, and of
displacement w(j)(t),j= 1,...,Nm. See Figure 4.
Figure 4: Modular network of stiff strings and lumped masses,
with connections indicated as yellow lines.
Now suppose that there are Ncindividual connections, each
associated with a force f(ν)
c,ν= 1,...,Nc. The νth connection
links the qνth stiff string, at location x(qν)=x(ν)
cwith the jνth
lumped object, where qν∈ {1,...,Ns}and jν∈ {1,...,Nm}.
The force f(ν)
cwill be of the form
f(ν)
c=f(ν)
cη(ν)η(ν)=u(qν)x(ν)
c−w(jν)(25)
DAFX-3
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
The force f(ν)
cη(ν)is assumed to be related to an underlying
potential energy φ(ν)η(ν)≥0as
f(ν)
c=dφ(ν)/dη(ν)(26)
In this case, φ(ν)will be chosen to be of the form (18), but any
non-negative form is possible. Furthermore, define the index sets
I(q)
c={ν∈ {1,...,Nc} | qν=q}(27a)
I(j)
c={ν∈ {1,...,Nc} | jν=j}(27b)
Finally, assume Neexcitation functions f(ξ)
e,ξ= 1,...,Ne,
acting on the stiff strings with index qξwhere qξ∈ {1,...,Ns}
at locations x(ξ)
e. Define also the index set
I(q)
e={ξ∈ {1,...,Ne} | qξ=q}(28)
The excitation functions f(ξ)
ecould be chosen as in (10).
The complete system is:
L(q)u(q)=−X
ν∈I(q)
c
f(ν)
cδx(q)−x(ν)
c(29a)
+X
ξ∈I(q)
e
f(ξ)
eδx(q)−x(ξ)
e
M(j)d2w(j)
dt2=X
ν∈I(j)
c
f(ν)
c(29b)
Energy analysis is an extension of the case of the single string.
Multiplying (29a) by ∂tu(q), and integrating over D(q)gives
d
dt H(q)
s+Q(q)
s+X
ν∈I(q)
c
f(ν)
c∂tu(q)x(ν)
c=P(q)(30)
where H(q)
sand Q(q)
sare stored energy and power loss for stiff
string q, as defined in (8), with parameter set γ(q), and where P(q)
is of the form given in (21). Summing over all strings gives
d
dt Hs+Qs+
Ns
X
q=1 X
ν∈I(q)
c
f(ν)
c∂tu(q)x(ν)
c=P(31)
where
Hs=
Ns
X
q=1
H(q)
sQs=
Ns
X
q=1
Q(q)
sP=
Ns
X
q=1
P(q)(32)
are the total stored energy, dissipated power and supplied power
for the set of stiff strings. Recognising that the sets I(q)
cform a
partition of the set {1,...,Nc}, one has, simply,
d
dt Hs+Qs+
Nc
X
ν=1
f(ν)
c∂tu(qν)x(ν)
c=P(33)
Similarly, multiplying (29b) by dw(j)/dt, and summing over
j∈ {1,...,Nm}, again using the partitioning property of I(j)
c,
gives
d
dt
Nm
X
j=1 M(j)
2dw(j)
dt 2!−
Nc
X
ν=1
f(ν)
c
d
dt w(jν)= 0 (34)
Adding (33) and (34) gives, using (25) and (26),
dH/dt +Qs=P(35)
where
H=Hs+Hc≥0Hc=
Nm
X
j=1
M
2dw(j)
dt 2
+
Nc
X
ν=1
φ(ν)≥0
(36)
3. DISCRETE-TIME SIMULATION
Finite difference schemes for the stiff string are covered in detail
in [11], and will be reviewed only briefly here.
Assume first a sample rate fs(and associated time step k=
1/fs), to be employed uniformly across all components in the net-
work. Consider now a single stiff string as defined by (1). The
grid function un
lrepresents an approximation to u(x, t)at t=nk
and x=lh, for integer nand l, and where his the grid spacing.
In particular, 0≤l≤N, where h=L/N, for integer N. The
discrete domains d,¯
dand ¯
dare defined as
d={0,...,N}¯
d={0,...,N −1}¯
d={1,...,N −1}
(37)
A discrete inner product and norm may be defined over a dis-
crete domain b⊂Zwith grid spacing h(such as d,¯
dor ¯
din (37)
above), for grid functions fn
l,gn
l, as
hfn, gnib=X
l∈b
hfn
lgn
lkfnkb=phfn, f nib(38)
3.1. Shift and Difference Operators
The forward and backward time-shift operators et+and et−may
be defined, with regard to the grid function un
l, as
et+un
l=un+1
let−un
l=un−1
l(39)
Forwards, backwards and centered approximations to a first time
derivative may be defined in terms of shifts as
δt+=et+−1
kδt−=1−et−
kδt◦=et+−et−
2k(40)
and averaging operators µt+and µt−and an approximation δtt to
a second derivative may be written as
µt+=et++ 1
2µt−=1 + et−
2δtt =δt+δt−(41)
Similarly, spatial shifts ex+and ex−may be defined as
ex+un
l=un
l+1 ex−un
l=un
l−1(42)
and approximations to the first and second spatial deriavtaives as
δx+=ex+−1
hδx−=1−ex−
hδxx =δx+δx−(43)
DAFX-4
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
3.2. Basic Scheme
A basic explicit finite difference scheme for an uncoupled linear
stiff string, as in (1) may be written, for u=un
l,l∈das
ρAδtt −T δxx +EI δ2
xx + 2ρAσ0δt◦−2ρAσ1δt−δxx
| {z }
`
u= 0
(44)
Numerical boundary conditions corresponding to (4) are
un
l=δxxun
l= 0 l= 0, N (45)
and allow (44) to be well-defined even when applied at or adjacent
to the domain end points.
The scheme (44) satisfies an energy balance of the form
δt+hn−1/2
s+qn
s= 0 (46)
where hn−1/2
sand qn
sare the discrete-time energy storage function
and power loss, respectively, defined as
hn−1
2
s=ρA
2kδt−unk2
d+T
2hδx+un, et−δx+uni¯
d(47a)
+EI
2hδxxun, et−δxx uni¯
d−ρAσ1kkδt−δx+uk2
¯
d
qn
s= 2ρAσ0kδt◦uk2
d+ 2ρAσ1kδt◦δx+uk2
¯
d(47b)
The power loss qn
sis non-negative, but the stored energy hsis only
non-negative under the condition
h2≥1
2
T k2
ρA + 4σ1k+sT k2
ρA + 4σ1k2
+ 16 EI k2
ρA
(48)
which is a numerical stability condition for scheme (44) in isola-
tion. Under this condition, the state size may be bounded in terms
of supplied energy.
In implementation, scheme (44) is explicit—if the state un
lis
written as a column vector un= [un
0,...,un
N]T, (44) becomes
un+1 =Bun+Cun−1(49)
where Band Care sparse (N+ 1) ×(N+ 1) matrices. See
[11] for the construction of these matrices in terms of the various
spatial difference operators.
3.3. String with Nonlinear Connection and Excitation
Consider now the simple case of a stiff string under an excitation
force and a nonlinear connection, as per (12). A discrete form is
`u =−fc
1
hI(xc) + fe
1
hI(xe)Mδttw=fc(50)
Here, fc=fn
cis a time series representing an approximation to
fc(t), of a nature to be described shortly, and fe=fn
eis an
approximation to the externally-supplied function fe(t), perhaps
obtained through sampling. The grid functions Il(x0), selects a
given location x0. Many choices are possible, but the simplest,
and that which will be employed subsequently here, is certainly
Il(x0) = 1, l =l0= round (x0/h)
0,otherwise (51)
When multiplied by 1/h, as in (50) above, approximations to the
Dirac delta functions from (12) result, where x0=xc, xe.
The force fn
cwill be dependent on the relative displacement η
of the string and lumped mass at the connection grid index l=lc:
ηn=un
lc−wn(52)
Consider now the inner product of the first of (50) with δt◦uover
d—this leads to the energy balance
δt+hn−1/2
s+qn
s+fn
cδt◦un
lc=fn
eδt◦un
le
| {z }
pn
(53)
where hn−1/2
sand qn
sare as defined in (47), and where pnis the
discrete input power due to the excitation.
Similarly, multiplying the second of (50) by δt◦wnleads to
δt+M
2(δt−wn)2−fcδt◦wn= 0 (54)
Adding (53) and (54), and using (52) leads to the balance
δt+hn−1/2
s+M
2(δt−wn)2+qn
s+fn
cδt◦ηn=pn(55)
What is lacking is a definition of fn
c. Here are two:
fn
c=δt+φn−1/2
δt◦ηfn
c=µt+ψn−1/2δt+ψn−1/2
δt◦ηn(56)
Here, φn−1/2is an approximation to φat time t= (n−1/2)k,
such as φn−1/2=µt−φ(ηn)≥0, and ψn−1/2is an approxima-
tion to ψat time t= (n−1/2)k. When inserted in (55) above,
either form in (56) leads to the energy balance
δt+hn−1/2+qn
s=pnhn−1/2=hn−1/2
s+hn−1/2
c(57)
where, for the two choices of the force fn
cfrom (56),
hn−1/2
c=M
2(δt−wn)2+(φn−1/2
1
2ψn−1/22≥0(58)
Under the further condition (48), then hs≥0implying that h≥0,
and as before, the system as a whole will be numerically stable.
3.4. Implementation: Iterative vs. Non-iterative Methods
When written in vector/matrix form, the scheme (50) has the form
un+1 =Bun+Cun+1 −θjcfn
c+θjefn
c(59a)
wn+1 = 2wn−wn−1+k2
Mfn
c(59b)
where θ=k2/(ρAh (1 + σ0k)), and where jeand jcare N+ 1
element column vectors, all zero except for a 1 in locations leand
lcrespectively.
Now, using the fact that
δt◦ηn=1
2kjT
cun+1 −un−1−wn+1 +wn−1(60)
and the updates (59) leads to the affine relationship between δt◦ηn
and fn
c:
δt◦ηn+ζf n
c+ Ξn= 0 (61)
DAFX-5
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
where Ξnconsists of previously computed (known) values of u
and samples of the excitation fn
e, and ζis a constant.
Consider now the first energy-conserving definition of fn
c, from
(56). In combination with (61), this leads to the nonlinear equa-
tion:
r+ 2kζ φr+ηn−1−φηn−1
r+ 2kΞn
| {z }
F(r)
= 0 (62)
where r=ηn+1−ηn−1is the unknown. Such a form has appeared
in earlier works regarding energy-conserving collision simulation
[12, 13], and requires, in general, an iterative solution through,
e.g., Newton-Raphson; the number of iterations depends strongly
on the particular parameters defining the nonlinearity.
The second form of fcgiven in (56) leads to a distinct update.
Define
gn=δt+ψn−1/2
δt◦ηn
,dψ
dη |t=nk (63)
The time series gncan be computed directly from known values
of ηnand the functional form of ψ. Given gn, the following pair
of updates results from (61) and (63):
δt◦ηn+ζgnµt+ψn−1/2+ Ξn= 0 δt+ψn−1/2=gnδt◦ηn
(64)
These can be consolidated into a single update yielding ηn+1 from
previously computed values of ηand ψ:
ηn+1 = Θ ηn, η n−1, ψn−1/2(65)
and, given ηn+1, the second of (64) may be updated to yield ψn+1/2,
at which point the simulation advances to the next time step. For
more details, see [18].
3.5. A Complete Discrete-time Modular Network
Returning to the complete modular system presented in Section
2.3, the numerical scheme corresponding to (29) is
`(q)u(q)=−X
ν∈I(q)
c
f(ν)
c
1
h(q)Ix(ν)
c+X
ξ∈I(q)
e
f(ξ)
e
1
h(q)Ix(ξ)
e
δttw(j)=1
M(j)X
ν∈I(j)
c
f(ν)
c(66)
Here, u(q)=u(q),n
lis the grid function corresponding to the qth
string, with grid spacing h(q), and defined over l∈ {0,...,N(q)}
and `(q)is the difference operator derived from L(q).w(j)=
w(j),n is the time series corresponding to the displacement of the
jth lumped object, j= 1,...,Nmand f(ν)
c,ν= 1,...,Ncto
the associated connection forces. In (3.5) above, the time step n
accompanying all dependent variables is suppressed for brevity.
Each of the Ncconnection forces f(ν)
c=f(ν),n
c,ν= 1....,Nc
is assumed dependent on a displacement
η(ν),n =u(qν),n
l(ν)
c
−w(jν),n (67)
There is assumed an underlying discrete potential φ(ν),n−1/2(and
accompanying function ψ(ν),n−1/2), such that, for the non-iterative
algorithm,
f(ν),n
c=µt+ψ(ν),n−1/2δt+ψ(ν),n−1/2
δt◦η(ν),n (68)
Full details of the implementation and energy analysis will not
be presented here, because of space limitations, but follow in al-
most all respects from the analysis of the single string/connection
described in the previous section. A demonstration of energy con-
servation appears in Section 4.1, and of the benefit of a non-iterative
algorithm, in terms of computation time, in Section 5.
4. SIMULATION RESULTS
In this section, we present some numerical results illustrating nu-
merical and musical aspects of the modular system described here.
All simulations are run at 44.1 kHz.
4.1. Energy Conservation
Consider first the energy conservation property, for a full network
of 25 strings (ranging in pitch from C2 to C4), and using 24 two-
sided connections, where the non-iterative scheme is employed.
A worst case is assumed here, where the strings are lossless, and
the initial conditions of the strings and lumped elements are ran-
domised. In Figure 5, the energy partition as a function of time be-
tween strings and connections is shown, alongside the normalised
energy variation, illustrating energy conservation to machine ac-
curacy. The availability of such a measure allows for an excellent
approach to debugging modular synthesis codes.
Figure 5: Left: energy partition, showing energy in strings, con-
nections, and the total. Middle: normalised sample to sample en-
ergy variation, and right: a detail showing energy conservation to
machine accuracy.
4.2. Single String/Lumped Object
An illustration of the interaction between a single string and a
lumped object in intermittent contact is shown in Figure 6. Even
in this extremely simple case, a wide variety of timbres is possible.
In Figure 7, spectrograms of sound output are shown where string
parameters are chosen according to a high E string on a guitar.
4.3. Large network
Consider now a network of 25 strings with 24 double-sided con-
nections, representing approximately the largest possible in real
time at 44.1 kHz. Snapshots of the time evolution of this network
are shown in Figure 8.
5. COMPUTATIONAL ANALYSIS
This section details the computational costs of the element types
(stiff string and connection) from which the system is built. We
DAFX-6
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
Figure 6: Interaction of a single stiff string with a lumped colliding
object, at times as indicated.
Figure 7: Spectrograms of sound output for a high E guitar string
connected to a single lumped element. Top left: free vibration. Top
right, under a single connection, illustrating abrupt changes in tim-
bre over a long time scale. Bottom left: illustrating low-frequency
“warbling" effects. Bottom right: for a high mass lumped object,
leading to distinct bounces or temporal events.
start with a set of strings, and then compare an individual non-
linear connection solver in both iterative and non-iterative form.
Finally we assess a full system of strings and connecting elements,
as could be used in a real-time audio plug-in. All simulations are
written in C++, and timings are produced by running at a sam-
ple rate of 44.1 kHz (in double precision) over 441,000 time steps
and then dividing by 10 to give an average performance for 44,100
steps. The test CPU is a 6-core Intel Xeon E5-1650 v2, and the
LLVM compiler was used. Whilst we will not consider multi-
threading here (as this presents problems for real-time usage) we
do make use of vectorization, namely with Intel’s SSE and AVX
intrinsics [25].
The stiff string is simulated using the scheme (44), which is
explicit, and amenable to spatial parallelization. The state size and
computational cost can become large, but not unmanageably so:
for the case of 25 low-pitched strings tuned from C2 at 65Hz to
middle C4, the total state size required is 2,550 values. Table 1
shows results using various compiler optimisation levels, and also
using manually written vector intrinsics which lead ultimately to a
speedup by a factor of four. Performance is faster than real time.
Consider now a single nonlinear connection. Two forms of
code were tested: first a form which uses an iterative Newton-
Figure 8: Large modular network, at rest (top), under initial exci-
tations (middle) and later (bottom).
Table 1: Computation times for 25 strings, tuned from C2 to C4,
for 1 s output. Total state size: 2,550 grid points.
Optimisation Level Time (s)
-O0 0.59
-O3 SSE only enabled 0.18
Manual AVX 0.13
Raphson solver, and then a form which uses the new non-iterative
solver. For the purposes of this testing the Newton-Raphson solver
was run for 10 iterations at each time step, starting from a cached
solution. This is a usable “average" figure for the simulation, al-
though in practice could be larger, and also possibly reduced by
testing for a residual.
The algorithm for solving for each connection force consists of
some initial arithmetic operations and two calls to the power()
function with non-integer exponents (using std::pow() from
the cmath library). Then the Newton-Raphson solver is launched.
This requires a further two calls of the power() function at each
iteration. Finally there are some further arithmetic calculations
to compute the forces at each end of the connection. The non-
iterative form is considerably simpler, requiring just two power()
functions in total. Table 2 shows the resulting computation times.
The benefit of the non-iterative form is clear, giving a 11×speed
up over the iterative form. This is mostly due to the reduction in
the number of calls to the power() function, from 22 in the it-
erative form to just two in the latter. Further optimisation may be
DAFX-7
Proceedings of the 22nd International Conference on Digital Audio Effects (DAFx-19), Birmingham, UK, September 2–6, 2019
Table 2: Compute times for an individual connection for 1 s.
Optimisation Iterative (ms) Non-Iterative (ms) Speedup
-O0 79.2 7.1 11.2×
-O3 SSE 73.5 6.3 11.6×
achieved by implementing a manually vectorized power function
across groups of connection calculations.
The final test simulation involved two octaves of strings with
24 two-sided rattle connections, such that each string was con-
nected to another through a lumped element—a single strike to
any string will excite the entire network, as in Figure 8. At each
time step the strings are updated first, followed by a loop over the
connections which then adds back the calculated forces into the
strings at the connection points. Table 3 shows the results for the
full system.
Table 3: Computation times: 25 strings/24 connections for 1 s.
Optimisation Iterative (s) Non-Iterative (s) Speedup
-O0 2.53 0.81 3.1×
-O3 SSE 1.93 0.35 5.5×
Manual AVX 1.84 0.28 6.6×
The version computed using an iterative solver results in a best
time of 1.84 s for 1 s sound output, which is clearly well short
of the real time threshold. The non-iterative solver results in a
6.6×speedup, and the resulting time of 0.28 seconds is just within
the scope of usability for a real-time application. Note that per-
formance levels may vary according to other factors such as the
CPU-specific cache, and other compiler details.
6. CONCLUDING REMARKS
A form of this system available as a real-time plug-in is under de-
velopment through Physical Audio [26], called net2. It is rewritten
from a previous version (called net1), which ran offline in multi-
core using an iterative solver. The ability to sidestep such iterative
methods, and maintain a numerically-stable synthesis algorithm
has allowed this move to real time through the approximately 10×
speedup for the nonlinear part of the simulation. Though only stiff
strings have been shown here, the extension to systems includ-
ing multiple vibrating plates is immediate—see, e.g., [5]. Also,
only one type of nonlinearity has been presented here, but the non-
iterative algorithm presented here is fully general.
A major consideration, at the level of the user experience, is
in the UI design, particularly when there are potentially many stiff
string/connection elements to manage—this has been partly dealt
with during the design of the simpler Derailer system, also from
Physical Audio. A deeper issue is that of exploring the design
parameter space—for the system illustrated here with 25 strings
and 24 connections, for example, there are 319 parameters to set.
Some heuristics can be employed to make this more manageable
(by, say, restricting string tunings), but clearly some more general
strategy for finding interesting regions of the parameter space (per-
haps invoking methods from machine learning) is necessary.
7. REFERENCES
[1] C. Cadoz, A. Luciani, and J.-L. Florens, “Responsive input devices and sound
synthesis by simulation of instrumental mechanisms,” Comp. Music J., vol. 8,
no. 3, pp. 60–73, 1983.
[2] D. Morrison and J.-M. Adrien, “Mosaic: A framework for modal synthesis,”
Comp. Music J., vol. 17, no. 1, pp. 45–56, 1993.
[3] J.-M. Adrien, “The missing link: Modal synthesis,” in Representations of
Musical Signals, G. DePoli, A. Picialli, and C. Roads, Eds., pp. 269–297. MIT
Press, Cambridge, Massachusetts, 1991.
[4] R. Rabenstein, S. Petrausch, A. Sarti, G. De Sanctis, C. Erkut, and M. Kar-
jalainen, “Block-based physical modeling for digital sound synthesis,” IEEE
Sig. Proces. Mag., vol. 24, no. 2, pp. 42–54, 2007.
[5] S. Bilbao, “A modular percussion synthesis environment,” in Proc. Int. Digital
Audio Effects Conf., Como, Italy, 2009, pp. 321–328.
[6] S. Bilbao, A. Torin, P. Graham, J. Perry, and G. Delap, “Modular physical
modeling synthesis on gpu,” in Proc. Int. Comp. Music Conf., Athens, Greece,
2014.
[7] W. Press, S. Teukolsky, W. Vetterling, and B. Flannery, Numerical Recipes in
C: The Art of Scientific Computing, Cambridge University Press, Cambridge,
UK, 1992.
[8] R. Müller and T. Hélie, “Power-balanced modelling of circuits as skew gradient
systems,” in Proc. Int. Conf. Digital Audio Effects, Aveiro, Portugal, 2018, pp.
1–8.
[9] K. Werner, V. Nangia, J. O. Smith, and J. Abel, “A general and explicit formu-
lation for wave digital filtres with multiple/multiport nonlinearities and com-
plicated topologies,” in Proc. Workshop Appl. Signal Proces. Audio Acoust.,
Mohonk, NY, 2015, pp. 1–5.
[10] A. Bernardini, K. Werner, A. Sarti, and J. O. Smith, “Modeling nonlinear wave
digital elements using the lambert function,” IEEE Trans. Circ. Syst. I, vol. 63,
no. 8, pp. 1231–1242, 2016.
[11] S. Bilbao, Numerical Sound Synthesis: Finite Difference Schemes and Simula-
tion in Musical Acoustics, John Wiley and Sons, Chichester, UK, 2009.
[12] V. Chatziioannou and M. van Walstijn, “An energy conserving finite differ-
ence scheme for simulation of collisions.,” in Proc. Stockholm Musical Acoust.
Conf., Stockholm, Sweden, 2013.
[13] S. Bilbao, A. Torin, and V. Chatziioannou, “Numerical modeling of collisions
in musical instruments,” Acta Acustica u. with Acustica, vol. 101, no. 1, pp.
155–173, 2015.
[14] M. Ducceschi and S. Bilbao, “Modelling collisions of nonlinear strings against
rigid barriers: Conservative finite difference schemes with application to sound
synthesis,” in Proc. Int. Conf. On Acoust. (ICA 2016), Buenos Aires, Argentina,
September 2016.
[15] X. Yang, “Linear and unconditionally energy stable schemes for the binary
fluid-surfactant phase field model,” Comp. Methods Appl. Mech. Eng., vol.
318, pp. 1005–1029, 2017.
[16] N. Lopes, T. Hélie, and A. Falaize, “Explicit second-order accurate method for
the passive guaranteed simulation of port-hamiltonian systems,” in Proc. 5th
IFAC 2015, Lyon, France, July 2015.
[17] A. Falaize, Modélisation, simulation, génération de code et correction de sys-
tèmes multi-physiques audios: Approche par réseau de composants et formu-
lation Hamiltonienne À Ports, Ph.D. thesis, Université Pierre et Marie Curie,
Paris, July 2016.
[18] M. Ducceschi and S. Bilbao, “Non-iterative solvers for nonlinear problems:
The case of collisions,” 2019, Under review, 22nd Int. Conf. Digital Audio
Effects.
[19] A. Chaigne and A. Askenfelt, “Numerical simulations of struck strings. I. A
physical model for a struck string using finite difference methods,” J. Acoust.
Soc. Am., vol. 95, no. 2, pp. 1112–1118, 1994.
[20] P. Ruiz, “A technique for simulating the vibrations of strings with a digital
computer,” M.S. thesis, University of Illinois, 1969.
[21] C. Vallette, “The mechanics of vibrating strings,” in Mechanics of Musical
Instruments, A. Hirschberg, J. Kergomard, and G. Weinreich, Eds., pp. 116–
183. Springer, New York, New York, 1995.
[22] C. Desvages and S. Bilbao, “Two-polarisation physical model of bowed strings
with nonlinear contact and friction forces, and application to gesture-based
sound synthesis,” Appl. Sci., vol. 6, pp. 135, 2016.
[23] K. Hunt and F. Crossley, “Coefficient of restitution interpreted as damping in
vibroimpact,” ASME J. Appl. Mech., pp. 440–5, June 1975.
[24] A. Falaize and T. Hélie, “Passive Guaranteed Simulation of Analog Audio
Circuits: A Port-Hamiltonian Approach,” Appl. Sci., vol. 6, pp. 273 – 273,
2016.
[25] N Firasta, M. Buxton, P. Jinbo, K. Nasri, and S. Kuo, “Intel AVX:New frontiers
in performance improvements and energy efficiency,” Intel White Paper, 2008.
[26] “Physical audio,” www.physicalaudio.co.uk, Accessed: 2019-03-26.
DAFX-8