Page  361 ï~~Physical modelling of a stiff string by numerical integration Michael Kurz Technische Universitat Berlin, Institut fur Kommunikationswissenschaft kurz Bernhard Feiten Deutsche Telekom, Technologiezentrum feiten fz. Abstract An algorithm for real time sound synthesis by physical modelling is presented. Starting from the differential equation of a string with bending stiffness and damping, a simple rule for computing the state of a virtual string is derived. Several methods of excitation are explored which allow the production of complex sounds. 1 Introduction The use of computer simulation of the mechanics of musical instruments for the generation of sound, so called physical modelling, results in timbres with a "natural" feeling. Also, the parameters used in this kind of synthesis are intuitive and therefore easy to manage as they have direct correspondences in the physical world [1]. With today's technology physical modelling synthesis of tones produced by a vibrating string can be carried out in real time as long as the algorithm is carefully designed to be com putationally efficient. The most common method used today, waveguide synthesis [2, 3], uses delaylines and filters, and several synthesizers employing this principle are commercially produced. The method of direct computation of the displacement state of a string in real time, presented here, has not been much explored so far. The model consists of a virtual string, the shape of which is determined for every step in time. Numerical integration of the differential equation which determines the behaviour is used to compute the state of the string based on its previous state. Because the displacement of every point on the string is known, excitation can be applied to and sound output taken from any point on the string without extra computation. For excitation a separate physical model, for example of a hammer, can be connected to the string and the force between the two can be determined relatively easily. This force will affect the movement of the string as well as the exciting system and very realistic sounding effects can be produced. The aim of the present work was to develop a program which would allow interactive control of the sound synthesis process in real time so that the system could be used like a virtual musical instrument. To this end a graphical user interface as well as MIDI input was added to the sound generation routines. In this way even nontechnical people can experiment with the range of timbres available by adjusting the values of the parameters which control the behaviour of the model. This virtual string ICMC Proceedings 1996 361 Kurz & Feiten

Page  362 ï~~program was named vstring and runs on Silicon Graphics platforms. H(z) Figure 1: Simplified block diagram of vstring 2 The continuous string The model is based on the differential equation describing the forces acting on and in the string [4]. It is assumed to behave linearly, which is a good aproximation for most musical instruments where displacement is very small relative to the length of the string. Only transverse waves in one plane are considered. The string has a mass per unit length u and is homogenous. A tension T is applied to the string. The bending stiffness I can be non-zero, leading to dispersion in the travelling waves. This has the effect of raising the frequencies of the harmonics and results in a metallic timbre, Damping is provided for with three parameters (co, c1, c2) which differently affect the vibrational modes present on the string and thereby determine how the spectrum changes over time. A driving force which is variable in time and place can be applied, for instance for excitation. Thus the differential equation, with y(x, t) being the displacement, is: =yi= Ty" - EIy" -coy + c l"- C29'"' Their frequencies are: wn - n L - + n4L (3) 3 The discrete string To simulate the continuous string using a digital computer it is necessary to sample its state in time and space. This is done by representing the string by a number of point masses which exert forces on each other and whose displacement is determined at time steps separated by the sampling period At. This representation is an approximation to the continuous string and its solution will be an approximation to the continuous solution. The error will be greatest for those vibrational modes whose wavelength is close to twice the mass spacing Ax and whose frequency is close to half the sampling frequency, i.e. the highest harmonics in the signal. A system of n point masses with one degree of freedom each can have no more than n vibrational modes. Therefore the number of string elements used in the simulation determines the number of harmonics in the resulting audio signal. To discretise the differential equation the simple Forward-Time-Centre-Space rule is used. Writing y = y(x = jAx, t= nAt): y _ Y ' - Y nOtj,n Axt (4) This leads to an explicit expression for calculting the new string state, i.e. using just known values: y+l= bo y +Fext (1) Its solution is the superposition of harmonic travelling waves. Taking a string of length L with two fixed ends, the standing waves (vibrational modes) have wavelengths: +b1 (y31 +yn1) +b2 (y 2 + y +2 ) +b3y-1 +b4 (y-1+ 1 +b5(y7-2 + yj+21) +b6F 2L Ann n-1,2,3... (2) (5) Kurz & Feiten 362 ICMC Proceedings 1996

Page  363 ï~~TI tions sami are c are n the s conti ie coefficients b0... b6 are simple func- low. This is noticeable in the sound outof the string's physical parameters, the put but does not detract much from the perle period and the mass spacing. They ceived quality. The lowering of the frequenonstant as long as the string parameters cies of the harmonics can be partly comLot changed, but this can be done while pensated by adding a small amount of bendynthesis is in progress to give real time ing stiffness which has the effect of raising rol. their frequencies. However, the highest partials will always be too low in frequency. n+ 1 o The errors in the simulation become smaller as more processing power is used by inn " 0 0 0 0 creasing the sample rate and the number of string elements. n-I.. 0 6 0 t/At ' x/Ax j-2 j-1 j j+l j+2 Figure 2: Dependence of a new value on known old values 3.1 Computational cost As can be seen from equation (5), the required computing power (without driving force) is 9 addition and 6 multiplication operations or 10 multiply-accumulate operations (MAC) per sample period for each string element. So, on a signal processor the required processing power for a string of l elements is P = 101 fT [ops/sec]. The additional processing time required for excitation, overheads and input/output is small by comparison. On a Silicon Graphics Indy workstation a string of 35 elements can be computed in real time at a sample rate of 32kHz. 3.2 Deviation of harmonic frequencies Solving the difference equation (5) leads to an expression for the frequencies of the resonant modes of the discrete string. Comparing these to those in the continuous case shows that in the simulation the frequencies of the harmonics are always somewhat too Figure 3: Frequencies of harmonics in discrete strings 3.3 Stability The approximations necessary for simulation also lead to problems of numeric stability. By definition the system is only stable as long as the damping is negative. This is also true for the continuous string but negative damping is impossible there due to the laws of physics. In the simulation, however, the system will also be unstable for some other choices of parameters, particularly when the highest partial (wavelength 2 Ax) has a frequency higher than half the sample rate. This will occur when the fundamental frequency is chosen too high with regard to the sample rate and number of elements. Within this limit the fundamental ICMC Proceedings 1996 363 Kurz & Feiten

Page  364 ï~~frequency can be set to any value by adjusting the tension and/or the stiffness. 4 Excitation To set the string in motion a force is applied at one point along its length. In the simplest case the force acts only for the duration of one sample, i.e. it is an impulse. More interesting is the use of another physical model which interacts with the string for a length of time while they are in contact, such as a virtual hammer. The position at which the force is applied to the string as well as the parameters of the hammer will affect how much the various resonant modes of the string are excited and thus change the resulting timbre. The position of the point on the string whose movement is taken as the sound output also has a large influence on the signal's spectrum. x z y Figure 4: A virtual hammer Applying a constant force representing gravity to the hammer results in it returning to make contact with the string after it has been thrown clear, again and again. This sounds very much like a ball bouncing on the string. Similarly, a virtual plectrum as well as a simple bow have been constructed and used to obtain complex timbres. 5 Implementation The algorithm has been implemented as a standalone program on a Silicon Graphics workstation. It comprises a full graphical user interface which allows real time control of all parameters by means of faders, as well as MIDI input for control of pitch and excitation. Furthermore it is possible to store and retrieve parameter settings and record the produced sound to disk. The executable and example parameter files can be obtained on ftp://ftp. kgw. tu-berlin. de/pub/vstring/. 6 Conclusion A new approach to physical modelling suitable for real time synthesis was presented. Physically modelled excitation allows production of complex timbres with a very "natural" sound. Metallic timbres can be obtained by simulating a string with bending stiffness or even a stiff bar without tension. Real time control permits the program to be used as a virtual musical instrument. References [1] Gianpaolo Borin, Giovanni De Poli, Augusto Sarti (1992), Algorithms and Structures for Synthesis Using Physical Models, Computer Music J., 16 (4): pp. 30-42, Winter 1992 [2] Julius 0. Smith (1992), Physical modelling using digital waveguides, Computer Music J., 16 (4): pp. 75-87, Winter 1992 [3] Julius 0. Smith (1993), Efficient synthesis of stringed musical intruments. In Proc. ICMC '93, Tokyo, pp. 64-71, Sept. 10-15, 1993 [4] Neville H. Fletcher (1991), Thomas D. Rossing, The Physics of Musical Instruments, Springer-Verlag New York Inc. Kurz & Feiten 364 ICMC Proceedings 1996