Page  00000001 Online Correction of Dispersion Error in 2D Waveguide Meshes Federico Fontana and Davide Rocchesso Dipartimento Scientifico e Tecnologico Universita di Verona Strada Le Grazie 15, 37134 Verona, Italy {fontana,rocchesso}@sci.univr.it Abstract An elastic ideal 2D propagation medium, i.e., a membrane, can be simulated by models discretizing the wave equation on the time-space grid (finite-difference methods), or locally discretizing the solution of the wave equation (waveguide meshes). The two approaches provide equivalent computational structures, and introduce numerical dispersion that induces a misalignment of the modes from their theoretical positions. Prior literature shows that dispersion can be arbitrarily reduced by oversizing and oversampling the mesh, or by adopting offline warping techniques. In this paper we propose to reduce numerical dispersion by embedding warping elements, i.e., properly tuned allpass filters, in the structure. The resulting model exhibits a significant reduction in dispersion, and requires less computational resources than a regular mesh structure having comparable accuracy. 1 INTRODUCTION Membranes are the crucial component of most percussion instruments. Their response to an excitation, and their interaction with the rest of the musical instrument and with the environment, strongly affect the sound quality of a percussion. Physical modeling of membranes has drawn the attention of the computer music community when a new model based on the Digital Waveguide was designed, called 2-D Digital Waveguide Mesh [Van Duyne and Smith, 1993]. The model was proved to provide a computational structure equivalent to a Finite Difference Scherme (FDS). In particular, it was shown that the numerical artifacts introduced by the model cause a phenomenon called dispersion. This means that, even in a flexible medium, different spatial frequency components travel at different speeds, and this speed is direction- and frequency-dependent [Strikwerda, 1989, Van Duyne and Smith, 1993]. Different mesh geometries have been studied: each of them have an equivalent FDS, and exhibits its peculiar dispersion error function [Fontana and Rocchesso, 2000]. The triangular geometry exhibits two valuable properties: the dispersion error is, with good approximation, independent from the direction of propagation of the spatial components; at the same time, the Triangular Waveguide Mesh (TWM) defines, from a signal-theoretic point of view, the most efficient sampling scheme among the geometries that can be derived from mesh models used in practice [Savioja, 2000, Fontana and Rocchesso, 2000]. The independency from direction has been successfully exploited [Savioja, 2000] to warp the signals produced by the model, using offline filtering techniques [Hirmi et al., 2000]. In this paper we work on a similar idea, but warping is performed online by cascading each unit delay in the TWM with a first-order allpass filter. By properly tuning the filter parameter, we will prove that a considerable reduction of the dispersion error can be achieved in a wide range around dc. This result is then compared with the performance of a TWM, oversized in order to reduce dispersion in the first modes. It will be shown that the warped mesh is less expensive in terms of memory and computational requirements. This evidence holds both for the straight waveguide and the FDS implementations. Our conclusion is that the most efficient, low-dispersion computational scheme for membrane modeling is a triangular FDS where the unit delays are cascaded with properly tuned allpass filters. Having an efficient and accurate membrane model is a key step toward the construction of affordable, tunable, and realistic models of complete percussion instruments. In particular, the coupling between air and membrane [Fontana and Rocchesso, 1998], and the interface with resonating structures are fundamental components that should be added to the membrane model in order to achieve better realism [Aird et al., 2000]. 2 ONLINE WARPING For a wave traveling along the waveguide mesh, the numerical dispersion error is a function of the two spatial frequency components. In the TWM, this function is symmetric around the origin of the spatial frequency axes, with good approximation. Con

Page  00000002 Dispersion function (TWM) Frequency response 0.5 1.5 rad/sample 1.5 rad/sample Figure 1: Plot of the dispersion error versus temporal frequency magnitude sequently, it makes sense to plot the dispersion factor as a single-variable function of spatial frequency, moving from the center of the surface to the absolute band edge along one of the three directions defined by the waveguide orientations1. Assuming the waveguides to have unit length, the spatial band edge results to be equal to 2x/v/3 [rad/spatial sample] [Fontana and Rocchesso, 2000]. A plot of the dispersion factor versus temporal frequency is then calculated recalling the nominal propagation speed factor, equal to 1/V/2 [spatial sample/time sample], affecting any finite difference model [Strikwerda, 1989], that fixes the edge of the temporal frequency at the value v/27r//3 [rad/sample]. Figure 1 depicts a plot of the dispersion factor. This analysis is confirmed by simulations conducted over a TWM modeling a square membrane of size 24 x 24 waveguide sections, clamped at the four edges, excited at the central junction by an impulse. In fact, the impulse response taken at the central junction shows that the positions of its modes match well with the theoretical frequencies of the odd modes of the membrane, each one of them being shifted by its own dispersion and by the nominal propagation speed factor. The results are depicted in Figure 2, where the frequency response of the model is plotted together with (o) the theoretical positions (compressed by the nominal propagation speed factor) of the modes resonating in the membrane below v/27-//3 [rad/sample], and (x) the real positions of the same modes, affected by dispersion. Overall, dispersion introduces a modal compression that increases with frequency. The careful reader will note a slight difference between the calculated frequency cut and the bandwidth of the sig1In [Savioja, 2000], a function averaging the surface magnitude around the origin is constructed, resulting in a slight difference respect to the curve adopted here. Figure 2: Frequency response taken at the center of a TWM (size 24 x 24) excited by an impulse at the same point. Theoretical positions of the odd modes resonating in a mebrane below F/2w/-/-3 [rad/sample], weighted by the nominal propagation speed factor (o). Positions of the same modes affected by dispersion (x). nal coming from the simulation. This difference is probably due to the simplifying assumption of considering the dispersion function as direction independent. Moreover, some modes show up as twin peaks. This may be due to the actual irregular shape of the resonator model, caused by the impossibility to design a perfectly square geometry using a TWM model. In order to conduct a controlled analytical study we avoided using interpolation along the edge, even though this is recommended in practical implementations [Aird et al., 2000]. Let H(z) be the transfer function of a TWM, regardless of the excitation (input) and acquisition (output) positions. The transfer function can be handled by conformal mapping, a method consisting in the application of a particular map T to the zdomain, in order to obtain a new, warped domain 2 = T(z) [Moorer, 1983, Hirmi et al., 2000]. The frequency response H(ejý), calculated from H(2)|i=eiw, changes according with the map. Practical implementations of transfer functions obtained by conformal mapping are often affected by non computable loops, that can sometimes be resolved [Hirmi, 1998]. In a TWM, delay free loops appear whenever the map does not allow to extract an explicit unit delay. However, if we change the number of unit delays in each waveguide section of a waveguide mesh, we only change the number of Fourier images of the frequency response2, by simply compressing each single image. Now, imagine a map that translates each unit delay into the cascade of a first-order allpass filter 2This occurs whenever a map i = zM is applied to a discretetime linear filter.

Page  00000003 Mapping functions Frequency response 0.5 k n 0 0.5 1 1.5 rad 2 2.5 3 0.3 0.4 rad/sample Figure 3: Mapping functions i- = z-1A(z) for equally-spaced values of the parameter a of the allpass filter A(z). Top line: a = 0. Bottom line: a = -0.9. A(z) and a unit delay, '- = z-1A(z). If the allpass filter has a negative coefficient, the phase delay introduced by the filter ranges from one sample (in high frequency) to a certain value larger than one (in low frequency). Therefore, it is reasonable to expect an extra image (due to doubling the unit elements for high frequencies), and a degree of compression that decreases with increasing frequency. This is exactly the kind of behavior that is desired in order to counterbalance the effects of numerical dispersion. In order to get rid of extra frequency components it is sufficient to lowpass filter at the desired cutoff frequency, and to restore the correct positions of low-frequency partials it is sufficient to increase the temporal sampling rate. The frequency domain is warped according with the formula = arctan 2 sin w{a + cosw} S1 + a2 + 2a cos w - 2 sin2 W where a is the parameter of the allpass filter A(z): A(z) = a+ 1 (2) 1 + az- 2) Figure 3 shows the mapping functions calculated for some negative values of the parameter of the allpass. The more negative is a, the more warped are the modes, especially in the low frequency range. This result has an intuitive interpretation if we consider the phase delay of the allpass: the more negative is a, the more delayed by the allpass filter are the lower frequencies traveling into the mesh respect to the higher ones. Choosing a = -0.45 (curve in the middle), the warping so introduced limits the modal dispersion to very low values. Figure 4 shows the frequency response of the same TWM simulated before, after warping. Using the Figure 4: Impulse response taken at the center of a warped TWM (size 24 x 24) excited by an impulse at the same point. Theoretical positions of the odd modes resonating in a mebrane, rescaled to align the fundamentals (o). Positions of the same modes affected by residual dispersion (x). same notation of figure 2, the response is compared with the ideal positions of the modes, rescaled to align the fundamentals (o), and with the real positions of the same modes, affected by the residual dispersion (x). The improvement in terms of precision in the alignment of the modes is evident by comparison of crosses and circles in figures 2 and 4. 3 COMPUTATIONAL PERFORMANCE Figure 5 shows a plot of the dispersion factor after warping. Dispersion is below 2% in a range equal to 75% of the whole band, then it climbs to the maximum. From a perceptual viewpoint, it is not clear how much tolerance we might admit in the frequency positions of high order partials of a drum. Frequency deviation thresholds should be derived from subjective experimentation, as it was done for piano sounds [Rocchesso and Scalcon, 1999]. Certainly, fig. 2 shows an unnatural compression of modes that results in a decrease in brightness. Moreover, the frequency distribution of resonances brings us some information about the shape of the resonating object, for instance making it possible to discriminate a circular from a square drum. The warped TWM preserves the correct distribution of modes quite well up to 75% of the frequency band. By comparison of figures 1 and 5, we can note that a similar precision is achieved by a TWM if the waveguides are reduced to one third of the original length (the mesh is nine times denser). Then, the fundamentals can be aligned in the two models by multiplying times 1.75 the sampling rate of the warped TWM. Finally, both the output signals must be lowpass filtered.

Page  00000004 Dispersion function (warped TWM) 1.02, 1 1 0.98 -0 cz S0.96 -C: 0 0.94 -0.92 - 0.9 0. 8 ' 1 1 1 0 0.1 0.2 0.3 0.4 rad/sample 0.5 0.6 0.7 Figure 5: Plot of the dispersion error versus temporal frequency magnitude in the warped TWM. SSums Mult Memory TWM 99 9 54 WTWM 40.25 22.75 22.75 FDS 54 9 18 WFDS 17.5 8.75 7 Table 1: Performance of the TWM (FDS) vs. warped version ('W') in terms of sums, multiplies and memory locations. Both the TWM (FDS) and its warped version allow the same dispersion tolerance. From these considerations, a comparison of the TWM versus its warped version in terms of needed sums, multiplies and memory locations, based on dispersion tolerance, can be summarized in Table 1, where the warped models are labeled with the prefix 'W', and the allpass filter is supposed to be implemented in canonical (2 multiplies, 1 delay) form. Both the straight mesh and FDS implementations are considered. The number of multiplies can be further reduced at the expense of more memory by using one-multiply allpass filter structures. 4 CONCLUSION A new technique to reduce modal dispersion in a wide frequency range in TWM and triangular FDS models of 2D resonators has been presented. This technique is based on first-order allpass filters embedded in the mesh, and it requires an increase in temporal sampling rate accompanied by lowpass filtering of the output signal. The resulting warped TWM is shown to be less expensive in terms of computing resources and memory consumption than oversizing a TWM or FDS model. The coefficient of the embedded allpass filters is also a parameter that can be controlled to introduce tension modulation or other more exotic effects. References [Aird et al., 2000] M. Aird, J. Laird., and J. Fitch. A Model for a Drum Using Interpolation/Deinterpolation Techniques to Interface 2-D and 3-D Waveguide Meshes. In Proc. International Computer Music Conference, elsewhere in these Proceedings, Berlin, Germany, 2000.. [Fontana and Rocchesso, 2000] F. Fontana and D. Rocchesso. Signal-theoretic characterization of waveguide mesh geometries for models of twodimensional wave propagation in elastic media. IEEE Trans. Speech and Audio Processing, 2000. In press. [Fontana and Rocchesso, 1998] Federico Fontana and Davide Rocchesso. Physical modeling of membranes for percussion instruments. Acustica, 83(1):529-542, 1998. [Hirmi, 1998] A. Hirmi. Implementation of recursive filters having delay free loops. Proc. IEEE Int. Conf. Acoustics, Speech, and Signal Processing, vol. 3, pp. 1261-1264, Seattle, Washington, 1998. [Hirmi et al., 2000] A. Hirmi, M. Karjalainen, L. Savioja, V. Vilimiki, U. K. Laine, and J. Huopaniemi. Frequency-warped signal processing for audio applications. AES 108th Int. Conv., preprint no. 5171, Paris, France, 2000. [Moorer, 1983] James A. Moorer. The Manifold Joys of Conformal Mapping: Applications to Digital Filtering in the Studio. Journal of the Audio Eng. Soc., 31(11):826-840, 1983. [Savioja, 2000] L. Savioja and V. Vilimiki. Reducing the dispersion error in the digital waveguide mesh using interpolation and frequency-warping techniques. IEEE Trans. Speech and Audio Processing, 8(2):184-194, 2000. [Rocchesso and Scalcon, 1999] Davide Rocchesso and Francesco Scalcon. Bandwidth of perceived inharmonicity for physical modeling of dispersive strings. IEEE Trans. Speech and Audio Processing, 7(5):597-601, 1999. [Strikwerda, 1989] J. Strikwerda. Finite Difference Schemes and Partial Differential Equations. Wadsworth & Brooks, Pacific Grove, CA, 1989. [Van Duyne and Smith, 1993] Scott A. Van Duyne and Julius O. Smith. The 2-D digital waveguide mesh. In Proc. IEEE Workshop on Applications of Signal Processing to Audio and Acoustics, Mo honk, NY, 1993.