The present invention relates generally to musical sound synthesis using networks of digital waveguides, and particularly to a digital filter that can be coupled to a resonant digital waveguide network for simulating interaction of a felt covered hammer with a one-dimensional string, two-dimensional membrane or three-dimensional musical resonator.
BACKGROUND OF THE INVENTION
The use of digital waveguide networks for digital signal processing and musical synthesis is disclosed in U.S. Pat. No. 4,984,276, which teaches the use of digital processors having digital waveguide networks for digital reverberation and for synthesis of musical sounds such as those associated with reed and string instruments. U.S. Pat. No. 4,984,276 is hereby incorporated by reference. The present invention concerns a digital waveguide hammer filter, which is a time varying digital filter that models a piano hammer or felt mallet.
The digital waveguide hammer filter of the present invention was designed to be used in conjunction with a one-dimensional digital waveguide network modeling a string (e.g., a piano string) to produce physically correct hammer-string interactions, and to be used in conjunction with a two-dimensional digital waveguide network modeling a membrane (such as a drum's surface) to produce physically correct mallet-membrane interactions. The digital waveguide hammer filter, however, can be used in conjunction with virtually any digital waveguide network, regardless of what the digital waveguide network is being used to model.
While the interactions of felt covered hammers with piano strings and the like has been the subject of study for some time, most such work has modeled strings and piano hammers in a manner that did not lend itself to real time musical synthesis with the microprocessors and digital signal processors typically found in music synthesizers and desktop computers in 1994 (i.e., microprocessors and digital signal processors capable of 33 million to approximately 100 million 32-bit mathematical computations per second).
Digital signal waveguides provide a methodology for simulating the operation of acoustic musical instruments and other resonators in a very computationally efficient manner, allowing real time computation of acoustic frequency waveforms in a resonating system with fairly modest computational resources. Recently issued patents using digital signal waveguides to synthesize musical tones in a manner that relates to the striking of a string by a hammer includes U.S. Pat. Nos. 5,187,314 (Kunimoto), 5,229,536 (Kunimoto) and 5,241,127 (Kobayashi), all of which are assigned to Yamaha Corporation of Hamamatsu, Japan.
SUMMARY OF THE INVENTION
The present invention is a music synthesizer having a main resonator waveguide network (e.g., a loop or mesh) that is coupled to a digital waveguide hammer filter by a scattering junction. The digital waveguide hammer filter uses a digital waveguide model of a felt covered hammer or mallet that enables efficient computation of the interactions between a string or membrane an a hammer that strikes the string or membrane. The digital waveguide hammer filter models the variable stiffness of the hammer's felt, which varies in accordance with compression of the felt, and models the mutual interaction of the string and hammer so as to generate a hammer waveform that is injected in attenuated form into the main resonator as an excitation signal.
The digital waveguide hammer filter of the present invention includes a time varying scattering junction that passes waveforms from the resonator waveguide network into the digital waveguide hammer filter. The digital waveguide hammer filter also includes an digital oscillator loop for generating a hammer velocity waveform whose oscillation frequency is a function of the compression of a simulated felt covered hammer by interaction of a simulated hammer with the waveforms received from the resonator. The digital waveguide hammer filter acts as a pass through filter that does not affect the waveforms in the resonator when the simulated hammer is not in contact with the string/membrane of the main resonator. When the simulated hammer is in contact with the string/membrane, the hammer filter modulates the frequency of its oscillator, by introducing a phase delay in its oscillator loop, in accordance with the time varying spring constant of the compressed felt.
Furthermore the hammer filter generates a time varying non-zero hammer wave impedance value when the simulated hammer is compressed. The time varying hammer wave impedance value is a function of the time varying compression of the hammer felt such that the hammer wave impedance increases in a nonlinear manner with increasing compression of the hammer felt. The waveform generated in the digital oscillator loop of the hammer filter is coupled to the main resonator in accordance with the wave impedance values of the resonator and hammer filter.
BRIEF DESCRIPTION OF THE DRAWINGS
Additional objects and features of the invention will be more readily apparent from the following detailed description and appended claims when taken in conjunction with the drawings, in which:
FIG. 1 depicts a string coupled mid-span to a mass by a spring.
FIG. 2 is a block diagram of a music synthesizer having a one dimensional digital waveguide resonator network and a digital waveguide hammer filter in accordance with the present invention.
FIG. 3 depicts a digital waveguide hammer filter in accordance with the preferred embodiment of the present invention.
FIG. 4 is a graph of an example of the nonlinear spring constant function for a felt covered hammer.
FIG. 5 is a graph of the relationship between felt compression and the filter coefficient a.sub.0 (n) for a hammer having the spring constant function shown in FIG. 4.
FIG. 6 is a graph of the nonlinear spring constant function for compression up to 0.1 meters (10 cm) of a hypothetical hammer.
FIG. 7 is a graph of the relationship between felt compression and the filter coefficient a.sub.0 (n) for a hammer having the spring constant function shown in FIG. 6.
FIG. 8 is a block diagram of a music synthesizer having a two dimensional digital waveguide resonator mesh and a digital waveguide hammer filter in accordance with the present invention.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
Referring to FIG. 1, there is shown the fundamental physical model of a string loaded by a nonlinear mass/spring system. The digital waveguide hammer filter of the present invention treats the hammer felt of a hammer striking a piano string as a spring that is loaded with the mass of a hammer. In FIG. 1 the parameter R.sub.0 represents the string's wave impedance, which is related to the density and stiffness of the string.
Referring to FIG. 2, there is shown a music synthesizer 100 in which a digital waveguide hammer filter 102 is coupled by a time-varying scattering junction 104 (S) to a digital waveguide resonator 105. The hammer filter 102 simulates a felt covered hammer or mallet as a pair of velocity waves in a medium having a variable wave impedance denoted as R.sub.h.
In the preferred embodiment, all signals or waveforms in the synthesizer are updated at a rate of 44,100 samples per second. For simplicity, in the equations in this document, time is represented by a variable n which starts at a value of zero at is incremented by one each sample period. Thus, after one second n will have a value of 44,100. Since the sampling rate of the preferred embodiment is 44,100 samples per second, the output signal generated by the synthesizer can have frequency components up to approximately 22 kHz.
The term "hammer" is defined for the purposes of this document to mean any instrument used to strike a resonating medium whose striking surface is at least somewhat compressible during normal use, and the term "hammer felt" is defined to mean the compressible portion of a hammer's striking surface.
The term "simulated hammer" is defined for the purposes of this document to mean any hammer-like instrument simulated by a digital waveguide hammer filter in accordance with the present invention, without regard to whether or not any such physical instrument exists. The present invention can simulate the operation of hammer-like instruments that might not be possible to implement with physical components.
The term "resonating medium" is defined for the purposes of this document to mean any resonating or reverberating system, whether real or not, simulated by a digital waveguide network. Digital waveguide networks can simulate the operation of instruments that might not be possible to implement with physical components.
Time Varying Scattering Junction
Referring to FIGS. 2 and 3, the scattering junction 104 (S) utilizes the time-varying wave impedance R.sub.h of the simulated hammer to couple the simulated hammer to the resonator 105. The scattering junction 104 (S) receives velocity waveforms v.sub.1.sup.+ (n) and v.sub.2.sup.+ (n) from the digital waveguide resonator 105 on ports 106 and 108, respectively, of the scattering junction. The scattering junction 104 (S) outputs velocity waveforms v.sub.1.sup.- (n) and v.sub.2.sup.- (n) to the digital waveguide resonator 105 via ports 110 and 112, respectively, of the scattering junction 104. In addition, the scattering junction receives a first hammer velocity waveform v.sub.h.sup.+ (n) from the digital waveguide hammer filter 102 on port 114 of the scattering junction and outputs a second hammer velocity waveform v.sub.h.sup.- (n) to the digital waveguide hammer filter 102 via port 116 of the scattering junction.
The operation of the scattering junction 104 is defined as follows: ##EQU1## where and where the hammer velocity wave impedance function 117 (R) generates ##EQU2## a current hammer velocity wave impedance value R.sub.h for time period n as follows: ##EQU3##
In the above equations, R.sub.0 represents the wave impedance of the resonant system, R.sub.h (n) represents the effective time varying wave impedance of the digital waveguide hammer filter 102, m represents the mass of the simulated hammer, and .alpha. is an arbitrary constant that is preferably set equal to twice the sampling rate of the synthesizer.
The variable a.sub.0 (n) in equation 3, above, and in the equations shown below represents a felt stiffness coefficient, where a felt stiffness value of -1 represents zero stiffness (when the hammer felt is not being compressed by the hammer) and a felt stiffness value of +1 represents infinite stiffness.
When the hammer simulated by the hammer filter 102 is not in contact with the simulated resonating medium, as represented by the waveforms received from the resonator 105, the felt stiffness coefficient a.sub.0 (n) is equal to -1 and the hammer filter's wave impedance R.sub.h (n) is equal to zero (see equation 3 ). As a result, as can be seen from equations 1 and 2, when the simulated hammer is not in contact with the resonating medium the waveforms v.sub.1.sup.- (n) and v.sub.2.sup.- (n) in the main resonator 105 are not affected by the hammer velocity waveform, represented by v.sub.h.sup.- (n) and v.sub.h.sup.+ (n), whatsoever.
However, when the hammer simulated by the hammer filter is in contact with the resonating medium, the felt stiffness coefficient a.sub.0 (n) is equal to a value, typically ranging between -0.9999 and -0.98, corresponding to the amount of compression of the hammer's felt, and the hammer filter's wave impedance R.sub.h (n) is then equal to a non-zero value. In that case, as can be seen from equations 1 and 2, the waveforms v.sub.1.sup.- (n) and v.sub.2.sup.- (n) in the main resonator are coupled to the hammer velocity waveform, represented by V.sub.h.sup.+ (n), by an impedance of R.sub.h (n) on the digital hammer filter side and by an impedance of R.sub.0 on the resonator side of the junction. The amount of scattering of the hammer velocity waveform V.sub.h.sup.+ (n) into the resonator 105 will be proportional to: ##EQU4##
From another viewpoint, the scattering junction can be viewed as having a junction velocity equal to v.sub.j (n), as defined by equation 2, above. The junction velocity v.sub.j (n) is formed by combining time varying fractions of the resonator waveforms v.sub.1.sup.+ (n) and v.sub.2.sup.+ (n) and the hammer filter waveform V.sub.h.sup.+ (n). The contribution of the hammer filter waveform V.sub.h.sup.+ (n) to the junction velocity v.sub.j (n) is proportional to the ratio defined by equation 4. The junction velocity is added equally to each of the waveforms v.sub.1.sup.- (n) and v.sub.2.sup.- (n) that are output by the scattering junction 104 (S) into the resonator 105.
Hammer Functions
Referring to FIG. 3, a closed loop oscillator 120 is formed by the scattering junction 104 (S), hammer velocity waveform nodes 118 and 119, a unit time delay element 122, and a nonlinear allpass filter 124. Unlike the oscillator formed by the main resonator 105, the hammer filter's loop oscillator 120 has a characteristic oscillation frequency of zero when the simulated hammer is applying no force to the medium represented by the resonator 105. The hammer filter oscillator loop 120 models a mass/spring system with a variable "spring constant" in which the nonlinear allpass filter 124 (H) sets the spring constant in accordance with the simulated hammer's felt compression, and thereby controls the hammer filter loop's oscillation frequency. Equivalently, the nonlinear allpass filter 124 (H) can be viewed as introducing a variable phase delay into the hammer filter's oscillator loop 120 that controls the oscillation frequency of the hammer filter's oscillator loop 120.
In particular, the transfer function of the nonlinear allpass filter 124 (H) is:
Since the felt stiffness coefficient a.sub.0 (n) is almost always very close -1 in value equation 5 can be rewritten in more intuitive form as follows:
From equation 6 it can be seen that the output u.sub.1 (n) of the nonlinear allpass filter 124 (H) is equal to (A) the filter's output in the prior time period u.sub.1 (n) attenuated by a factor of -a.sub.0 (n), minus (B) the change in received hammer velocity wave v.sub.h.sup.- (n) between times n-2 and n-1 where the more recent sample of the received hammer velocity wave v.sub.h.sup.- (n-1) is attenuated by a factor of -a.sub.0 (n). The affect of the attenuation factor -a.sub.0 (n), when it is unequal to -1, is to "increase the spring constant" of the mass/spring system modeled by the hammer filter's oscillator loop 120 and to thereby increase the loop's oscillation frequency.
The velocity waveform of the simulated hammer is a function of any hammer strike impulses specified by the user and is also a function of the time-varying felt stiffness coefficient a.sub.0 (n). The reason that the simulated hammer's velocity waveform is a function of the felt stiffness coefficient a.sub.0 (n) is that the felt stiffness represents the instantaneous spring-constant of the hammer's felt. As explained in more detail below, the felt's sprint constant increases in a nonlinear fashion with increased compression of hammer's felt. Furthermore, the product of the felt stiffness constant k and the current hammer position represents the amount of back force on the simulated hammer. As a result, the portion of the hammer velocity waveform associated with hammer strikes is computed using a modified one-pole integrator 128 (G) defined by: ##EQU5## V.sub.l (n) is a hammer velocity input function that has the form of an impulse function representing the hammer's initial velocity: ##EQU6## where v0 is a negative quantity, indicating movement in the negative direction (toward the string/membrane simulated by the main resonator). While the impulse hammer blow is defined by equation 8 to occur at time n=0, the synthesizer's controller 130 (see FIG. 2) can specify the hammer velocity input function v.sub.l (n) to have a hammer impulses at any specified time, or to have a series of hammer impulses at a set of specified times: ##EQU7## The hammer velocity u.sub.2 (n) is an excitation signal that is added to the output u.sub.1 (n) of the nonlinear allpass filter 124 (H) to generate the hammer velocity waveform v.sub.h.sup.+ (n) on node 119. When multiple hammer strikes are used, it is preferable that each hammer strike take place only after the filter coefficient a.sub.0 (n) has returned to a value of -1, and thus R.sub.h (n) equals zero. Furthermore, the following variables in the filter should be initialized to a value of zero at the time of each hammer strike: v.sub.h.sup.- (n), v.sub.h.sup.- (n-1), v.sub.h.sup.- (n-2), u.sub.1 (n), u.sub.1 (n-1), u.sub.2 (n), and u.sub.2 (n-1).
Hammer Felt Compression Functions
Adder 132 computes the difference u.sub.3 (n) between the two hammer velocity waveforms:
where u.sub.3 (n) represents the amount of force applied to the resonator medium by the simulated hammer's felt, scaled by 1/R.sub.h (n).
A felt compression function 134 (X) translates the force signal u.sub.3 (n) into a felt compression value x.sub.k (n): ##EQU8## x.sub.k (n) has a negative value when the simulated hammer felt is being compressed. When x.sub.k (n) is greater than or equal to zero, the simulated hammer felt is not being compressed.
A felt loss hysteresis function 136 (L) generates a hysteresis loss factor u.sub.4 (n) as follows: ##EQU9## where .epsilon. is a typically a small positive valued constant or table, preferably derived from felt stiffness and loss functions measured from an actual felt covered hammer or mallet.
Adder 138 adds the hysteresis loss factor u.sub.4 (n) generated by the hysteresis function 136 (L) from the felt compression value x.sub.k (n) to generate an adjusted felt compression value u.sub.5 (n):
During the downward stroke of the simulated hammer, while x.sub.k (n) is becoming more negative, the hammer's felt becomes more compressed. In accordance with equation 12 above, u.sub.4 (n) will be a negative value during the downward stroke of the simulated hammer, and thus u.sub.5 (n) will be smaller (i.e., more negative) than x.sub.k (n) while the hammer felt's compression is increasing. Smaller (i.e., more negative) values of u.sub.5 (n) correspond to greater stiffness and thus to larger spring constant values.
When the felt expands, pushing back on the simulated hammer, the simulated hammer is in its upstroke and u.sub.4 (n) will be a positive value in accordance with equation 12, and thus u.sub.5 (n) will be larger (i.e., less negative) than x.sub.k (n) while the hammer felt's compression is decreasing.
The felt stiffness function 140 (K) generates the felt stiffness coefficient a.sub.0 (n) as follows: ##EQU10## where k(u.sub.5) is a nonlinear function. In one preferred embodiment, the felt stiffness function 140 uses a spring constant lookup table, and interpolation for u.sub.5 values between data points in the table, to compute the value of k(u.sub.5) and then computes the value of a.sub.0 (n+1) in accordance with the equation shown above. In another more computationally efficient preferred embodiment, the felt stiffness function 140 uses a felt stiffness coefficient lookup table 141, and interpolation for u.sub.5 values between data points in the table, to compute the value of a.sub.0 (n+1).
FIG. 4 is a graph of an the nonlinear spring constant function k(u.sub.5) for one example of a felt covered hammer. The spring constant function shown in FIG. 4 is representative of the spring constant function of a hammer for the middle-C string of a piano. In this example, the hammer's felt is typically never compressed by more than a millimeter, and the stiffness of the felt (i.e., its spring constant) increases from 0 to approximately 140,000 Newtons per meter as the hammer felt's compression changes from zero to 0.001 meters.
FIG. 5 depicts the relationship between felt compression and the filter coefficient a.sub.0 (n) for a digital hammer filter in accordance with the present invention having the spring constant function shown in FIG. 4. The filter coefficient a.sub.0 (n) for a digital hammer filter that is modeled on actual piano hammers will typically range between -1.0 and approximately -0.98.
As shown in FIGS. 6 and 7, it is quite possible to use the digital hammer filter of the present invention to model hammers that do not correspond to any hammers or mallets used in existing acoustic instruments. FIG. 6 depicts the nonlinear spring constant function for compression up to 0.1 meters (10 cm) of a hypothetical hammer, and FIG. 7 is a graph of the relationship between felt compression and the filter coefficient a.sub.0 (n) for a hammer having the spring constant function shown in FIG. 6. As shown in FIG. 7, the filter coefficient a.sub.0 (n) for a digital hammer filter may vary over a larger range than that shown in FIG. 5. However, the felt stiffness coefficient a.sub.0 (n) for a digital hammer filter is cannot go outside the range -1 (no stiffness) to +1 (infinite stiffness), because outside that range the digital hammer filter becomes unstable.
The net effect of the hysteresis function 136 (L) described above is to increase the spring constant k of the hammer, and thus to increase the value of the filter coefficient a.sub.0 (n+1) (typically by making a.sub.0 (n+1) less negative in value) during the downward stroke of the simulated hammer. During the upward stroke of the simulated hammer, the net effect of the hysteresis function 136 (L) is decrease the value of a.sub.0 (n+1), making a.sub.0 (n+1) closer to -1 in value. The absolute value of a.sub.0 (n+1) is clipped to 1 to ensure that the filter coefficient a.sub.0 (n+1) remains inside the range -1 to +1.
In order to make the digital hammer filter 102 implementable using digital filter computation techniques, the spring constant function 140 (X) generates a felt stiffness coefficient a.sub.0 (n+1) for time period n+1, and a unit time delay element 142 stores each felt stiffness coefficient value a.sub.0 (n+1) so as to output the felt stiffness coefficient value a.sub.0 (n) for the current time period, n.
The current felt stiffness coefficient value a.sub.0 (n), also herein called the time varying hammer filter coefficient, is used by the hammer filter function 124 (H), the hammer impulse input function 128 (G), the felt compression function 134 (X), and the hammer velocity wave impedance function 117 (R) to compute their respective output values during the current time period, n.
Operation of the Music Synthesizer
Referring to FIG. 2, the operation of music synthesizer 100 is controlled by a controller 130, typically a microprocessor such as those found in Yamaha synthesizers or the microprocessors found in desktop computers. The controller 130 receives commands from a user interface 150 that typically includes command input devices such as a set of function buttons, vibrato and other control wheels, a keyboard for specifying tones or notes to be generated, as well as output devices such as an LCD display and other visual feedback output devises that confirm user commands and inform the user of the state of the synthesizer. In most implementations, the user interface 150 can be coupled to a computer so as to receive MIDI commands, pitch values and the like from a computer.
The controller 130 includes a resonator setup program that generates control parameters for the main resonator, such as delay line lengths for the resonator's delay lines 152, scattering junction and termination junction parameters that determine the resonating properties of the resonator 105, and the gain constant G1 of the resonator's output amplifier 154. Similarly, a hammer setup program sets the control parameters, such as the spring constant conversion table, and the values of the mass and time scale factors .alpha., used by the functions in the hammer filter 102. Music synthesis by the system 100 is performed under the control of resonator and hammer execution programs executed by the controller 130. The signals output by the resonator are converted from digital form to an analog voltage by a digital to analog converter 156, are amplified by the output amplifier 154 and then transmitted to one or more speakers 158 so as to generate audible sounds.
Digital Hammer with Mesh Connected Resonator Network
Referring to FIG. 8, the operation of the digital hammer when used with a resonator 170 having a two-dimensional mesh of digital waveguides is largely the same described above. However, since the digital hammer's scattering junction 104 now receives four waveforms resonator 170 and outputs four waveforms back into the resonator 170, the operation of the scattering junction 104 must be changed to take the additional resonator waveforms into account. In the preferred embodiment, the operation of the digital hammer scattering junction 104 when used with a resonator having a two-dimensional mesh of digital waveguides is defined as follows: ##EQU11##
More generally, each of the digital waveguides coupled to the digital hammer's scattering junction could be given a distinct wave impedance (R.sub.1, R.sub.2, R.sub.3, R.sub.4), in order to simulate a system in which waves propagate unevenly over a two dimensional membrane (e.g., in a simulated cymbal having the digital waveguides coupled in a spiral pattern and radial couplings that have different wave impedances than the spiral couplings) in which case the junction velocity equation 16 above would have to be adjusted accordingly.
The inventors have found the digital hammer filter of the present invention to be a very convenient and computationally efficient mechanism for introducing realistic excitation signals into two dimensional networks of digital waveguides, enabling the efficient synthesis of realistic drum sounds and the like.
Even more generally, the digital hammer filter 102 of the present invention can be used with a resonator 170 having an N-dimensional mesh of digital waveguides, with the scattering junction equations being adjusted in order to properly represent the coupling the number and wave impedances of the digital waveguides coupled to the digital hammer filter. In such applications of the digital hammer filter v.sub.j (n) is defined as ##EQU12## where N represents the number of digital resonator waveforms received by the scattering junction.
While the present invention has been described with reference to a few specific embodiments, the description is illustrative of the invention and is not to be construed as limiting the invention. Various modifications may occur to those skilled in the art without departing from the true spirit and scope of the invention as defined by the appended claims.