Page  293 ï~~TRANSMISSION-LINE MODELING AND REAL-TIME SYNTHESIS OF STRING AND WIND INSTRUMENTS Matti Karjalainen, Unto K. Laine, Timo Laakso and Vesa Valimaki Helsinki University of Technology, Otakaari 5 A, SF-02150 Espoo, Finland and Computer Arts Centre at Espoo (CARTES), Espoo, Finland In this paper we present a method for semi-physical modeling and real-time synthesis of string and wind instruments by using the transmission-line principle and a floating-point signal processor (TMS320C30). Fractional delay approximation by Lagrange interpolation is applied to the implementation of a variable-length delay. A bidirectional transmission-line consisting of a pair of delay-lines is used for modeling both the 6-string guitar and the flute. High-quality real-time sound synthesis of both instruments is achieved. Introduction The transmission line (i.e. one-dimensional wave propagation) is known to be one of the basic acoustical principles in many musical instruments. Strings as well as tubes in wind instruments are good examples thereof. By careful modeling of the two-directional propagation, reflection, and attenuation of waves it is possible to make very natural sound synthesis but the real-time behavior has been hard to achieve. In this paper we present an approach to transmission-line modeling that can be used for real-time synthesis of several instruments when modern signal processors are utilized. The acoustic guitar and the flute are given as examples that we have studied in more detail. One of the basic problems in digital transmission-line models has been the difficulty of realizing fractional delays, especially if the length of the delay should vary continuously during the sound synthesis. (As classical papers, see Karplus & Strong [1] and Jaffe & Smith [2]). We solved the problem by introducing fractional delay approximation with Lagrange interpolation [3,4]. Although, as Smith [5] points out, it is possible to minimize extra glitches and transients by using all-pass filters, our experience shows that FIR-type solutions are better in this sense. On the contrary, all-pass filters have an ideal amplitude response that is sometimes the most critical property. It seems to be very application dependent to decide which one is the best. Approximation of variable length string and tube by FIR interpolators Delay-lines consisting of an integer number of unit delays are not adequate for representing lengths of strings and tubes required for playing the scale of equal temperament. For that reason a way to implement fractional delay and to vary the length must be found. Our solution to the length variation problem is to design a FIR filter that produces the fractional delay. It has been proposed e.g. by Laine [3] that the Lagrange interpolator is a filter that has good group delay approximation of ideal fractional delay, although it suffers from amplitude response problems at higher frequences. Lagrange interpolation means fitting a power series curve through the given integer index points in a delay line (see Fig. 1). It can be considered also as a generalization of the simple linear two-point interpolator that has been used e.g. by Sullivan [6] in string modeling. The more samples are used for the interpolation the better the group-delay and amplitude response estimations are but the computational cost will also increase. ICMC 293

Page  294 ï~~delay n+l n+2 n-1 n x n+3 fractional delay Fig. 1 The principle of Lagrange interpolation The Lagrange interpolator can be interpreted as an N-tap FIR filter. When the number of taps is N = 2k (k = 1, 2,...) the transfer function of the filter is defined by the formula: N2 (1) LN,x (z) = N i = -N/2+1 -i(x) z, where:x<1 -.. (x) z, whereO0_x<l The filter coefficients i (x) are given in form: N/2 (2)"j(x)= N xI-j j = -N/2+1, ji The interpolator used in string and wind instrument modeling has been a fourth order filter that is a compromise between efficiency and accuracy. The properties of FIRtype interpolators will be described and analyzed in detail in a forthcoming paper [7]. Modeling and real-time synthesis of the acoustic guitar If a sampling frequency of 22.05 or 44.1 kHz is used the length of guitar string delay lines vary beetween tens of samples and about 200 samples. An efficient algorithm and a fast processor are needed to synthesize a 6-string guitar in real time. We managed to do that on TMS320C30 when the sampling frequency is 22.05 kHz, resulting in effective bandwidth of several kHz. The modeling of the body of acoustic guitar is a computationally expensive task that reserves another signal processor [8]. Figure 2 shows a principal diagram for the implementation of the string model. Length controls Left hand side FL END R EFLT fTIONN Excitation4 point Bridge side END REFT FCIO 1.ij.. '........Pickup "' point...... Fig. 2. A diagram of the string model. Two delay lines of variable length are combined with end reflection filters, excitation point and pickup point(s). ICMC 294

Page  295 ï~~The variable length delay-lines with fractional part interpolation are implemented as ring buffers by using the circular addressing mode of the TMS320C30. The coefficients of the Lagrange interpolator are simple enough to be computed directly at runtime if the update rate is lower than the sampling frequency (about 1 kHz in our case). In reality the delay-lines are combined so that only one common fractional part is needed [4]. The excitation point and even the pickup point(s) can be changed by integer steps at runtime. The excitation signal that is divided equally to both delay-lines is proportional to the acceleration of the string in the excitation point. An ideal impulse corresponds to a very sharp plucking of the string. A second-order low-pass filter following the excitation impulse can be used to make the plucking smoother. The output from the pickup point (summed from both lines) is also an acceleration signal that may be integrated to achieve a velocity signal that better corresponds to the radiated signal of acoustic systems. The output of a string may be coupled to other strings in order to force sympathetic oscillations on them. A body model follows the strings but is not discussed here. The end point reflections of the string as well as all the attenuations by losses and the dispersions of a string are lumped to filters (FL and FR) of low-pass type, including inverting of the amplitude polarity. We have used simple first-order filters succesfully. By proper control of attenuation by filters these the damping of the string before plucking can be simulated, at least in a simple case. Sound synthesis experiments show that the string model is accurate enough for most normal ways of playing. Some noise-like and hammering excitations, when added to right-hand or to left-hand point, may add reality to the sound. The complex interaction of the vibrating string and the right-hand is often difficult to simulate. The string models without a body model sound somewhat "electric" but still surprisingly acoustic. This shows that the primary role of the body is to amplify and only secondarily to color the sound. Modeling and synthesis of the flute The modeling and real-time synthesis of the flute follows the same general guidelines of using the variable-length transmission line, see Fig. 3. Our model also exploits the results of several studies on the sound production mechanism by the flute. A good summary of those studies can be found in a recent book by Fletcher and Rossing [9]. Nonlinearity Variable delay-line Fig. 3. The principle of the flute model. ICMC 295

Page  296 ï~~The excitation of the flute is modeled by white noise, which is produced by a pseudorandom number generator. The coupling of the excitation to the tube resonator is implemented by a smooth nonlinearity, that is called a sigmoid function. In a real flute there is a phase shift along the air jet caused by the finite wave propagation speed. That is why there is a delay before the nonlinearity in our model (Fig. 3). The length of both delay-lines corresponds to the effective length of an vibrating air column of a real flute. The dispersive effect of the finger holes on the signal propagating in the delay-line is brought about by a one-pole IIR filter in the ends of the tube (blocks Ff and Fb in Fig. 3). The same first-order filters implement the end point reflection functions of the tube as well as all the losses due to the walls. The output is high-pass filtered by a differentiator (block Fr in Fig. 3) for modeling the relation between the volume flow propagating inside the tube and the radiated sound pressure. We have applied a sampling frequency of 44.1 kHz that leads to high-quality synthetic sounds covering the most part of the audio bandwidth. Summary The transmission-line principle was applied to the implementation of a real-time synthesis model of a 6-string acoustic guitar with a rich set of parametric controls. Highquality sounds have been generated without any audible distortion or extra sounds even during gliding pitch or vibrato. We have also implemented a model for real-time sound synthesis of the flute that is able to synthesize high quality sounds. The floating-point signal processor TMS320C30 (with peak performance of 33 MFlops) was used for the model-based synthesis. Both models were controlled from special sequencer programs (written in Common Lisp) on a Macintosh II or from a MIDI sequence. Acknowlegment This work has been financially supported by the Academy of Finland. References [1] K. Karplus, A. Strong, "Digital Synthesis of Plucked String Algorithms,"CMJ 7(2), 1983. [2] D.A. Jaffe, J.O. Smith, "Extensions of the Karplus-Strong Plucked String Algorithm," CMI 7(2), 1983. [3] U.K. Laine, "Digital Modelling of a Variable Length Acoustic Tube," in Proc. of Nordic Acoustical Meeting, Tampere. The Acoust. Soc. of Finland, 1988. [4] M. Karjalainen, U.K. Laine, "A Model for Real-Time Sound Synthesis of Guitar on a FloatingPoint Signal Processor," Proc. of IEEE ICASSP-91, Toronto, 1991. [5] J.O. Smith, "J.O. Smith III Comments on Sullivan Karplus-Strong Algorithm," A letter to CMJ 15(2), 1991. [6] C.R. Sullivan, "Extending the Karplus-Strong Algorithm to Synthesize Electric Guitar Timbres with Distortion and Feedback," CMJ, 14(3), 1990. [7] T. Laakso, U. Laine, and M. Karjalainen, "Fractional Delay Approximation by Digital Filters," to be published. [8] M. Karjalainen, U.K. Laine and V. Vlimiki, "Aspects in Modeling And Real-Time Synthesis of the Acoustic Guitar," to be published. [9] N.H.Fletcher, T.D.Rossing, The Physics of Musical Instruments, New York, Springer Verlag, 1991, Ch.16 ICMC 296