Page  1 ï~~An Improved Digital Waveguide Model of a Flute - Implementation Issues Vesa Valimiki University of Westminster School of Electronic and Manufacturing Syst. Eng. 115 New Cavendish Street LONDON W1M 8JS United Kingdom vesa.valimaki @hut.fi Rami Hainninen Helsinki Univ. of Technology Telecommunications and Multimedia Laboratory Otakaari 1 FIN-02150 ESPOO Finland rami.hanninen@hut.fi Matti Karjalainen Helsinki Univ. of Technology Laboratory of Acoustics and Audio Signal Processing Otakaari 5A FIN-02150 ESPOO Finland matti.karjalainen@hut.fi Abstract This paper introduces a digital waveguide model of a flute which features a full set of finger holes of a real flute. The model responds correctly to real playing techniques, including the fingering combinations, overblowing, and vibrato. Many of the flute model parameters, such as the lengths of delay lines and finger hole filter parameters, have been computed from measurements taken from a real flute. 1 Introduction Digital waveguide modeling of musical instruments is one of the most popular sound synthesis techniques at present. This methodology has been mainly developed by Smith [Smith, 1992]. Digital waveguide modeling is well suited to synthesis of wind and string instruments, although the same principles have recently been applied to the piano and percussion instruments as well. Digital waveguide synthesis of the flute has been a target of active research during the recent years. The first version of a real-time digital waveguide flute model was introduced by Karjalainen et al. [Karjalainen, 1991] and Vdlimiiki et al. [Vailimaiki, 1992]. Cook has implemented a simplified version of this model [Cook, 1992]. Similar principles for simulating the air reed mechanism of the flute had been used by McIntyre et al. [McIntyre, 1983] and Wawrzynek [Wawrzynek, 1989]. More recently also Coltman [Coltman, 1992] has reported on a flute simulation model. Newest developments in flute modeling include the works of Chafe [Chafe, 1995] and Cook [Cook, 1995]. A more detailed and physically accurate flute model could be constructed based on recent research by Verge [Verge, 1995]. Other research work on flute synthesis using a time-domain model include [Magalotti, 1995a], [Magalotti, 1995b], and [Agull6, 1995]. So far, many implementations have failed to produce realistic flute sound that could be controlled using the same techniques that are used to play a real flute. One of the major problems has been the note transition. Changing the length of the delay lines of the waveguide flute changes the pitch but produces an audible 'click' when the internal state of the model abruptly changes. On the other hand, changing the length of the delay lines gradually changes the state smoothly but produces an undesirable pitch-bend effect. A solution to these problems was introduced in [Vailimiiki, 1993b] and [Viilimiiki, 1995]. The finger holes that are used to control the pitch in a flute must be incorporated into the model. Their position is adjusted using interpolation techniques, which are implemented as fractional delay filters [Laakso, 1996]. Our implementation uses fractional delay filters that match the function, location and size of the finger holes of a real flute. 2 Waveguide Flute Model The overall structure of the new flute model is nearly the same as that described in [Valimaki, 1992]. This version however includes multiple simultaneously functioning finger holes. The signal flowgraph of the new, improved flute model is illustrated in Figure 1. 2.1 Boundary Loss Filter The boundary loss filter in [Vailimaiki, 1992] has been moved from the end of the upper delay line. When placed before the upper delay line, it now affects also the upper delay line finger hole filter inputs. As explained in [Vailimaiki, 1992], the boundary loss filter models signal losses that occur when sound waves propagate along the flute main tube. For the sake of efficiency, all loss filtering is realized by one filter, and as long as there is only one signal output, this is perfectly legal [Smith, 1992]. With finger hole filters, a more accurate, but computationally much more expensive solution would be to distribute the loss filtering among several "smaller" loss filters, placed between signal outputs. 2.2 Modeling an Open Finger Hole Each open finger hole is implemented as a threeport junction. It is assumed that a finger hole is a short side-branch in the bore of the tube. The acoustic impedance of the side-branch is simulated with a first-order IIR filter as described in [Vialimaki, 1993b] and [Vialimaiki, 1995]. ICMC Proceedings 1996 Valimaki et al.

Page  2 ï~~Sigmoid nonlinearity DC killer T Boundary loss filter - LFI)-- Upper delay line 2 Jet delay line Direct feed- Feedback Finger hol (adjustable) back gain Feedack filters t gainI Voiced gain f Â~-4 4 -Vibrato A0 Noise Lower dela O control @ gain line Amplitude Noise d input input Figure 1: Block diagram of the new waveguide flute model 0 Output i signal 0 The location of the finger hole must be very carefully adjusted. This is achieved by using interpolation techniques. The input signal to the finger hole model is obtained using some bandlimited interpolation method (we use Lagrange interpolation). The output signal of the finger hole model must be injected equally carefully back into noninteger points of the delay line. Deinterpolation [Vailimaiki, 1993a] is a new signal processing method that performs this operation. Deinterpolation may be implemented with an FIR filter which has the same coefficients as a corresponding interpolation filter [Vilimaiki, 1995]. 3 Implementation Two different implementations of the flute model have been built: one with Matlab for easy testing and analysis and another with C++ for high performance. Only the Matlab version is described here since it is simpler and easier to explain. The complete source code for the Matlab version may be obtained from [Hainninen, 1995]. 3.1 Multiple Finger Holes If properly arranged, the finger hole filtering and the interpolation and deinterpolation operations can be carried out with just a few matrix and vector operations. For example, a delay line of length N can be conveniently expressed as a vector with N components. We first define a sparse COEFFS matrix that stores the Lagrange interpolation coefficients for fractional delay filters. COEFFS is a N x M matrix, where N is the length of the delay line and M is the number of finger holes. Each column of the COEFFS matrix holds Lagrange coefficients for one fractional delay filter. The coefficient groups are padded with zeros, and the placement of coefficients within columns defines the integer part of each delay. For example, let us assume that N = 80, M = 2, the order of the fractional delay filters is 3, and the finger holes are located at positions 40.3 and 60.1. The matrix COEFFS then becomes: F0... 0 -0.06 0.77 0.33 -0.06 0... 0 -COEFFS =L - 0. 1 L0 3 0 -0.03 0.94 0.10 -0.10 0... 0 (1) where subscript T denotes matrix transposition. After COEFFS has been initialized, the input signals for all finger hole models can be computed with a single instruction: VENTINPUT = (UPPER+LOWER)* COEFFS (2) UPPER and LOWER are both 1 x N vectors and represent the upper and lower delay lines of the waveguide model, respectively. The LOWER delay line flows in the opposite direction than the UPPER delay line, and the order of elements in LOWER is therefore reversed. VENTINPUT is a 1 x M row vector that contains the fractionally delayed samples for the M finger hole models. The finger hole filters are approximated with firstorder IIR filters ([Vailimaiki, 1993b] and [Vlimkki, 1995]), and the outputs of the M filters are collected into a 1 x M vector: VENTO UTP UT = BR * VENTINP UT - AR * VENTOUTPUT (3) AR and BR are finger hole filter parameters and VENTOUTPUT on the right side of the equation holds the previous VENTO UTP UT values. AR and BR may be scalars if the parameters are the same for all finger hole filters, or vectors if the parameters vary. The values in VENTOUTPUT are distributed back to the upper and lower delay lines using deinterpolation. The same Lagrange interpolation coefficients that were used to extract the fractionally delayed samples are used to insert them back into the delay Valimaki et al. ICMC Proceedings 1996

Page  3 ï~~lines [Vilimaiki, 1995]. Reversing the interpolation process, we first construct a deinterpolation vector: DEINTER = VENTOUTPUT * COEFFST (4) This yields a 1 x N vector where each element is the sum over all finger hole filter outputs, weighted by the appropriate fractional delay filter coefficients. These values are then added to the upper and lower delay lines, finishing the deinterpolation operation: UPPER = UPPER + DEINTER (5) LOWER = LOWER + DEINTER 4 Simulation The proposed flute model produces a convincing flute-like sound that changes pitch smoothly when the finger holes are opened and closed. Nevertheless, this requires that the finger holes themselves are operated smoothly. This is realistic since the finger holes of a real flute do not open or close infinitely fast. Any abrupt change in the values of the finger hole parameters creates a severe discontinuation to the internal state of the model which produces an audible click. Adjusting the parameters gradually removes this effect. Below we give two examples of the behaviour of the Matlab version of the flute model [Hainninen, 1995]. Both tests were run using the configurable parameter set shown in Table 1. The only difference between these examples is how the finger hole parameters are operated: in Figure 2, they are changed smoothly, in Figure 3, infinitely fast. The continuous line in the figures shows the state of the finger holes. A real flute is controlled with finger holes and input air flow. The air flow control is brought into the flute model by controlling the amplitude of the noise input and the length of the jet delay line. The control over the jet delay line length corresponds mainly to the angle in which a flutist blows air into a mouth piece. The blowing technique has the important func tion of controlling the overblowing effect of the flute. When no overblowing is in effect and all finger holes are closed, the jet line length is equal to the sum of upper and lower line lengths. By halving the length of the jet line, the model starts to overblow, producing one octave higher pitch (the fundamental frequency is doubled). Halving the jet line length again raises the pitch a fifth more, etc. It is interesting to note that the exact jet line length required to reach a certain note and overblow level depends on the current note and overblowing level of the flute model. The current resonator equilibrium state affects the requirements to reach a new equilibrium state, just like with a real flute. Although this does not usually require any conscious effort, a real flutist must also learn the proper blowing techniques for every possible transition from one note to another. With our flute model, the jet line length must be equally carefully adjusted to produce the expected sounds. Table 1. Test run parameters (FH = Finger Hole) Flute length: 80 Sample rate: 44.1 KHz # of holes: 2 Sim. time: 1 s Pos. of FHI: 40.3 Interp. Ord: 2 Pos. of FH2: 60.1 RAND seed: 1 5 Summary Our complete implementation of the proposed model includes the full finger hole set of a flute. Measuring the location and sizes of the finger holes from a real flute and converting them to finger hole parameters produces suprisingly good result. Just like when designing and building a flute, many finger hole configurations fail to produce any sound at all. Therefore, finding a set of 15 finger holes that responds correctly to flute fingering combinations is a success in itself. Unfortunately, fine-tuning the numerous parameters of the flute model is a difficult task. An interesting possibility to adjust the parameters of the linear part (tube) of the flute would be to measure the x 10' Output from the open end of the flute (A) 0 -I 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 x 104 5000 -5000 1 0 0.5 1 Output from finger holes (B) 1 I-2.5 3 3. 4 L.5 1.5 2 2.5 3 3.5 4 4.5 x 10:4 x 10' Output from the open end of the flute (A) 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 x 10! 104 Output from finger holes (B) x 104 1x 10 Combined output (A+B) 0 0 0.5 1 1.5 2 2.5 3 3.5 4 Samples x 104 Figure 3. Infinitely fast finger hole operation x 104 Combined output (A+B) 0 -1 0 0.5 1 1.5 2 2.5 3 3.5 4 Samples x 10' Figure 2. Smooth finger hole operation ICMC Proceedings 1996 V5lim~ki et al.

Page  4 ï~~delay and filter characteristics needed for each finger hole, following the guidelines proposed by Karjalainen et al. [Karjalainen, 1995]. One more alternative way to adjust the parameter values would be to use an automatic learning system, such as a genetic algorithm [Vuori, 1993]. References [Agull6, 1995] Agull6, J., and Puig, J. Time-domain modeling of the recorder. Proc. Int. Symp. Musical Acoustics (ISMA'95), Le Normont, Dourdan, France, July 2-6, 1995, pp. 48-53. [Chafe, 1995] Chafe, C. Adding vortex noise to wind instrument physical models. Proc. Int. Computer Music Conf. (ICMC'95), Banff, Canada, Sept. 3-7, pp. 57-60. [Coltman, 1992] Coltman, J. Time-domain simulation of the flute. J. Acoust. Soc. Am., vol. 92, no. 1, pp. 69-73. [Cook, 1992] Cook, P. R. A meta-wind-instrument physical model, and a meta-controller for realtime performance control. Proc. Int. Computer Music Conf. (ICMC'92), San Jose, California, Oct. 14-18, 1992, pp. 273-276. [Cook, 19951 Cook, P. R. Integration of physical modeling for synthesis and animation. Proc. Int. Computer Music Conf. (ICMC'95), Banff, Canada, Sept. 3-7, 1995, pp. 525-528. [Hanninen, 1995] Hainninen, R., and Valimaiki, V. Matlab source code for the improved waveguide flute model. <URL:ftp://helmholtz. hut.fi/pub/flute/> [Karjalainen, 1991] Karjalainen, M., Laine, U. K., Laakso, T. I., and Vailimaiki, V. Transmissionline modeling and real-time synthesis of string and wind instruments. Proc. Int. Computer Music Conf. (ICMC'91), Montreal, Canada, Oct. 16-20, 1991, pp. 293-296. [Karjalainen, 1995] Karjalainen, M., Valimaiki, V., Hernoux, B., and Huopaniemi, J. Explorations of wind instruments using digital signal processing and physical modeling techniques. J. New Music Research, vol. 24, no. 4, pp. 301-317. [Laakso, 1996] Laakso, T. I., Vailimaiki, V., Karjalainen, M., and Laine, U. K. Splitting the unit delay-tools for fractional delay filter design. IEEE Signal Processing Magazine, vol. 13, no. 1, pp. 30-60. [Magalotti, 1995a] Magalotti, R., and Borin, G. Time-domain simulation of the instruments of the flute family. Proc. Second Int. Conf. Acoustics and Music Research (CIARM'95), Ferrara, Italy, May 19-21, 1995, pp. 61-66. [Magalotti, 1995b] Magalotti, R., Borin, G., and De Poli, G. A new dipole source for time-domain simulation of flute-like instruments. Proc. Int. Symp. Musical Acoustics (ISMA'95), Le Normont, Dourdan, France, July 2-6, 1995, pp. 491-495. [McIntyre, 1983] McIntyre, M. E., Schumacher, R. T., and Woodhouse, J. On the oscillations of musical instruments. J. Acoust. Soc. Am., vol. 74, no. 5, pp. 1325-1345. [Smith, 1992] Smith, J. 0. Physical modeling using digital waveguides. Computer Music J., vol. 16, no. 4, winter, pp. 74-87. [Vilimaiki, 1992] Vailimaiki, V., Karjalainen, M., Jinosy, Z., and Laine, U. K. A real-time DSP implementation of a flute model. Proc. 1992 nt. Conf. Acoustics, Speech, and Signal Processing (ICASSP'92), San Francisco, California, March 23-26, 1992, vol. 2, pp. 249-252. [Valimaki, 1993a] Vailimiki, V., Karjalainen, M., and Laakso, T. I. Fractional delay digital filters. Proc. IEEE Int. Symp. on Circuits and Systems (ISCAS'93), Chicago, Illinois, May 3-6, 1993, vol. 1, pp. 355-358. [Valimiki, 1993b] Vailimaiki, V., Karjalainen, M., and Laakso, T. I. Modeling of woodwind bores with finger holes. Proc. Int. Computer Music Conf. (ICMC'93), Tokyo, Japan, Sept. 10-15, 1993, pp. 32-39. [Vailimaiki, 1995] Vilimaiki, V. Discrete-Time Modeling of Acoustic Tubes Using Fractional Delay Filters. Doctoral thesis. Report no. 37. Espoo, Finland, Helsinki University of Technology, Laboratory of Acoustics and Audio Signal Processing. 193 p. [Verge, 1995] Verge, M. P. Aeroacoustics of Confined Jets, with Applications to the Physical Modeling of Recorder-Like Instruments. PhD thesis. Eindhoven, The Netherlands, Eindhoven University of Technology. 243 p. [Vuori, 1993] Vuori, J., and Vailimiki, V. Parameter estimation of non-linear physical models by simulated evolution-application to the flute model. Proc. Int. Computer Music Conf. (ICMC'93), Tokyo, Japan, Sept. 10-15, 1993, pp. 402-404. [Wawrzynek, 1989] Wawrzynek, J. VLSI models for sound synthesis. In: Mathews, M. V., and Pierce, J. R. (eds.) Current Directions in Computer Music Research, MIT Press, Cambridge, Massachusetts, pp. 113-148. Valimaki et al. 4 ICMC Proceedings 1996