Final course project for MUMT618 – ”Computational Modeling of Musical Acoustics“ instructed by Gary Scavone at McGill University 2013.
The 2D Digital Waveguide Mesh is an extension of the one dimensional digital waveguide into 2D and was first described by Van Duyne and Smith (1993). In its original rectilinear form, the lattice is obtained by superimposing waveguides perpendicularly with a unit delay spacing. This results in a grid of 4-port scattering junctions connected with one sample delays.
It has been proven that this method is a viable finite difference approximation to the two dimensional wave equation and therefore suitable for modeling membranes.
The 2D Digital Waveguide Mesh suffers from dispersion errors and doesn’t inherit the 1D waveguide’s computational efficiency as every node in the mesh has to be computed.
When exciting the system at one junction with a given input energy, the energy will spread throughout the system, building up a wave. In a constrained 2D Digital Waveguide Mesh, this wave will eventually hit the boundaries and either get reflected, absorbed, or partially reflected, according to the boundary conditions.
Typically, the boundary nodes of a rectangular 2D Digital Waveguide Mesh are terminated as a 1D digital waveguide. At the boundary, an interaction between the terminating junction that represents the boundary and its immediate neighbour on the mesh itself takes place. As you can see in the graphic, in a simple rectangular model of boundary conditions, corners are not connected and boundary nodes are perpendicular to its neighbouring nodes. Also, boundary nodes are only interacting with one single neighbouring node.
The basic boundary condition after Kelloniemi (2004):
where p represents pressure, subscript B denotes the border node, subscript 1 represents its perpendicular neighbour and r is the reflection coefficient.
Simple interaction can be modelled by setting the reflection coefficient: With r = 0, anechoic conditions at the boundary are simulated, whereas with r = 1, a phase preserving total reflection without absorpition is simulated. A phase reversing reflection is modelled by setting r = -1 (Murphy and Mullen 2002). This however is an oversimplification and doesn’t model the real interaction between the wavefront and the boundary, as on a real instrument (a plate, sound bar, drum) the connected material and shape of the membrane play a role.
In order to refine the interaction, a filter can be added to obtain a frequency-dependend reflection. This leads to the intention of this work.
Goals of this project
This project is dedicated to find interesting approaches to the modelling of boundary filters and to implement additions into the STK environment. Furthermore, a filter design to model a semantically more wooden sound is to be found, as opposed to the inherent metallic sound when considering a total reflection of the wave.
Using a one pole filter
A single pole filter has a pole at a real number on the z-plane, constrained by -1 and 1 for stability of the filter. The position of the pole, which is used to model the boundary of the 2D Digital Waveguide Mesh has a great effect on the resulting sound.
Pole at 0.0001
If the pole is placed near zero (the center of the unit circle), the filter structure approaches b0/1, essentially modelling a simple total reflection.
Pole at 0.9999
A pole near the unit circle results in a high absorption of the traveling waves.
Frequency response of a sequence of generated sounds of the waveguide mesh
This video shows the magnitude plot of a sequence of 20 sounds that were generated using the Synthesis Tool Kit Instrument ”2DMesh“, which by default already implements a OnePole Filter. The pole positions of the one pole boundary filters of the waveguide meshes change with every new energy initiation from -0.95 to 0.95, adding 0.05 to the pole position on the real axis with every iteration. You can verify the effect of the pole position on the frequency response of the filter by using this java applet on earlevel.com. Basically, if the pole position is below zero, the filter has a high-pass characteristic, whereas for values above zero, it turns into a low-pass filter.
Mesh2D OnePole pole position magnitude plot (video – download as .zip)
The following sequence of plots represent the 200th frame of a 2D Digital Waveguide Mesh simulation in Matlab®, where the pole position in the first picture is at 0.05 and is incremented for every following picture about 0.10, ending with a pole position of 0.95.
Using a OneZero Filter
In order to alter the sound differently, a one-zero filter was implemented in the STK Mesh2D instrument. The one-zero filter is simply summing the current sample with the past sample, therefore providing simple low-pass characteristics. After building the library, the zero position could be set using a function called
setZero as opposed to
setPole for the
OnePole version. The usage is basically the same. As the
OneZero filter has low-pass characteristics, the results were similar to the
OnePole implementation and yielded no interesting sounds. Try listening to this audio file:
Using a Multiband FIR Filter
The acoustic sound absorption coefficients for wood can be found online. I tried to design a multiband FIR filter using these coefficients as a base and scaling them linearly in order to maintain more amplitude of the signal. The resulting sound is pretty interesting, but also much attenuated. Besides the high frequency hiss and the short decay, in my opinion it sounds like a hard knock on wood. The filter was designed with the use of the
fdatool in Matlab.
Using a Yule-Walker Filter
Another approach to achieve multiband filtering is to use a Yule-Walker filter (
yulewalk in Matlab) that approximates the filter’s frequency spectrum with the Yule-Walker autoregressive method by minimizing the forward-prediction error . This filter implementation yields no better results and inflicts more high frequency hiss.
This filter and the latter filter are of order twenty and require significant time to compute, but the Yule-Walker filter is by far less computational expensive.
Comparison of spectrograms
OnePole Boundary Filter
OneZero Boundary Filter
Multiband FIR Boundary Filter
Yule-Walker Boundary Filter
Varying the input position
By varying the input position of the initial impulse to the mesh, the resulting sound can be altered. In the plot below we can see that with less distance of the input position to the output position of the mesh, where a node value is written to the audio file, the energy contained in the mesh increases. The energy is measured after a certain amount of samples, corresponding to one quarter of the iteration time in the C++ implementation.
Two different changes in distance were tested. The input position was consecutively altered over a diagonal line across the square mesh (blue lines) and over a horizontal line, where the y-value was parallel to the output position at any time. When coming too close to the output position, the in the mesh becomes too high, so that the audio signal gets clipped. This can be adjusted with the amount of energy that is input into the mesh via the noteOn function.
Altering the output position
Varying the output position also has an effect on the spectral content of the generated sound. In the spectrogram plots below you can see that for different output positions, the spectral content especially in the high frequency range changes.
Different tests concerning the boundary filters of the 2D Digital Waveguide Mesh were shown. Four different filters were implemented. The input and output positions on the Waveguide Mesh were changed over time using the STK instrument Mesh2D.
By choosing an appropriate filter at the boundary of a 2D Digital Waveguide Mesh, the sound resulting of an excitation of the system can be altered in its amplitude and spectral content, corresponding to perceived loudness and timbre. Likewise, the change in input and output position has an influence on the frequency characteristics and amplitude of the sound.
However, the effect is not very interesting, as no filter configuration could be found that could result in a quite different sound, such as transforming the metallic timbre into a more wood-like timbre. I therefore conclude that the modelling of an appropriate sound body is more important to the alteration of the sound than a boundary filter as proposed by, for example, Aird 2002 and Laird 2001.
Epilogue: Future improvements of the Mesh2D STK Instrument
The Mesh2D STK Instrument is a basic implementation of the 2D Digital Waveguide Mesh, giving the option to specify the x- and y-dimensions of a rectangular mesh, the decay factor and the input position on the mesh. The system can then be excited with a desired amplitude through a noteOn command.
Digital waveguide meshes can be far more complex than this. First of all, there are different mesh geometries, such as a hexagonal or triangular node pattern. The latter showed less dispersion error and less computed nodes per space unit (Fontana 1995). The STK implementation could also be extended to be able to model circular meshes, using rimguides to connect the mesh to a virtual boundary (Laird 1998). Laird then introduced the modelling of diffuse boundaries to simulate rough materials by randomly varying the incident traveling wave’s angle (1999). The accuracy of this modelling approach can be greatly improved through multidimensional deinterpolation and frequency warping, consequently almost diminishing the dispersion error at the expense of computational efficiency (Laird 2000).
These improvements refer to the use of the Mesh2D STK Instrument as a means of modelling actual instruments. However, the waveguide mesh technique can also be used to model the human vocal tract, or the acoustics of a room, especially in its extension into 3D in an either rectilinear or tetrahedral setting.
Matlab and C++ code
This archive contains both the Matlab code and the C++ code with instructions on how to use it with the STK. Please refer to the README file.
- Aird, Marc-Laurent. 2002. Musical Instrument Modelling Using Digital Waveguides. Diss. PhD thesis, University of Bath, 2002.
- Doctoral dissertation about the modelling of different instruments including the construction of a drum model connection 2D- and 3D-Waveguide Meshes.
- Fontana, Federico, and Davide Rocchesso. 1995. A New Formulation of the 2D-Waveguide Mesh for Percussion Instruments. Paper read at Proceedings of XI Colloquium on Musical Informatics.
- Introduction of the triangular mesh geometry, reducing the dispersion error.
- Huopaniemi, Jyri, Lauri Savioja, and Matti Karjalainen. 1997. Modeling of reflections and air absorption in acoustical spaces a digital filter design approach. Paper read at IEEE Workshop on Applications of Signal Processing to Audio and Acoustics.
- Digital filter modelling of reflection and air absorption for room acoustics.
- Kelloniemi, Antti, Damian T. Murphy, Lauri Savioja, and V. Välimäki. 2004. Boundary Conditions in a Multi-Dimensional Digital Waveguide Mesh. Paper read at IEEE International Conference on Acoustics, Speech, and Signal Processing.
- Modelling of artificial boundary conditions using a Taylor series approximation in an interpolated mesh.
- Laird, Joel, Paul Masri, and Nishan Canagarajah. 1998. Efficient and Accurate Synthesis of Circular Membranes Using Digital Waveguides. Paper read at IEE Colloquium on Audio and Music Technology: The Challenge of Creative DSP.
- Exploring several rimguide strategies for the modelling of circular membranes, suggesting the adjustment of phase delays.
- Laird, Joel, Paul Masri, and Nishan Canagarajah. 1999. Modelling Diffusion at Boundary of a Digital Waveguide Mesh. Paper read at International Computer Music Conference, at Beijing, China.
- An approach to model diffusion at the boundaries of a mesh with curved boundaries by randomly varying the incident angle of incident traveling waves, e.g, for modelling rough surfaces.
- Laird, Joel. The physical modelling of drums using digital waveguides. Diss. University of Bristol, 2001.
- Doctoral dissertation about the modelling of drums, involving very detailed models and connected 2D and 3D Waveguide Meshes.
- Lee, Kyogu, and Julius O. Smith. 2004. Implementation of a Highly Diffusing 2-D Digital Waveguide Mesh with a Quadratic Residue Diffuser. Paper read at International Computer Music Conference, at Miami, Florida.
- A more recent paper dealing with the modelling of diffusion at the boundary of a 2D Waveguide Mesh using quadratic residue sequences.
- Murphy, Damian T., Antti Kelloniemi, Jack Mullen, and Simon Shelley. 2007. Acoustic Modeling Using the Digital Waveguide Mesh. IEEE Signal Processing Magazine.
- Magazine article summarizing developments in the field of Digital Waveguide Meshes.
- Murphy, Damian T., and Jack Mullen. 2002. Digital Waveguide Mesh Modelling of Room Acoustics: Improved Anechoic Boundaries. Paper read at Conference on Digital Audio Effects (DAFX-02), at Hamburg, Germany.
- This paper gives an overview of known boundary types and describes a new approach to the specific case of an anechoic boundary.
- Rossing, Thomas D. 1982. The Physics of Kettledrums. Scientific American, 172-78.
- A introductory magazine article about the physics of kettle drums in particular, but also drums in general.
- Savioja, Lauri. 1999. Modeling Techniques for Virtual Acoustics. Helsinki: Aalto University.
- A research report with a 19 page chapter on Digital Waveguide Meshes.
- Savioja, Lauri, and V. Välimäki. 2000. Reducing the Dispersion Error in the Digital Waveguide Mesh Using Interpolation and Frequency-Warping Techniques. IEEE Transactions on Speech and Audio Processing 8 (2).
- An attempt to reduce the dispersion error of the Waveguide Mesh using a methot that involves multidimensional interpolation, optimization of the point-spreading function, and frequency warping.
- Smith, Julius O. 2004. Virtual Acoustic Musical Instruments: Review and Update. Journal of New Music Research 33 (3):283-304.
- A journal article reviewing the developments in the field of virtual acoustics with a short but concise section about percussion modelling, referencing many important publications.
- Strikwerda, J.C. 2004. Finite Difference Schemes and Partial Differential Equations: Society for Industrial and Applied Mathematics (SIAM, 3600 Market Street, Floor 6, Philadelphia, PA 19104).
- Basic theory of finite difference schemes and an explanation of the Von Neumann Analysis used to determine the dispersion error of a 2D Digital Waveguide Mesh geometry.
- Van Duyne, Scott A., and Julius O. Smith. 1993. Physical Modeling with the 2-D Digital Waveguide Mesh. Paper read at International Computer Music Conference.
- The original paper, introducing the rectilinear 2D Digital Waveguide Mesh.
- Van Duyne, Scott A., and Julius O. Smith. 1995. The Tetrahedral Digital Waveguide Mesh. Paper read at IEEE Workshop on Applications of Signal Processing to Audio and Acoustics.
- The extension of the 2D Digital Waveguide Mesh into 3D using a tetrahedral approach with four port scattering junction for a better computational efficiency.
- Vocal Tract Modeling
- Mullen, Jack. 2006. Physical Modelling of the Vocal Tract with the 2D Digital Waveguide Mesh, Department of electronics, University of York, York, United Kingdom.
- Mullen, Jack, David M. Howard, and Damian T. Murphy. 2004. Acoustical Simulations of the Human Vocal Tract Using the 1D and 2D Digital Waveguide Software Model. Paper read at Conference on Digital Audio Effects (DAFX’04), at Naples, Italy.
- Fitting a 2D Digital Waveguide Mesh into an arbitrary geometrical shape
- Lee, Jung Suk, Gary P. Scavone, Philippe Depalle, and Moonseok Kim. 2011. Conformal Method for the Rectilinear Digital Waveguide Mesh. Paper read at IEEE Workshop on Applications of Signal Processing to Audio and Acoustics, at New Paltz, NY.
- Room Acoustics
- Murphy, Damian T., and Mark Beeson. 2007. The KW-Boundary Hybrid Digital Waveguide Mesh for Room Acoustics Applications. IEEE Transactions on Audio, Speech, and Language Processing 15 (2):552-64.
- Murphy, Damian T., and David M. Howard. 2000. 2-D Digital Waveguide Mesh Topologies in Room Acoustics Modeling. Paper read at Conference on Digital Audio Effects (DAFX-00), at Verona, Italy.