This repository contains Matlab scripts that implement both the Transfer Matrix Method (TMM) and Digital Waveguide (DWG) methods for acoustic modeling. Instrument definition files are in the geometries/ directory. Example usage files are in the examples/ directory.
The Transfer Matrix Method (TMM) is a frequency-domain approach to calculate input impedance for acoustics systems that can be approximated by piece-wise one-dimensional cylindrical and conical segments (with extensions for side holes and more arbitrary sub-structures). The user will normally call either the function tmm.m or tmmi.m with appropriate parameters for the air column geometry, output end type, frequencies of interest, loss type and temperature. The function tmmi.m approximates external interactions between open toneholes, while the function tmm.m assumes all open holes are independent. Several models for viscous boundary layer losses are provided by the function sectionLosses.m, while classical and molecular air losses are approximated in airLosses.m. Flanged and unflanged open end approximations are provided by the function radiation.m. See examples in the files examples/tmmex#.m.
Digital waveguide methods for time-domain modeling of acoustic structures comprised of interconnected piece-wise one-dimensional cylinders, cones and toneholes have been well reported in the past. The Matlab class dwg.m provides functionality that can be used to model arbitrary wind instrument air column structures, defined by length, radii and hole geometric parameters, using digital waveguide methods. The user will normally create an instance of dwg.m, specifying a sample rate and temperature, and then call various class methods to define the geometry, control the modeling options, and compute responses. Fractional-delay filtering can be enabled or disabled, with support for both Thiran and Lagrange filter types of specified order (dwgFractionalDelay.m). Viscous boundary and air losses can be modeling using either a discrete-time least squares or a shelf-filter fit, both of arbitrary order (dwgLosses.m). Three different tonehole model options are provided (two-port, three-port or wave digital filter) by dwgTonehole.m. End boundary conditions include closed, anechoic, ideally open, open flanged and open unflanged (dwgRadiation.m). The class object (dwg.m) can be used either in single-sample iterative contexts (for example, with an attached excitation model) or with arbitrarily-sized input signals (for example, to compute a reflection function or impedance). The modeled geometry can be constructed manually by iteratively adding segments or holes, or a complete geometry can be specified in a file. See examples in the files examples/dwgex#.m.