Circuit based classical guitar model

Circuit based classical guitar model

Applied Acoustics 97 (2015) 96–103 Contents lists available at ScienceDirect Applied Acoustics journal homepage: www.elsevier.com/locate/apacoust C...

3MB Sizes 5 Downloads 61 Views

Applied Acoustics 97 (2015) 96–103

Contents lists available at ScienceDirect

Applied Acoustics journal homepage: www.elsevier.com/locate/apacoust

Circuit based classical guitar model Jingeol Lee a,⇑, Mark French b a b

Department of Electronic Engineering, Paichai University, 439-6 Domadong Seogu, Taejon 302-735, Republic of Korea Department of Mechanical Engineering Technology, Purdue University, 138 Knoy Hall, 401 N. Grant St., West Lafayette, IN 47907, USA

a r t i c l e

i n f o

Article history: Received 1 October 2013 Received in revised form 25 March 2015 Accepted 10 April 2015 Available online 27 April 2015 Keywords: Guitar model Synthesis Circuit Frequency response function Admittance

a b s t r a c t With the growth of electronic gaming, personal electronics and the widespread creation and distribution of digital music, the ability to synthesize realistic instrument sounds is becoming more important. In particular, the ability to synthesize guitar sounds is necessary for a variety of applications. The dynamics of a string with ideal boundary conditions are well known, but the structure of an acoustic guitar presents very different boundary conditions that modify the resulting sound. We propose an approach based on measured transfer functions from a classical guitar. A transmission line is used to represent the output of a vibrating string which is then modified by a filter bank whose transfer function reproduces the driving point frequency response functions from the classical guitar. The result is a synthesized sound that reproduces much of the tonal quality of the actual instrument. Ó 2015 Elsevier Ltd. All rights reserved.

1. Introduction The behavior of strings and string instruments like guitars and violins has been studied and simulated using electrical analogies for more than 70 years. A vibrating string was considered as an electrical transmission line due to the fact that a traveling wave exists on both of them [1]. Later, a violin was modeled as a circuit composed of an electrical transmission line, transformers, resistors, inductors, and capacitors in continuous time domain [2]. As digital technologies mature, strings and string instruments are simulated using digital waveguides or wave digital filters. The digital waveguide consists of two delay lines along which the sampled values of traveling waves propagate oppositely. A physical value like the displacement at the specific location of a string is obtained by summing two values from the delay lines at the corresponding location [3,4]. Models using wave digital filters are accomplished by converting a string instrument into an analog circuit and then substituting analog components with counterparts of the wave digital filter such as one-ports and their connections with adaptors [5]. Of course, there have been many examples of strings and of instruments being modeled numerically. For example, the wave equation governing a flexible string was approximated to a finite difference form [6]. This paper deals with the synthesis of a classical guitar sound with an equivalent electrical circuit. The string is replaced by a transmission line, and the body by a combination of resistors, ⇑ Corresponding author. Tel.: +82 42 520 5707; fax: +82 42 533 7354. E-mail addresses: [email protected] (J. Lee), [email protected] (M. French). http://dx.doi.org/10.1016/j.apacoust.2015.04.006 0003-682X/Ó 2015 Elsevier Ltd. All rights reserved.

inductors, and capacitors, simulating a series of plate resonances coupled with air modes of a sound box. The resistors, inductors, and capacitors in the circuit are adjusted such that its calculated admittance conforms to the measured one by modal testing. In the string models built with an analogy to the transmission line, a rigid end to strings had been represented as an open circuit, and the displacement of a string as the current on the transmission line [1,2,7]. However, it turned out that the rigid end corresponds to a short circuit, the displacement to the voltage. Reflecting these discoveries, a transmission line based plucked string model comprising a transmission line, two piecewise linear current sources, and switches was proposed [8]. On the other hand, the existing transmission line based models for strings and string instruments were either developed with rigid ends to strings, or with conceptual models for bodies of the instruments [1,2,7]. In this paper, the circuit for a guitar body is implemented with a RLC circuit based on the equivalent circuit for the well known two-mass model which covers two resonant frequencies with a Helmholtz frequency between them [9]. The circuit is expanded to include additional 19 resonant frequencies over the second resonant frequency of the two-mass model, and tuned according to the measured frequency response function of the guitar body. The expanded circuit is finally integrated with the transmission line based plucked string model to make a guitar model. The implementation of the frequency response function of a guitar body in the models using digital waveguides or wave digital filters would be nontrivial due to the aliasing or the frequency warping resulting from the analog–digital transformation. The proposed circuit model is built and simulated using Pspice. The voltage and current

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

97

Fig. 1. Circuit for an open E-1 string with rigid ends. The delay time of the transmission line is set to 1.515 ms according to the fundamental frequency of the string, 329.6 Hz.

Fig. 2. Piecewise linear currents supplied by the current sources of I1 and I2 in Fig. 1. The current from I1 linearly increases from 0 mA at 0 ms to 1 mA at 0.303 ms, and decreases back to 0 mA at 1.515 ms, while the current from I2 is symmetric to that from I1 with respect to the half of 1.515 ms.

Fig. 4. Measured admittance for a guitar body. It shows that the first resonant frequency is 101.6 Hz, the Helmholtz resonant frequency is 118.8 Hz, and the second resonant frequency is 204.7 Hz, etc.

waveform at a node in the proposed circuit model corresponding to a place on the bridge where a string crosses are differentiated with respect to time to get the velocity and the force at the same

place on the bridge, respectively. The velocity and the force waveforms, taken as the synthesized guitar sounds, are compared with a real one in both time and frequency domains.

Fig. 3. Current waveform at the probe in Fig. 1. It is acquired after 1.515 ms because the voltage distribution along the transmission line at 1.515 ms corresponds to the initial plucking of the string.

98

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

The paper is organized as follows; the circuit for a string is reviewed in Section 2. In Section 3, the circuit for a body is presented. The circuit based classical guitar model is proposed in Section 4, and then conclusions are drawn in Section 5. 2. Review of the circuit for a string It is well known that a traveling wave along a transmission line is transmitted and or reflected at a boundary depending on the characteristic impedance of the transmission line relative to the load impedance at the boundary as that along a string. The usual analogy of a mechanical system to an electrical circuit, that is, the force to the voltage and the velocity to the current, had led to the replacement of the rigid end with the open circuit. Along with that, the displacement had been replaced with the current in the transmission line analogy [1,2,7]. However, the transmission

line based plucked string model demonstrated that the rigid end corresponds to a short circuit, the displacement to the voltage as follows [8]; The voltage, v(x, t) and the current, i(x, t) on a lossless transmission line are given by

@v @i ¼L @t @x @i @v ¼C  @x @t



ð1Þ

where L is the inductance, and C is the capacitance per unit length of the transmission line [10]. Behavior along the transmission line or the string is governed by the same form of the wave equation with the voltage, v and the displacement, y, the inductance, L and the mass per unit length, q, the capacitance, C and the compliance per unit length, 1/T interchanged as follows [8];

Fig. 5. Circuit for a body. The resistor-inductor-capacitor series correspond to the resonances of the top plate, and R2, R3, C2 and L2 are comprised in a sound box.

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

@2y q @2y ¼ ; @x2 T @t 2 @2v @2v ¼ LC 2 ; 2 @x @t

v0 ¼

 12 T

ð2Þ

q

v 0 ¼ ðLC Þ

1 2

ð3Þ

where v0 is the velocity, and T is the total tension on the string. The vertical force on the string is defined as [3]

f ðx; tÞ ¼ T

@ yðx; tÞ @x

ð4Þ

From Eqs. (1) and (4), it is evident that the derivative of the current on the transmission line with respect to time corresponds to the scaled vertical force on the string considering that the displacement on the string corresponds to the voltage on the transmission line. On the other hand, the reflection coefficient between an incident and a reflected wave at an end of the transmission line is given by



V 0 ZL  Z0 ¼ ZL þ Z0 V þ0

ð5Þ

 where V þ 0 and V 0 are the amplitude of the voltage waves traveling to the +x, and to the x direction, respectively, and ZL and Z0 are the load impedance and the characteristic impedance of the transmission line, respectively. From Eq. (5), the rigid end corresponds to ZL = 0, which gives rise to C = 1. Since the polarity of the reflected wave at the rigid end is reversed with respect to the incident wave, the rigid end is equivalent to the short circuit. Based upon their interrelationship, the string is replaced by the transmission line in the equivalent electrical circuit. The open E-1 string (the first string) is tested because it is the most flexible among the six strings of the guitar, and thus it most obeys the wave Eq. (2). The ideal string is assumed to have no bending stiffness, and bending stiffness is proportional to the fourth power of diameter. The E-1 has the smallest diameter of the six strings. A circuit for the string with rigid ends is implemented as shown in Fig. 1. Since the open E-1 string is tuned to 329.6 Hz, the time delay of the transmission line is set to 1.515 ms which is the half of the period for the frequency of 329.6 Hz. The initial voltage distribution along the transmission line is produced by the two piecewise linear currents shown in Fig. 2 which are supplied by the current sources I1 and I2 in Fig. 1. The current provided by the current source I1 linearly increases from 0 mA at 0 ms to 1 mA at 0.303 ms which is one fifth of the time delay of the transmission line, and decreases back to 0 mA at 1.515 ms, while the current from I2 is symmetric to that from I1 with respect to the half of the time delay. The peak value of 1 mA is determined arbitrarily. Since the proposed guitar model is linear, the peak value just controls the amplitude of the model outputs, that is, the synthesized sound waveforms within a range in which the circuit simulations work. The characteristic impedance of the transmission line is set to 2000 X experimentally, by which the synthesized guitar sound sustains as long as the recorded sound of a real guitar as will be shown in Section 4. Both current sources provide the voltage waves traveling to the opposite direction. At 1.515 ms, the voltage waves, which are obtained by the current flown into the transmission line multiplied by the input impedance of the transmission line from an end, coincide along the transmission line, which corresponds to plucking a string at one fifth of the distance from the right end of the string analogous to the transmission line, T1. At the same time, the switches, u3 and u4 open, and u1 and u2 close, by which the current sources and resistor, R2 and R4 are disconnected from the circuit, and both ends of transmission line, T1 are shorted, by which the voltage waves are ready to be reflected back and forth between both the ends.

99

The current waveform at the probe in Fig. 1 is shown in Fig. 3. The current waveform is acquired after 1.515 ms because the voltage distribution along the transmission line at 1.515 ms corresponds to the initial plucking of the string. As in Eq. (4), its derivative with respect to time would produce the scaled force on the rigid end exerted by the vibrating string, which is a pulse train as well known [9]. 3. Circuit for a body It is known that the force given by a vibrating string is transmitted to a body through a bridge, which eventually leads to the guitar sound. In order to model the body of a classical guitar taking this fact into account, a modal test is taken by applying the force on the bridge of the classical guitar and monitoring its response. With the test guitar in tune and its strings damped, the driving point frequency response function is measured on the right next to a place on the tie block where the E-1 string crosses with an impact hammer, ENTEK IRD E086c40 and a miniature lightweight accelerator, PCB 352A24 [11]. The measurement on the tie block is chosen for the experimental convenience, however its dynamic response is expected to be similar to that on the saddle where the force from the string is exerted. The measured frequency response function is divided by 2pf to get the mechanical admittance (mobility) as shown in Fig. 4. Considering that the peak

Fig. 6. Measured and calculated admittance (a) magnitude; (b) phase.

100

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

Fig. 7. Circuit for a guitar. The circuits for a string in Fig. 1 and a body in Fig. 5 are integrated.

Fig. 8. Frequency response of the differentiator. The frequency in the abscissa is normalized to the sampling frequency such that the half of the sampling frequency becomes p radian.

values of the admittance above 2 kHz are lower than half of the lowest among those below 2 kHz, and the force delivered by the string is distributed mostly at the fundamental frequency of 329.6 Hz and its harmonic frequencies in the vicinity of the fundamental frequency, the frequency range for the body is limited to 2 kHz.

An electrical circuit for the body is implemented such that its admittance conforms to the measured one as shown in Fig. 5. This circuit is based on one for the two-mass model which includes R1 through R3, L1, L2, C1, and C2 [9]. R1, L1, and C1 are the loss, the inertance (mass/area2), and the compliance for the first resonant frequency of the top plate, respectively. R2 and C2 are the loss and the compliance of the enclosed air, respectively. R3 and L2 are the loss due to radiation and the inertance of air in the soundhole, respectively. Based on the circuit for the two-mass model, the resistor-inductor-capacitor series are parallel connected to the existing series such that each additional series corresponds to the resonance of the top plate. In this manner, a total of 21 resonances is included, and their numbers are shown in Fig. 5. The component values for the circuit are determined such that the calculated admittance at each frequency of interest is fitted with the measured one in a least-squares sense. The calculated admittance is compared with the measured one in Fig. 6, which shows that the calculated admittance is well fitted to the measured one in terms of both magnitude and phase. Consequently, it is expected from Eq. (5) in Section 2 that the circuit for a body functions almost like the body of the test guitar since both magnitude and phase of the reflected wave from the circuit for a body are consistent with those from a place on the saddle of the test guitar where the E-1 string crosses. 4. Circuit for a guitar The circuits for a string and a body are integrated to make a circuit for a guitar as shown in Fig. 7. The short circuit to the right of

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

101

Fig. 9. Waveforms and spectrograms (a) velocity; (b) force; (c) recorded sound; (d) force 4000. The sampling frequency is 8 kHz. The spectrograms are produced by applying a Hamming window and then the FFT over a data segment of length of 1024 with 50% overlap between segments. The length of the FFT is set to be the same as that of the data segment.

102

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

T1 in Fig. 1 is replaced with the circuit for a body in Fig. 5. It is assumed that the boundary at the nut is rigidly fixed. The characteristic impedance of the transmission line is set to 2000 X experimentally so that the current waveform at the probe in Fig. 7 sustains as long as the recorded sound of the test guitar. Since the voltage on a transmission line corresponds to the displacement on a string and the velocity of a bridge has a high correlation with the sound pressure produced by a vibrating soundboard, the sound from the circuit model is supposed to be synthesized by taking the voltage waveform at the probe in Fig. 7 as the displacement and differentiating it with respect to time [12]. However, through a series of experiments, it turns out that a synthesized sound reproducing much of the tonal quality of the actual guitar can be acquired by taking the current waveform at the same position and differentiating it with respect to time, which is the scaled vertical force to the bridge according to Eq. (4) in Section 2. The voltage and the current waveform at the probe in Fig. 7 are differentiated with respect to time to get the velocity and the scaled force. The differentiation is carried out using a linear-phase FIR filter whose frequency response is shown in Fig. 8 which approximates an ideal response, H(x) = jx . The voltage and the current waveform are acquired after 1.515 ms for the same reason as stated in Section 2. The real sound is recorded with a Rode N5 microphone placed 10 cm above the saddle in an anechoic chamber under the same condition of plucking for the synthesized sound, which is to pluck the open E-1 string at one fifth of the distance from the saddle. The velocity, the force and the recorded waveforms with a sampling frequency of 8 kHz are compared in both time and frequency domains in Fig. 9. The waveforms are normalized to the maximum of absolute values of each, and then the spectrograms are taken for comparison. The spectrograms are produced by applying a Hamming window and then the FFT over a data segment of length of 1024 with 50% overlap between segments. The length of the FFT is set to be the same as that of the data segments. The measured peak frequencies and their decay times from the spectrograms are tabulated in Table 1. The time taken for the amplitude of each peak frequency component in the spectrograms to drop by 60 dB is presented as a measure of the decay time [9]. As shown in Fig. 9, whereas the envelope of the velocity waveform is quite different from that of the recorded waveform, the force waveform and the recorded waveform are similar overall, and show the same trend, that is, the upper part of the waveforms with respect to the ground level decays slower than the lower part in the beginnings of the waveforms. However, the force waveform shows the fluctuations in amplitude whereas the recorded sound decays smoothly. The string in the real guitar will not be displaced or plucked so sharply

Table 1 Peak frequencies and their decay times for the spectrograms in Fig. 9. Velocity

Force

Recorded

Peak frequency (Hz)

Decay time (s)

Decay time (s)

Peak frequency (Hz)

Decay time (s)

Peak frequency (Hz)

Force 4000 Decay time (s)

328.1 656.3 992.2 1320.3 1640.6 1968.8 2296.9 2625.0 2953.1 3273.4 3601.6 3929.7

4.2 1.7 0.9 1.2 1.4 1.6 1.4 1.2 1.2 1.2 1.2 1.2

4.2 1.7 1.1 1.3 1.5 1.6 1.4 1.0 1.2 1.3 1.3 1.7

328.1 664.1 992.2 1320.3 1648.4 1984.4 2312.5 2648.4 2976.6 3312.5 3640.6 3976.6

>4.5 3.2 1.7 2.3 2.2 1.9 1.6 1.3 1.5 1.3 2.2 1.3

328.1 656.3 992.2 1320.3 1648.4 1976.6 2304.7 2632.8 2960.9 3289.1 3617.2 3945.3

>4.5 3.3 1.8 2.0 2.6 3.0 2.9 2.5 2.6 2.8 2.6 2.9

as the initial voltage distribution produced by the piecewise linear currents, and thus the frequency contents in the harmonics are more salient in the force waveforms than in the recorded sound, which may result in the fluctuations in amplitude. The peak frequencies for the velocity and the force waveforms are same, and thus their frequencies are not duplicated in Table 1. The decay times for the two waveforms are comparable to each other. The peak frequencies for the recorded waveform are mostly higher than those for the force waveform, which is pronounced from the fifth harmonic on. The decay times for the recorded waveform are longer than those for the force waveform up to the sixth harmonic, and are comparable to each other for the higher harmonics except the 11th harmonic. In order to adjust the decay times for the low harmonics of the force waveform such that they are comparable to the recorded waveform, the resistances of R2 and R4 and the characteristic impedance of T1 in Fig. 7 are tentatively changed from 2000 X to 4000 X. The resultant waveform and spectrogram are presented in Fig. 9(d), and their peak frequencies and decay times are tabulated in Table 1 under the heading of force 4000. The decay times for the low harmonics are now comparable to those for the recorded waveform, however the decay times for higher harmonics are longer than those for the recorded waveform. The peak frequencies lie between those for the velocity and the recorded waveform. It seems that the discrepancy of the decay times between the force and the recorded waveform is caused by the polarization of real strings [9]. The discrepancy of the peak frequencies between the force and the force 4000 is caused by the difference of the phase of a reflected wave at the node corresponding to a place on the saddle where the E-1 string crosses which is a function of the characteristic impedance of T1 and the impedance of a guitar body as shown in Eq. (5) in Section 2. The current model does not take this factor into account for the frequency tuning. Despite these fluctuations in amplitude and discrepancies, the force waveform sounds more like the real guitar than the velocity waveform. Sound files of velocity, force, and recorded are appended for comparison. 5. Conclusions The components of a classical guitar, that is, an open E-1 string, and a body, are implemented into their equivalent circuits. The string is replaced with the transmission line based plucked string model in which the correspondences of the rigid end to a short circuit and the displacement to the voltage were made, and the way of excitation of the transmission line corresponding to the plucking a string was presented. The validity for the circuit for a body is proven by showing that the calculated admittance conforms to the measured one for the body. The circuits for a string and a body are integrated to form an equivalent circuit for a guitar, and the velocity and the force waveforms at the node corresponding to a place on the saddle where the E-1 string crosses are compared with the recorded sound of the test guitar in both time and frequency domains. It was known that the velocity of the bridge is approximately proportional to the sound pressure produced by a vibrating soundboard, however our experiments show that the force at the bridge is closer to the real sound. Our approach to the guitar model leads to a model based synthesis in the context of computer music. It is known that the amount of the reflected wave back to a string and the transmitted force wave to a body is determined by the mechanical impedance, which is a function of frequency, at a place on the saddle where a string crosses and the characteristic impedance of the string. Accordingly, it is expected that the timbre of the synthesized sound can be varied by adjusting the component values in the circuit associated with the resonances of the top plate coupled with the

J. Lee, M. French / Applied Acoustics 97 (2015) 96–103

air modes of the body. If the relevance of the mechanical impedance to the structural details of a body is revealed somehow, it is expected that the general trend of timbre of guitar sound under design is predictable using the proposed model. Appendix A. Supplementary material Supplementary data associated with this article can be found, in the online version, at http://dx.doi.org/10.1016/j.apacoust.2015.04. 006. References [1] Kock Winston E. The vibrating string considered as an electrical transmission line. J Acoust Soc Am 1937;8:227–33. [2] Schelleng John C. The violin as a circuit. J Acoust Soc Am 1963;35(3):326–38.

103

[3] Smith III Julius O. Physical modeling using digital waveguides. Comput Music J 1992;16(4):74–91. [4] Karjalainen M, Välimäki V, Tolonen T. Plucked-string models: from the Karplus–Strong algorithm to digital waveguides and beyond. Comput Music J 1998;22(3):17–32. [5] Välimäki V, Pakarinen J, Erkut C, Karjalainen M. Discrete-time modelling of musical instruments. Rep Prog Phys 2006;69(1):1–78. [6] Giordano N, Roberts J. Musical acoustics and computational science. Int Conf Comput Sci 2001. [7] Clarke RJ. The analysis of multiple resonance in a vibrating mechanical system by the use of the electrical transmission line analogy. Acustica 1978;40:34–9. [8] Lee Jingeol, French Mark. Transmission line based plucked string model. J Acoust Soc Kr 2013;32(4):361–8. [9] Fletcher Neville H, Rossing Thomas D. The physics of musical instruments. New York: Springer Verlag; 1998. [10] Ulaby Fawwaz T. Fundamentals of applied electromagnetics. 2nd ed. New Jersey: Prentice Hall; 2001. [11] Ewins DJ. Modal testing: theory, practice and application. 2nd ed. Hertfordshire: Research Studies Press Ltd.; 2000. [12] Giordano N. Sound production by a vibrating piano soundboard: experiment. J Acoust Soc Am 1998;104(3):1648–53.