Josep Mª Comajuncosas Nebot
The motivations behind this work came from an article I read a year ago in the Journal of New Music Research, vol. 24 (1995): "Physical Models of Wind Instruments : A Generalized Excitation Coupled with a Modular Tube Simulation Platform" by Gijs de Bruin and Maarten van Walstijn.
Most of the Csound implementation is biased towards the clarinet by now, and most of the given examples will be from my last clarinet model, which can be found on my Csound page at
My aim is to build a nice collection of virtual woodwind instruments of great quality to use them in my Csound compositions. In this article I summarize the current progress of the implementation and two already functional models are presented : a clarinet and the Grallot (a sort of doublereed clarinet).
One of the main differences between this woodwind model and the ones implemented in the Csound sources - from P. Cook´s Synthesis Toolkit - is the simulation of the reed nonlinearity.
which after some simplification and cosmetics becomes
I refer you to the bibliography and the Csound code for a complete description of all the parameters involved. The Bernoully pressure (pb) takes an important role in double reeds but is neglected in clarinet-type single reeds.
The flow entering the reed as function of the reed aperture and the pressure difference between the mouth and the mouthpiece is assumed to obey Backus equation for single reed instruments
and a modified Backus equation for double reeds, taking into account the different reed geometry
(0.4e-6 is the reed aperture in equilibrium for a clarinet, the instrument in which Backus measurements were done). I´ll possibly experiment with another set of equations described in the revised Nederveen´s thesis.
Notice that at very small reed apertures (when playing hard) the Backus equation is no longer valid and can lead to large numerical errors. Also, the reed aperture cannot go to zero as in a real instrument. To overcome that problem several strategies have been proposed, like desining different computing zones according to the reed aperture.
allowing overblowing (MP3) and being parametrizable. This is vital because the reed clipping has a strong effect on the sound and makes possible a large variety of reeds and playing styles. This clipping routine can be considered as a phenomenological model of the reed curling up the mouthpiece.
To couple the reed with the bore one must be able to compute the outgoing pressure (p right) which will be the value injected into the waveguide, from the flow Ub and the ingoing pressure (p left).
According to Nederveen this term behaves like a virtual volume added to the mouthpiece cavity and one has to compensate for it when computing the total delay time of the waveguide.
The bore is implemented as a recursive comb filter. Specifically, the current implementation is simple enough (i.e, a single cylindrical bore without a tonehole lattice) to allow a special implementation which makes use of a single waveguide of double length (half the wavelength of the desired note in the case of an open/closed cylinder) to simulate the upward and inward travelling waves. This method is similarly implemented in R. Cook´s woodwind and stringed instruments.
Assuming that most of the radiation coming out of the clarinet is due to the first open tonehole, we can neglect the rest of the bore and derive the reflectance and transmittance filters from a generic clarinet tonehole and apply it to all pitches, as if the clarinet was a sizeable cilinder with the tonehole at the end of the bore.
The filter design routine has been implemented in Matlab by Maarten van Walstijn and matches the frequency and phase response of the theoretical tonehole response according to D.Keefe´s tonehole models. The frequency response of the reflection filter has a lowpass shape with a cutoff frequency of about 1,5 kHz, which agrees well with Keefe´s measurements.
The phase response of the refletance filter is taken into account when computing the total delay length, compensating for it in the main delay line.
The final bore structure as shown below includes the main waveguide together with the tonehole reflection filter and a fractional delay filter to fine tune the delay length. Notice that the transmittance filter is outside the feedback mechanism and thus could be parameterizable (for tone and brightness control) without undesired effects on the tuning (MP3)
As the aim is to accurately model an instrument it is conceptually advisable to split the code into 2 Csound instruments. The first one works as the player, that is, it is activated at each new event and sends the appropiate performance values (such as flow and reed parameters, pitch, volume and so on) to the second instrument.
The system of equations describing the reed motion and the air flow through it are integrated as follows: first integrate the reed motion (2nd order ODE) with the Euler method. Thus we will get the reed aperture.
The filters employed to implement the tonehole (reflectance and transmission filters) are designed with Matlab as 1st or 2nd order sections and thus can be implemented in Csound with the biquad opcode. Though rather simple they approximate very well the actual tonehole response and allow an analytic computation of their phase delay, which is used to fine tune the instrument.
The fractional delay filter is implemented as a simple interpolator (a first order Lagrange interpolator) but I´ll soon implement it as a 3rd order FIR filter with the filter2 opcode, which should minimize the high frequency losses.
The delay line is implemented as a delayr/delaw pair, from where I extract the precise sample with the deltapn opcode. Notice a cubic interpolation could be possible without the explicit use of filter opcodes, making use of the new deltap3 opcode. I avoided it because I´m not sure if it is reliable enough.
Because the woodwind is left active during the performance, it is possible to deal with legato notes quite easily.
Changing the pitch in a legato fragment could be done by shortening or enlarging the bore like in a slide flute, but this glissando sounds unnatural and causes the volume to increase during the note transition.
The solution was to implement a second bore running in parallel with the first. At each new event the bore is switched with an appropiate crossfade time. The crossfade is not linear but sigmoidal, though the difference is subtle. The result is not unlike the transition time needed to change the fingering in a real instrument.
I found that the optimum transition time depends on the note frequency and the speed of the fragment to be played. If it is too low a glissando is heard and the note takes longer to oscillate at the expected amplitude, if too short, the abrupt transition will cause noticeable clicks.
More recently I decided to recode the instruments making use of the new Macro functionality. Thus the woodwind is built in a modular way: reed + bore + tonehole. The reed itself, for example, also includes macro calls showing its internal structure : reed motion + clipping routine + flow equation. Hopefully the code is more readable this way. Also it makes it easy to change part of the code, to apply it to different designs and eventually to port all the stuff to C++ or viceversa (that´s what I´m actually doing with Maarten´s C++ implementation of the clarinet).
Both a MIDI and a Score activated orchestra will have the "instrument" identical, but the "player" code will differ depending on how the event is activated.
Usually the clarinet is a good candidate to begin this kind of modeling, because of its relative simplicity : a nearly cylindrical bore with a small bell which can be neglected for most pitches, and a single reed is much simpler to model than the saxophone´s. The clarinet mouthpiece can also be neglected at a first approximation without so much discrepancy as in the sax.
This instrument is my first nearly successful implementation of a double reed, which is far more complicated because of the higher Bernoulli pressure caused by the small reed apertures and the more pronounced beating regime.
Despite taking into account all the parameters infuencing the pitch -those related to the (frequency dependent) phase delay caused by the tonehole reflectance filter, the (constant) delay induced by the extra flow in the reed motion equation, and the fractional delay filters- the instrument can be completely out of tune sometimes. This was notorius in my Grallot, probably because I neglected some crucial parameters (or there could even be a serious mistake somewhere !).
Implementing piecewise conical waveguides is the next step in the model, to be able to design bores of arbitrary shape. It is well known that implementing conical sections can lead to numerical instabilities and Csound could not work wery well until double precision is implemented.
Modelling a whole tonehole/register hole lattice might well be an exhausting experiment and I leave it for the future, as well as implementing the bell with the new Truncated IIR filters.
Once you have a very accurate woodwind instrument, sensitive to all the playing parameters such as lips and mouth pressure, flow pressure, fingerings, etc. how do you play such a beast with a MIDI keyboard or even worse, with a numerical Score written by hand?
A. Barjau, J. Agulló: Calculation of the Starting Transients of a Double-reed Conical Woodwind. Acustica, vol.69 (1989)
A. H. Benade: Fundamentals of Musical Acoustics. Second edition. Dover publications, NY 1990.
Gijs de Bruin, Maarten van Walstijn: Physical Models of Wind Instruments : A Generalized Excitation Coupled with a Modular Tube Simulation Platform. Journal of New Music Research, vol. 24 (1995)
M. Pavageau: Synthèse d´un modèle physique d´anque double. Rapport du stage D.E.A. d´Acoustique Appliqué de l´Université du Maine. Septembre 1993
C. J. Nederveen: Acoustical Aspects of Woodwind Instruments.Revised edition. Northern Illinois University Press. DeKalb 1998