The Second-Order Digital Waveguide OscillatorSkip other details (including permanent urls, DOI, citation information)
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 3.0 License. Please contact email@example.com to use this work in a way not covered by the license. :
For more information, read Michigan Publishing's access and usage policy.
Page 150 ï~~The Second-Order Digital Waveguide Oscillator Julius O. Smith and Perry R. Cook Center for Computer Research in Music and Acoustics (CCRMA) Music Dept., Stanford University, Stanford, CA 94305 email: jos/prc ccrma.stanford.edu Abstract A digital sinusoidal oscillator derived from digital waveguide theory is described which has good properties for VLSI implementation. Its main features are no wavetable and a computational complexity of only one multiply per sample when amplitude and frequency are constant. Three additions are required per sample. A piecewise exponential amplitude envelope is available for the cost of a second multiplication per sample, which need not be as expensive as the tuning multiply. In the presence of frequency modulation (FM), the amplitude coefficient can be varied to exactly cancel amplitude modulation (AM) caused by changing the frequency of oscillation. 1. Introduction One of the very first computer music techniques introduced was additive synthesis (Risset 1985). It is based on Fourier's theorem which states that any sound can be constructed from elementary sinusoids, such as are approximately produced by carefully struck tuning forks. Additive synthesis attempts to apply this theorem to the synthesis of sound by employing large banks of sinusoidal oscillators, each having independent amplitude and frequency controls. Many analysis methods, e.g., the phase vocoder, have been developed to support additive synthesis. A summary is given in (Serra and Smith 1990). The cost of additive synthesis can be greatly reduced by making special purpose VLSI optimized for sinusoidal synthesis. In a VLSI environment, major bottlenecks are wavetables and multiplications. Even if a single sinusoidal wavetable is shared, it must be accessed sequentially, inhibiting parallelism. The wavetable can be eliminated entirely if recursive algorithms are used to synthesize sinusoids directly. In (Gordon and Smith 1985), three techniques were examined for generating sinusoids digitally by means of recursive algorithms. The recursions can be interpreted as implementations of secondorder digital resonators in which the damping is set to zero. The three methods considered were (1) the coupled form which is identical to a two-dimensional vector rotation, (2) the modified coupled form, or "magic circle" algorithm, which is similar to (1) but has ideal numerical behavior, and (3) the direct-form, second-order, digital resonator with its poles set to the unit circle. The digital waveguide oscillator appears to have the best overall properties yet seen for VLSI implementation. The new structure was derived as a spin-off from recent results in the theory and implementation of digital waveguides (Smith 1987a; Smith 1987b). Any second-order digital filter structure can be used as a starting point for developing a corresponding sinusoidal signal generator, so in this case we begin with the second-order wavguide filter. 150
Page 151 ï~~2. The Second-Order Waveguide Filter The first step is to make a second-order digital filter with zero damping by abutting two unitsample sections of waveguide medium, and terminating on the left and right with perfect reflections, as shown in Fig. 1. It turns out that to obtain sinusoidal oscillation, one of the terminations must provide an inverting reflection while the other is non-inverting. p2 (t) 1 + k p1 (t} R3 = 0 - 1 R?2 k=-k R p2 (t) I - k p() Figure 1. The second-order, lossless, digital waveguide oscillator, built using two acoustic tube sections. The wave impedance in section i is given by R = pc/A,, where p is air density, Ai is the cross-sectional area of tube section i, and c is sound speed. The reflection coefficient is determined by the impedance discontinuity via k = (R1 - R2)/(R1 + R2). At the junction between sections 1 and 2, the signal is partially transmitted and partially reflected such that energy is conserved, i.e., we have lossless scattering. The formula for the reflection coefficient k can be derived from the physical constraints that (1) pressure is continuous across the junction, and (2) there is no net flow into or out of the junction. The discrete-time simulation for the physical system of Fig. 1 is shown in Fig. 2. The propagation time from the junction to a reflecting termination and back is one sample period. The half sample delay from the junction to the reflecting termination has been commuted with the termination and combined with the half sample delay to the termination. This is a special case of a "half-rate" waveguide filter (Smith 1987a). p (n) p(n) 1+ R3=0 -1 R2 k -k/R, Ro=o p; (n)PT) Figure 2. The second-order, lossless, waveguide filter. Since only two samples of delay are present, the digital system is at most second order, and since the coefficients are real, at most one frequency of oscillation is possible in (0, 7r). 151
Page 152 ï~~The scattering junction shown in the figure is called the Kelly-Lochbaum junction in the literature on lattice and ladder digital filters (Markle and Gray 1975,1976). While it is the most natural from a physical point of view, it requires four multiplies and two additions for its implementation. It is well known that lossless scattering junctions can be implemented in a variety of equivalent forms, such as the two-multiply and even one-multiply junctions. However, most have the disadvantage of not being normalized in the sense that changing the reflection coefficient k changes the amplitude of oscillation. This can be understood physically by noting that a change in k implies a change in R2/R1. Since the signal power contained in a waveguide variable, say p+(n), is [pit(n)]2 /R1, we find that modulating the reflection coefficient corresponds to modulating the signal energy represented by the signal sample in at least one of the two delay elements. Since energy is proportional to amplitude squared, energy modulation implies amplitude modulation. The well-known normalization procedure is to replace the traveling pressure waves pÂ~ by "rootpower" pressure waves fi = p+/ VR so that signal power is just the square of a signal sample (pr+)2. When this is done, the scattering junction transforms from the Kelly-Lochbaum or one-multiply form into the normalized ladder junction in which the reflection coefficients are again Â~k, but the forward and reverse transmission coefficients become v/1-k2. Defining k = sin(g), the transmission coefficients can be seen as cos(O), and we arrive essentially at the coupled form, or two-dimensional vector rotation considered in (Gordon and Smith 1985). An alternative normalization technique is based on the digital waveguide transformer (Smith 1987a). The purpose of a "transformer" is to "step" the force variable (pressure in our example) by some factor g without scattering and without affecting signal energy. Since traveling signal power is proportional to pressure times velocity p+ u+, it follows that velocity must be stepped by the inverse factor 1/g to keep power constant. This is the familiar behavior of transformers for analog electrical circuits: voltage is stepped up by the "turns ratio" and current is stepped down by the reciprocal factor. Now, since p+ = Ru+, traveling signal power is equal to p+u+ = (p+)2/fR. Therefore, stepping up pressure through a transformer by the factor g corresponds to stepping up the wave impedance R by the factor g2. In other words, the transformer raises pressure and decreases volume velocity by raising the wave impedance (narrowing the acoustic tube) like a converging cone. If a transformer is inserted in a waveguide immediately to the left, say, of a scattering junction, it can be used to modulate.the the wave impedance "seen" to the left by the junction without having to use root-power waves in the simulation. As a result, the one-multiply junction can be used for the scattering junction, since the junction itself is not normalized. Since the transformer requires two multiplies, a total of three multiplies can effectively implement a normalized junction, where four were needed before. Finally, in just this special case, one of the transformer coefficients can be commuted with the delay element on the left and combined with the other transformer coefficient. These transformations lead to the final form shown in Fig. 3. G(n) C(n) Figure 3. The transformer-normalized, digital waveguide oscillator. The "tuning coefficient" is given, by C(n) = cos(2irf, T), where f,, is the desired oscillation frequency in Hz at sample n, and T is the sampling period in seconds. The "amplitude coeffi 152
Page 153 ï~~cient" is G(n) = r, g, /g~ _, where r~ = e-T/Tn is the exponential growth or decay per sample (r~ - 1 for constant amplitude), and g~ is the normalizing transformer "turns ratio" given by g~= v1 - C(n)]/[1 + C(n)]. When both amplitude and frequency are constant, we have G(n) - 1, and only the tuning multiply is operational. When frequency changes, the amplitude coefficient deviates from unity for only one time sample to normalize the oscillation amplitude. When amplitude and frequency are constant, there is no gradual exponential growth or decay due to round-off error. This happens because the only rounding is at the output of the tuning multiply, and all other computations are exact. Therefore, quantization in the tuning coefficient can only cause quantization in the frequency of oscillation. Note that any one-multiply digital oscillator should have this property. In contrast, the only other known normalized oscillator, the coupled form, does exhibit exponential amplitude drift because it has two coefficients c = cos(0) and s = sin(0) which, after quantization, no longer obey c2 + s2 = 1 for most tunings. Conclusions A recursive algorithm was presented for digital sinusoid generation that has excellent properties for VLSI implementation. It is like the coupled form in that it offers instantaneous amplitude from its state and constant amplitude in the presence of frequency modulation. However, its implementation requires only one or two multiplies per sample instead of four. While these properties make the new oscillator appear ideally suited for FM applications in VLSI, there are issues to be resolved regarding conversion from modulator output to carrier coefficients. Preliminary experiments indicate that FM indices less than 1 are well behaved when the output of a modulating oscillator simply adds to the coefficient of the carrier oscillator (bypassing the exact FM formulas). Approximate amplitude normalizing coefficients have also been derived which provide a first-order approximation to the exact AM compensation at low cost. For music synthesis applications, we believe a distortion in the details of the FM instantaneous frequency trajectory and a moderate amount of incidental AM can be tolerated since they produce only second-order timbral effects in many situations. References J. W. Gordon and J. 0. Smith, "A Sine Generation Algorithm for VLSI Applications," Proc. 1985 Int. Conf. Computer Music, pp. 165-168. A. H. Gray and J. D. Markel, "Digital Lattice and Ladder Filter Synthesis," Selected Papers in Digital Signal Processing, Digital Signal Processing Committee, eds., IEEE Press, 1975. J. D. Markel and A. H. Gray, Linear Prediction of Speech, Springer-Verlag, New York, 1976. P. M. Morse and K. U. Ingard, Theoretical Acoustics, McGraw-Hill, New York, 1968. J. C. Risset, "Computer Music Experiments 1964-...," Computer Music Journal, 9(1):11-18, Spring, 1985. Reprinted in The Music Machine,, Roads, C., ed., MIT Press, 1989. X. Serra and J. 0. Smith, "Spectral Modeling Synthesis: A Sound Analysis/Synthesis System Based on a Deterministic plus Stochastic Decomposition," Computer Music Journal, 14(4):12-24, Winter, 1990. J. 0. Smith, "Music Applications of Digital Waveguides," CCRMA Tech. Rep. STAN-M-39, Stanford University, 1987. This is a compendium of four papers and presentations. Copies can be ordered by calling CCRMA at (415)723-4971. J. 0. Smith, "Waveguide Filter Tutorial," Proc. 1987 mnt. Conf. Computer Music, Illinois. 153