DIGITAL FILTER APPLICATIONS TO MODELING WAVE PROPAGATION IN SPRINGS, STRINGS, MEMBRANES AND ACOUSTICAL SPACE

Size: px
Start display at page:

Download "DIGITAL FILTER APPLICATIONS TO MODELING WAVE PROPAGATION IN SPRINGS, STRINGS, MEMBRANES AND ACOUSTICAL SPACE"

Transcription

1 DIGITAL FILTER APPLICATION TO MODELING WAVE PROPAGATION IN PRING, TRING, MEMBRANE AND ACOUTICAL PACE a dissertation submitted to the department of music and the committee on graduate studies of stanford university in partial fulfillment of the requirements for the degree of doctor of philosophy cott A. Van Duyne June 2007

2 c Copyright 2007 by cott A. Van Duyne All Rights Reserved ii

3 I certify that I have read this dissertation and that in my opinion it is fully adequate, in scope and quality, as a dissertation for the degree of Doctor of Philosophy. Chris Chafe (Principal Adviser) I certify that I have read this dissertation and that in my opinion it is fully adequate, in scope and quality, as a dissertation for the degree of Doctor of Philosophy. Jonathan Berger I certify that I have read this dissertation and that in my opinion it is fully adequate, in scope and quality, as a dissertation for the degree of Doctor of Philosophy. David Berners I certify that I have read this dissertation and that in my opinion it is fully adequate, in scope and quality, as a dissertation for the degree of Doctor of Philosophy. Jonathan Abel Approved for the University Committee on Graduate tudies: iii

4 Preface This work is primarily archival in nature, documenting the research I did at CCRMA in the 1990s. Although new or unpublished material is presented herein, most of the research was completed, published, presented publicly and/or patented by me by 1999, at which time I stopped out of tanford to pursue a start-up company in the valley. I have only now returned to my degree program in I have focused the narrative of this dissertation on the tools and methods of spectral analysis of hyperbolic differential equations, finite differences, multi-dimensional waveguide structures, linear and nonlinear coupling of modes and strings, linear and nonlinear excitation models and the basic model calibration methods. I rely heavily on my previously published works, internal reports, patent applications, etc. which are cited throughout as appropriate. iv

5 Acknowledgments My most profound appreciation goes to these few: Jean-Claude Risset, who believed in me from the start, and who gave me my first true window into what computer music was about; John Chowning, who created the CCRMA culture of the 80s and 90s which was so fertile for so long to my random-walk research; John Pierce, who rolled up his sleeves with me on the passive nonlinearity, and gave me a glimpse at how the engineering giants of another time built the world we live in; Max Mathews, whose unshakable enthusiasm for hands-on exploration was a daily inspiration; Julius mith, who provided me an introduction to the nuts and bolts of physical modeling; Chris Chafe, who never gave up on me, and whose help and advice was instrumental in getting me back on track after an extended detour; Dave Berners, Jonathan Abel and Jonathan Berger, who served beyond the call of duty on my various academic review committees; David Jaffe, Tim tilson, and ean Costello, fellow travelers who stuck with me beyond reason through ynthbuilder, ynthcore, taccato ystems, oundmax, MartTools, and VisualAudio till the very last day; and my wife Becky, who lovingly waited 17 years for me to finish up my degree. v

6 Contents Preface Acknowledgments iv v 1 Traveling Wave Warm-Ups Introduction The Classical Wave Equation A Physical Derivation The Traveling-Wave olution Transforming the Wave Equation A Frequency Domain Approach The Differential Equation as a econd-order ystem Introduction to pectral Amplification Factors Allowed Frequencies on an Ideal tring with Rigid Terminations The Digital Waveguide Difference Bi-Directional Delay Lines Fractional Delay Line Lengths Analysis of the Internal Waveguide Filter ignals The Equivalent Finite Difference cheme Converging to the Differential Equation Transforming the Waveguide Difference cheme A Frequency Domain Approach The Finite Difference as a econd-order ystem Discrete pectral Amplification Factors Von Neumann Analysis vi

7 1.6 A More General Difference for c Deriving the General Difference pectral Analysis of the General Difference Numerical Instability when c > Dispersion Error when c < Digital Waveguide tructure Models Optimal Wave peed Inharmonicity, Decay and Coupling Effects of Internal Loss and tiffness on Traveling Waves The pectral Amplification Factors Commuted ummary Filter Implementation tiffness in the Wave Equation The Bar Equation The tiff tring Equation A Piano tring Example The More General Lossless Equation Modeling tiffness in the Digital Waveguide Introducing tiffness with Allpass Filters Rate of tretching in the Partials of tiff trings Rate of tretching in the Modes of a Delay Loop with Cascaded One-Pole Allpass Filters Internal Loss in the Wave Equation Physically Valid Forms of the 1-D Isotropic Wave Equation Parameterizing the Wave Equation from Measured Data Loss and Dispersion at the Termination Lumped Impedance Force Waves, Velocity Waves, and Wave Impedance Terminating a tring at a Lumped Impedance Interpreting tiffness Allpasses as a Termination Impedance Calibrating the Digital Waveguide tring Model The ummarized Loop Model Calibration Approach Obtaining the Data Directly from an Audio Recording vii

8 2.6.4 Calibrating Loop tiffness from Recorded Data Calibrating Loop Loss From Recorded Data Coupled trings Two-tage Decay Rate The Loaded cattering Junction The Coupled tring Model Calibrating the Coupling Filter First Method: Deducing R b from ingle-tring Decay Rates econd Method: Deducing R b from First-tage Decay Rates The Waveguide Mesh Traveling-Wave olution to the Ideal Membrane Equation The Membrane Equation in the Frequency Domain Polar Coordinate View of the 2-D Fourier Transform olving the Wave Equation The 2-D Digital Waveguide Mesh The Lossless cattering Junction The Birth of Traveling Plane Waves Terminating the Mesh Implementation Features Empirical Evaluation of the Mesh Mirroring of the pectrum Dispersion in Plates Why the Thing Works Finite Difference cheme Equivalence The Difference as a tandard 2-D cheme Converging to the 2-D Wave Equation Von Neumann Error Analysis in 2-D olving the Difference Directly in the Frequency Domain Evaluation of the Error Other Mesh tructures Meshes Constructed of N-Port cattering Junctions Lossless N-Port cattering Junctions viii

9 4.1.2 Connecting Two Junctions with a Bidirectional Unit Delay The General Finite Difference cheme Generalized Amplification Factors The 8-Port 2-D Multiply-Free Mesh The 6-Port 2-D Mesh The 6-Port 2-D Multiply-Free Non-Isotropic Mesh The 6-Port 3-D Rectilinear Mesh Animating the 6-Port 3-D Mesh Dispersion Error The 3-Port 2-D Mesh Alternating ymmetry: Two Time teps Needed Computing the Finite Difference Verifying the FDA Converges to the PDE Dispersion Results Animating the 3-Port 2-D Mesh The 4-Port 3-D Tetrahedral Mesh Motivation for the Tetrahedral Mesh The Tetrahedral Difference Converging to the PDE Dispersion Analysis Benefits of the Tetrahedral Mesh Over the Rectilinear Mesh The Passive Nonlinear Filter Nonlinearity in Musical Instruments: pectral Energy preading Memoryless Nonlinearities Passive Nonlinearity: The Physical Concept First Attempt: The Bent pring Termination econd Attempt: The Mass-pring ystem with Alternating k The Equivalent Electrical Circuit: Nonlinear Inductor or Capacitor tring Terminated with a Nonlinear pring Nonlinear Filter Derivation The imple Linear pring Terminating a tring with a pring ix

10 5.4.3 Bilinear Transform from s-plane to z-plane Making the pring Nonlinear Finding the Digitally Correct Coefficient Gating ignal Implementation Why It Works from a Phase Modulation Perspective Phase Response of the One Pole Allpass Filter inusoidal Variation of the Coefficient tep Variation of the Coefficient imple Models of pectrally Active ounds ummary The Wave-Decomposed Mass-pring Lumped ystems and Distributed ystems The Tuned One-Pole Allpass Feedback Loop The Wave-Decomposed Mass-pring Oscillator Coupling the Oscillators with a cattering Junction Calibrating the Coupling Filter Mass-pring Oscillator vs. Mass-pring Hammer Motivation for the Hammer The Hammer Model Overview of the Digital Waveguide tring and Hammer Model The Mass and pring ystem Traveling Wave Decomposition of the Lumped ystem cattering Junction Connection Making the Felt Nonlinear The Lossless Digital Model Hysteresis Loss in the Felt Empirical Evaluation with Published Data The Commutable Piano Hammer Background Linearizing the Piano Hammer Impedance of the Un-Terminated Ideal tring Impedance of the Terminated Ideal tring x

11 7.2.3 Impedance of the Ideal Linear Hammer Connecting the Hammer to the tring Implementation Analysis of Real Hammer-tring Interaction Data pectral Modeling Approach to the Multi-Pulse Effect Excitation ynthesis with Nonlinearly Filtered Noise ynthesizing ustain Pedal Effect Wrap Up A Pick-Up Point Modulation 202 A.1 Implementation of a Variable Pick-Up Point on a Waveguide tring Model with FM/AM Applications A.2 Background and Description of the Model A.3 Moving the Pick-Up Point A.4 Modulating the Pick-Up Position at Audio Rates A.5 Conclusion B Pitchbendable Allpass Interpolation 214 B.1 The Problem tatement B.2 Puzzle Pieces B.2.1 Minimizing the Transient Effect B.2.2 Legato Crossfade of Digital Waveguide tring Models B.3 Implementation B.3.1 Psychoacoustical Detail B.3.2 A DP Implementation Trick C tiffness Using Regions of FM 219 C.1 Analysis/ynthesis Model of the pectral tructure C.2 Construction of Decay Envelopes C.3 Fine Points: Beating in the Partials C.4 Conclusion xi

12 List of Figures 1.1 Transverse Force Component of tring with Constant Tension K The Digital Waveguide Linearly Interpolated Delay Line Allpass Interpolated Delay Line Phase Response of One-Pole Allpass Close-Up of the Digital Waveguide Magnitude of pectral Amplification Factor, g ω Normalized Frequency-Dependent Traveling-Wave peed Lumped Implementation of the Lossy Dispersive Traveling Wave Measured Partials from an A0 Piano tring Measured Frequency Distance Between the A0 Partials Rate of tretching for Hypothetical A Dispersive Delay Loop ystem Modes on z N H(z) vs. Modes on z (N+1) tretching of Partials on a Delay Loop tring Terminated by imple pring Mass/pring Chain tring Terminations Waveguide tring Loop Model Including Loss, Dispersion, and Yielding Terminations implified tring Loop First Allpass Parameterization Optimization Method Parallel Computation tructure for Cascaded Allpasses Measured Decay Rates in C5 Piano Tone xii

13 2.15 Modes of Two Identical trings Coupled Together by a Bridge: Reactive Coupling (left graph) and Resistive Coupling (right graph). Adapted from (Fletcher and Rossing, 1991) Decay Trajectories Measured on Piano G4 Tone: ingle tring vs. Three tring G4 Decay Trajectories Measured on ynthesized G4 Piano Tone: Tuned Exactly vs. light Detuning Two trings Coupled at a Lumped Impedance Three Piano trings Coupled at a Bridge Termination G4 Piano Tone: ingle- and Triple-tring Decay Rates The 2-D Digital Waveguide Mesh Four-Way cattering Junction Rigidly Terminated Membrane Open Termination of the Mesh Mesh Terminated with Arbitrary Wave Transfer Functions Wave Propagation on the Mesh Comparison of Theoretical Modes on a quare Membrane (shown above) and Measured Modes on a Waveguide Mesh (shown below) pectrum Reflecting Around π/ tretching Modes on the Mesh Detail View of the 4-Port Rectilinear Waveguide Mesh Frequency-Dependent Dispersion in the 4-Port Rectilinear Mesh. Vertical axis is fraction of full speed for that spatial frequency Frequency-Dependent Dispersion in the 4-Port Rectilinear Mesh. Contour lines are shown at 1% intervals Time-Domain View of Dispersion in the 4-Port Rectilinear Mesh The Lossless N-Port cattering Junction cattering Junctions Connected by a Bidirectional Unit Delay Port Rectilinear Mesh Dispersion in the 8-Port Rectilinear Mesh Port Triangular Mesh Dispersion in the 6-Port 2-D Mesh xiii

14 4.7 6-Port Mesh with Non-Isotropic Wave Impedance Dispersion in the Non-Isotropic 6-Port Mesh tructure of the 6-Port Rectilinear 3-D Mesh Animation of the 3-D Rectilinear Mesh Modeling Compression Wave Through a Tube Rectilinear Dispersion: ω z = Rectilinear Dispersion: ω z = ω x Rectilinear Dispersion: ω = π/ The 3-Port 2-D Hexagonal Mesh Close-up howing Alternating ymmetry Three-Port Dispersion The Animated 3-way 2-D Hexagonal Mesh Methane: Tetrahedral Bonds on the Carbon Atom Diamond: The Tetrahedral Carbon Mesh D Tetrahedral Mesh tructure Bi-Directional Delay Unit Tetrahedral Dispersion: ω x = Tetrahedral Dispersion: ω y = Tetrahedral Dispersion: ω z = Tetrahedral Dispersion: ω = π/ Delay Loop with quare Law Nonlinearity tring with Bent pringy Termination and Gong Viewed as Bent Plate Passive Nonlinear Mass/pring Oscillator Equivalent Electrical Capacitance Circuit Equivalent Electrical Inductance Circuit tring Terminated with Double pring Nonlinearly Terminated Transmission Line imple Linear pring ystem tring Terminated by imple pring The Allpass pring Termination Nonlinear tring/pring ystem Phase Response of the One Pole Allpass Filter xiv

15 5.13 Effect of Varying a center Effect of Varying a Output pectrum from inusoidally Driven, inusoidally-modulated Allpass Filter Evolving pectrum of tring/pnf ystem Harmonic Loop with Lowpass Filter Harmonic Loop with Lowpass Filter and Passive Nonlinear Filter Inharmonic Loop with Lowpass Filter Inharmonic Loop with Lowpass Filter and Passive Nonlinear Filter The Tuned One-Pole Allpass Filter Feedback Loop The Very hort Waveguide The Wave-Decomposed econd-order Oscillator Geometric Computation of Impedance Phase Response Impedance of This ystem is F (s)/v (s) = ks/(s 2 + k/m) Mass-pring Oscillators Coupled at a pring-loaded Junction Digital Implementation of econd-order Oscillators Coupled at a Loaded Junction The Digital Waveguide tring/hammer ystem Mass and pring Force Diagram The Continuous-Time Mass-pring ystem with Initial Velocity The Digital Wave-Decomposed Mass and pring Filter tring Loaded with Mass and Nonlinear pring Attaching the Wave Digital Hammer Attaching the Wave Digital Hammer to a 2-D Digital Waveguide Mesh The Wave Digital Hammer Nonlinear pring and Dashpot Equivalent Nonlinear pring Calculated Forces on Hammer Felt for v 0 = 1,2,3, and 4 m/s The Elaborate Physically Modeled Piano tring Terminated on One ide Only The Linear Mass-pring Hammer Model tep-driven Recursive Hammer Filter xv

16 7.5 Feed-Forward Hammer Filter Impulse-Driven Recursive Hammer Filter Middle-C (261 Hz) truck Hard: Force ignals Computed Using the WDH Parameterized with Physical Data Taken from (Chaigne and Askenfelt, 1994b) pectral EQ Method of Modeling the Hammer Filter ixth-order Filter Fit to Ratio pectrum ynthesis of oundboard Tap with Nonlinearly Filtered Noise Pole oundboard Resonance Implementation Noise-Plus-Resonator oundboard ynthesis db Frequency Response of a Recorded Piano oundboard Tap (above) and a Close-Up of the Lower Frequencies (below) ynthetic oundboard Tap Using a wept 1-Pole and Noise Pedal-Down ynthesis of Dry oundboard Tap Plus Wet Open trings Tap A.1 Terminated tring and Pick-up Placement Model A.2 Close-up of the Interpolated Position of the Pick-up A.3 low Continuous Pick-up Point Motion Over the tring Length A.4 Fast Discontinuous Pick-up Point peeds A.5 Effect of Accelerating Pick-up Point Position A.6 inusoidally Oscillating Pick-up Point Position A.7 Effects of Constant peed Plus Modulation Modulating on Pick-up Position 211 A.8 Effects of Accelerating Pick-up Position with Modulation B.1 The Interpolated Allpass Crossfade tructure B.2 Timing Diagram for the Alternating Crossfade Between Read Point Outputs 217 C.1 Plotter Data howing Natural Groupings of Partials of A C.2 pectral Evolution of A C.3 Measured Partial Frequencies in Hz for A C.4 MUIC 5 Diagram of Instrument xvi

17 Chapter 1 Traveling Wave Warm-Ups 1.1 Introduction This first chapter investigates the partial differential equation of the vibrating string and its relationship to the digital waveguide filter implementation and the equivalent finite difference approximations. Understanding the wave equation and its traveling-wave solution is fundamental to the digital waveguide physical modeling approach (mith, 1992). Furthermore, a grasp of the numerical properties of finite difference approximations to differential equations is illuminating in the one-dimensional case of vibrating strings, and is indispensable in the development of the multi-dimensional digital waveguide mesh solutions for traveling waves in membranes, plates, and rooms presented here in Chapters 3 and 4, and originally published in (Van Duyne and mith, 1996; Van Duyne and mith, 1993b; Van Duyne and mith, 1993a; Van Duyne and mith, 1995a). Inasmuch as finite difference approximations are a fundamental computational tool to the scientific community (trikwerda, 1989), we review the derivation of the flexible string equation and derive the traveling-wave solutions in both the continuous time space equation and in the standard finite difference approximation. We then review the digital waveguide computational model and show its exact equivalence to an optimally sampled finite difference approximation. Chapter 2 follows up with modeling stiffness and loss in strings and coupled strings including calibration methods to make the models useful. Chapter 5 addresses nonlinear coupling of modes. Chapter 6 introduces traveling-wave decomposition of lumped impedances, in particular, a coupled-mode synthesis method, and a nonlinear piano hammer 1

18 CHAPTER 1. TRAVELING WAVE WARM-UP 2 design. Chapter 7 investigates how to commute the piano soundboard response through a nonlinear hammer excitation to create efficient piano tone synthesis algorithms. The Appendices provide some interesting sidelights: a hybrid waveguide/fm pick-up point modulation synthesis method, a stiff-string FM-based synthesis model, and an interesting way to do signal-controlled artifact-free allpass interpolation of delay line loop lengths. Now on to the analysis of the 1-D wave equations and finite difference schemes in both the continuous time and space domains and the discrete time and space domains, spectral amplification factors, and techniques for evaluating and correlating the digital waveguide filters, finite difference schemes and differential equations which describe traveling wave behavior in isotropic media. 1.2 The Classical Wave Equation A Physical Derivation The ideal flexible string equation is worked out fully in (Morse, 1976), and in many other places. We review here the basic physical intuition of the equation. Assume an ideal lossless flexible string whose transverse displacement is given by y(t, x), where t is time, and x is horizontal position along the string. Assume it is infinitely long, that is, there are no termination boundary conditions to worry about for now. There is a constant tension, K, on the string; and the string has a mass per unit length of ε. We may apply Newton s econd Law, f = ma, that is, force = mass acceleration, to a small piece of the string between point x and point x + x. The mass of this small string segment is its mass density times its length, ε x. Its acceleration is the second partial time derivative of its transverse position, 2 y/ t 2. Figure 1.1 shows the transverse force on the right end point of the string segment as the transverse component of the string tension, which may be approximated, for small string deflection angles, θ, as K sin θ K tan θ = K y/ x evaluated at the point x + x. The transverse force on the left end point of the string segment may be similarly approximated as K y/ x evaluated at the point x. Hence, the total transverse force is the sum of these two forces. ubstituting these values for force, mass and acceleration into f = ma, we obtain the relationship, ( y(t, x + x) K x ) y(t, x) = ε x 2 y x t 2 (1.1)

19 CHAPTER 1. TRAVELING WAVE WARM-UP 3 y(x) K θ K sinθ x x+δx Figure 1.1: Transverse Force Component of tring with Constant Tension K Dividing both sides by x and taking the limit as x goes to zero, we note that the left-hand side of the equation contains the definition of the second partial derivative of y with respect to x. Hence, we may write, K lim x 0 y(t, x + x) x x y(t, x) x = ε 2 y t 2 (1.2) K 2 y x 2 = ε 2 y t 2 (1.3) A derivation along these lines may be found in (Morse, 1976) or (Graff, 1975). This is a simple looking equation. However, it is just an approximation of real string behavior, even ideal string behavior. Recall that, in order to obtain this conveniently linear equation, we assumed that tension on the string was constant at all times, that there is no longitudinal motion of the string, transverse motion was allowed in only one plane, and that the string was completely flexible, i. e., it had no diameter. However, even with these idealized assumptions, we have still approximated the transverse force component, taking sin θ tan θ, which is only true for very small string deflection angles, θ. As soon as the string starts moving, error is introduced into the approximation; even this idealized string is inherently nonlinear (Pierce, 1974). A more detailed treatment of the nonlinear vibration problem may be found in (Carrier, 1945), as well as a treatment of the nonlinear coupling between the three modes of vibration, horizontal transverse

20 CHAPTER 1. TRAVELING WAVE WARM-UP 4 waves, vertical transverse waves, and longitudinal compression waves, all of which play an important role in the vibration of real strings. These three modes of vibration are linear and may be separated into orthogonal, non-coupled modes in the ideal string only when deflections remain small enough (Elmore and Heald, 1985) The Traveling-Wave olution Returning to the simplified case, Jean Le Rond d Alembert published the traveling-wave solution to the wave equation in 1749 in his Recherches sur la courbe que forme une corde tendue mise en vibration (d Alembert, 1749). It is easy to verify by substitution that the ideal wave equation (1.3) is solved by the sum of two arbitrary traveling waves, y(t, x) = y + (x ct) + y (x + ct) (1.4) where y + (x ct) represents an arbitrary fixed wave shape traveling to the right at speed c, and y (x + ct) represents an arbitrary fixed wave shape traveling to the left at speed c. Defining ÿ ± as the second derivatives of the traveling-wave shape functions y ±, we take second-order partial derivatives of (1.4) to obtain ÿ ± (ξ) = d2 y ± (ξ) dξ 2 (1.5) 2 y(t, x) t 2 = c 2 ÿ + (x ct) + c 2 ÿ (x + ct) (1.6) 2 y(t, x) x 2 = ÿ + (x ct) + ÿ (x + ct) (1.7) ubstituting, we see, 2 y(t, x) t 2 = c 2 2 y(t, x) x 2 (1.8) which is equivalent to (1.3) with c = K/ε. Hence, the traveling-wave solution of the wave equation is verified by direct substitution. The arbitrary traveling waves may be expressed as sums of their traveling sinusoidal components: y ± (x ct) = k A ± k ejω k(x ct) (1.9)

21 CHAPTER 1. TRAVELING WAVE WARM-UP 5 where the A ± k are complex amplitude scalers containing magnitude and phase information, and e jωk(x ct) represents a complex sinusoid of spatial frequency ω k traveling at speed c. Note that, in this formulation, the corresponding temporal frequency observed at some fixed point on the string would be ω k c. 1.3 Transforming the Wave Equation A Frequency Domain Approach If we lack the intuition of d Alembert, or otherwise prefer not to guess at the solutions of the wave equation, we may derive the traveling-wave solution from Equation (1.8) by applying straightforward spectral transform methods. An application of the generalized bi-directional Laplace transform to the space dimension of the wave equation may be found in (Zemanian, 1987). However, we do not follow this method; our approach will be to apply the Fourier transform to the continuous space dimension, < x <, mapping to the continuous frequency variable, < ω < ; then to apply the uni-directional Laplace transform to the continuous time dimension, t > 0, mapping to the complex frequency variable, s, over the complex plane where the imaginary part of s corresponds to real frequencies, and the real part of s corresponds to decaying exponentials. First, we take the Fourier transform of (1.8) over the spatial coordinate, mapping, y(t, x) F y ω (t) = y(t, x)e jωx dx (1.10) and taking advantage of the derivative theorem (Hsu, 1984) which states, y(t, x) x to obtain the ordinary differential equation in time, F jωy ω (t) (1.11) 2 y ω (t) t 2 = c 2 (jω) 2 y ω (t) (1.12) where y ω (t) is the Fourier transform of y(t, x) along x. Laplace transform to 1.12, mapping, Applying the uni-directional y ω (t) L Y ω (s) = y ω (t)e st dt (1.13) 0

22 CHAPTER 1. TRAVELING WAVE WARM-UP 6 and then applying the Laplace derivative theorems, y ω (t) t L sy ω (s) y ω (0) (1.14) and we find 2 y ω (t) t 2 L s 2 Y ω (s) sy ω (0) ẏ ω (0), (1.15) s 2 Y ω (s) sy ω (0) ẏ ω (0) = c 2 (jω) 2 Y ω (s) (1.16) where y ω (0) is the initial condition spatial spectrum at time zero, and ẏ ω (0) = y ω / t evaluated at ω = 0 is the first partial time derivative of the spatial spectrum at time zero. olving for Y ω (s) and making a partial fraction expansion, we obtain the result, where, Y ω (s) = sy ω(0) + ẏ ω (0) s 2 + c 2 ω 2 = y+ ω s + jωc + y ω s jωc y ω ± = 1 ( y ω (0) ẏω(0) ) 2 jωc (1.17) (1.18) The Differential Equation as a econd-order ystem We may view Equation (1.17) as a continuum of second-order analog filter systems which operate pointwise on space spectrum point signals. The filter continuum is tuned according to the frequency ω of the spatial spectrum point on which it is working. Noting that, e at L 1 s a we take inverse Laplace transform of Equation (1.17) to get, (1.19) y ω (t) = y + ω e jωct + y ω e jωct (1.20) Applying the inverse Fourier transform in space, taking advantage of the shift theorem, which maps linear phase modulation in the spectral domain to constant distance shift in the space domain, we obtain the classical traveling-wave solution, y(t, x) = y + (x ct) + y (x + ct) (1.21)

23 CHAPTER 1. TRAVELING WAVE WARM-UP 7 Furthermore, taking the inverse Fourier transform of Equation (1.18), we may express the left and right displacement wave components in terms of the initial displacement, y(0, x), and initial transverse velocity, y(0, x)/ t, of the the string: y ± (x) = 1 2 ( y(0, x) 1 x c ) y(0, ξ) dξ t (1.22) These initial condition relations are reached in (Morse and Ingard, 1968) in an entirely time-space domain approach Introduction to pectral Amplification Factors Our spectral transform approach is somewhat heavy-handed if its only purpose is to solve the 1-D wave equation. However, we have in mind to apply this same method to finite difference approximations to the wave equation in the multi-dimensional cases. These methods will give us a way to evaluate quantitatively the numerical error in finite approximation schemes. We work out the details here in the one-dimensional case, and apply the same principles to the analysis of the digital waveguide mesh solutions to the multi-dimensional wave equation in Chapters 3 and 4. To proceed, we may study the behavior of wave travel in the wave equation by tracing the evolution of the spatial spectrum over time. In particular, we may compute a set of spectral amplification factors (trikwerda, 1989) which describe how the spatial spectrum changes over a given time interval, t. Equation (1.20) expresses the spatial spectrum at time t as the sum of two initial constant spectra, y ω ±, modulated by linear phase terms, e ±jωt. We may investigate how the spatial spectrum changes over the interval from t to t + t by comparing (1.20) with the following: y ω (t + t) = y + ω e jωc(t+ t) + y ω e jωc(t+ t) (1.23) = y ω + e jωct g ω + ( t) + y ω ejωct gω ( t) (1.24) where, g ± ω ( t) = e jωc t (1.25) are the spectral amplification factors. The magnitude of these factors is equal to 1, which

24 CHAPTER 1. TRAVELING WAVE WARM-UP 8 means there is no loss in this equation. However there is a spatial phase shift of g ω ± ( t) = ωc t (1.26) This is the number of radians that a given spatial frequency, ω, will advance in phase after a time interval t. Phase Distance By analogy with the concept of phase delay, or really phase advance, in the time domain, we may define a phase distance which is intuitively the distance which a space wave travels in the time interval corresponding to the apparent phase advance at the given frequency. Phase distance is the phase advance normalized by spatial frequency, g ± ω ( t) ω = ±c t (1.27) peed of Wave Travel Of course, we may define the speed of wave travel as phase distance traveled per unit of time, g ± ω ( t) ω t = ±c (1.28) Allowed Frequencies on an Ideal tring with Rigid Terminations Allowed frequencies on a rigidly terminated vibrating ideal string of length, L, and traveling-wave speed, c, can be computed as follows: Rigid terminations reflect and invert traveling waves (Morse, 1976), so round-trip traveling-wave length of the string system is 2L. upported wave lengths on the string are those that have multiples equal to the round-trip traveling-wave path. Call the spatial wave lengths of partial frequencies allowed on the terminated string, T n, where T n = 2L/n (1.29) and n = 1, 2,... are the partial frequency index numbers.

25 CHAPTER 1. TRAVELING WAVE WARM-UP 9 patial frequencies associated with these wave lengths would be ω n = 2π = nπ T n L (1.30) Defining the travel speed of the spatial frequencies to be C(ω n ) = c, constant for all spatial frequencies, then the allowed partial frequencies, p(n), are computed as p(n) = C(ω n) T n = nc 2L (1.31) which can be written, p(n) = n p(1) (1.32) Allowed partial frequencies are simply multiples of the fundamental frequency, p(1). Although this computation is evidently trivial and not surprising in the ideal flexible string case, this method is general and will permit us to compute allowed frequencies on terminated media where C(ω n ) is not constant over ω n. 1.4 The Digital Waveguide Difference For an excellent technical overview and history of the delay-line loop-based string models, please see (Karjalainen et al., 1998) Bi-Directional Delay Lines For the purpose of the present work, note that the digital waveguide is a direct implementation of the traveling-wave solution to the wave equation as a pair of bi-directional delay lines which represent both time delay and physical distance by their delay elements (mith, 1987; mith, 1992). Figure 1.2 illustrates a high-level view of the digital waveguide. Two arbitrary digital traveling-wave signals propagate independently in their respective leftand right-going directions in delay line registers, while the physical wave amplitude at any point may be obtained by summing the left- and right-going signals at a physical position. The physical signal output, u, is the transverse displacement of the vibrating string at some pick-up point on the string, and is computed as sum of its traveling components, u + and u. The full shape of the string can be computed by summing the traveling-wave signals at each point of the bidirectional delay lines.

26 CHAPTER 1. TRAVELING WAVE WARM-UP 10 u + DELAY LINE + u DELAY LINE u Figure 1.2: The Digital Waveguide The position of the pick-up point is critical in audio synthesis, as the choice of position comb filters (Dodge and Jerse, 1985; Parks and Burrus, 1987) the output signal significantly in relation to the modal shapes on the strings. ometimes this is desirable, often not. In much physical modeling synthesis, the audio output can be taken directly from one of the traveling waves (without computing the sum of traveling waves), or in more advanced modeling, extracted form the bridge filter or scattering junction (mith, 1987). In Chapters 3 and 4, we extract output audio from scattering junctions on the plane, but then a 2-D comb filtering effect is in place relating to the modal shapes on the membrane. Appendix A investigates the audio synthesis possibilities of sliding the position of the pick-up point along the length of the string model at constant velocity, accelerating it, or oscillating the position placement something that would be hard to do in reality, but easy to do in a physical model. This exploits the comb filtering effect and the result is a combination of amplitude and frequency modulation (Chowning, 1973) effects on physical model output.

27 CHAPTER 1. TRAVELING WAVE WARM-UP 11 z -N z -1 1 ε ε + Figure 1.3: Linearly Interpolated Delay Line Fractional Delay Line Lengths We will need to model string systems whose loop delays are a non-integral number of samples long. However, we are in a time-sampled environment and there is no way to have a fractional delay except by some form of filtering. Much work has gone into this area of research and we do not intend to explore this area fully. ee (Välimäki, 1995) for some excellent analysis and applications. For now, we may extract two simple methods which are in common use due to their efficiency and useful properties. Linear Interpolation If we require a delay line of length of N + ε samples, where ε is some number between 0 and 1, we may use the method of linear interpolation between two delay lengths as is shown in Figure 1.3 (Jaffe and mith, 1983). uch a method is extremely convenient when variable delay lengths are to be expected, however, if the the delay line is to be part of a feedback loop, as in the simple string model presented in the next section, there is a major drawback. The very act of interpolation is equivalent to applying a one-zero lowpass filter inside the feedback loop. For example if ε = 0.5, the interpolation applies a two point averaging filter with a zero right on the Nyquist limit frequency (Parks and Burrus, 1987). Allpass Interpolation An alternative to linear interpolation, which does not attenuate the magnitude of the signal in the delay line is allpass interpolation (Jaffe and mith, 1983). The idea is to

28 CHAPTER 1. TRAVELING WAVE WARM-UP 12 z -N H ε (z) Figure 1.4: Allpass Interpolated Delay Line insert an allpass filter into the delay line whose phase response delays the phase of the component frequencies in the signal so as to imitate the effect of a fractional delay. The first-order allpass filter is sufficient for this purpose. The one-pole digital allpass filter may be defined by its difference equation, y(n) = a 0 x(n) + x(n 1) a 0 y(n 1) (1.33) where x(n) is its input signal and y(n) is its output signal, or by its Z transform (Parks and Burrus, 1987), H(z) = a 0 + z a 0 z 1 (1.34) We take the coefficient, a 0, to be a real number between 1 and 1. The frequency response of this filter is obtained by replacing z with e jωt, where ω is the radian frequency and T = 1/f s is the sampling interval. The magnitude response, H(e jωt ), is always 1; therefore, we may re-write the frequency response in the following polar form, H(e jωt ) = e jφ(ωt ) (1.35) where the phase response is φ(ωt ) = H(e jωt ). We may derive an analytic expression for the phase response, { } φ(ωt ) = arctan Im H(e jωt ) Re{H(e jωt )} = arctan (a 0 2 1) sin ωt 2a 0 + (a ) cos ωt (1.36) (1.37) where the arc tangent function has been unwrapped. ince we restrict ω to positive frequencies, we can unwrap the values of the usual computer generated arc tangent function by subtracting π whenever the arctan function is positive. Figure 1.5 shows overlaid plots of φ(ωt ) for values of a 0 ranging from 0.8 to 0.8.

29 CHAPTER 1. TRAVELING WAVE WARM-UP 13 ωt 0 0 π/4 π/2 3π/4 π π/4 a 0 = 0.8 φ(ωt) π/2 3π/4 π a 0 = 0.8 Figure 1.5: Phase Response of One-Pole Allpass The phase delay of the allpass filter is defined as the phase response normalized by frequency, P d (ω) = φ(ωt )/ω (1.38) The phase delay tells us the effective number of samples that a particular frequency has been delayed. Therefore, if we need a fractional delay of ε, then we simply need an allpass filter whose phase delay is ε at all frequencies. This is not exactly possible, but the onepole allpass makes a convenient unattenuated approximation to this. An estimate of the correct allpass coefficient for a given fractional delay is given in (Jaffe and mith, 1983), a 0 1 ε 1 + ε (1.39) which is good for low frequencies. There is some dispersion at the higher end of the frequency response, but the effect is quite good when the coefficient is near zero, which is where the allpass reduces to the exactly linear phase case of one sample of pure delay. Therefore, it may be best to let your desired fractional delay, ε, range from.5 to 1.5, rather than from 0 to 1 by modifying the integral delay length appropriately.

30 CHAPTER 1. TRAVELING WAVE WARM-UP 14 ee Appendix B for a brute-force psychoacoustics-based solution to the problem of making continuous pitchbend or glissandi on a string when using the lossless allpass interpolation approach Analysis of the Internal Waveguide Filter ignals Returning to the digital waveguide filter structure, per se, we note that the continuous time and space solution to the wave equation, y(t, x) may be sampled over space and time with a time sampling interval of T and a spatial sampling interval of X to define a discrete time space function, v m (n), where n is the time index and m is the space index. If we take X = ct, then waves should travel at the rate of one spatial sample per time sample: v m (n) = y(nt, mx) (1.40) = y + (mx cnt ) + y (mx + cnt ) (1.41) = y + ((m n)x) + y ((m + n)x) (1.42) = u + (m n) + u (m + n) (1.43) where u ± are the sampled traveling-wave signals as in Figure 1.2 of the solution corresponding to the continuous traveling waves, y ±. In Figure 1.6, we now explicitly define separate traveling-wave signals between every delay unit in the upper and lower delay lines: v + m(n) is the signal output at position m on the upper right-going delay line at time n; v m(n) is the signal output at position m on the lower left-going delay line at time n. To clarify by an example, note that v m + (n) is the same signal as v m 1 + (n 1), similarly v m (n) is the same signal as v+ m+1 (n 1) The Equivalent Finite Difference cheme Figure 1.6 illustrates the basic computational structure in digital filter block diagram notation. The time index is represented by n and the spatial position is represented by m. The signal v + m(0) is the initial spatial wave shape at time 0 which travels to the right as n increments. The signal vm (0) is the initial spatial wave shape at time 0 which travels to the left as n increments. The actual physical variable is given by v m (n) = v + m(n) + v m(n) (1.44)

31 CHAPTER 1. TRAVELING WAVE WARM-UP 15 + v m-1 (n) z 1 v + m (n) z 1 v+ m+1 (n) z 1 + v m-1 (n) + v m (n) + v m+1 (n) v m-1 (n) z 1 v m (n) z 1 v m+1 (n) z 1 Figure 1.6: Close-Up of the Digital Waveguide Moving to the Z-Plane If we view v m (n), v + m(n), and v m(n) as three sets of time indexed signals which are associated with spatial positions, m, we may perform a Z-transform (Kuo, 1966; Ludeman, 1986) on the entire set v m (n) v ± m (n) Z V m (z) = Z V m ± (z) = v m (n)z n (1.45) n=0 With this, we observe the following relationships from the Figure 1.6: n=0 v ± m (n)z n (1.46) V m (z) = V m + (z) + V m (z) (1.47) V m + (z) = z 1 V m 1 + (z) (1.48) Vm (z) = z 1 Vm+1 (z) (1.49) Applying these observations, we may express the traveling-wave signals, V ± m (z) as combinations of the physical signals, V m (z) V m + (z) = z 1 V m 1 + (z) (1.50) = z 1 (V m 1 (z) Vm 1 (z)) (1.51)

32 CHAPTER 1. TRAVELING WAVE WARM-UP 16 = z 1 (V m 1 (z) z 1 V m (z)) (1.52) = z 1 (V m 1 (z) z 1 (V m (z) V + m (z))) (1.53) = z 1 V m 1 (z) z 2 V m (z) + z 2 V m + (z) (1.54) olving for V + m (z) we find, V + m (z) = imilarly for the left-going wave signals, V m (z) = Eliminating the Wave Variables z 1 1 z 2 (V m 1(z) z 1 V m (z)) (1.55) z 1 1 z 2 (V m+1(z) z 1 V m (z)) (1.56) Hence, the physical variable signals, V m (z), may be expressed in terms of other physical variable signals, and the wave variable signals may be eliminated, V m (z) = V m + (z) + V m (z) (1.57) = z 1 1 z 2 (V m 1(z) 2z 1 V m (z) + V m+1 (z)) (1.58) Gathering terms, (1 z 2 )V m (z) = z 1 (V m 1 (z) + V m+1 (z)) 2z 2 V m (z) (1.59) (1 + z 2 )V m (z) = z 1 (V m 1 (z) + V m+1 (z)) (1.60) The Waveguide Difference cheme The inverse Z-transform leads to the time domain expression, v m (n) + v m (n 2) = v m 1 (n 1) + v m+1 (n 1) (1.61) This is the difference scheme which the digital waveguide computes.

33 CHAPTER 1. TRAVELING WAVE WARM-UP Converging to the Differential Equation In later chapters it will be useful to have a reliable method to verify exactly what partial differential equation a given finite difference scheme converges to as the grid interval sizes approach 0. In general we will be able to replace the discrete time and space variables with continuous time and space variables, and replace the unit spatial and time sample shifts in the finite difference with an ε. We can then apply a multi-dimensional power series expansion around an arbitrary point in all directions, and let ε converge to 0. When the finite difference relation under study represents wave propagation in a membrane or in 3-D space, and uses a non-rectilinear space grid, this may be the most direct way to glean the actual theoretical wave speed of the traveling waves in a closed form. Let s apply the techniques in the simple 1-D case. Note that even in the 1-D case we will need a 2-D Taylor s expansion as there are two variables, time and space. Definition of the 2-D Taylor s eries Expansion The 2-D Taylor s series expansion around the point, u(t, x) can be defined as follows (Courant and John, 1974) = + t 1! u(t + t, x + x) = n t n x u(nt,nx) (t, x) tnt xnx n t!n x! ( u(t, x) + x ) 1! u(0,1) (t, x) + x2 u (0,2) (t, x) ! + t2 2! ( u (1,0) (t, x) + x ) 1! u(1,1) (t, x) + x2 u (1,2) (t, x) ! ( u (2,0) (t, x) + x ) 1! u(2,1) (t, x) + x2 u (2,2) (t, x) ! (1.62) +... where u (n,m) (t, x) is the partial derivative of u of order n in the t direction and of order m in the x direction (and assumed to exist), evaluated at the point (t, x).

34 CHAPTER 1. TRAVELING WAVE WARM-UP 18 Making the Waveguide Difference a Continuous Function If we imagine a continuous function (with continuous derivatives) running through the discrete points of the difference, we can re-write the waveguide difference derived in Equation 1.61 as follows, u(t, x) + u(t 2ε, x) = u(t ε, x ε) + u(t ε, x + ε) (1.63) Expanding with 2-D Taylor s eries Then we can replace each term with a full Taylor s expansion around the point (t, x): u + ( ) u 2εu (1,0) + (2ε)2 u (2,0) + O{ε 3 } 2! + = (1.64) ( ) u εu (1,0) εu (0,1) + ε2 2! u(2,0) + ε2 2! u(0,2) + ε 2 u (1,1) + O{ε 3 } ( ) u εu (1,0) + εu (0,1) + ε2 2! u(2,0) + ε2 2! u(0,2) ε 2 u (1,1) + O{ε 3 } where O{ε 3 } are terms of order ε 3 or higher. Canceling and gathering terms, this reduces to ε 2 u (2,0) = ε 2 u (0,2) + O{ε 3 } (1.65) Letting the Grid ize hrink Dividing through by ε 2, u (2,0) = u (0,2) + O{ε3 } ε 2 (1.66) and taking the limit as ε 0, we arrive at the standard 1-D wave equation, u (2,0) = c 2 u (0,2) (1.67) where the wave speed c = 1.

35 CHAPTER 1. TRAVELING WAVE WARM-UP Transforming the Waveguide Difference cheme A Frequency Domain Approach We wish now to arrive at the discrete traveling-wave solution by solving the difference scheme directly. To begin, we take the discrete Fourier transform of the infinite spatial series (DFTI) in the difference equation mapping v m (n) DF T I v ξ (n) (1.68) where ξ is the spatial frequency variable and v ξ (n) are a time sequence of spatial transforms. v ξ (n) + v ξ (n 2) = v ξ (n 1)e jξ + v ξ (n 1)e jξ (1.69) = 2v ξ (n 1) cos ξ (1.70) This is just a second-order difference equation in n of the indexed spatial transforms, which may be solved easily by taking the Z-transform over n, and applying the shift theorems which map y(n 1) y(n 2) Z z 1 Y (z) + y( 1) (1.71) Z z 2 Y (z) + z 1 y( 1) + y( 2) (1.72) We get, [ ] [ ] V ξ (z) + v ξ ( 2) + z 1 v ξ ( 1) + z 2 V ξ (z) = 2 cos ξ v ξ ( 1) + z 1 V ξ (z) (1.73) where v ξ ( 1) and v ξ ( 2) are initial spatial spectrum conditions at times 1 and 2. olving for V ξ (z), V ξ (z) = 2v ξ( 1) cos ξ v ξ ( 2) z 1 v ξ ( 1) 1 2z 1 cos ξ + z 2 (1.74) The denominator may be factored into two complex-conjugate poles and we may make a

36 CHAPTER 1. TRAVELING WAVE WARM-UP 20 partial fraction expansion of V ξ (z) as follows, V ξ (z) = v + ξ 1 e jξ z 1 + v ξ 1 e jξ z 1 (1.75) where v + ξ and v ξ are some combination of the initial condition spatial spectra v ξ( 1) and v ξ ( 2) The Finite Difference as a econd-order ystem We may view 1.75 as a continuum of second-order digital filter systems which operate pointwise on space spectrum signals. The filter continuum is tuned according to the frequency ξ of the spatial spectrum bin on which it is working. Taking the inverse Z-transform we obtain an expression for the evolution of the spatial spectrum over time, v ξ (n) = v ξ + e jξn + vξ ejξn (1.76) Taking the inverse discrete time spatial Fourier transform we obtain a pure traveling-wave solution, v m (n) = v + (m n) + v (m + n) (1.77) Discrete pectral Amplification Factors Just as we did in the continuous time and space domain, we can define the digital spectral amplification factors as g ξ ± (T ) = e jξ, (1.78) representing the change in the spatial spectrum over one time sample. The magnitude of these factors is one, which means the implementation is lossless; there is no decay in the waveshape as time passes. The Wave peed The spatial phase shift, g ± ξ (T ) = ξ, (1.79) is the number of radians that a given spatial frequency, ξ, will advance in phase after a time interval of one sample. By analogy with the concept of phase advance in the time

37 CHAPTER 1. TRAVELING WAVE WARM-UP 21 domain, we compute the phase distance which a space wave travels in the time interval as, g ξ ± (T ) = ±1 (1.80) ξ The speed of wave travel is one space sample per time sample Von Neumann Analysis In effect, we have just compared the continuous-time spectral amplification factors (which revealed that all spatial frequencies traveled at speed c) with the discrete-time spectral amplification factors (which revealed that spatial frequencies traveled at 1 spatial sample per time sample) to conclude that the difference approximation modeled the behavior of the continuous equation exactly on the sampled grid for the case, c = 1. This approach is known as von Neumann analysis (trikwerda, 1989); it uses a variety of frequency transforms to compare the evolution over time of the spatial spectrum in the continuous time system to that in the discrete time system. Recall that to solve an ordinary linear differential equation, we may reduce the problem to a polynomial in s by taking the Laplace transform and replacing orders of derivatives with powers of s, then take a spatial transform of a partial differential equation with independent time and space variables to obtain an ordinary differential equation describing the evolution of spatial spectra over time. From here, we can check how the spatial spectrum evolves after a time delay of T seconds. The ratio of the spatial spectrum at time t + T to the spatial spectrum at time t is known as the spectral amplification factor. Also, recall that in the discrete case, to solve a time-indexed difference equation, we may reduce the problem to a polynomial in z 1 by taking the Z-transform and replacing samples of time delay in the index with powers of z 1. If we have a time- and space-indexed difference scheme approximation to compare with our partial differential equation, we may even perform a similar spectral evolution analysis in multiple dimensions. First, let s look at the more difficult 1-D situation where c A More General Difference for c 1 The digital waveguide filter structure implements a finite difference scheme where wave speed is c = 1. We consider now the a standard difference for the more general case.

38 CHAPTER 1. TRAVELING WAVE WARM-UP Deriving the General Difference The first derivative of a continuous function may be approximated by a first-order forward difference (trikwerda, 1989), f (x) f(x + x) f(x) x (1.81) A centered second-order difference approximation to the second derivative may be obtained by taking a first-order backward difference of the first-order forward difference, f (x) f (x) f (x x) x = f(x + x) 2f(x) + f(x x) x 2 (1.82) Now, in making a difference equation approximation to wave equation, 2 y t 2 = c2 2 y x 2 (1.83) we first make a time-space sampling of the continuous time-space solution as follows, u(n, m) = y(nt, mx) (1.84) where T is the time sampling interval, and X is the space sampling interval. We may then approximate the continuous wave equation with the following partial finite difference equation, where we have chosen a centered difference in space, and a backward difference in time: u(n, m) 2u(n 1, m) + u(n 2, m) = C 2 [u(n 1, m + 1) 2u(n 1, m) + u(n 1, m 1)] (1.85) where, C = ct X (1.86) Here, C is the normalized wave travel speed parameter given in units of spatial samples per time samples.

39 CHAPTER 1. TRAVELING WAVE WARM-UP pectral Analysis of the General Difference We wish to determine how closely this difference equation will simulate the behavior of the differential equation it approximates. There is predictably going to be numerical error introduced simply because of the space and time sampling. But it is less obvious how this approximation error affects the traveling-wave behavior of the system. To begin, we take the discrete Fourier transform on the infinite spatial series of the difference equation 1.85, mapping u(n, m) DF T I u ω (n) = m= u(n, m)e jωm (1.87) where ω is the spatial frequency variable lying in the range from π to π, and u ω (n) is a discrete time sequence of spatial transforms, giving ( u ω (n) 2u ω (n 1) + u ω (n 2) = C 2 u ω (n 1) e jω 2 + e jω) (1.88) Gathering terms, ( u ω (n) C 2 cos ω C 2) u ω (n 1) + u ω (n 2) = 0 (1.89) This is just a second-order difference equation in n of the indexed spatial transforms, which may be solved easily by taking the Z-transform over n (Ludeman, 1986), u ω (n) and applying the shift theorems, Z U ω (z) = u ω (n)z n (1.90) n=0 u ω (n 1) u ω (n 1) Z z 1 U ω (z) + u ω ( 1) (1.91) Z z 2 U ω (z) + z 1 u ω ( 1) + u ω ( 2) (1.92) to obtain ( U ω (z) C 2 cos ω C 2) [ ] z 1 U ω (z) + u ω ( 1) (1.93) [ ] + z 2 U ω (z) + z 1 u ω ( 1) + u ω ( 2) = 0 (1.94)

40 CHAPTER 1. TRAVELING WAVE WARM-UP 24 olving for U ω (z), U ω (z) = 2 ( 1 + C 2 cos ω C 2) u ω ( 1) u ω ( 2) u ω ( 1)z (1 + C 2 cos ω C 2 ) z 1 + z 2 (1.95) The econd-order ystem Equation 1.95 may be viewed as a continuum of second-order digital filters operating on spatial spectrum signals and tuned according to ω, the spatial frequency variable. Factoring the denominator of (1.95) into two poles at g ω ± = 1 + C 2 cos ω C 2 ± (1 + C 2 cos ω C 2 ) 2 1 (1.96) we may make a partial fraction expansion of (1.95) yielding the expression, U ω (z) = u + ω 1 g + ω z 1 + u ω 1 g ω z 1 (1.97) where u + ω and u ω are some combination of the initial condition spatial spectra u ω ( 1) and u ω ( 2). Noting that, a n Z 1 1 az 1, (1.98) we see the inverse Z-transform of Equation 1.97 leads to a discrete time series of spatial spectra, u ω (n) = u + ω (g + ω ) n + u ω (g ω ) n (1.99) Numerical Instability when c > 1 The g ω ±, as defined in 1.96, are now the spectral amplification factors for the finite difference equation First we may observe by inspection of Equation (1.96) that the magnitude of g ω ± may exceed 1 for certain values of ω if C is chosen greater than 1. C greater than 1 means that a spatial sampling interval, X, and time step, T, were chosen such that the wave speed, c, in the original partial differential equation corresponded to something greater that one spatial sample per time step. The von Neumann numerical stability analysis method (trikwerda, 1989) states that if the spectral amplification factors exceed 1 in magnitude (and are not otherwise dependent on the sampling grid size), then the difference equation can be numerically unstable. In fact, it is obvious from (1.99) that if

41 CHAPTER 1. TRAVELING WAVE WARM-UP 25 Figure 1.7: Magnitude of pectral Amplification Factor, g + ω the magnitudes of either g + ω or g ω are greater than 1, then as n gets large, the magnitude of the spatial spectrum u ω (n) is unbounded. Figure 1.7 illustrates how the spectral amplification factor magnitude, g ω +, exceeds 1 for some spatial frequencies for wave speeds greater than 1. Courant-Friedrichs-Lewy tability Condition for Hyperbolic Differences The Courant-Friedrichs-Lewy condition (Courant et al., 1956; trikwerda, 1989) states that a necessary condition for the convergence of an explicit finite difference scheme is that the domain of dependence of the discrete difference includes the domain of dependence of the differential equation in the limit as the size of the finite difference grid steps shrink to zero. In our finite difference, the domain of dependence is expanding out 1 sample spatially in each direction, per time sample. The domain of dependence of the wave equation with c = 1 is expanding outward at the rate of c in each direction. Defining λ = T/X, where T is the time sampling interval, and X is the spatial sampling interval, this condition states that, for explicit computational schemes for hyperbolic

42 CHAPTER 1. TRAVELING WAVE WARM-UP 26 difference equations to be numerically stable, it is necessary that cλ 1 (1.100) This condition simply states that a difference scheme cannot possibly propagate waves faster than the domain of dependence expands. Reformulating the standard finite difference equation (1.85) as an explicit computation scheme, that is, a scheme where a given point may be computed in terms of a finite sum of points in the past, u(n, m) = C 2 [u(n 1, m + 1) 2u(n 1, m) + u(n 1, m 1)] + 2u(n 1, m) u(n 2, m) (1.101) one can see that u(n, m) is dependent on the three spatial points between u(n 1, m 1) and u(n 1, m + 1) from the previous time step; and that those points are, in turn, dependent on the five spatial points between u(n 2, m 2) and u(n 2, m + 2) at the time step before that; and that, in general, there is a domain of dependence such that a point N time steps in the future can only be affected by grid points not more than N spatial steps away in either direction in the present time step (Courant et al., 1956). Hence, a wave speed greater that one spatial step per time step forces the difference scheme to predict the value at a point without the information it needs from outside its domain of dependence, which leads to numerical instability Dispersion Error when c < 1 If we assume C 1, then the expression 1 + C 2 cos ω C 2, which appears twice in (1.96), is always between 1 and 1. As a symbol manipulation convenience, we may define a new frequency variable ω = ω(ω) such that cos ω = 1 + C 2 cos ω C 2 (1.102) and make the change of variables in (1.96): g ω ± = 1 + C 2 cos ω C 2 ± (1 + C 2 cos ω C 2 ) 2 1 (1.103) = cos ω ± cos 2 ω 1 (1.104) = cos ω ± j sin ω (1.105)

43 CHAPTER 1. TRAVELING WAVE WARM-UP 27 = e ±j ω (1.106) In the special case where C = 1, we note that ω = ω and (1.99) may be written, u ω (n) = u + ω e jωn + u ω e jωn (1.107) We may perform an inverse discrete time spatial Fourier transform, applying the shift theorem, to obtain a pure traveling-wave expression, u(n, m) = u + (m n) + u (m + n) (1.108) This means that the standard second-order difference approximation of the wave equation computes an exact traveling-wave solution when C = ct/x = 1, up to the Nyquist frequency band limit imposed by the sampling intervals. Furthermore, values at any points in between on the time-space sampling grid may be reconstructed through band-limited interpolation. When C 1, there is dispersion error in the computation scheme. In general, the higher spatial frequencies begin to travel a little slower than the lower spatial frequencies. This may be seen through an analysis of the finite difference amplification factors. The spectral amplification factors are g ± ω = e ±j ω (1.109) = e ±j arccos(1+c2 cos ω C 2 ) (1.110) The magnitudes are evidently 1, so there is no loss in the system. However there is a spatial phase shift of ( g ω ± = arccos 1 + C 2 cos ω C 2) (1.111) This is the number of radians that a given spatial frequency, ω, will advance in phase in one time sample. We define the frequency dependent normalized wave speed, C(ω), as C(ω) = ± arccos ( 1 + C 2 cos ω C 2) wc (1.112) Figure 1.8 illustrates the dispersion error of traveling-wave speed for finite difference approximations for C less than 1.

44 CHAPTER 1. TRAVELING WAVE WARM-UP C = 1.0 C = 0.9 C = 0.8 C(ω) 0.8 C = π/4 π/2 3π/4 π ω Figure 1.8: Normalized Frequency-Dependent Traveling-Wave peed Digital Waveguide tructure Models Optimal Wave peed Note that subtracting 2v m (n 1) from both sides of the difference scheme derived in ection for the digital waveguide structure, v m (n) + v m (n 2) = v m 1 (n 1) + v m 1 (n 1) (1.113) leads to v m (n) 2v m (n 1) + v m (n 2) = (1.114) v m 1 (n 1) 2v m (n 1) + v m 1 (n 1) (1.115) This is the standard second-order difference approximation, backward in time, central in space, of the partial differential equation, 2 y t 2 = c2 2 y x 2 (1.116)

45 CHAPTER 1. TRAVELING WAVE WARM-UP 29 where the wave speed in the difference equation is C = ct/x = 1, one spatial sample per time sample, as specified by the digital waveguide structure. This demonstrates that the digital waveguide, which actually uses no computation to propagate the traveling waves (aside from updating the delay line pointers), is mathematically equivalent to the optimal finite difference approximation, in the Courant-Friedrichs- Lewy sense where C = ct/x = 1, of the ideal one-dimensional wave equation. Further, there is no numerical dispersion error, and the value at any non-integral space-time point may be reconstructed exactly, in a band-limited sense, through proper interpolation of time- and space-sampled digital signals. We will use a similar mathematical approach in Chapters 3 and 4 when analyzing the validity of complex spatial geometries for higher dimensional wave equations.

46 Chapter 2 Inharmonicity, Decay and Coupling 2.1 Effects of Internal Loss and tiffness on Traveling Waves To this point we have considered only the lossless ideal string. In all real strings there is some loss of energy. This loss may come from a variety of sources, such as viscous drag by the enveloping air or internal frictional loss. There is also loss and phase delay associated with yielding string terminations, which shall be considered separately in a later section. tiffness in real strings tends to cause a certain inharmonicity in the partials. When a string is stiff, it does not like to be bent into too tight a radius of curvature. High spatial frequency modal shapes on a string have a shorter period wavelength along the string than do lower modes, hence higher frequency shapes must, on average, bend the string into a tighter curvature. The stiffness in the string tends to produce a greater restoring force on the string for higher modes than for lower modes. The result of this is that higher modes tend to travel faster on a stiff string than do low modes, which means that they will travel the length of the loop, up the string and back down the string, in a shorter time. horter loop travel time means higher audible frequency The pectral Amplification Factors The introduction of loss and stiffness into the linear string equation modifies the travelingwave solution in two ways: (1) loss introduces an exponential decay into the traveling waves 30

47 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 31 z -N lossless traveling wave G(z) lumped attenuation H(z) phase correction Figure 2.1: Lumped Implementation of the Lossy Dispersive Traveling Wave in the direction of travel; (2) stiffness introduces a frequency dependence into the wave travel speed. As a result, waveshapes do not remain intact when they travel on a lossy stiff string. The spectral amplification factors for a general string with frequency-dependent loss and wave speed can be written as follows: g ± ( t) = e t/τ(ω) e ±jc(ω) t (2.1) where the frequency-dependent wave propagation speed is C(ω) and the frequency-dependent time constant of decay is τ(ω) Commuted ummary Filter Implementation In the linear waveguide string model, we may gather the distributed loss over an unobserved section of string and lump it together in a single loss filter. We can do this because of the commutative and associative properties of linear systems (Karjalainen et al., 1993; mith, 1993). imilarly, wave speed dispersion may be modeled by an appropriate summary allpass filter which corrects for the compound frequency-dependent phase delay in the same section of string (Karplus and trong, 1983). The frequency-dependent phase response of the allpass filter can simulate the frequency traveling-wave speed, C(ω). In effect, the loop length of the waveguide string model will seem longer or shorter to different frequencies due to phase adjustment; and this is equivalent to making the various frequencies travel faster or slower. Figure 2.1 illustrates the lumping together of loss into a single attenuation filter, G(z), and dispersion effects into an allpass filter, H(z).

48 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING tiffness in the Wave Equation The Bar Equation First, the extreme case of a stiff string is when it is so stiff it becomes a solid bar. The standard equation for wave propagation in a bar is given in (Morse and Ingard, 1968), 2 y(t, x) t 2 = a 2 4 y(t, x) x 4 (2.2) where we summarize physical stiffness and density factors in a 2. Transforming the Bar Equation Applying Fourier transform, we get the ordinary differential equation, Applying the Laplace transform, leads to 2 (y ω ) t 2 (t) = a 2 (jω) 4 y ω (t) (2.3) s 2 Y ω (s) sy ω (0) ẏ ω (0) = a 2 (jω) 4 Y ω (s) (2.4) olving for Y ω (s) and making a partial fraction expansion, we have Inverse Laplace transform to get Y ω (s) = sy ω(0) + ẏ ω (0) s 2 + a 2 ω 4 (2.5) y ω + = s + jaω 2 + yω s jaω 2 (2.6) y ω (t) = y + ω e jaω2t + y ω ejaω2 t (2.7) with spectral amplification factors g ± ω ( t) = e jaω2 t (2.8)

49 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 33 Traveling-wave speed on the bar is spatial-frequency-dependent, Allowed Frequencies on a Bar C(ω) = g ± ω ( t) ω t = aω (2.9) Allowed frequencies on a hinged, vibrating bar of length, L, and spatial-frequency-dependent traveling-wave speed, C(ω) = ±aω, can be computed as follows: Rigid terminations reflect and invert traveling waves, so round-trip traveling-wave length of the bar system is 2L. upported wave lengths, T n, of partial frequencies allowed on the terminated string are T n = 2L/n (2.10) where n = 1, 2,... are the partial frequency index numbers. patial frequencies associated with the partials would be ω n = 2π = nπ T n L With C(ω n ) = aω, the allowed partial frequencies, p(n) on the bar are computed as (2.11) p(n) = C(ω n) T n = ω nna 2L = πn2 a 2L 2 (2.12) which can be written, p(n) = n 2 p(1) (2.13) Allowed frequencies increase as the square of the partial number The tiff tring Equation omewhere between the ideal flexible string and the ideal bar, there is the stiff string, which has elements of both. The standard partial differential equation for wave propagation on a stiff string (Morse and Ingard, 1968) is given as where we summarize the stiffness term as a 2. 2 y t 2 = c2 2 y x 2 a2 4 y x 4 (2.14) Notice this equation just combines the spatial derivative terms from both the flexible string and the bar equations.

50 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 34 Transforming the tiff tring Equation Applying Fourier transform, we get the ordinary differential equation, Applying the Laplace transform, leads to 2 (y ω ) t 2 (t) = c 2 (jω) 2 y ω (t) a 2 (jω) 4 y ω (t) (2.15) s 2 Y ω (s) sy ω (0) ẏ ω (0) = c 2 (jω) 2 Y ω (s) a 2 (jω) 4 Y ω (s) (2.16) olving for Y ω (s) and making a partial fraction expansion, we have Y ω (s) = sy ω (0) + ẏ ω (0) s 2 + ω 2 (c 2 + a 2 ω 2 ) (2.17) = y ω + s jω c 2 + a 2 ω + yω 2 s + jω (2.18) c 2 + a 2 ω 2 Inverse Laplace transform to get, y ω (t) = y + ω e jωt c 2 +a 2 ω 2 + y ω ejωt c 2 +a 2 ω 2 (2.19) pectral amplification factors are, g ± ω ( t) = e jω t c 2 +a 2 ω 2 (2.20) Traveling-wave speed on the stiff string is spatial-frequency-dependent, C(ω) = g ± ω ( t) ω t = c 2 + a 2 ω 2 (2.21) Allowed Frequencies on a tiff tring Allowed frequencies on a rigidly terminated vibrating stiff string of length, L, and spatialfrequency-dependent traveling-wave speed, C(ω) = c 2 + a 2 ω 2, can be computed as follows: Rigid terminations reflect and invert traveling waves, so round-trip traveling-wave length of the stiff string system is 2L. upported wave lengths, T n, of partial frequencies

51 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 35 allowed on the terminated string are T n = 2L/n (2.22) where n = 1, 2,... are the partial frequency index numbers. patial frequencies associated with the partials would be ω n = 2π = nπ T n L (2.23) The allowed partial frequencies, p(n) on the stiff string are computed as p(n) = C(ω n) T n which can be expanded in a power series as = nc 1 + a2 n 2 π 2 2L c 2 L 2 (2.24) p(n) = C(ω n) T n = nc 2L (1 + βn2 +...) (2.25) Compare this with the allowed frequencies for the ideal flexible string, nc/(2l). Here, β is a small stiffness factor that stretches the distance between partials as the partial number increases. One function corresponding to the frequency separations between the partials at a certain partial number is the derivative of the hypothetical continuous function through the partial frequency points, We pick this concept up in a ection dp(n) dn = c 2L + cβ 4L n +... (2.26) A Piano tring Example Piano strings are well-known to exhibit inharmonicity due to stiffness, especially in the lower octaves. Figure 2.2 shows measured frequency peaks for an A0 piano string (the lowest string on most pianos). The first 50 or so partials are shown as dots. Gaps indicate partials were not present at a high enough amplitude for reliable measurement. Measurements were made from sound recordings in matlab using peak tracking methods similar to those described in (erra, 1997). The straight line indicates the expected partial

52 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 36 Figure 2.2: Measured Partials from an A0 Piano tring frequencies for all partials as perfect harmonic multiples of the fundamental frequency, 27.5Hz. The bending upward of the sequence of partial frequency points on the graph indicates that the partials are getting further and further apart. Much more detailed analysis and re-synthesis of piano string sounds has been undertaken in (Bensa, 2000). Figure 2.3 shows the frequency difference between adjacent partials. The data is somewhat quantized due to a peculiarity of the analysis technique; however, we can interpolate a line through the data points and note that the rate of increase in distances between the partials is approximately linear. This implies that the partial frequency number curve contains something close to a square term, as expected. Appendix C explores the nature of partial stretching in low piano strings, and describes a novel inharmonic FM-based synthesis method, first published in (Van Duyne, 1992) The More General Lossless Equation If we wish to derive a general differential equation for a an ideal lossless isotropic string with arbitrary stiffness, or rather, arbitrary wave travel speed, it is convenient to start in the Laplace/Fourier domain defining the spectral amplification factors. We wish the spectral amplification factors to reflect that the medium can support 1-D traveling waves in opposite directions which have a frequency-dependent speed of travel and which are

53 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 37 Figure 2.3: Measured Frequency Distance Between the A0 Partials symmetric in their speed with respect to direction. The wave travel in this medium may be described with a system, Y ω (s), which is characterized by two conjugate poles in the Laplace domain. The two poles correspond to the two traveling-wave directions, and their magnitudes should be 1 corresponding to lossless wave travel, and their phases correspond to wave speeds of the spatial frequency components. Let us assume we have a continuous differentiable function describing the wave propagation speed for each ω as C(ω). Thus we can write the spectral amplification factors for the desired partial differential equation as g ± ( t) = e ±jωc(ω) t (2.27) Not worrying about the initial conditions for this analysis, this corresponds to the secondorder system, Y ω (s) = = α + s jωc(ω) + α s + jωc(ω) (2.28) A(s) s 2 + ω 2 C(ω) 2 (2.29) ince C(ω) is an even real function with non-negative real values, we can re-write ω 2 C(w) 2

54 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 38 as a function of ω 2, defining Γ thus, Γ(η) = ηc( η) 2 (2.30) and make the substitution, Y ω (s) = A(s) s 2 + ω 2 C(ω) 2 = A(s) s 2 + Γ(ω 2 ) (2.31) or, s 2 Y ω (s) + Γ(ω 2 )Y ω (s) = A(s) (2.32) For now, let us assume Γ to be a well-behaved, continuous and differentiable function. We can then expand it in power series in ω 2 around zero to obtain, Γ(ω 2 ) = n=0 c n ω 2n 1 d n Γ η=0, c n = n! dη n (2.33) We can re-write Γ(ω 2 ) as sums of powers of (jω) 2 noting that ω 2n = ( 1) n (jω) 2n (2.34) and substitute everything back into 2.32 to get, [ ] s 2 Y ω (s) + ( 1) n (jω) 2n c n Y ω (s) = A(s) (2.35) n=0 Noting that A(s) was a first-order polynomial in s corresponding to the initial spatial spectral conditions, we can now inverse Laplace transform to the time domain, and inverse Fourier transform to the space dimension to obtain the general differential equation 2 y t 2 + n=0 ( 1) n (2n) y c n = 0 (2.36) x (2n) This is an equation whose solutions are a sum of spatial frequency waves which travel in left and right directions at the same rate of speed, and at only one speed for each spatial frequency. The wave speed dispersion comes from the even space derivatives. The

55 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 39 reason that there may only be even-ordered partial space derivatives is that the frequencydependent decay rates and wave speed functions are even with respect to positive and negative values of ω. This means that phase of the roots of the characteristic polynomial in 2.31 are the same for positive and negative frequencies. Hence, speed of travel and decay rates are the same for left and right going waves. 2.3 Modeling tiffness in the Digital Waveguide Delay lines do not have stiffness: all the frequencies of a signal travel at exactly the same rate of speed in a delay line, precisely one spatial sample per time sample. But there are filters which can modify the phase delay of a signal in a frequency-dependent way without affecting the signal s magnitude spectrum. These are known as allpass filters. All frequencies pass through these filters without modification of their magnitudes, however their phases may be modified. Technically, a delay line is a kind of allpass filter: it modifies the phase of the input signal in such a way that all frequencies are delayed by exactly the same number of samples. In order to simulate the behavior of stiff strings, however, we must create the effect of higher frequency modes traveling faster than lower frequency modes Introducing tiffness with Allpass Filters By a fortunate coincidence, a set of cascaded first-order allpass filters will produce the qualitatively correct kind of stiffness effects, and can be controlled by a single parameter. We will show that the effect on inharmonicity of cascaded first-order allpasses embedded in a feedback delay loop is qualitatively similar to the effect of real stiffness on real strings. That is, the general way in which partials of a real stiff string stretch apart and get more and more out of tune as one progresses up the spectrum, is qualitatively similar to the way in which the modes of a delay line loop will stretch apart in the presence of cascaded allpass filters. First-order allpass filters, in their less severe ranges of operation, have long been used for fractional tuning, as was discussed in Chapter 1. The use of allpass filtering to introduce dispersion into feedback delay loops has been known for some time (Jaffe and mith, 1983). tiff string sounds have been generated with excellent results, (Paladin and Rocchesso, 1992) on the MAR workstation in real time using a group delay based

56 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 40 analysis approach to the stiff string equation, and using one of the allpass filter design methods in the literature such as that proposed by (Yegnanarayana, 1982) to find allpass filter coefficients for a desired group delay response. However, the order of allpass filters found by these methods can become large, requiring a fair amount of computation; and finding the coefficients requires a sophisticated filter design algorithm. A simplified approach to the filter design is described here, first published in (Van Duyne and mith, 1994). It is based on building up stiffness modeling allpass filters out of firstorder blocks. These filters are designed to be multiply free when implemented directly in hardware by virtue of choosing a coefficient which may be computed with a binary shift and at most one add. Alternatively, when number of multiplies is not a concern, amount of stiffness in a string model may be controlled in real time by a single filter coefficient. More recently, the idea of cascaded first-order allpass to model stiffness, which is described in the following paragraphs, has been extended in (Rauhala and Välimäki, 2006) by identifying and applying a closed-form expression to determine the filter coefficients based on a tunable dispersion filter design method. In addition, a novel allpass design method is described in (Abel and mith, 2006) where, to match a given high-order group delay response curve, the frequency axis is broken up into sections containing 2π total area under the desired group delay curve, and a pole zero allpass pair is assigned to each Rate of tretching in the Partials of tiff trings We first consider the the qualitative way in which partials are detuned on a stiff string. In the ideal flexible, i. e., non-stiff, string, the modes are harmonically related. We can say, p(n) = np(1) (2.37) where p(1) is the fundamental frequency of the string, n is the harmonic number, and p(n) is the frequency of the n th harmonic. For the stiff string, however, higher spatial frequencies travel faster than lower spatial frequencies, causing the higher partials to become farther apart than the lower. The partial frequencies may be approximated as, ( p(n) n α + βn 2) (2.38) (Morse and Ingard, 1968), where β is a small inharmonicity factor, and the fundamental frequency is p(1) = α + β. As n gets large, and higher order terms come into play,

57 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING (p 0 ) kHz 20kHz p 0 Figure 2.4: Rate of tretching for Hypothetical A0 this approximation breaks down. From Equation (2.38), we can say that the frequency separation between the partials, (p 0 ), at some point in the spectrum, p 0, is approximately, (p 0 ) = p(n 0 +.5) p(n 0.5) p (n 0 ) (2.39) where p 0 = p(n0 ). We defined p (n) = dp/dn in an earlier section, however it is a function of partial number, n. In the following analysis we will need the rate of stretching to be a function of the partial frequency, which is a slightly warped version of this function. The rate at which the partial frequency separation changes per unit of spectrum height, i. e., the rate of stretching at a given spectral frequency, p 0, may be defined as the derivative of with respect to p 0. Using the chain rule, we have, (p 0 ) = d dp 0 = ( )( ) d dn0 dn 0 dp 0 = p (n 0 ) p (n 0 ) (2.40) Figure 2.4 shows a plot of the rate of stretching,, for a hypothetical low A0 piano string with a reasonable inharmonicity factor of β =.001 assumed, and partial frequencies defined as, ( p A0 (n) = n n 2) (2.41) If the value of were constant at.01, the separation between adjacent partials would

58 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 42 + z N H M Figure 2.5: Dispersive Delay Loop ystem increase at the rate of 10Hz per khz of spectrum. At the fundamental, the partials would be about 27.5Hz apart; at 1000Hz they would be about 37.5Hz apart, and so on. Actually, the plot shows that the rate of stretching is not flat. Rather, it ramps up from zero (rate of zero meaning the partials are exactly harmonic), reaches a maximum, and drops slowly as we get higher into the spectrum. It is this qualitative shape of the rate of stretching curve which leads us to model dispersion in stiff strings with cascaded one-pole allpass filters Rate of tretching in the Modes of a Delay Loop with Cascaded One-Pole Allpass Filters A resonant loop consisting of a length N delay line and a block of M cascaded one-pole allpass filters is shown in Figure 2.5. The transfer function one time around the loop is, L(z) = z N H(z) M (2.42) We compute the phase response of L to be, θ(ωt ) = L(e jωt ) = NωT + Mφ(ωT ) (2.43) For frequency ω k T to be supported on this loop, θ(ω k T ) must equal k2π, for some positive integer k. In fact, k = 1 implies ω k T is the fundamental, k = 2 implies ω k T is the second partial, and so forth. Figure 2.6 compares the supported modes for a loop of the form z (N+M) with a loop of the form z N H(z) M, where N = 8, M = 1, and a 0 = 0.8. The ω i T are the harmonics of the pure delay loop, and the ˆω i T are the inharmonic partials of the delay plus allpass loop. Comparing the ˆω i T with the ω i T, it seems clear that ˆω 1 T is less than ω 1 T, that the spacing between ˆω 1 T and ˆω 2 T is about the same as that between ω 1 T and ω 2 T, and that

59 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING ^ω 1 T ^ω ω 1 T 2 T ω^ ω 2 T 3 T ω^ 4 T ω 3 T ω 4 T π θ(ωτ) 2π 4π 6π 8π Figure 2.6: Modes on z N H(z) vs. Modes on z (N+1) the spacing between ˆω 2 T and ˆω 3 T is greater than that between ω 2 T and ω 3 T. This means that the ˆω i T are stretching partials. In general, the choice of a 0 negative will produce a stretching in the resonant modes of the loop. The more negative it is, the more the stretching will be, at least in the lower frequency range. We can make a qualitative comparison between the kind of stretching in the delay line loop with that found in stiff strings by computing a rate of stretching function for the digital loop. We derive θ (ω k T ) = 2π/θ (ω k T ) to be the separation between partials on the loop at a particular point in the normalized frequency spectrum, ω k T, where ω k is the k th partial frequency in radians per second. The rate of partial stretching per unit of spectrum on the digital loop is the derivative of θ with respect to ω k T, θ (ω k T ) = 2π θ (ω k T ) θ (ω k T ) 2 (2.44) Figure 2.7 shows a plot of θ for the delay line loop system shown in Figure 2.5 with delay line length,n = 8, number of first-order allpass filters, M = 1, and allpass coefficient, a 0 = Comparing the physical rate of stretching,, in Figure 2.4 with the digital loop rate of stretching, θ, one can see a qualitative correspondence: each plot

60 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING θ (ω k T) π/2 π ω k T Figure 2.7: tretching of Partials on a Delay Loop ramps up from zero, reaches a maximum, then falls off. If we choose N, M, and a 0 well, we can approximate partials of a real stiff string. 2.4 Internal Loss in the Wave Equation Physically Valid Forms of the 1-D Isotropic Wave Equation If we desire to express the general differential equation for a an ideal isotropic string with arbitrary stiffness and loss, it is convenient to start in the Laplace/Fourier domain defining the spectral amplification factors. We wish the spectral amplification factors to reflect the idea that the medium can support 1-D traveling waves in opposite directions which have a frequency-dependent decay time and a frequency-dependent speed of travel, and which are symmetric in their speed and decay rates with respect to directions. The wave travel in this medium may be described with a system, Y ω (s), which is characterized by two damped conjugate poles in the Laplace domain. The two poles correspond to the two traveling-wave directions, and their magnitudes and phases correspond to the decay rates and wave speeds of the spatial frequency components. Let us assume we have continuous differentiable functions describing the time constants of decay for each ω as τ(ω) and the wave propagation speed for each ω as C(ω). Thus we

61 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 45 can write the spectral amplification factors for the desired partial differential equation as g ± ( t) = e t/τ(ω) e ±jωc(ω) t = e t[ 1/τ(ω)±jωC(ω)] (2.45) Not worrying about the initial conditions for this analysis, this corresponds to the two pole system, Y ω (s) = = α + α [ ] s 1 τ(ω) jωc(ω) + [ ] s 1 τ(ω) + jωc(ω) (2.46) A(s) [ ] [ ] s τ(ω) s + τ(ω) + ω 2 C(ω) 2 2 (2.47) ince C(ω) and τ(ω) are even functions with non-negative real values, we can define B(η) Γ(η) = 2/τ( η) (2.48) = 1/τ( η) 2 + ηc( η) 2 (2.49) and make the substitution, Y ω (s) = A(s) s 2 + B(ω 2 )s + Γ(ω 2 ) (2.50) or, s 2 Y ω (s) + B(ω 2 )sy ω (s) + Γ(ω 2 )Y ω (s) = A(s) (2.51) For now, let us assume B and Γ to be well-behaved, continuous and differentiable functions. We can then expand them in power series in ω 2 around zero to obtain, B(ω 2 ) = Γ(ω 2 ) = n=0 n=0 b n ω 2n 1 d n B η=0, b n = n! dη n (2.52) c n ω 2n 1 d n Γ η=0, c n = n! dη n (2.53) We can re-write B(ω 2 ) and Γ(ω 2 ) as sums of powers of (jω) 2 noting that ω 2n = ( 1) n (jω) 2n (2.54)

62 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 46 and substitute everything back into 2.51 to get, [ ] [ s 2 ] Y ω (s) + ( 1) n (jω) 2n b n sy ω (s) + ( 1) n (jω) 2n c n Y ω (s) = A(s) (2.55) n=0 n=0 Noting that A(s) was a first-order polynomial in s corresponding to the initial spatial spectral conditions, we can now inverse Laplace transform to the time domain, and inverse Fourier transform to the space dimension to obtain the general differential equation 2 y t 2 + n=0 ( 1) n b n (2n+1) y t x (2n) + n=0 ( 1) n (2n) y c n = 0 (2.56) x (2n) This is an equation whose solutions are a sum of spatial frequency waves which travel in left and right directions at the same rate of speed, and at only one speed for each spatial frequency. The wave speed dispersion comes from the even space derivatives, and the damping comes from the mixed first time derivative and even-ordered space derivatives. The reason that there may only be even-ordered partial space derivatives is that the frequency-dependent decay rates and wave speed functions are even with respect to positive and negative values of ω. This means that phase and damping of the roots of the characteristic polynomial in Equation (2.50) are the same for positive and negative frequencies. Hence, speed of travel and decay rates are the same for left and right going waves. It is also essential the there are no higher-order derivatives of s, since, for example, if a third-order time derivative were present, resulting in an s 3 term in the denominator of Equation (2.50), then we would have three roots, one of which must be real and, therefore, non-traveling. If there were a fourth-order time derivative in the wave equation (2.56), there would be an s 4 term in (2.50) resulting in possibly two pairs of conjugate roots, corresponding to potentially two sets of traveling waves at the same spatial frequency but traveling at different speeds. The differential equation (2.56) is the anatomically correct class of wave equations we can model with bidirectional delay lines and allpass filters and low pass filters to model stiffness and loss.

63 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 47 Understanding Morse s Lossy tring Equation In an earlier section, we presented the stiff string equation taken from (Morse and Ingard, 1968). It contained second and fourth order spatial derivatives. This is consistent with our general wave equation (2.56). However, the lossy string equation provided in (Morse and Ingard, 1968) is puzzling at first: ɛ 2 y t 2 = T 2 y x 2 R(ω) y t (2.57) ɛ is density per unit length, T is tension, and R(ω) represents the effective frictional resistance per unit length. What does it mean to have R(ω) a function in the frequency domain, mixed into the partial differential equation in x and y? In fact, we need to view R(ω) as a differential operator on the first partial time derivative, rather than a function of ω multiplied pointwise by the first time derivative. Thus, R(ω) y x R ω { } y x = ɛ n=0 ( 1) n b n (2n+1) y t x (2n) (2.58) In other words, Morse s R(ω) frictional resistance term has to be incorporated into the equation in the frequency domain, and then expanded back out to the time domain. Another minor detail to keep in mind is that the loss profile impacts the coefficients on the stiffness-related partial derivatives as well, as we saw above Parameterizing the Wave Equation from Measured Data Till now we have assumed that the decay rate and wave speed functions have been ideal continuous differentiable functions. In practice, we may be able to measure actual data points for decay rate and wave speed at a certain spatial frequency, deduced from string length, pitch of the vibrating string s partial frequency, and measured rate of decay in audio amplitude. Hence, if we actually know only τ(ω k ) and C(ω k ) for several data points, ω k for k = 1, 2, 3,..., then we can compute B(ωk 2) and Γ(ω2 k ) from Equations (2.48) and (2.49) and then fit a k th order polynomial through the points, reducing the infinite series of high even order spatial derivative terms in Equation (2.56) to a finite set of high-order terms.

64 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING Loss and Dispersion at the Termination Lumped Impedance Impedance is some measure of how a physical system reacts to stimulus. It is defined as the complex ratio of the force applied to the resultant velocity of a system. It is most sensibly defined in the Laplace frequency domain. R(s) = F (s)/v (s) (2.59) where F and V are the Laplace transforms of force and velocity, respectively, R(s) is the impedance ratio, and s is the Laplace frequency variable. Replacing s with jω gives the frequency response of the system. The magnitude part of R(jω) tells us the magnitude ratio between force and velocity at some particular frequency ω, and the phase part tells us the phase difference between force and velocity oscillations at that frequency. For example, an oscillating mass and spring system will have a zero impedance when driven at the mass end at its resonant frequency, as it is very content to oscillate at that frequency. When driven at other frequencies, it has a non-zero impedance. On the other hand, a purely damped, non-reactive linear system, such as a dashpot or an electrical resistor, has a constant real impedance (Cruz and Van Valkenburg, 1974), which means force is in phase with velocity (or voltage is in phase with current) and there is no frequency dependence on the ratio of force and velocity magnitudes Force Waves, Velocity Waves, and Wave Impedance A variety of physical variables of the string may be expressed as the sum of traveling waves in addition to displacement. We will be particularly interested in force and velocity waves. Transverse velocity waves may be defined by taking the partial derivative of (1.4) with respect to time. v(t, x) = y t = cẏ+ (x ct) + cẏ (x + ct) = v + + v, (2.60) where ẏ + and ẏ are the first derivatives of y + and y, respectively. imilarly, we may define transverse force waves by noting that the force which the left portion of the string exerts on the right portion across a point on the string is approximated

65 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 49 Wave Impedance R 0 f r f l k Figure 2.8: tring Terminated by imple pring for small displacements by, f(t, x) = K y x = Kẏ+ (x ct) Kẏ (x + ct) = f + + f (2.61) Combining (2.60) and (2.61), we find a wave impedance relationship between the traveling components of force and velocity in the string which can be written, f + = R 0 v + and f = R 0 v (2.62) where the wave impedance is defined as R 0 = K/c = Kɛ. This relationship corresponds to the wave impedance relation between pressure and flow in acoustic tubes, or between voltage and current in electrical transmission lines (Magnusson, 1970) Terminating a tring at a Lumped Impedance When a string is terminated perfectly rigidly, traveling waves reflect off the termination and head back the other way without modification, with the exception of possible sign inversion: velocity and displacement waves reflect with sign inversion, while force waves reflect without sign inversion. However, there are many ways to terminate a string. Figure 2.8 shows, for example, the ideal case of a string terminated by a pure lossless spring. The more likely case in the real world is that a string is terminated at some nearly rigid bridge which has some resistive damping, some springiness and some mass. The result is that a given sinusoidal component of a traveling wave is reflected off the yielding termination with some damping and some phase modification. It is useful to formulate lumped

66 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 50 systems such as a simple linear string termination in terms of their driving point impedance. Impedance is the complex ratio of force and velocity in the Laplace transform frequency domain. At the string termination, we have, R b (s) = F (s) V (s), (2.63) where R b (s) is the driving point impedance function of the string termination ( b for bridge ), and F and V are the Laplace transforms of driving point force and velocity. For example in the spring termination shown in Figure 2.8, R b (s) = k/s, where k is the spring stiffness constant, and s is the Laplace frequency variable. Using definitions of force and velocity waves on the string, (2.60) and (2.61), and the wave impedance relation, (2.62), we may derive a force wave transfer function at the string termination: The Bilinear Transform F (s) = R b (s)v (s) (2.64) F + (s) + F (s) = R b (s) F + (s) F (s) R 0 (2.65) F (s) = R b(s) R 0 R b (s) + R 0 F + (s) (2.66) To move from the continuous physical system to the discrete digital filter, we use the conformal bilinear transform from the s-plane to the z-plane, s α 1 z z 1 (2.67) The bilinear transform maps DC in the continuous system to DC in the digital system, while mapping infinite frequency in the continuous system to half the sampling rate, or the Nyquist frequency, in the digital system (Nehari, 1952). The parameter α is a degree of freedom which may be used to control the frequency warping. It is usual to choose α = 2/T to obtain faithful frequency response at the low end of the frequency range. We apply the bilinear transform to Equation (2.66) to obtain, F (z) = H b (z)f + (z) (2.68)

67 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 51 R 0 m 3 R 0 R 0 m 1. k 3 k 5 m 4 R 0. k 1 M = 1 k 2 M = 2 m 2 k 4 M = 3 k 6 M = 4 Figure 2.9: Mass/pring Chain tring Terminations In the spring termination case, H b (z) = a 0 + z a 0 z 1 and a 0 = k αr 0 k + αr 0 (2.69) Interpreting tiffness Allpasses as a Termination Impedance In ection 2.3, we introduced cascaded allpass filters into the delay line loop to create the effects of stiffness in the medium, which results in higher spatial frequencies traveling at slightly higher speeds. It is of some interest to reverse engineer the process, to find out what equivalent lumped impedance termination fo the string would produce a similar impact on an ideal flexible string. A delay line loop with a one pole allpass filter in it may be interpreted as an ideal string terminated with an ideal spring, as is shown in Figure 2.9 for the M = 1 case. The loop computes traveling force waves, where the allpass filter is a transfer function from the right going force wave, F +, to the left going force wave, F, at the spring termination. Given an arbitrary termination impedance, F (s)/v (s) = R(s), the force wave transfer function is, F F + = R(s) R 0 R(s) + R 0 (2.70)

68 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 52 where R 0 is the wave impedance of the string, which is the geometric mean of its tension and mass density. When two transfer functions corresponding to two termination impedances, R 1 (s) and R 2 (s), are cascaded in the loop, we find, where, F F + = ( )( ) R1 (s) R 0 R2 (s) R 0 R 1 (s) + R 0 R 2 (s) + R 0 F V = R(s) = R 1(s)R 2 (s) + R 0 R 1 (s) + R 2 (s) = R(s) R 0 R(s) + R 0 (2.71) 2 (2.72) Hence, comparing Equations (2.70) and (2.72), we see that the physical termination impedance actually modeled by the two cascaded wave transfer functions is R(s). We learned in an earlier section that the wave transfer function for a spring termination corresponded to a first-order allpass function. If we then cascade two equal allpass functions, corresponding to wave transfer functions in the Laplace domain, R 1 (s) = R 2 (s) = k/s, we can compute the implied termination impedance as R(s) = (k/s)2 + R 0 2 2(k/s) = k/2 s + R 0 2k s (2.73) This is just a mass-spring system, where the spring stiffness coefficient is k/2 and the mass is m = R 0 /2k. Using a similar analysis procedure, we may derive the physical string termination impedances for the cascaded digital allpass filters, H M, described earlier. H 1 k 1 /s (2.74) H 2 m 1 s + k 2 /s (2.75) H 3 (k 3 /s) (m 2 s + k 4 /s) (2.76) H 4 m 3 s + ((k 5 /s) (m 4 s + k 6 /s)) (2.77) where a b = ab/(a + b) is a parallel connection of two elements, and all the spring stiffness constants, k i, and masses, m i, are dependent on k 1 and the string wave impedance, R 0. The physical meanings of these termination impedances are illustrated in Figure 2.9. We conclude that a delay loop with cascaded one pole allpass filters corresponds to a distributed transmission line string model extended by a non-uniform lumped transmission

69 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 53 z -N/2 H G T 1 T 2 G H z -N/2 Figure 2.10: Waveguide tring Loop Model Including Loss, Dispersion, and Yielding Terminations line model of chained masses and springs. 2.6 Calibrating the Digital Waveguide tring Model The ummarized Loop Model The lossy, stiff string may be modeled as a digital waveguide with termination filters, internal string loss filters and allpass filters modeling dispersion as shown in Figure In the Figure, z N/2 represents the basic delay time in in samples for a wave to travel from one end of the string to the other; H represents the allpass modification to this length correcting for dispersion in wave speed due to stiffness; G is a low pass filter representing total energy loss in the traveling wave as it goes from one end of the string to the other; and T 1 and T 2 represent digital wave transfer functions corresponding to yielding terminations. These termination filters may contain a loss part due to damping and a phase modifying part due to the reactive elements such as springiness in the terminations. To understand the simplified model, note that a traveling wave, as it makes its way one complete cycle around the loop in Figure 2.10 sees a total closed loop transfer function of, L total (z) = z N/2 H(z)G(z)T 1 (z)z N/2 H(z)G(z)T 2 (z) (2.78) This may be commuted and refactored into a delay part, a loss part represented by a lowpass filter, LP (z) and a phase dispersion part represented by an allpass filter, AP (z). L total (z) = z N LP (z)ap (z) (2.79)

70 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 54 z -N LP(z) AP(z) Figure 2.11: implified tring Loop This simplified formulation is shown in Figure The problem of model calibration is now reduced to choosing a delay length, N, and coefficients for the allpass filter AP (z) to tune the string partials, and designing a lowpass filter, LP (z), which gives the correct overall exponential decay rates of each partial per loop period Calibration Approach The actual per period rate of attenuation of this simple string model is determined by the magnitude response of of the low pass filter in the delay loop. The more severe the roll-off of the filter over the frequency spectrum, the faster the high frequencies in the loop will decay compared with the low frequencies. Calibration schemes for the delay line loop models of strings are generally based on measuring the decay rates of the individual partials of a real string, and then fitting a filter magnitude response curve through those data points. One approach to calibrating a physics based digital waveguide model is to make the appropriate physical measurements of material properties of the string, namely string tension and mass density per unit length; to estimate loss from viscous drag in the air we must know the diameter; to estimate internal damping we must determine the complex Young s modulus of the string material; to estimate the wave speed dispersion in a stiff string, we must determine in addition the radius of gyration which is dependent on the strain in the string material as it is distributed over the cross-sectional area of the string. To estimate the termination transfer functions, we must first come up with an impedance function for the terminations, which may be done either by imagining a lumped system mechanism for

71 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 55 the termination behavior and computing parameters from information about the materials somehow, or by collecting force response data from measurements taken directly from the instrumented terminations, and then performing system identification on the data to obtain a lumped impedance model which can then be mapped to the digital domain and converted into wave transfer functions. This is too hard, and fraught with opportunity for error. For our modeling purposes, we ultimately only care about what it sounds like, so we can use a simpler more direct calibration approach. The goal of this present work is, not so much to study the details of the physics of musical instruments, but instead to develop an efficient audio synthesis model which produces sounds which are psychoacoustically indistinguishable from the real thing. To this end, a simplified model is proposed which may be directly calibrated from recorded sound data, without concern about where exactly the system loss and dispersion is coming from, only what the net effect of all the physical considerations is. Presentation of techniques and theory for this system identification problem can be found here and there in the literature. ystem identification techniques applied to the bowed string are found in (mith, 1983). Methods for loop estimation in plucked string and guitar sounds are described in (Karjalainen et al., 1993). Calibration of the coupling filter in coupled piano strings is addressed in (Van Duyne and mith, 1995b). A calibration method for stiffness in strings is published in (Van Duyne and mith, 1994). A method to calculate the coupling filter from measured decay rates for a wave-decomposed coupled oscillator system is described in (Van Duyne, 1997). ome clues to the inner workings of the Korg OAY synthesizer calibration methods were brought to light during presentation of (Leary, 1996) and taccato ystems revealed some of their physical model calibration techniques while demonstrating (Porcaro et al., 1996) Obtaining the Data Directly from an Audio Recording For our modeling purposes, we require the exact frequencies of the resonant modes on the string to design the delay loop length and the allpass filter coefficients; and we require the exponential decay rates of each of the partials in order to design the lowpass loop gain filter. We can obtain data in this form from a recorded string sound using short time Fourier analysis and a peak tracking algorithm. Essentially, we may take a representative clip of the recorded string sound and break it up into sequential time frames separated by M seconds. We may then perform a peak extraction procedure to identify the frequency

72 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 56 and magnitude of the partials present in each frame. In general, for a simple linear string we should expect the partial frequencies in each frame to be the same, or very close. These partial frequencies may be called, p(n), where n is the partial number, p(1) being the fundamental frequency, p(2) being the first overtone, i. e., second partial, and so on. Further, we may track the magnitude evolution of these partial frequencies across the frames in order to obtain amplitude trajectory envelopes for each of the partials, in the form A n (mm), where n refers to the n th partial frequency, m is the m th analysis frame index, mm is the time index of the m th frame in seconds, and A n (mm) is the measured amplitude of the n th partial at time mm. In this way, we obtain a set of partial frequencies on the string, p(n) and their amplitude decay trajectories over time, A n (mm). Fundamental work in this field is reported in (erra, 1997). We can fully identify the salient audible parameters needed for calibrating a simple stiff string model, without resorting to any physical measurements, or calculations Calibrating Loop tiffness from Recorded Data As noted earlier, new methods of modeling and calibrating dispersion in piano strings have been described in (Bensa, 2000; Rauhala and Välimäki, 2006; Abel and mith, 2006). We turn now to the present task of parameterizing the cascaded allpass model of string stiffness presented in ection 2.3. To design a resonant loop of the form z N H M, we must find a good a 0, M, and N. We present two parameter optimizing methods. First Optimization Method This first method is appropriate for implementation in hardware where multiply operations are costly to implement in silicon. We reduce the field of search by requiring that the filter coefficient, a 0, be a power of 2, or 1 minus a power of 2, so that the multiply may be implemented efficiently in hardware as a binary shift plus at most one addition. Coefficients closer to zero provide the most even stretching of partials, but the number of allpasses needed will be greater; whereas, coefficients closer to 1 will necessitate less filters in the loop, but the effect will be biased in favor of stretching at the lower frequencies. We can eliminate N as a variable by requiring that one of the partial frequencies on the

73 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING n θ (n) - n M = 0 M = 1 M = 2 M = 3 M = 4 M = 5-1 Figure 2.12: First Allpass Parameterization Optimization Method n loop be held constant. The necessary value for N may be computed as, N = 2πn 0 + Mφ(2πp(n 0 )T ) 2πp(n 0 )T (2.80) Choosing n 0 = 1 holds the fundamental fixed. In the case of missing data, or in the case of very low piano strings, where the perceived pitch is more a function of the partials an octave or two above the fundamental, it may be desirable to hold some other partial fixed. Assume that we have a set of partial frequency measurements, p i = p(n i ), for a set of partial indices, n i. Given a 0, we can compute the apparent partial number, n θ (n i ), on the delay line loop for each of the measured partial frequencies, p(n i ), n θ (n i ) = θ(2πp(n i )T )/( 2π) (2.81) and compare it to the actual partial number for that frequency, n i. If the digital loop is a perfect match for the data, then n θ (n i ) will equal n i. If not, we can nonetheless minimize a least sum of squares error function, ε(m) = i (n θ (n i ) n i ) 2 (2.82)

74 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 58 Figure 2.13: Parallel Computation tructure for Cascaded Allpasses As an example, we measured the first 22 partial frequencies of a recorded E2 piano tone. Choosing a 0 =.75, we obtained the best fit parameters, M = 2 and N = 255. Figure 2.12 plots the difference between the apparent partial index on the digital loop, n θ (n i ), and the actual partial index for each of the measured partial frequencies, n i, for values of M from 0 (no allpass filters) to 5 (five allpass filters). It is fairly clear from the figure that M = 2 is a good choice. That is, we need only two allpass filters, with coefficient a 0 =.75. Note that M = 1 would be a good choice if we only cared about the accuracy of the first 10 or 15 modes. This becomes a psychoacoustical level of detail trade-off problem. If we choose a more relaxed allpass coefficient, a 0 =.5, and perform a similar analysis, we arrive at an optimal combination of N = 221 and M = 16. For practical purposes, using the a 0 = 0.75, M = 2 choice will be a lot less computation. On the other hand, if implementation in silicon is planned, the 16 allpass filters can be arranged in parallel bucket brigade alternation by reformulating z 221 H 16 as z 205 ( z 1 H ) 16, thereby double buffering the allpass filters as shown in Figure This means all the filters can be computed in parallel. econd Optimization Method In an implementation where multiplies are not costly to compute, such as on a standard DP for example, but, on the other hand, where the number of allpass filters used, M, is limited by available program memory and computational speed requirements, we may modify the optimization procedure accordingly: In this case, we may let M be constant (chosen as large as possible within the hardware constraints) and choose the optimal a 0 and N to fit the partial frequency data. It is most efficient to investigate the error in the modeled partials resulting form various

75 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 59 choices of N (delay line length), when, for each N we choose a corresponding a 0 which fixes some desired partial (usually the fundamental) to be exactly in tune. We can then obtain a least squares error function dependent on N instead of M, where n θ is dependent on a 0 which depends on N: ε(n) = i (n θ (n i ) n i ) 2 (2.83) Given a constant M, and a choice of N, the correct a 0 which holds the k th partial fixed in tune on the loop is: where, a 0 (N) = κ srqt(κ2 + 1) sin 2 2πp(n 0 )T κ cos 2πp(n 0 )T sin 2πp(n 0 )T κ = tan N2πp(n 0)T k2π M (2.84) (2.85) Choosing the Right N A practical approach in determining the best value of N, delay line length, is to choose a first guess as N = IntegerP art(samplingrate/theoreticalf undamental) M; (2.86) This is the natural delay line length, assuming M allpass filters, each representing a delay of at least 1 sample. For this value of n, find the best a 0. Then decrement N and iterate. top decrementing N when the sum of squares partial frequency match up error is at a minimum. A similar algorithm can be used to sort through non-integer values of N inserting an allpass fractional delay interpolator into the loop Calibrating Loop Loss From Recorded Data Recall, A n (t m ) represents the amplitude of the n th partial at time t m, as analyzed from recorded data. Define à n (t m ) = A n(t m ) A n (0) (2.87)

76 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 60 where t m = mm is the time in seconds of the m th data frame, and Ãn(t m ) is the amplitude trajectory of the n th partial, normalized so that Ãn(0) = 1. ince we are assuming a linear system, we expect an exponential decay of the form, Ã n (t m ) e rntm (2.88) where r n is some decay rate for the n th partial between 0 and 1. Taking the natural log of both sides, we see that, log Ãn(t m ) r n t m (2.89) This reduces, therefore, to the task of fitting the log scale amplitude data to a straight line of some slope, r n. To find an r n for the measured data, we may use an error criterion based on the sum of squared differences, ε(r n ) = m ( log Ãn(t m ) + r n t m ) 2 (2.90) Minimizing this error function over r n, we obtain a decay rate for the n th partial. In designing the loop loss filter, LP (z), we desire that this filter provide sufficient frequency-dependent loss to account for the attenuation through one full cycle of the string loop. ince the essential loop time is N samples, or, N T seconds, where T is the digital sampling interval, and since the attenuation of the n th partial in NT seconds is e rnnt, we may design LP (z) by fitting it to a magnitude spectrum based on the loop attenuation of the partials, LP (e j2πp(n)t ) = e rnnt (2.91) As an example, Figure 2.14 shows (above) measured decay rates of a piano note C5 (one octave above middle-c). The lower plot shows the decay rates in units of db per string loop period. To model this string, we need to design a loop loss filter which has this db magnitude response. Fitting the data in the log domain is psychoacoustically sensible in view of the ear s quasi-logarithmic perception of loudness, log LP (e j2πp(n)t ) = r n NT (2.92)

77 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 61 Figure 2.14: Measured Decay Rates in C5 Piano Tone

78 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 62 A Practical matlab Loop Estimation Trick Many design algorithms are more effective if they have a magnitude as well as a phase to design to. Mathwork s matlab invfreqz iteratively finds a discrete-time transfer function that corresponds to a given complex frequency response (mith and Little, 1994). From a filter design perspective, invfreqz can be used to convert magnitude and phase data into transfer functions. The invfreqz algorithm is based on (Levi, 1959). The desired magnitude spectrum is known, but the natural phase response is unknown and not really important. The author has found that a practical approach is to set the phase initially to 0 everywhere, then to take the phase of the transfer function the invfreqz finds and to replace the phase of the desired magnitude with this new phase; then, iterate the process. In this way, the natural phase of the desired magnitude response gets closer and closer to optimum, and the fits provided by invfreqz improve iteratively as the complex response gets easier for the algorithm to fit. Another natural approach, which may reduce the number of iterations required to converge to a result, is to compute the minimum-phase response for the given magnitude response and use that as the starting phase response. Group Delay vs. Phase Delay In tuning the delay line length for pitch and stiffness, it was correct to use phase delay to compute the allowed frequencies in the loop. However, when computing the desired loop loss filter, while in the presence of significant stiffness effects from cascaded allpass filters, using phase delay may not be sufficiently accurate. The author has found that group delay is the correct phase measure to use when computing the decay rates from the measured data. While the tuning of resonant frequencies in a loop is dependent on exact multiples of 2π in phase delay through the loop, the decay rates of the modes only depend on the actual time it takes for the modal frequency band to travel one cycle through the loop. Hence, the decay rate per period for each measured modal frequency must take into account a group delay correction associated with the bank of M allpass cascaded allpass filters before a summary loop loss filter is designed.

79 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 63 Figure 2.15: Modes of Two Identical trings Coupled Together by a Bridge: Reactive Coupling (left graph) and Resistive Coupling (right graph). Adapted from (Fletcher and Rossing, 1991). 2.7 Coupled trings Two-tage Decay Rate Figure 2.15 compares the behavior of modes of identical strings coupled at a purely reactive (e.g., springy) bridge and a purely resistive bridge. The parameters ω 1 and ω 2 are the unperturbed frequencies of the string modes; Ω + and Ω are the frequencies of the combined coupled system. The solid crisscross lines, one horizontal, one at 45, represent the string frequencies without coupling. In the left-hand graph, the modes of the system coupled at a reactive bridge repel each other, as shown by the thinner solid lines. In the right-hand graph, the modes of the system coupled at a resistive bridge are drawn together and become the same frequency when the unperturbed mode frequencies are close enough, as shown by the thinner solid lines. These modes, although they are drawn together to the same frequency in the resistive bridge case, may develop different exponential decay rates, creating the effect of two-stage decay. A very important quality to the piano sound is the characteristic two-stage decay rate. The first portion of the note decays quickly corresponding to energy being lost into the soundboard, and subsequently into the air, giving the piano tone loudness. Then as the

80 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 64 db -10 ingle tring Decay vs. Three tring Decay Piano Note: G seconds Figure 2.16: Decay Trajectories Measured on Piano G4 Tone: ingle tring vs. Three tring multiple strings get out of phase, energy is lost into the air more slowly giving the tone persistence. Behavior of coupled piano strings has been studied in detail in (Weinreich, 1977). The nearly tuned resonating modes typically relocate themselves from two or more detuned pitches at the same decay rate, into essentially one pitch, with two decay rates. Excellent insight into this pole migration using root-locus analysis techniques is given in (tilson, 1997; tilson, 2006). The solid line in Figure 2.16 shows the measured amplitude decay of a G4 piano tone (G above middle-c) when all three strings are struck and decay together. Note the first-stage decay where the amplitude drops at the rate of 22 db per second in the first second, followed by a second-stage decay where the amplitude only drops 1 or 2 db over the next second. The dashed line is an instrumented measurement where two of the strings were stopped with a rubber wedge. Note that the decay rate during the first 2.5 seconds appears to be single stage, are a rate of approximately 13 db per second. The musical benefit of two-stage decay is that the impression of a louder attack sound can be generated with the initial excitation peak. This delivers a lot of energy into the soundboard (hence loss in the string) in the first stage, then a longer sustained sound is provided during the second stage (Martin, 1947; chuck and Young, 1943). Using the method of coupled string synthesis as described in (mith, 1993), we may model the several strings of a piano note coupled at some bridge impedance. Details of

81 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 65 Figure 2.17: G4 Decay Trajectories Measured on ynthesized G4 Piano Tone: Tuned Exactly vs. light Detuning the piano string model are addressed in a later section. If these multiple strings are tuned exactly equal in our synthesis model, no two-stage decay occurs (see the dashed line in Figure 2.17). If these strings are tuned to pitches more that 1 or 2 Hz apart, they sound simply out of tune and decay separately (not shown). In order to obtain two-stage decay rate in the piano model output, one must set the tuning of the coupled waveguide strings to some small fraction of a Hz apart (Kirk, 1959). For example, to properly tune the twostage decay in a middle C string, one might most simply couple 3 (or 2) waveguide loops at a loaded scattering junction and tune one loop 0.4 Hz different than the second loop (shown are the solid line in Figure 2.17). This synthesized piano model was implemented in a synthesis modeling tool called ynthbuilder (Porcaro et al., 1998). To obtain fractional Hz tunings like this, one may use the allpass interpolation method described earlier and in (Jaffe and mith, 1983). A linear interpolation method will probably introduce too much unwanted loss in the string loops. But the allpass method is very easy to control and very slight pitch modifications are possible.

82 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 66 v + 1 v + 2 R 0 R 0 v - 1 v - 2 R b Figure 2.18: Two trings Coupled at a Lumped Impedance Una Corda If using the coupled string method described herein below, then the proper excitation method is to drive all waveguide string loops which are coupled with the hammer excitation equally. This models the hammer hitting all three (or two) strings simultaneously. On the piano there is a middle pedal, or una corda pedal, which traditionally is thought to make the piano tone softer. In reality, on grand pianos it slides the hammers a little to one side so that only 1 of the 2 or 3 strings is struck, while the remaining string or strings for each note is not struck. The effect of this is not so much to make the sound softer, but to introduce the second stage of two-stage decay right at the beginning. This happens since, through coupling, the strings almost instantly enter into an out of phase mode of oscillation. In order to model this effect, one may simply load the excitation signal into only one string loop of a two strings-coupled model, while leaving the second string loop to take its energy entirely through the coupling filter, and not through a direct hammer excitation. This results in the desired simple second stage decay occurring right away The Loaded cattering Junction The loaded scattering junction math is derived in (mith, 1993) and we review it here. Refer to Figure 2.18 to see the identified forces and velocities in a coupled strings system. First we decompose the transverse force and velocity at the junction between the strings into traveling waves on the string: F i = F + i + F i (2.93)

83 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 67 V i = V + i We also have the wave impedance relation: + V i (2.94) F ± i = ±R 0 V ± i (2.95) The impedance of the bridge is F J = Rb V J (2.96) The strings are joined at a series junction so that all the velocities are all equal at the junction: V 1 = V 2 = = V N = VJ (2.97) The force on the bridge is the sum of all the component string forces: F J = F i (2.98) = ( ) F i + + Fi (2.99) = ( ) R 0 V i + R 0 Vi (2.100) = [ ] R 0 V i + R 0 (V J V i + ) (2.101) = NR 0 V J + 2 R 0 V + i (2.102) Using the bridge impedance relation, F J input velocity waves, V + i : = Rb V J, we may solve for V J in terms of the V J = 2 R 0 V i + = 2 V + i (2.103) NR 0 + R b N + R b /R 0 We can now integrate this scattering model into a full model of piano strings The Coupled tring Model Figure 2.19 illustrates a coupled piano string model for one note of the piano. The coupling filter represents the loss at the yielding bridge termination, and controls the coupling of energy between and among the three strings. Each of the three string loops shown contains two delay elements, the first corresponding to the delay path from the hammer strike point to the agraffe and back, the second corresponding to the delay path from the hammer strike

84 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 68 E 3 + Delay tiffness Tuning + Delay Filters Filter C 3 * E 2 + Delay tiffness Tuning + Delay Filters Filter C 2 * E 1 tiffness Tuning Delay + Delay Filters Filter C 1 * + Coupling Filter + Output Figure 2.19: Three Piano trings Coupled at a Bridge Termination

85 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 69 point to the bridge and back. The relative delay length ratio for most strings is about 1 to 8, although the relative delay lengths may be set to model any particular piano string strike position. The input signals E 1, E 2, and E 3 are taken from the output of the hammer filter, which has been driven, in turn, by a soundboard impulse response, or a nonlinearly filtered noise excitation synthesis. Note that the input signals are introduced into the string loops at two points, in positive and negative form: this models the spectral combing effect of the relative strike position of the hammer on the string. The signals C 1, C 2, and C 3 should be set to 1.0 during the sustain portion of the piano sound, and should be ramped to some appropriate loop attenuation factor, such as.95, at key release time. Alternatively, some more elaborate release sound model might be used. Note that, for una corda pedal effects, one or more of the signals E 1, E 2, or E 3, should be set to zero at key strike time. This causes the coupled string system to move quickly into its second-stage decay rate, just as is found in real piano sounds when the una corda pedal is depressed. In this coupled string model, the delay lengths are fine-tuned such that the effective pitch of each of the three string loops is very nearly equal, but not exactly equal. This is the mechanism by which two-stage decay is synthesized in the commuted piano synthesis model. The stiffness filters, as shown in Figure 2.19, are intended to be an allpass filter structure which modifies the phase response of the loop so as to create the effect of the natural inharmonicity of the piano string partials. We recommend a bank of one-pole allpass filters as described earlier in this chapter and in (Van Duyne and mith, 1994). 2.8 Calibrating the Coupling Filter Calibrating the coupling filter in the coupled piano string model can be difficult as it apparently requires knowing the actual impedance function of the bridge and the actual wave impedance of the strings, or else making good guesses at them. In order to avoid this task, we have formulated two alternative methods to find the coupling filter coefficients directly from recorded data. The first method requires instrumenting the double or triple strings so that only one string resonates and then to record and measure the decay rates of each of the partials. The second method requires only to record and measure the decay rates of the partials on the natural first-stage decay of the full two or three coupled strings system. In each case we deduce the bridge impedance and compute the coupling filter.

86 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING First Method: Deducing R b from ingle-tring Decay Rates Ideally, from a physical perspective, we would like to measure empirically the bridge impedance, R b, and the string impedance, R 0 ; and then from these measurements compute the desired coupling filter. However, following the spirit of the simplified string loop model presented above, let us say we have already calibrated a single string system and know LP (z), a lowpass filter modeling the per period attenuation of the tone, and AP (z), an allpass filter summarizing the dispersion in the string due to stiffness. We have presumably done this by measuring the partial frequencies and corresponding decay rates of a single piano string. This may be accomplished by physically damping two of the three piano strings in a piano note group with felt, rubber, or some such means, and then recording the sound of the remaining undamped string decaying after it is struck. The decay rate of this single string should not contain very much two-stage decay interference (Weinreich, 1977) from the other damped strings, but should, instead, produce a reasonable single stage decay from which data about the partial frequencies and their individual decay rates may be extracted. Loss in a string-bridge system comes almost entirely from the yielding bridge termination itself. That is, the loss from viscous air drag and internal friction is very small compared to termination loss. Therefore, let us simply say that LP (z) T f (z) is the force wave transfer function at the bridge, that the string is rigidly terminated at the other end so that the force wave transfer function there is unity, and that the dispersion, AP (z), is entirely due to stiffness in the string, and not due to any significant reactive qualities in the bridge. We may therefore write, LP = T f = R b R 0 R b + R 0 (2.104) and solve for R b in terms of L, R b = R LP 1 LP The coupling filter for N strings coupled at an impedance R b is (2.105) H b = 2 N + R b /R 0 = 2 N LP 1 LP = 2(1 LP ) (1 + N) + (1 N)LP N=3 1 LP 2 LP (2.106) In summary of this calibration approach, we have measured the sound of a single string

87 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 71 decaying, derived the loop loss filter from this data, then re-interpreted this to be the force wave transfer function at the bridge (assuming that almost all of the loss is due to the yielding bridge); from this point, we derive the bridge impedance and thence the N-string coupling filter. In the model shown in Figure 2.19, we have three strings coupled, N = 3. However, several minus signs have been commuted around in that figure and the Coupling Filter is actually represented by H b. To complete the model, the Tuning Filters should be tweaked by a good piano tuner to achieve a fine, full-bodied two-stage decay rate (around Hz detuning between strings) (Kirk, 1959) econd Method: Deducing R b from First-tage Decay Rates A much more convenient approach is to deduce the coupling filter directly from a recording of the piano in its normal mode of operation. We will derive a method to compute the coupling filter from recorded data from the first-stage decay of the target piano string. For the purpose of working through the math, let s assume there is known single-string decay data summarized in a loop filter, LP (z). Then, per the results of the last section, this corresponds to a three-strings-coupled coupling filter of H b = 1 LP 2 LP (2.107) This again is assuming all the loss is at the bridge, and we then deduce the bridge impedance and compute the coupling filter according to the scattering junction equations. Now, hypothesize that all three coupled strings start off in phase after struck, and say they are all identical loops exactly in tune, then, referring to Figure 2.19, we can fold the three strings loops on top of themselves and reduce the system to a single loop with the coupling filter operating on 3 times the input, ( ) 1 LP (3) 2 LP (2.108) and the signal fed back into each loop being expressible as the coupling filter minus the (single) input signal ( ) 1 LP (3) 1 = 2LP 1 2 LP 2 LP (2.109) This means that if we have measured data for single-string decay rates per period, LP,

88 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 72 Figure 2.20: G4 Piano Tone: ingle- and Triple-tring Decay Rates we can deduce the first-stage triple-string decay rates as LP 3 = (2LP 1)/(2 LP ). By inverting this expression, solving for the single-string decay rate, LP, we can the compute the single-string decay rates form measured three-string decay rates as LP = 2LP LP 3 (2.110) By way of empirical verification, Figure 2.20, shows measured and computed decay rates of partial frequencies from a real G4 piano tone. x s are measured data. The two solid lines running through The dashed lines running through data plotted as circles are computed data. The upper line of x s are decay rates measured form a single G4 piano string, when the other two strings are stopped with a rubber wedge. The lower solid line runs through measured partial decay rates form the first-stage decay when all three G4 strings are struck. The points plotted as circles connected by a dashed line are triple-string first-stage decay rates derived from the measured single-string decay rates. The lower set

89 CHAPTER 2. INHARMONICITY, DECAY AND COUPLING 73 of data plotted as circles connected by a dashed/dotted line are triple-string first-stage decay rates derived from the measured single-string decay rates. Note that the measured and deduced single-string decay rate curves are in alignment. imilarly, the measured and computed triple-string decay rate curves are in alignment with each other. Another way of looking at this problem is as follows. If we say the strings have wave impedance or R 0 and the bridge has termination impedance of R b, then the force wave transfer function at the bridge should be, T 1 f = R b R 0 R b + R 0 (2.111) As a thought experiment, if we think of the three strings as acting on the bridge all together in phase, in fact, as though they are fused together, then the mass density has in effect tripled; but the wave speed, c = K/ɛ, is the same, so we can see the tension has also tripled. Therefore, the effective wave impedance on our three fused strings must be (3K)(3ɛ) or 3R 0, were R 0 = Kɛ is the wave impedance of the single-string. Hence, the force wave transfer function for the triple fused strings would be computed as From these two equations, it is easy to show that T 3 f = R b 3R 0 R b + 3R 0 (2.112) T 3 f = 2T 1 f 1 2 T 1 f (2.113) which is equivalent to the expression we derived in Equation

90 Chapter 3 The Waveguide Mesh An extremely efficient method for modeling wave propagation in a membrane is provided by the multi-dimensional extension of the digital waveguide. The 2-D digital waveguide mesh is constructed out of bi-directional delay units and scattering junctions. We show that it coincides with a standard finite difference approximation scheme for the 2-D wave equation, and we derive the dispersion error. ince its first publication in (Van Duyne and mith, 1993a; Van Duyne and mith, 1993b) and in (Van Duyne and mith, 1995c), additional applications have been found in physical models of drums (Fontana and Rocchesso, 1998), cymbals and gongs (Pierce and Van Duyne, 1997a; Van Duyne et al., 1994; erafin et al., 2001), soundboards and body resonators (Huang et al., 2000; Fontana and erefin, 2003), and room acoustics modeling (avioja et al., 1994; avioja et al., 1995; Murphy et al., 2001; Kelloniemi et al., 2005; Kelloniemi et al., 2006) including improved methods for implementing boundary conditions (Kelloniemi, 2006). Although finite element (Kindel and Wang, 1987) and difference scheme approximation methods are known which can help with the numerical solution of the 2-D wave equation, these methods have two drawbacks: (1) their heavy computational time is orders of magnitude beyond desired levels for musical instrument sound synthesis, and (2) traditional problem formulations fit poorly into the physical model arena of linear systems, filters, and network interactions. On the other hand, the 2-D digital waveguide mesh formulation described in this chapter and the next, while corresponding exactly with a standard difference scheme approximation, may be implemented in a fully parallel, multiply-free formulation; the energy preserving, digitally exact round-off method eliminates numerical problems; the mesh extends simply to 3- or N-dimensions; and, finally, the algorithm is a 74

91 CHAPTER 3. THE WAVEGUIDE MEH 75 linear network which connects up easily to other physical models. 3.1 Traveling-Wave olution to the Ideal Membrane Equation The two-dimensional wave equation for displacement of an ideal membrane may be written as follows, [ ] 2 u 2 t 2 = u c2 x u y 2 (3.1) where t is time, x and y are spatial coordinates on the membrane, u(t, x, y) is transverse displacement of the membrane as a function of time and spatial position(morse and Ingard, 1968). In the one-dimensional string case, we could solve and implement the wave equation as two bi-directional traveling waves. In the 2-D membrane case, the traveling-wave solution involves the integral sum of an infinite number of arbitrary plane waves traveling in all directions, u(t, x, y) = α g α (xcosα + ysinα ct)dα (3.2) where g α is the waveshape traveling in the direction α at speed c. In the 1-D case we were able to assign one delay line to each of two traveling waves. ince assigning one waveguide to each of the infinite plane waves is not feasible, we need an alternative approach to model the 2-D wave equation efficiently. 3.2 The Membrane Equation in the Frequency Domain We can solve the 2-D wave equation, just as we did the 1-D wave equation in Chapter 1, only this time using the 2-D spatial Fourier transform and a Laplace transform in time. A brief digression on the 2-D Fourier transform will prove helpful in interpreting the derived amplification factors in later analysis.

92 CHAPTER 3. THE WAVEGUIDE MEH Polar Coordinate View of the 2-D Fourier Transform The 2-dimensional Fourier transform of a continuous function u(x, y) may be written as a double integral over the infinite x, y plane: u(x, y) F u ωx,ω y = u(x, y)e jωxx e jωyy dxdy (3.3) where ω x and ω y are the spatial frequency variables in the x and y directions, respectively. ince the kernel of this transform is e jωxx e jωyy, the particular value u ωx,ω y may be understood in a polar coordinates interpretation as indicating how much (and at what phase) there is present in u(x, y) of the plane wave oriented in angular direction α and spatial frequency ω α, where tan α = ω y /ω x (3.4) ω α = ω 2 x + ω 2 y (3.5) It is trivial that the period of the complex plane wave e jωxx, traveling in the x direction is 2π/ω x. However, we derive the period rigorously by solving for the contour lines, e jωxx = 1 (3.6) ω x x = k2π, k = 1, 2,... (3.7) x = k2π/ω x (3.8) Applying this same technique in a less trivial case, we may derive for the period of the complex plane wave e jωxx e jωyy in a similar fashion: e jωxx e jωyy = 1 (3.9) ω x x + ω y y = k2π (3.10) y = k2π ω x x (3.11) ω y ω y These are parallel lines of slope ω x /ω y = 1/ tan α. Hence, these periodic contour lines are perpendicular to the radial direction α, which corresponds to a plane wave traveling in the direction α. To see that the spatial frequency of this complex sinusoidal plane wave

93 CHAPTER 3. THE WAVEGUIDE MEH 77 is ω α, we note that the formula for the perpendicular distance between two parallel lines, y 1 = mx + b 1 and y 2 = mx + b 2, both of slope m and with y intercepts b 1 and b 2, is as follows: Therefore, the period of the plane wave is: d = b 2 b m 2 (3.12) 2π/ω y 1 + (ω x /ω y ) 2 = 2π/ω α (3.13) which corresponds to a spatial frequency of ω α olving the Wave Equation Returning to the membrane equation, ( ) 2 u 2 t 2 = u c2 x u y 2, (3.14) defining u ωx,ω y (t) as the 2-D spatial Fourier transform, and U ωx,ω y (s) as the Laplace transform of u ωx,ω y (t) in time, we have ( ) u ωx,ω y (t) = c 2 (jω x ) 2 u ωx,ω y (t) + (jω y ) 2 u ωx,ω y (t) (3.15) s 2 U ωx,ω y (s) su 0 u 0 = c 2 (jω 2 x ) ( U ωx,ω y (s) + U ωx,ω y (s) ) (3.16) where u 0 = uωx,ω y (0) (3.17) u 0 = uωx,ω y (0) (3.18) Gathering terms and making a partial fraction expansion we get, U ωx,ω y (s) = su 0 + u 0 s 2 + c 2 (ω 2 x + ω 2 y ) (3.19)

94 CHAPTER 3. THE WAVEGUIDE MEH 78 = u + ω x,ω y + u ω x,ω y (3.20) s + jcω α s jcω α where u ± represent initial wave decomposed spatial spectra ( u + 1 ω x,ω y = 2 u ω x,ω y = 1 2 u 0 u ) 0 jcω ( α u 0 + u ) 0 jcω α (3.21) (3.22) ω α = ω 2 x + ω 2 y (3.23) The spatial frequency variable ω α represents a plane wave traveling in direction α = arctan ω y /ω x of spatial frequency ωx 2 + ωy. 2 Taking the inverse Laplace transform, we get u ωx,ω y (t) = u + ω x,ω y e jcωαt + u ω x,ω y e jcωαt (3.24) Letting u + ω x,ω y and u ω x,ω y be 0 in turn, we can see the spectral amplification factors as time goes from t to t + t are g ± ( t) = u ω x,ω y (t + t) u ωx,ω y (t) = e jcωα t (3.25) These spectral amplification factors correspond to a phase advance of g ± = ±cω α t in t seconds for the plane wave in direction α. The phase delay, or more correctly, the phase distance is g ± ( t) ω α t = ±c, (3.26) This means plane waves of any spatial frequency or in any direction propagate at speed c. 3.3 The 2-D Digital Waveguide Mesh We propose here a numerical solution of the 2-dimensional wave equation in terms of a network of bi-directional delay elements and 4-port scattering junctions. This structure can be viewed as a layer of parallel vertical waveguides superimposed on a layer of parallel horizontal waveguides intersecting each other at 4-port scattering junctions between each

95 CHAPTER 3. THE WAVEGUIDE MEH 79 Figure 3.1: The 2-D Digital Waveguide Mesh bi-directional delay unit. Figure 3.1 shows such a mesh. In the canonical case, the scattering junctions are taken to be equal impedance lossless junctions and the interconnecting waveguides are of unit length. If we view the mesh as a lattice of interconnected vibrating strings, the displacement velocities at the four ports of each junction must be equal, and the forces at each junction must sum to zero; in this case, we have series scattering junctions with force or velocity waves traveling in the two-port, bi-directional, delay units. Alternatively, if we view the mesh as a lattice of interconnected acoustic tubes, the pressures at each junction must be equal, and the flows into each junction must sum to zero; these are parallel scattering junctions with pressure or volume velocity waves traveling through the delay units.

96 CHAPTER 3. THE WAVEGUIDE MEH 80 Z 2 Z 1 Z 3 Z 4 Figure 3.2: Four-Way cattering Junction The Lossless cattering Junction It is useful to be able to interconnect waveguides of possibly varying wave impedance at junctions which may be lossless, or which may be loaded with impedances of their own, or be driven by external forces. For example, driving a violin string with a pulsed noise signal representing the bow requires a scattering junction on the string where the bow divides it (Chafe, 1990). Tone holes in wind instrument models may take advantage of scattering junctions. trings may be coupled together at a bridge via scattering junctions (mith, 1993). cattering junctions may be used to build up acoustic tubes of varying diameter by joining segments of cylindrical tubes (Cook, 1990). A reverberation algorithm which depends on interconnecting any number of varying length and varying impedance waveguides into an arbitrarily elaborate network has been described in (mith, 1987). The membrane model presented in this paper may be viewed as a canonical form of this reverberation structure. Figure 3.2 shows a schematic representation of four waveguides intersecting in a lossless scattering junction. The line segments with opposing arrows on them represent the bidirectional delay lines of the digital waveguide with their associated wave impedances, Z i. The circumscribed represents the junction. When four strings intersect at a single point, or junction, without loss of energy, we have a series junction and require two conditions: (1) that the velocities of all the strings

97 CHAPTER 3. THE WAVEGUIDE MEH 81 at the junction be equal since they are all moving together at that point, v 1 = v 2 = v 3 = v 4 (3.27) and (2) that the forces exerted by all the strings must balance each other at that point, i.e., they must sum to zero, f 1 + f 2 + f 3 + f 4 = 0 (3.28) Combining the two series junction constraints for strings with the wave variable definitions, v i = v + i + v i (3.29) f i = f + i + f i (3.30) and with the wave impedance relations, f + i = Z i v + i (3.31) f i = Z i v i (3.32) we can derive the lossless scattering equations for the interconnection of several strings, v J = 2 4 i=1 Z i v + i 4i=1 Z i (3.33) v i = v J v + i (3.34) v J represents the junction velocity, the v i + are the incoming waves at the junction, and the vi are the outgoing waves at the junction. These equations say that, as a wave is coming into a junction along a string, some portion of the wave reflects off the junction and travels back where it came from, while the rest of it travels into the junction and is divided among the outgoing waves along the other strings. The relative proportions of this scattering effect are dependent only on the relative impedances, Z i, of the strings and not on their lengths. In the case of the 4-port isotropic waveguide mesh, we take the wave impedances of all the strings to be equal, and the equations reduce to, v J = 1 ( ) v v+ 2 + v+ 3 + v+ 4 (3.35) vi = v J v i + (3.36)

98 CHAPTER 3. THE WAVEGUIDE MEH The Birth of Traveling Plane Waves The idea of interconnecting many waveguides together to produce a complex model of waves traveling through space has long been known (mith, 1987). In fact, the waveguide mesh can be viewed as a model of just so many very short strings or air columns in a crisscross of interconnections supporting many bidirectional waves scattering at many junctions. However, something much more amazing occurs when the interconnected strings are arranged in regular shapes and are pulled taut into regular canonical forms: uperposed 2-D plane waves arise, represented in the junction velocity values, traveling in all 360 directions on the surface. This is a non-trivial step, from the interconnectivity and scattering of many 1-D waveguides to the 2-D and 3-D wavefronts traveling on a membrane or in space. The mathematical analysis will be presented later in this chapter. First we will consider some practical concerns such as how to terminate the mesh, empirical evaluations of its performance, and implementation features that make it efficient Terminating the Mesh As a practical concern, we must terminate the mesh in some way. Terminating the mesh waveguide ends with perfect reflections, that is multiplying the arriving traveling wave by 1 before sending it back into the mesh, models a membrane clamped rigidly at the edges, such as a drum head. Figure 3.3 shows this structure. A membrane stretched taut but floating in space unterminated (or terminated at frictionless guide rods) could be modeled with a non-reflecting termination, that is multiply by 1 at the terminations. Alternatively, the rim junctions could be replaced by 3-port and 2-port junctions as shown in Figure 3.4. More generally, the termination filter could be arbitrary, as shown in Figure 3.5 where the f s represent arbitrary wave transfer functions at the terminations. In practical situations, these filters can be used to introduce summarized loss into the mesh and modify the apparent wave speed of the modes to simulate stiffness. 3.4 Implementation Features The digital waveguide mesh may be computed in parallel, and without multiplies. In addition, numerical round-off loss may be redistributed back into the mesh to create a zero-loss system.

99 CHAPTER 3. THE WAVEGUIDE MEH Figure 3.3: Rigidly Terminated Membrane

100 CHAPTER 3. THE WAVEGUIDE MEH 84 Figure 3.4: Open Termination of the Mesh

101 CHAPTER 3. THE WAVEGUIDE MEH 85 f f f f f f f f f f f f f f f f f f f f Figure 3.5: Mesh Terminated with Arbitrary Wave Transfer Functions

102 CHAPTER 3. THE WAVEGUIDE MEH 86 Two-Pass Parallel Computation The network elements in the 2-D digital waveguide mesh are of two types: 4-port scattering junctions and 2-port bi-directional unit delays. If the unit delays are double buffered, so that each delay has its own input and output buffers, the computation of all the elements in the mesh can be segregated and computed in any arbitrary order or in parallel, according to the following two-pass computation scheme: (1) The scattering junction outputs are computed from their known inputs and placed at the junction outputs. This constitutes the scattering pass. (2) The outputs from each scattering junction are placed at the inputs of the adjacent scattering junctions, thereby implementing the bi-directional delay units. This constitutes the delay pass. Due to the possibility of arbitrary ordering of the scattering computations, implementation on a parallel computing architecture with local four-sided connectivity between processors is ideal for the mesh algorithm. In this implementation, the junction equations are computed in the processors; and then the data transfer cycle is used to transfer data from the outputs of each processor to the appropriate inputs of the adjacent processors. ince the equal impedance 4-port lossless scattering junction is multiply-free, as pointed out in ection 4.2, a VLI implementation may be constructed with a handful of gates with no need for hardware multipliers. ince the junctions may be computed in parallel, the whole mesh may be computed in the time it takes to do 7 adds (i.e., 3 adds and 4 subtracts) and one shift. In fact, the four subtracts may be performed in parallel. Energy Preserving Junctions When performing the multiply-free junction computation, one divide by two is required. If a simple sign-preserving right shift and truncation is used for this operation, the junction value is rounded toward zero in the case of positive numbers and rounded away from zero in the case of negative numbers. This is a round down in both cases, which could introduce a negative offset into the values of the mesh which may eventually lead to numerical instability or reduced dynamic range, if there is no loss in the system somewhere else. The usual solution to such a problem would be to make a conservative rounding toward zero in both the positive and negative cases. This way no energy and no DC drift will be introduced into the system. This method is known to work quite well in one-dimensional feedback loops. Unfortunately, in the two-dimensional mesh case, there are so many

103 CHAPTER 3. THE WAVEGUIDE MEH 87 junctions that the cumulative losses in all the junctions add up to a noticeable amount. An energy preserving method of junction computation may be constructed as follows. When shifting a binary number to the right, there are exactly two cases: (1) the low-order bit which is shifted off the end of the word is zero, and the computation is exact, or (2) the low-order bit is one, and the error is exactly 0.5. When the junction inputs are subtracted off v J in computing the scattering junction outputs, this error is magnified by a factor of 4 and the 0.5 error propagates into the four output signals equally. Note that the error is in the same direction in all four cases so the total error is = 2 full bits. To preserve energy in the mesh, round two output signals down (i.e., just truncate) and round the other two output signals up (i.e., add the low-order bit back in after truncating). This re-distribution of the error produces a numerically exact lossless scattering junction. In effect, the slight numerical error has been converted into a slight scattering dispersion error. Whereas the numerical error was problematic, the dispersion adjustment is vanishingly small Empirical Evaluation of the Mesh It is evident that, given an initial excitation at some point on the digital waveguide mesh, that energy from that excitation will tend to spread out from the excitation point more and more as the traveling waves scatter through the junctions. It is not, however, easy to see that the wave propagation on the mesh converges to that on the ideal membrane. Animation of the Mesh A visual verification of the waveguide mesh algorithm can be seen in Figure 3.6, which shows three separate time frames of an animation computed directly from the algorithm. The top frame shows the initial deflection loaded into the mesh. Each intersecting grid point represents a scattering junction. The next two frames show the circular propagation outward of the initial excitation in a way consistent with wave propagation on the ideal membrane. ounds from the Mesh As another check of the mesh algorithm, we can compare the expected modal frequencies on an ideal membrane with those generated from the mesh model. The allowed frequencies

104 CHAPTER 3. THE WAVEGUIDE MEH 88 Figure 3.6: Wave Propagation on the Mesh

105 CHAPTER 3. THE WAVEGUIDE MEH 89 Figure 3.7: Comparison of Theoretical Modes on a quare Membrane (shown above) and Measured Modes on a Waveguide Mesh (shown below) in a theoretical ideal square membrane with clamped edges are proportional to m 2 + n 2, for m = 1, 2,..., and n = 1, 2,... (Morse and Ingard, 1968). These modes may be labeled (m, n) for any given m and n. In Table is computed a list of the normalized frequencies of the first few of these modes given as multiples of the lowest allowed frequency. (1,1) 1.00 (1,2) 1.58 (2,2) 2.00 (1,3) 2.24 (2,3) 2.55 (1,4) 2.92 (3,3) 3.00 (2,4) 3.16 (3,4) 3.54 (1,5) 3.60 (2,5) 3.80 (4,4) 4.00 (3,5) 4.12 (1,6) 4.30 (2,6) 4.47 (4,5) 4.50 (3,6) 4.74 (5,5) 5.00 Table 3.1: Normalized Mode Frequencies on an Ideal quare Membrane Figure 3.7 shows a comparison of ideal modal frequencies on a square membrane to frequencies generated by a square digital waveguide mesh. The lines across the top half of the figure represent the first 17 modes listed in Table 3.1. The bottom half of the figure is a magnitude spectrum plot of a sound generated by the mesh. The figures have been scaled horizontally to line up their lowest frequency. A careful inspection of the figure will reveal that the theoretical modal frequencies listed in Table 3.1 are generally present and accounted for in the sound generated by the model. This would indicate that the mesh is doing the right thing. Error in the correspondence of ideal and computed modes can be attributed to the extreme coarseness of the mesh used.

106 CHAPTER 3. THE WAVEGUIDE MEH Mirroring of the pectrum Observe the four spectral plots in Figure 3.8. The top plot is an magnitude spectrum analysis of the output of a square 10x10 mesh running at 22050Hz, horizontal scale marked in khz. The spectrum mirrors around one quarter of the sampling rate. This symmetry, which also occurs in the one dimensional waveguide case, is a result of the fact that, when the waveguide system is reflectively terminated, all the unit delays on the upper rail can be commuted down to the lower rail making the system a function of z 2, in effect, over-sampling the system by a factor of two. When the unit bi-directional delays are replaced with longer waveguides, the mirroring replicates. For example, the second plot in Figure 3.8 shows the magnitude spectrum when bi-directional delay lines of length 2 are used between the scattering junctions: the entire mirrored spectrum is compressed by half, and, itself, mirrored around π/4. The third and fourth plots show the cases where the bi-directional delay lines are length 4 and 8, respectively. What this means is you can reduce the number of junctions needed to compute lower frequency meshes at a given sampling rate by adding more delay between the junctions. However, you still get the same number of accurate lower modes as when one delay unit is used, and you get mirrored copies of the base spectrum filling the upper spectrum. 3.5 Dispersion in Plates A detailed treatment of allpass modeling of dispersion in the two-dimensional case is not possible here. However, much as in stiff strings, the higher frequencies in stiff membranes travel faster than lower frequencies, causing a stretching of the modes. Figure 3.9 illustrates the spectral effect of terminating a D digital waveguide mesh with single allpass filters around the rim. The six plots in the figure have been scaled horizontally to align the de-tuned fundamental mode in each case so that the mode stretching effect for various choices of allpass coefficient, a 0, is clarified. ince the 2-D mesh is designed for parallel multiply-free hardware implementation, our simplified multiply-free allpass approach is ideally suited to it.

107 CHAPTER 3. THE WAVEGUIDE MEH 91 Figure 3.8: pectrum Reflecting Around π/4

108 CHAPTER 3. THE WAVEGUIDE MEH 92 0 π/4 π/2 3π/4 π a 0 = 0 a 0 =.125 a 0 =.25 a 0 =.5 a 0 =.75 a 0 = π/4 π/2 3π/4 ωt π Figure 3.9: tretching Modes on the Mesh

109 CHAPTER 3. THE WAVEGUIDE MEH 93 Figure 3.10: Detail View of the 4-Port Rectilinear Waveguide Mesh 3.6 Why the Thing Works Using the tool set we developed in Chapter 1 in the 1-D waveguide case, we now study the waveguide mesh equivalence to a finite partial difference, and compare wave propagation in the mesh difference to the wave propagation in the ideal isotropic membrane and the 2-D wave equation.

110 CHAPTER 3. THE WAVEGUIDE MEH Finite Difference cheme Equivalence Interpreting the 2-D Mesh as a Finite Difference Figure 3.10 shows a detail of the 2-D mesh, labeling all the signals in the mesh. We use the bridge table convention of North, outh East and West to label the four ports of each scattering junction and apply N,, E, and W as superscripts to the traveling-wave signals as appropriate. The junction velocity, vl,m J (n) of the junction at position l, m at time n, may be written as one half the sum of its four input velocity waves, vl,m N+ (n), v+ l,m (n), ve+ l,m (n), and vl,m W+ (n) from the north, south, east, and west direction respectively: v J l,m(n) = 1 2 [ v N+ l,m (n) + v+ l,m (n) + ve+ l,m ] (n) + vw+ l,m (n) (3.37) The four output waves, v N l,m (n), v l,m (n), ve l,m (n), and vw l,m (n) may be computed as the junction velocity minus the input wave from the same direction: l,m (n) = vj l,m(n) vl,m N+ (n) (3.38) v N v l,m (n) = vj l,m (n) v+ (n) (3.39) l,m vl,m E (n) = vj l,m (n) ve+ l,m (n) (3.40) l,m (n) = vj l,m(n) vl,m W+ (n) (3.41) v W Further, we may observe that the input to one junction is the output from the adjacent junction delayed by one time sample: Using these relationships we may conclude that, v N+ l,m (n) = v l,m+1 (n 1) (3.42) vl,m + (n) = vn l,m 1 (n 1) (3.43) vl,m E+ (n) = vw l+1,m (n 1) (3.44) v W+ l,m (n) = ve l 1,m (n 1) (3.45) v N+ l,m (n) = v l,m+1 (n 1) (3.46) = vl,m+1 J (n 1) v+ l,m+1 (n 1) (3.47) = vl,m+1 J (n 1) vn (n 2) (3.48) l,m

111 CHAPTER 3. THE WAVEGUIDE MEH 95 [ ] = vl,m+1 J (n 1) vl,m J (n 2) vn+ l,m (n 2) (3.49) imilarly, we may see that, v + l,m (n) = vj l,m 1 (n 1) [ v E+ l,m (n) = vj l+1,m(n 1) ] vl,m J (n 2) v+ l,m (n 2) [ ] vl,m(n J 2) vl,m E+ (n 2) [ ] vl,m W+ (n) = vj l 1,m (n 1) vl,m J (n 2) vw+ l,m (n 2) (3.50) (3.51) (3.52) Returning to the definition of the junction velocity as a sum of the input velocity waves, we may substitute in these new expressions to find a relation among junction velocities of adjacent junctions: Noting that vl,m(n) J = 1 [ vl,m N+ 2 = 1 2 (n) + v+ l,m { v J l,m+1(n 1) (n) + ve+ l,m ] (n) + vw+ l,m (n) [ ] vl,m(n J 2) vl,m N+ (n 2) (3.53) [ ] + vl,m 1 J (n 1) vl,m J (n 2) v+ l,m (n 2) [ ] + vl+1,m J (n 1) vl,m J (n 2) ve+ l,m (n 2) [ ] } + vl 1,m(n J 1) vl,m(n J 2) v W+ l,m (n 2) (3.54) v N+ l,m (n 2) + v+ (n 2) + ve+ l,m l,m (n 2) + vw+ l,m (n 2) = 2vJ l,m(n 2) (3.55) Gathering terms, we see vl,m(n) J + vl,m(n J 2) = 1 { [ ] v J 2 l+1,m(n 1) + vl 1,m(n J 1) [ ] } + vl,m+1 J (n 1) + vj l,m 1 (n 1) (3.56) The Difference as a tandard 2-D cheme Dropping the J superscript for now, v n l,m + vn 2 l,m = (3.57)

112 CHAPTER 3. THE WAVEGUIDE MEH 96 [ ] 1 vl+1,m n vn 1 l 1,m + vn 1 l,m+1 + vn 1 l,m 1 (3.58) we can subtract 2v n 1 l,m from both sides to obtain vl,m n 2vn 1 l,m [ vn 2 l,m = (3.59) vl+1,m n 1 2vn 1 l,m + vn 1 + vl,m+1 n 1 2vn 1 l,m + vn 1 l,m 1 l 1,m (3.60) ] (3.61) This is in fact a standard finite difference approximation of the 2-D wave equation, applying a second-order backward difference in time, and centered second-order differences in both space dimensions. By analogy with the 2-D wave equation, c 2 corresponds to 1/2, so the apparent wave speed, c that this difference should be approximating is 1/ Converging to the 2-D Wave Equation As we did with the 1-D waveguide difference, we will be able to replace the discrete time and space variables with continuous time and space variables, and replace the unit spatial and time sample shifts in the finite difference with an ε. We can then apply a multidimensional Taylor s series expansion around an arbitrary point in all directions, and let ε converge to 0. Making the Waveguide Mesh Difference a Continuous Function If we imagine a continuous function (with continuous derivatives) running through the discrete points of the difference, we can re-write the waveguide difference as follows, u(t, x, y) + u(t 2ε, x, y) = 1 [u(t ε, x + ε, y) + u(t ε, x ε, y) 2 (3.62) + u(t ε, x, y + ε) + u(t ε, x, y ε)] (3.63) Taylor s eries Expansion Taylor s eries in three variables is defined as follows,

113 CHAPTER 3. THE WAVEGUIDE MEH 97 u(t + t, x + x, y + y) = n t n x n y u(nt,nx,ny) (t, x, y) tnt xnx yny n t!n x!n y! (3.64) We can replace each term with a full Taylor s expansion around the point (t, x, y). The symbol manipulation is tedious and is omitted here. In any case, the use of a symbolic mathematics processing tool such as Mathematica (Wolfram, 1999) is recommended. After replacing each term with a Taylor s series expansion, canceling and gathering terms, everything reduces to Letting Grid ize hrink ε 2 u (2,0,0) = ε2 2 [ u (0,2,0) + u (0,0,2)] + O{ε 3 } (3.65) Dividing through by ε 2, and taking the limit as ε 0, we arrive at the standard 2-D isotropic wave equation, where, the wave speed c = 1/2. u (2,0,0) = c 2( u (0,2,0) + u (0,0,2)) (3.66) Not o Obvious in Non-rectilinear Cases This technique is fairly heavy handed to determine something which is reasonably obvious from the difference equation itself, that the wave speed is c = 1/2. Now that it has been applied to the 1-D waveguide difference and the 2-D mesh difference, it should be getting more comfortable. In the next chapter we will apply this technique on mesh structures which are non-rectilinear, to compute wave speeds simply and efficiently. Determining wave speed in the hexagonal and tetrahedral mesh structures is not obvious from the resultant mesh differences. ome Intuition on the Traveling-Wave peed The 4-port rectilinear mesh appears to implement a wave propagation speed of 1/2 spatial sample per time sample. 1/2 is one-half unit diagonal distance between grid points per time sample. Why should the plane waves in the mesh travel slower than the 1-D waves traveling in each of the individual waveguides between the scattering junctions?

114 CHAPTER 3. THE WAVEGUIDE MEH 98 Recall that the wave speed derived for the physical wave equation is proportional to K/ε, or the square root of tension over density (Morse and Ingard, 1968). Imagine a layer of parallel waveguide strings, and a plane wave traveling down parallel strings together. The speed of this wave would of course be one space sample per time sample, because that is the speed in each of the parallel waveguides. Intuitively, when creating the 4-port mesh, we have superimposed one layer of parallel wave guide strings over a second layer of parallel waveguide strings, at right angles, and soldered them together at the junctions to form the mesh. In effect, we have doubled the number of waveguide strings in the same plane area, which therefore doubled the density of the material. If we doubled the mass density per unit area, and the wave speed is proportional to K/ε, then we should expect the traveling-wave speed to be reduced by a factor or 1/ 2, which is in fact the case. The Courant-Friedrichs-Lewy Condition for 2-D Hyperbolic Difference chemes Defining λ = T/X, where T is the time sampling interval, and X is the spatial sampling interval, the Courant-Friedrichs-Lewy stability condition states that, for explicit computational schemes for hyperbolic difference equations to be numerically stable, it is necessary that, for a difference scheme to track the solution of a hyperbolic equation with two space dimensions, the cone of dependence for each point of the continuous wave equation solution must lie within the discrete pyramid of dependence for each point of the difference scheme solution (Courant et al., 1956; trikwerda, 1989). The waveguide mesh difference equivalent clearly expands at the rate of one half grid diagonal per time step, which corresponds to the relation, cλ 1 2 (3.67) ince the Courant-Friedrichs-Lewy condition is satisfied in the equality, the lowest possible dissipation and dispersion error for this particular scheme is obtained. The numerical approximation schemes for initial value problems involving secondorder hyperbolic partial difference equations usually require a multi-step time scheme which retains values for at least two previous time frames. second partial time derivative in the equation. This is to cope with the The waveguide mesh structure reduces this time dependence to a novel one-step time scheme where each new time frame may be computed wholly from the previous time frame. This is made possible by the use of the bi-directional traveling-wave components in place of physical wave variables. In a sense,

115 CHAPTER 3. THE WAVEGUIDE MEH 99 the bi-directional traveling-wave structure contains the past history of the traveling waves right in the delay line contents. 3.7 Von Neumann Error Analysis in 2-D By applying a von Neumann-style analysis as described in Chapter 1 to both the partial differential membrane equation and the partial difference approximation scheme, we may study the dissipation and dispersion error in the model. Analysis of 2-D systems will require the use of both continuous and discrete 2-D transforms to compare the evolution over time of the spatial spectra. We begin by solving the difference in the frequency domain olving the Difference Directly in the Frequency Domain We have already shown that the 2-D digital waveguide mesh is equivalent to the following difference scheme, v l,m (n) + v l,m (n 2) = 1 { [v l+1,m (n 1) + v l 1,m (n 1)] 2 } + [v l,m+1 (n 1) + v l,m 1 (n 1)] (3.68) In the case of the finite difference scheme, a two-dimensional discrete-space Fourier transform may be performed over the spatial grid to yield, v ξ1,ξ 2 (n + 1) + v ξ1,ξ 2 (n 1) = 1 2 v ξ 1,ξ 2 (n)(e jξ 1 + e jξ 1 + e jξ 2 + e jξ 2 ) (3.69) v ξ1,ξ 2 (n + 1) + bv ξ1,ξ 2 (n) + v ξ1,ξ 2 (n 1) = 0 (3.70) where b = 1 2 ( ) e jξ 1 + e jξ 1 + e jξ 2 + e jξ 2 = cos ξ 1 cos ξ 2 (3.71) This is just a second-order recursion equation in n, with a solution easily obtainable via the Z-transform in the time dimension. We delay the system one time sample to make the difference causal, and make the

116 CHAPTER 3. THE WAVEGUIDE MEH 100 mathematics more convenient, v ξ1,ξ 2 (n) + bv ξ1,ξ 2 (n 1) + v ξ1,ξ 2 (n 2) = 0 (3.72) Applying the Z-transform in the time dimension, and using the shift theorem which maps y(n 1) y(n 2) Z z 1 Y (z) + y( 1) (3.73) Z z 2 Y (z) + z 1 y( 1) + y( 2) (3.74) we get, ( ) V ξ1,ξ 2 (z) + b z 1 V ξ1,ξ 2 (z) + v ξ1,ξ 2 ( 1) ( ) + z 2 V ξ1,ξ 2 (z) + z 1 v ξ1,ξ 2 ( 1) + v ξ1,ξ 2 ( 2) (3.75) = 0 (3.76) where v ξ1,ξ 2 ( 1) and v ξ1,ξ 2 ( 2) are the initial spatial spectra at times 1 and 2. Gathering terms and solving for V ξ1,ξ 2 (z), we have V ξ1,ξ 2 (z) = (b + 1)v ξ 1,ξ 2 ( 1) v ξ1,ξ 2 ( 2) 1 + bz 1 + z 2 (3.77) Performing a partial fraction expansion and noting that, 1 1 pz 1 Z p n (3.78) we then arrive at V ξ1,ξ 2 (n) = A ξ1,ξ 2 (p + ) n + B ξ1,ξ 2 (p ) n (3.79) where A ξ1,ξ 2 and B ξ1,ξ 2 are simple combinations of the initial spatial spectra at time samples 1 and 2 and where p ± = b ± b = b ± j 4 b 2 2 (3.80) These are the discrete-time spectral amplification factors for the 2-D 4-port digital waveguide mesh.

117 CHAPTER 3. THE WAVEGUIDE MEH 101 c (ξ 1, ξ 2 ) c π 2 -Pi ξ 1 T 0 0 π 2 Pi -- 2 π 2 -Pi π 2 Pi -- 2 ξ 2 T Figure 3.11: Frequency-Dependent Dispersion in the 4-Port Rectilinear Mesh. axis is fraction of full speed for that spatial frequency. Vertical Evaluation of the Error There is evidently no magnitude dissipation loss in the finite difference scheme, just as there is none in the ideal membrane, since, p ± = ( ) b 2 ( ) 4 b = 1 (3.81) 2 2 This is as expected, since all the junctions in the mesh are lossless and energy is conserved. On the other hand, there is some phase dispersion error in the high frequencies. Recalling c = 1/2 in the model, we see the ratio of actual wave propagation speed in the mesh to desired speed is, c (ξ 1, ξ 2 ) c = 2 4 b 2 ξ arctan b (3.82) with b defined as above, b = cos ξ 1 cos ξ 2. Figure 3.11 shows the relative speed of travel of a plane wave with spatial frequency ξt = ξ1 2 + ξ2 2 T, aligned in the direction α = arctan ξ 2 /ξ 1. Comprehending the meaning

118 CHAPTER 3. THE WAVEGUIDE MEH 102 of this plot is difficult at first. Please note that there is no dispersion error in the wave travel in the diagonal directions (that is, when ξ 1 = ξ 2, and the direction angle α points in one of the four diagonal directions). However, there is some loss of speed in the higher spatial frequencies traveling along the mesh axes (when one of the component frequencies is zero). The data points near the center of the plot represent the near full speed of travel for plane waves of low (large period) spatial frequency, and the data points further out from the center of the plot indicate the fractions of full speed that the plane waves of higher spatial frequency travel at in their particular directions of travel. In a terminated mesh, speed distortion results in a mistuning of resonant modes. This distortion can be reduced by allpass filtering and/or warping of the membrane boundary in a compensating manner. We note that the high-frequency modes of a membrane become so dense that, in audio contexts, this error may not be important. Figure 3.12 shows the same dispersion information on a contour plot, with 1% contour lines, which we shall adopt as our standard presentation form factor for dispersion data. We also show only up to one-quarter the spatial sampling rate, as beyond this frequency, the output spectrum is not physically valid as it is mirrored around π/2 as the entire system is a multiple of z 2. Comparing Figures 3.11 and 3.12 may be helpful. In another view, we can see dispersion in time/space domain in Figure The effect of dispersion in the higher spatial frequencies is visible as the wavefront smoothes out as it travels along the axes. On the other hand, if you look closely, you can see it remains sharp as it travels along the diagonal directions of the mesh (showing no dispersion in wave speeds), that is, the wave shape remains coherent while traveling in the diagonal directions. What is happening in the wave front as it is traveling in the directions of the axes, is that the low spatial frequencies are rolling out ahead of the high spatial frequencies, and the wavefront smoothes out, while the high spatial frequencies traveling the direction of the axes lag behind and cause the rippling in the center of the membrane as the wavefront moves out.

119 CHAPTER 3. THE WAVEGUIDE MEH Figure 3.12: Frequency-Dependent Dispersion in the 4-Port Rectilinear Mesh. Contour lines are shown at 1% intervals.

120 CHAPTER 3. THE WAVEGUIDE MEH 104 Figure 3.13: Time-Domain View of Dispersion in the 4-Port Rectilinear Mesh.

121 Chapter 4 Other Mesh tructures 4.1 Meshes Constructed of N-Port cattering Junctions In this chapter we study several alternative 2-D mesh structures, and then derive a 4-port multiply-free solution for 3-D acoustical space modeling. A body of follow-on work has been done in the area of difference and scattering modeling of membranes and plates; most notable is the thorough exploration of the field found in (Bilbao, 2001; Bilbao, 2004) and numerous papers by the same author. We also note here some early work in the 3-D mesh (avioja et al., 1994; avioja et al., 1995), and in alternative mesh structures in (Fontana and Rocchesso, 1998). The tetrahedral mesh work presented later in this chapter was first published in (Van Duyne and mith, 1996; Van Duyne and mith, 1995a) and (Van Duyne and mith, 1997). We first derive the general relationships in structures constructed from N-port lossless scattering junctions Lossless N-Port cattering Junctions Referring to Figure 4.1, let N be the number of strings connected together at a single junction in a series manner. Let F and V represent the force and velocity at the junction and F γ and V γ the transverse force and velocity of the N strings where they interconnect, taking γ = 1, 2, 3,..., N. Then we define the wave variable relationships for each string, F γ = F γ+ + F γ V γ = V γ+ + V γ (4.1) 105

122 CHAPTER 4. OTHER MEH TRUCTURE 106 V 1+ V 1 V 2+ V 2 V Ν+ V Ν Lossless N-Port cattering Junction Figure 4.1: The Lossless N-Port cattering Junction where F γ+ and V γ+ are the incoming waves on each string, and F γ and V γ are the outgoing wave on each string at the point where they connect at the junction. Now, taking the wave impedance of the all the interconnecting strings to be uniform, R 0, we have the wave impedance relations: F γ+ = R 0 V γ+ F γ = R 0 V γ (4.2) The series junction constraints say that the transverse string velocities at the junction are all equal, and they equal the junction velocity (because they are all moving together at the point where they are connected). The force constraint is that all the transverse forces on the strings at the junction balance each other so that the junction force, which is the sum of the string forces, is 0. V = V γ γ = 1, 2,..., N N F γ = 0 (4.3) γ=1 Combining the wave variable definition, the wave impedance relationships, and the series junctions constraints, we can derive the general scattering equations for the N-port losses scattering junction (mith, 1987; mith, 1993): V = 2 N N V γ+ V γ = V V γ+ (4.4) γ= Connecting Two Junctions with a Bidirectional Unit Delay Consider two scattering junctions, A and B, interconnected by bi-directional unit delay as in Figure 4.2. Let the transverse velocity at junction A be V A and at junction B, V B. These junction velocities are equal to the endpoint velocities of the string represented

123 CHAPTER 4. OTHER MEH TRUCTURE 107 cattering Junction A V B A z -1 V A+ B V B+ A z -1 V A B cattering Junction B Figure 4.2: cattering Junctions Connected by a Bidirectional Unit Delay by the bidirectional unit delay. We will call the transverse velocity on the string which connects from junction A to junction B, measured at A, V B A. imilarly, we define V A B to be the transverse velocity on the string which connects from junction B to junction A, measured at B. Thus we have the wave variable decompositions, V A = V B A V B = V A B = V B+ A + V B A (4.5) = VB A+ + V B A (4.6) o, VA B+ is the incoming wave from B to A as it arrives at A, and VA B wave from A to B as it leaves A. The time-domain equations of the bidirectional delay are is the outgoing v B+ A (n) = va (n 1) va+ (n) = vb (n 1) (4.7) B B A or, in the Z-transform domain, V B+ A = z 1 VB A VB A+ = z 1 VA B (4.8) Using these relationships, we can derive an expression for the incoming wave at junction A from junction B in terms of the junction velocities of A and B only: VA B+ = z 1 VB A (4.9) = z 1 ( V B V A+ B ) (4.10)

124 CHAPTER 4. OTHER MEH TRUCTURE 108 [ ( )] = z 1 V B z 1 V A VA B+ olving for VA B+, ( ) z VA B+ 1 ( ) = 1 z 2 V B z 1 V A (4.11) (4.12) The General Finite Difference cheme Remember that these are N-port junctions, so that we can express the junction velocity at A in terms the sum of its input waves from the N surrounding junctions, V A = 2 N N γ=1 V Jγ+ A (4.13) where V Jγ+ A represents the incoming wave from junction J as it arrives at A. Generalizing Equation (4.12), we can write the N wave input velocities at the central junction, V Jγ+ A, in terms of the central junction velocity, V A, and the surrounding N junction velocities, V Jγ, ( ) V Jγ+ z 1 ( ) A = 1 z 2 V Jγ z 1 V A (4.14) Plugging (4.14) into (4.13) we can eliminate the wave input variables, and write an expression for the junction velocity at A in terms of only the velocities at the N surrounding junctions: V A = 2 ( ) z 1 N N 1 + z 2 V Jγ (4.15) γ=1 Apply the inverse Z-transform to arrive at the time-domain finite difference equation for a waveguide mesh built of symmetrical N-port junctions. v A (n) + v A (n 2) = 2 N N v Jγ (n 1) (4.16) γ=1 These equations apply to the cases N = 4, which was the subject of the last chapter. It can also be applied to the 2-D case N = 6, and N = 8 which we show next. It also applies to the 3-D rectilinear mesh case, when N = 6. The 2-D N = 3 triangular case is problematic, since the symmetry at the junction-to-junction level alternates. A similar

125 CHAPTER 4. OTHER MEH TRUCTURE 109 problem arises in the 3-D N = 4 tetrahedral case, which we will address later in the chapter Generalized Amplification Factors In Equation (4.16), the v Jγ are the junction velocities at the N spatial points, J γ. These points can lie in a plane, or in 3-D space around the central junction, v A. Let s assume 3-D, just to be more general. Taking the points J γ to be (x γ, y γ, z γ ), we can state the 3-D shift theorem in the Fourier domain as v k+xγ,l+y γ,m+z γ DFT I e jω kx γ e jω ly γ e jωmzγ v ωk,ω l,ω m (4.17) Re-stating the general mesh difference relationship, v A (n) + v A (n 2) = 2 N N v Jγ (n 1) (4.18) γ=1 we apply the Z-transform in the time domain, and the discrete-time Fourier transform on the infinite 3-D spatial series, to obtain: 1 + bz 1 + z 2 = 0 (4.19) where, b = 2 N The general spatial amplification factor is N e jω kx γ e jω ly γ e jωmzγ (4.20) γ=1 G = b ± j 4 b 2 2 (4.21) with plane wave propagation speed calculated as C(ω k, ω l, ω m ) = G ωk 2 + ω2 l + ω2 m (4.22)

126 CHAPTER 4. OTHER MEH TRUCTURE 110 Figure 4.3: 8-Port Rectilinear Mesh

127 CHAPTER 4. OTHER MEH TRUCTURE 111 Figure 4.4: Dispersion in the 8-Port Rectilinear Mesh 4.2 The 8-Port 2-D Multiply-Free Mesh ome effort has been expended in developing mesh structures that meet the multiplyfree definition, and in general, this has been an important consideration. At the time this research was done, in the mid 1990 s, cost of silicon multiplies was high, in cycles as well as in custom silicon. To some extent computation costs are less critical today, however, to the extent that custom silicon may still be an option for certain applications, the multiply-free constraint may yet be relevant. The 8-port mesh is another case of no-multiply junction computation. The 2/N term with N = 8 can be implemented with two right shifts. The structure is the only one we discuss where waveguide bidirectional unit delays actually cross over each other on the diagonals, as shown in Figure 4.3. Letting N = 8, and plugging into the general waveguide mesh difference equation 4.16, we have, v A (n) + v A (n 2) = 1 4 N v Jγ (n 1) (4.23) γ=1 Taking the limit as the sampling intervals approach 0, we find that this difference

128 CHAPTER 4. OTHER MEH TRUCTURE 112 Figure 4.5: 6-Port Triangular Mesh converges to the partial differential equation, u tt = 3 4 (u xx + u yy ) (4.24) Hence, the ideal wave speed, c = 3/ The 6-Port 2-D Mesh The 6-way 2-D mesh turns out to be one of the best implementations in terms of dispersion error. This mesh operates on a grid where the 6 surrounding spatial points are located at: ( 1, 0), ( 1/2, 3/2), (1/2, 3/2), (1, 0), (1/2, 3/2), ( 1/2, 3/2), As before, we can show that the difference scheme converges to the differential equation u tt = 2 3 (u xx + u yy ) (4.25) with the wave propagation speed, c = 2/3. Computing wave propagation speed for the 6-port triangular mesh (see Equation (4.22)), we find the dispersion is quite uniform in all directions and small compared to other formations, as shown in Figure 4.6.

129 CHAPTER 4. OTHER MEH TRUCTURE 113 Figure 4.6: Dispersion in the 6-Port 2-D Mesh The 6-Port 2-D Multiply-Free Non-Isotropic Mesh As a quick example of variations that can be applied to reduce number of multiplies in the mesh computation, Figure 4.7 illustrates a situation where 2 of the 6 wave impedances are taken to be double the other directions. In this case, the junction equations are multiply-free: V = 1 ] [V 1+ + V 2+ + V 3+ + V ] [V 5+ + V 6+ (4.26) 4 2 A little math reveals the spatial sampling is compressed by 3/5 in X direction to obtain isotropic behavior. 4.4 The 6-Port 3-D Rectilinear Mesh Rectilinear meshes compute an approximation of the lossless 3-D wave equation as well (avioja et al., 1995; Van Duyne and mith, 1993b). Figure 4.9 shows a representation of the 6-port 3-D mesh structure. Each junction computes standard 6-port scattering.

130 CHAPTER 4. OTHER MEH TRUCTURE 114 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Z 2 Figure 4.7: 6-Port Mesh with Non-Isotropic Wave Impedance Figure 4.8: Dispersion in the Non-Isotropic 6-Port Mesh

131 CHAPTER 4. OTHER MEH TRUCTURE 115 Figure 4.9: tructure of the 6-Port Rectilinear 3-D Mesh Animating the 6-Port 3-D Mesh Tim tilson implemented a full 3-D mesh bent cylindrical tube simulation (tilson, 1994), first published in (Van Duyne and mith, 1996). Figure 4.10 shows the 3-D wave front making its way around the turn of a U-shaped tube. This structure was used to study room acoustics modeling in (avioja et al., 1995) Dispersion Error We show dispersion plots for the 6-port rectilinear 3-D waveguide mesh with the same 1% contour line settings. Figure 4.11 shows a horizontal slice through the origin, and Figure 4.12 shows a diagonal slice through ω x = ω z. Figure 4.13, again, shows the response on the hemispherical surface, ω = π/2. idelight: The 6-way 3-D Multiply-Free Non-Isotropic Rectilinear Mesh For potential full-silicon implementations, a no-multiply solution for the rectilinear mesh is available by setting the wave impedances in one direction equal to twice the wave

132 CHAPTER 4. OTHER MEH TRUCTURE 116 Figure 4.10: Animation of the 3-D Rectilinear Mesh Modeling Compression Wave Through a Tube

133 CHAPTER 4. OTHER MEH TRUCTURE ω y ω x Figure 4.11: Rectilinear Dispersion: ω z = ω y ω x,ω z Figure 4.12: Rectilinear Dispersion: ω z = ω x

134 CHAPTER 4. OTHER MEH TRUCTURE ω y ω x Figure 4.13: Rectilinear Dispersion: ω = π/2 impedances in the other directions, and making the necessary adjustments to grid size in that direction. 4.5 The 3-Port 2-D Mesh Figure 4.14 shows a hexagonal mesh built out of three-port junctions. Note that the orientation of the junctions alternates. Referring to the detail Figure 4.15 we see that the central junction A has one port directly to the left, and two ports to the right, 60 up and 60 down. Junctions B, C and D all are just the opposite orientation: one port directly to the right, and two ports to the left, 60 up and 60 down. This makes the analysis a little trickier, since we cannot treat every junction as identical, and we must somehow represent the alternating pattern of junction orientations in the convergence analysis as well as the dispersion analysis.

135 CHAPTER 4. OTHER MEH TRUCTURE 119 Figure 4.14: The 3-Port 2-D Hexagonal Mesh

136 CHAPTER 4. OTHER MEH TRUCTURE 120 1/2 6 1 B D A 5 C 3 4 Figure 4.15: Close-up howing Alternating ymmetry Alternating ymmetry: Two Time teps Needed To address the alternating symmetry of the junctions and simplify the math, we expand the analysis by one more time step. Note that the positions of the junctions around Junction A two steps out, Junctions 1,2,3,4,5 and 6, are actually symmetrical no matter which junction we put at the center. In this way we can get a general computation of dispersion in the difference: ( z 1 ) (V B + V C + V D ) V A = z 2 [ ( )] 2 z 1 2 = 3V z 2 A + (4.27) 6 V γ (4.28) γ=1 V A = 4 ( ) z (2/3)z 2 + z 4 V γ (4.29) γ=1

137 CHAPTER 4. OTHER MEH TRUCTURE Computing the Finite Difference v n l,m vn 2 l,m + vn 4 l,m = γ=1 with surrounding junctions located two time steps out at v n 2 l+x γ,m+y γ (4.30) (x 1, y 1 ) = (0, 3) (4.31) (x 2, y 2 ) = (3/2, 3/2) (4.32) (x 3, y 3 ) = (3/2, 3/2) (4.33) (x 4, y 4 ) = (0, 3) (4.34) (x 5, y 5 ) = ( 3/2, 3/2) (4.35) (x 6, y 6 ) = ( 3/2, 3/2) (4.36) Verifying the FDA Converges to the PDE Define the continuous function: F(x, y, t, ε) = (4.37) u(x, y, t) + 2 u(x, y, t 2ε) + u(x, y, t 4ε) 3 (4.38) 4 6 u(x + x γ ε, y + y γ ε, t 2ε) 9 γ=1 (4.39) Plugging in the 3-D Taylor s eries Expansion, we compute the limit as grid size shrinks: lim ε Dispersion Results F (2ε) 2 = u tt 1 ) (u xx + u yy 2 Dispersion for the three-port mesh is fairly uniform, as shown in Figure (4.40) Animating the 3-Port 2-D Mesh Figure 4.17 illustrates a computed animation of the mesh in a sequence of time-domain snapshots.

138 CHAPTER 4. OTHER MEH TRUCTURE 122 Figure 4.16: Three-Port Dispersion 4.6 The 4-Port 3-D Tetrahedral Mesh Motivation for the Tetrahedral Mesh The 2-D digital waveguide mesh (Van Duyne and mith, 1993a; Van Duyne and mith, 1993b) has proven to be effective and efficient in the modeling of musical membranes and plates, particularly in combination with recent simplifications in modeling stiffness (Van Duyne and mith, 1994), nonlinearities (Van Duyne et al., 1994), and felt mallet excitations (Van Duyne et al., 1994). The rectilinear 3-D extension to the mesh had been suggested (Van Duyne and mith, 1993b), and has been applied to the case of room acoustics (avioja et al., 1995). However, it requires the use of 6-port scattering junctions, which make a multiply-free implementation impossible in the isotropic case. The 4-port scattering junctions of the 2-D mesh required only an internal divide by 2, which could be implemented as a right shift in binary arithmetic. However, the 6-port junction requires a divide by 3. The multiply-free cases occur for N-port junctions in which N is a power of two (mith, 1987). We propose here a tetrahedral distribution of multiply-free 4-port scattering junctions, with junction port placement analogous to the 4-bond carbon atom shown in Figure 4.18.

139 CHAPTER 4. OTHER MEH TRUCTURE 123 Figure 4.17: The Animated 3-way 2-D Hexagonal Mesh

140 CHAPTER 4. OTHER MEH TRUCTURE 124 Figure 4.18: Methane: Tetrahedral Bonds on the Carbon Atom These four-port junctions may fill space tetrahedrally analogous to the molecular structure of the diamond crystal shown in Figure 4.19, where the placement of the scattering junctions corresponds to the placement of the carbon nuclei, and the bi-directional delay units correspond to the four tetrahedrally-spaced single bonds between each pair of nuclei. We show that the tetrahedral mesh is mathematically equivalent to a finite difference scheme which approximates the 3-D lossless wave equation. We further compute the frequencyand direction-dependent plane wave propagation speed dispersion error The Tetrahedral Difference Figure 4.20 shows a small chunk of the tetrahedral mesh. We take the distance between adjacent junctions to be 1, and the junction point marked A to lie at the origin of an (x, y, z) cartesian coordinate system. We arrange the junctions B(0, 2 2/3, 1/3), C( 2/3, 2/3, 1/3), D(0, 0, 1), and E( 2/3, 2/3, 1/3) tetrahedrally about point A(0, 0, 0). The line segments between these junction points represent bi-directional delay units of the form shown in Figure The equations describing the computation of the lossless 4-port scattering junctions are (mith, 1987; Van Duyne and mith, 1993a; Van Duyne and mith, 1993b), V A = 1 2 Γ V Γ+ A (4.41) V Γ A = V A V Γ+ A (4.42)

141 CHAPTER 4. OTHER MEH TRUCTURE Figure 4.19: Diamond: The Tetrahedral Carbon Mesh

142 CHAPTER 4. OTHER MEH TRUCTURE E 6 B 9 A D C Figure 4.20: 3-D Tetrahedral Mesh tructure cattering Junction A V B A z -1 V A+ B V B+ A z -1 V A B cattering Junction B Figure 4.21: Bi-Directional Delay Unit

143 CHAPTER 4. OTHER MEH TRUCTURE 127 where Γ ranges over the four junction points surrounding A, namely Γ {B, C, D, E}. V A represents the junction velocity at junction A. VA Γ+ Γ and VA represent the input and output signals, respectively, of junction A in the direction of junction Γ. ince the junctions are interconnected with bi-directional delay units, the input to junction A from the direction of Γ is equal to the output from Γ delayed by one sample. In the Z-transform domain we my write this relationships as, V Γ+ A = z 1 V A Γ (4.43) Using (4.42) and (4.43), we obtain an expression for the input signal to junction A from the Γ direction in terms of the junction velocities A and Γ only, ( ) VA Γ+ = z 1 VΓ A = z 1 V Γ V A+ = z 1 [ V Γ z 1 ( V A V Γ+ A Γ )] (4.44) (4.45) which implies, ( ) z VA Γ+ 1 ( ) = 1 z 2 V Γ z 1 V A (4.46) We substitute (4.46) into (4.41) to get an expression for the junction velocity V A in terms of the four surrounding junction velocities V Γ, V A = 1 ( ) z z 2 V Γ (4.47) Γ Unfortunately, the orientations of the tetrahedra vary from point to point. Notice in Figure 4.20 that the tetrahedron around point A and that around point B are in vertically opposite orientations. However, consider the relationship between the center point A and the twelve equally-spaced junctions marked 1 through 12, which are all equidistant from A, and which are two time steps away from A. With some imagination, one can see that the directional relationships between point A and the outer twelve points repeats itself around every point in the mesh, regardless of orientation of the inner four points, B, C, D, and E. Therefore, we take note of the following relationships, which may be derived in a

144 CHAPTER 4. OTHER MEH TRUCTURE 128 manner similar to (4.47), ( z 1 V Γ = z 2 ) V A + γ Γ V γγ (4.48) where Γ {B, C, D, E} and γ B {2, 8, 9}, γ C {3, 4, 5}, γ D {10, 11, 12} and γ E {1, 6, 7}. Plugging (4.48) back into (4.47), we get an expression for V A in terms of the junction velocities of the twelve junctions, V i : V A = 1 ( ) z z 2 + z 4 V i (4.49) i=1 To see that this partial difference equation approximates the continuous time wave equation, we first multiply through by the denominator in (4.49), inverse Z-transform, and gather all the terms onto the left-hand side. Then, we view the equation as a continuous time and space expression of the form F(t, p) = 0, where F(t, p) is, 2 v(t 2kε, p) 1 12 v(t 2ε, p + P 4 i ε) (4.50) k=0 i=1 and p is now the arbitrary spatial position of junction A, and the P i represent the twelve directional vectors from point A to the junction points marked 1 through 12 in Figure 4.20, respectively. The unit time and space steps are taken to be ε Converging to the PDE We may expand (4.50) in a four dimensional Taylor series about the point p = (0, 0, 0) at time t = 0, replacing each term of (4.50) with something of the form, n t n x n y n z (n v t,n x,n y,n z) 0 t nt x nx y ny z nz n t!n x!n y!n z! (4.51) Collecting terms and computing the limit reveals that lim ε 0 F (2ε) 2 = u tt 1 3 [u xx + u yy + u zz ] (4.52)

145 CHAPTER 4. OTHER MEH TRUCTURE ω z ω y Figure 4.22: Tetrahedral Dispersion: ω x = 0 Evidently, the tetrahedral waveguide mesh is equivalent to an FD approximating the continuous wave equation. The apparent wave speed is c = 1/3, which is the numerically optimal speed in the Courant-Friedrichs-Lewy sense (Courant et al., 1956; trikwerda, 1989). (Incidentally, we found it convenient to use the symbol manipulating feature of the mathematics processing language Mathematica to verify the algebra.) Dispersion Analysis To quantify dispersion error in the tetrahedral mesh, we apply a von Neumann analysis directly on the FD (trikwerda, 1989; Van Duyne and mith, 1993a). Essentially, we transform the FD into the frequency domain in both time and space, replacing spatial shifts with their corresponding spatial linear phase terms. Then we observe how the spatial spectrum updates after one time sample. With this information, we can determine how fast the various plane waves travel in the mesh at each frequency. There can be no attenuation since the mesh is constructed from lossless scattering junctions. Therefore, the only departure from ideal behavior, aside from round-off error, is traveling-wave dispersion.

146 CHAPTER 4. OTHER MEH TRUCTURE ω z ω x Figure 4.23: Tetrahedral Dispersion: ω y = ω y ω x Figure 4.24: Tetrahedral Dispersion: ω z = 0

147 CHAPTER 4. OTHER MEH TRUCTURE ω y ω x Figure 4.25: Tetrahedral Dispersion: ω = π/2 In order to avoid the difficulty of defining a discrete Fourier transform over a tetrahedrally sampled space, we consider the discrete-time/discrete-space difference scheme to be in continuous space by replacing the sample points in space by their corresponding generalized impulse functions, filling the regions in between them with zeros. In this formulation, the tetrahedral difference scheme applies to all points in space continuously; however, since there shall only be initial conditions at the tetrahedral mesh sampling points, the zero regions will remain at zero as the difference scheme progresses through time. We may now take the spatial Fourier transform of (4.49) and replace the spatial positions of the twelve outer junction points with their corresponding linear phase terms, V i V (ω)e jp T i ω, where ω is the three-dimensional spatial frequency vector, to obtain the following quadratic expression in z 2 : 1 + bz 2 + z 4 = 0, b = i=1 e jp T i ω (4.53) where z 2 represents two time samples of delay. Due to the symmetrical orientation of

148 CHAPTER 4. OTHER MEH TRUCTURE 132 vectors P i, as indicated in Figure 4.20, it may be shown, rather remarkably, that the value of b remains a real number between 2 and 2 for all values of ω. Hence, we may define G 2 (ω) = b 2 ± j 4 b 2 2 (4.54) where G is the spectral amplification factor of the spatial spectrum after one time sample. It is easy to show that G 1, hence plane waves propagate losslessly. We note that the phase of G corresponds to the spatial phase shift of a plane wave in the direction of travel in one time sample, where G = 1 2 arctan ± 4 b 2 b (4.55) Hence, the phase distance traveled in one time sample by a spatial plane wave of frequency ω and direction ω is c (ω) = G/ ω, where c (ω) is the frequency dependent speed of plane wave travel measured in space samples per time sample. (Phase distance corresponds to phase advance in time domain language.) Dispersion Results Figures 4.22, 4.23 and 4.24 show contour plot slices along the planes ω x = 0, ω y = 0, and ω z = 0, respectively, of the normalized plane wave speed c (ω)/c in the tetrahedral mesh. The innermost contour line is drawn at 99% of full speed and subsequent lines are drawn at 1% intervals. Because of the spatial sampling interval, there is a Nyquist limit on the spatial frequencies which may be supported on the mesh, namely ω < π. In addition, all transfer functions definable at any one junction, and the denominators of all transfer functions definable between any pair of junctions, are functions of z 2, as may be seen from Figure Therefore, frequencies above π/2 are not independent, and are constrained to be a copy of the frequencies below π/2. We have superimposed a circle marking this limit in the contour plots. The central area of each plot corresponds to lower spatial frequencies, and the outer regions correspond to higher spatial frequency. angular position of a point on each plot indicates the direction of the wave travel in the planar slice being shown. Figure 4.25 shows the response on the hemispherical surface, ω = π/2, where ω z = (π/2) 2 ωx 2 ωy. 2 The

149 CHAPTER 4. OTHER MEH TRUCTURE 133 Both the rectilinear and the tetrahedral mesh have reasonable dispersion characteristics. And both model a wave speed of c = 1/3 space samples per time sample Benefits of the Tetrahedral Mesh Over the Rectilinear Mesh Practical benefits of using the tetrahedral 4-port mesh over using the rectilinear 6-port 3-D mesh can be summarized as follows: The tetrahedral mesh uses 35% fewer junctions than the rectilinear mesh per unit volume. It also uses 57% less delay memory. The rectilinear mesh uses 1 multiply per junction, whereas the tetrahedral mesh is multiply-free. The rectilinear mesh uses 11 adds per junction, whereas the tetrahedral mesh uses 7 adds per junction. Although the bookkeeping required to develop code or silicon to implement the tetrahedral mesh requires some clever indexing, overall the extra effort may be worth the trouble in large systems.

150 Chapter 5 The Passive Nonlinear Filter 5.1 Nonlinearity in Musical Instruments: pectral Energy preading Among the various approaches to the digital synthesis of musical sounds, some involve the production and excitation of linear resonances which are characteristic of a musical instrument. The Karplus-trong plucked-string algorithm (Karplus and trong, 1983; Jaffe and mith, 1983) models the vibrating string as a delay line loop. This is a special case of the physics-based digital waveguide modeling technique (mith, 1992) which is applicable to many kinds of synthesis from strings to acoustic tubes (mith, 1987; Cook, 1990; Hirschman, 1991; Välimäki, 1995). The vibrating membrane and other two- and three-dimensional musical structures have been physically modeled using the 2-D digital waveguide mesh (Van Duyne and mith, 1993b) and are described in earlier chapters. It is in the context of these kinds of wave-decomposed digital modeling schemes that the present passive nonlinear filter most naturally resides. While properly excited resonances of linear systems can closely approximate the tones of some instruments, nonlinearity plays an essential part in the sound of other instruments. Fletcher and Rossing (Fletcher and Rossing, 1991) observe that after striking cymbals, Chinese gongs or tam-tams, the spectra become brighter with time. The higher portions of the spectra rise in comparison with the lower portions. The relative rise in higher frequencies, which is essential to the timbre of the sound, comes about because nonlinearities transfer vibrational energy from lower frequency to higher frequency modes. 134

151 CHAPTER 5. THE PAIVE NONLINEAR FILTER 135 Beyond this, Lagge and Fletcher (Lagge and Fletcher, 1984) have shown that small nonlinearities in the compliance of a bridge supporting one end of a vibrating string can cause the transfer of energy among modes of vibration. Thus, nonlinearities may have a smaller but nonetheless important effect on the tones of some stringed instruments. We have found that the addition of passive nonlinearities to an otherwise linear digital synthesis algorithm can cause the transfer of energy among modes, and can lead to large and interesting alterations and evolutionary changes in timbre. In physical instruments nonlinearities are necessarily passive because physical nonlinearities cannot cause an increase in total energy, but can only transfer energy among modes. The use of nonlinearities that are inherently passive in digital sound synthesis is important because other ways of adding nonlinearity can result in instability or oscillation. If our passive nonlinearity is also lossless, we can avoid unwanted, or unpredictable loss in our system as well. The means we have used for adding nonlinearities is to incorporate a circuit element that is necessarily passive. The circuit element we have used is a spring that is stiffer for deflection in one direction than in the other, or a capacitance that has a different value for positive than for negative voltages. uch an element stores no energy at zero deflection (spring) or at zero voltage (capacitor). Any energy that is stored by an increase or decrease in deflection or voltage will be given up as the voltage goes to zero. The element can store and release energy, but it cannot produce energy. We have found that the use or addition of this simple element is economical in computation and effective in causing energy transfer among otherwise linear modes. It can lead to a substantial and pleasing alteration in the sound produced. Our addition of passive nonlinearities is different from the use of nonlinearities to excite or maintain oscillations of blown or bowed instruments (mith, 1987). The purpose of the passive nonlinearities we have used is not to initiate or maintain oscillation, but to modify the spectrum naturally over time by transferring energy among modes. The research presented in this chapter was developed in collaboration with John R. Pierce, and was first published in (Pierce and Van Duyne, 1997a; Van Duyne et al., 1994) and (Pierce and Van Duyne, 1997b).

152 CHAPTER 5. THE PAIVE NONLINEAR FILTER delay line * ε + 1 ε lowpass filter Figure 5.1: Delay Loop with quare Law Nonlinearity 5.2 Memoryless Nonlinearities While many spectral modifications can be achieved by memoryless nonlinearities (Rodet, 1994), energy conservation is difficult to control without additional amplitude tracking and/or scaling elsewhere in the loop. For example, Figure 5.1 illustrates a simple resonant delay line loop with a lowpass attenuation filter, much like the Karplus-trong pluckedstring algorithm (Karplus and trong, 1983), which has been modified to include a square law nonlinearity within the feedback loop. The ε and 1 ε scalings allow some control over how much nonlinearity shall be present in the loop. For small ε, a pleasant spectral brightening may occur over time. We note that, interpreted physically, this kind of memoryless nonlinearity corresponds to a string terminated with a dashpot whose coefficient varies with the force applied to it, or to an oscillating transmission line terminated with a resistor whose coefficient depends on the voltage drop across it. In Figure 5.1, the choice of scaling coefficients will guarantee passivity of the system, however, as we increase ε, thereby increasing the amount of nonlinearity in the system, the nonlinear dashpot becomes more and more lossy. Yet, for gongs and cymbals, a large nonlinear effect is required. We might adjust the scaling factors to allow more nonlinearity without as much loss, but this could correspond to physical systems where the terminating dashpot has a negative, non-passive, coefficient for certain forces and we risk instability without a careful monitoring of the overall loop gain. To resolve this dilemma, we have approached the problem through physical modeling of a passive nonlinear system with internal state. We have derived a nonlinear filter based on a real physical system constructed from passive, lossless elements only, namely two

153 CHAPTER 5. THE PAIVE NONLINEAR FILTER 137 springs of differing stiffness. 5.3 Passive Nonlinearity: The Physical Concept First Attempt: The Bent pring Termination The first attempt was to develop a model of a string terminated with a bent springy bridge (Pierce, 1993a). Figure 5.2 shows an artist s rendering of this above, and a gong viewed as a bent plate below. The idea is that the essential functional aspect of the gong is the presence of many bends in the plate which function in a manner similar to the bent termination of the string. John R. Pierce actually constructed a physical monochord made of wood and metal with a single string with such a termination and was able to demonstrate, by plucking the string, the energy in the fundamental was being transferred nonlinearly into the second mode an octave above. We can understand the mechanism of this transfer as follows: As the string vibrates in its pure first mode up and down at frequency f 0, it pulls on the springy termination twice per period (once at the upper extremity of its excursion, and once at the lower extremity. Because the springy termination is at a 45 angle, as it gets pulled in twice per period, it also bends up and down twice per period, thus driving the string at transverse frequency 2f 0. While this model provided excellent intuition, it proved difficult to find a mathematically efficient digital filtering model of the physics. The following nonlinear mass-spring circuit offered more opportunities to the wave-theoretic physical modeling techniques econd Attempt: The Mass-pring ystem with Alternating k Consider a passive nonlinear physical mass/spring oscillator as shown in Figure 5.3. In this system, the springs are taken to be at rest when the mass is at displacement zero, touching both springs, but feeling no force from either spring. When the mass is at a positive displacement, it is feeling force from the upper spring with stiffness constant k 1 ; when it is at negative displacement, it is feeling force from the lower spring with stiffness constant k 2. Note that the resultant oscillation is clearly periodic, but that the upper half of the cycle is at a different frequency and has a different maximum displacement than the lower

154 CHAPTER 5. THE PAIVE NONLINEAR FILTER 138 Figure 5.2: tring with Bent pringy Termination and Gong Viewed as Bent Plate

155 CHAPTER 5. THE PAIVE NONLINEAR FILTER 139 lower frequency greater maximum displacement k 1 k 1 m k 1 k 1 k 1 m m m m k 2 k 2 k 2 k 2 k 2 time smaller maximum displacement higher frequency Figure 5.3: Passive Nonlinear Mass/pring Oscillator half of the cycle. When k 1 and k 2 are nearly equal, but different, this nonlinear oscillator has an essentially sinusoidal response, but with a rolling off set of harmonic overtones due to the slight discontinuity at displacement zero crossings. + v i { C C = 1, v 0 C2, v < 0 Figure 5.4: Equivalent Electrical Capacitance Circuit

156 CHAPTER 5. THE PAIVE NONLINEAR FILTER v i L = { L 1, i 0 L2, i < 0 Figure 5.5: Equivalent Electrical Inductance Circuit The Equivalent Electrical Circuit: Nonlinear Inductor or Capacitor This nonlinear spring circuit can be viewed in the electrical domain as shown in Figure 5.4: The nonlinear spring is mathematically equivalent to a nonlinear capacitor whose capacitance value depends on the sign of the voltage across it (Pierce, 1993b). Voltage, v, replaces mechanical force, f; and current, i, replaces mechanical displacement velocity, v. Figure 5.5 shows the dual circuit with voltage and current interchanged. In this case, the inductance value depends on the direction of the current flow through the circuit. Examples of electrically equivalent circuits of physical impedances found in musical instruments can be found in (Fletcher and Rossing, 1991). More on linear electrical circuits can be found in (Cruz and Van Valkenburg, 1974) tring Terminated with a Nonlinear pring Consider a string terminated by a double spring apparatus as shown in Figure 5.6. Three states of the system are shown in the figure: First, the lower spring is compressed, while the upper spring is at rest; second, both springs are at rest; and, third, the upper spring is compressed, while the lower spring is at rest. In effect, the spring termination apparatus is equivalent to a single nonlinear spring whose stiffness constant is k 1 when the displacement is positive and k 2 when the displacement is negative. Now consider what is happening to the energy in the system. When the lower spring is compressed, some energy from the string is converted to potential energy stored in the spring. When the lower spring returns to its rest state, the stored spring energy is entirely returned to the string, and the spring contains no stored energy. When the upper spring is then compressed, exactly the same kind of energy exchange occurs. This ideal system

157 CHAPTER 5. THE PAIVE NONLINEAR FILTER 141 at rest k 1 compressed k 2 at rest k 1 at rest k 2 compressed k 1 at rest k 2 Figure 5.6: tring Terminated with Double pring

158 CHAPTER 5. THE PAIVE NONLINEAR FILTER R 0 Transmission line or other resonant system + v i C C = 1, v 0 { C2, v < 0 Passive Non-Linear Capacitor Figure 5.7: Nonlinearly Terminated Transmission Line is physically passive and lossless since energy is neither created nor destroyed. If the spring stiffness constant had changed while stored potential energy was still in the spring, i. e., when one of the springs was still compressed, the stored energy would be scaled by the new relative stiffness of the spring. In this case, the stored energy before the stiffness change would be different from the stored energy after the stiffness change, leading to the creation or loss of energy, possibly resulting in a non-passive system. In our model of this physical system, we must be careful to change the spring stiffness coefficient at the right time, to preserve passivity and losslessness. Passivity is the requirement that no energy be created by the system. When energy is created in a feedback loop, stability problems may ensue. We have specifically tried to discover a nonlinear system which is passive, and which is lossless, so the system loss may be decoupled from the nonlinear effect, and designed separately. Figure 5.7 shows a transmission line (Kock, 1937; Magnusson, 1970) terminated with a nonlinear capacitance circuit. This is an electrically equivalent circuit to the string terminated by nonlinear spring shown in Figure 5.6. Here, the electrical characteristic impedance of the transmission line corresponds to the mechanical wave impedance of the string, R Nonlinear Filter Derivation We will first derive the linear spring equations, then terminate a string with a linear spring. From there we determine how to vary the spring stiffness appropriately, and investigate the way in which energy spreads through the modes.

159 CHAPTER 5. THE PAIVE NONLINEAR FILTER 143 f k x Figure 5.8: imple Linear pring ystem The imple Linear pring The force equation for the ideal linear spring shown in Figure 5.8 is, f(t) = kx(t) = df(t)/dt = kv(t) (5.1) where f(t) is the force applied on the spring, x(t) is the compression distance of the spring, v(t) is the velocity of compression, and k is the spring stiffness constant. Taking the Laplace transform, and assuming no initial force on the spring, we get, F (s) = (k/s)v (s) (5.2) Here, k/s is the lumped impedance of the spring. etting s = jω will give the frequency response of this system Terminating a tring with a pring Figure 5.9 shows a string terminated by a spring. The physical force at the string termination is the sum of the transverse force waves on the string at that point, f = f r + f l, while the physical velocity at the termination is the difference between the force waves scaled by 1/R 0, v = (1/R 0 )(f r f l ). We may, therefore, re-formulate Equation (5.2) as a transfer function from F r to F l, F (s) = (k/s)v (s) (5.3) F r (s) + F l (s) = (k/s) F r(s) F l (s) R 0 (5.4)

160 CHAPTER 5. THE PAIVE NONLINEAR FILTER 144 Wave Impedance R 0 f r f l k Figure 5.9: tring Terminated by imple pring F l (s) = k/s R 0 k/s + R 0 F r (s) (5.5) The force wave transfer function is stable and allpass since its pole is at s = k/r 0 and its zero is s = k/r 0, where k and R 0 are defined to be positive real numbers Bilinear Transform from s-plane to z-plane To move from the continuous physical system to the discrete digital filter, we use the conformal bilinear transform from the s-plane to the z-plane (Nehari, 1952), s α 1 z z 1 (5.6) The bilinear transform maps DC in the continuous system to DC in the digital system, while mapping infinite frequency in the continuous system to half the sampling rate, or the Nyquist frequency, in the digital system. α is a degree of freedom which may be used to control the frequency warping. It is usual to choose α = 2/T to obtain faithful frequency response at the low end of the frequency range. We apply the bilinear transform to Equation (5.5) to obtain, F l (z) = H(z)F r (z) (5.7) where, H(z) = a 0 + z a 0 z 1 and a 0 = k αr 0 k + αr 0 (5.8)

161 CHAPTER 5. THE PAIVE NONLINEAR FILTER 145 z -1 f r (n) + u(n) z -1 a 0 + f l (n) Figure 5.10: The Allpass pring Termination a 0 ranges from 1 to 1 as k ranges from 0 to. α is a degree of freedom in the bilinear transform allowing some control over the nature of the frequency warping in moving from continuous time to discrete time. By a similar derivation, we may obtain the equivalent velocity wave transfer function, V l (z) = H(z)V r (z) (5.9) Figure 5.10 shows a system diagram of the spring termination, H(z), using the force wave construction given in Equations (5.7) and (5.8) Making the pring Nonlinear ince the filter coefficient, a 0, represents the spring stiffness, we need only change a 0 to effect a change in the stiffness of the spring termination. We must, however, effect the change just at the point where the spring is at rest to preserve physical and digital passivity and losslessness Finding the Digitally Correct Coefficient Gating ignal Referring to Figure 5.10, consider the case where the input signal to the filter is always zero, f r (n) 0, but where there is some internal state value, namely, let u( 1) = u 0. ince, we see from the system diagram, u(n) = a 0 u(n 1) (5.10) = ( a 0 ) n+1 u 0 (5.11)

162 CHAPTER 5. THE PAIVE NONLINEAR FILTER 146 we can, then, write the filter output signal, due only to the internal filter energy state ringing out, as, f l (n) = a 0 u(n) + u(n 1) (5.12) = a 0 [ a 0 u(n 1)] + u(n 1) (5.13) = (1 a 2 0 )u(n 1) (5.14) = (1 a 2 0 )( a 0 ) n u 0 (5.15) If we change the filter coefficient, a 0, it is clear that the internal state energy will ring out of the filter with a different decay rate than if the coefficient had not been changed. uch coefficient changes, if made arbitrarily, may lead to instability in a feedback loop. However, if u 0 is zero or near zero, we change the coefficient with relative impunity, since the resultant discontinuity in the state energy will be minimal or zero. Therefore, we choose to gate the filter coefficient change on the sign of u(n), to maintain passivity in the nonlinear allpass filter. As noted, there may necessarily be some small state energy in the filter at the time that the coefficient changes. In nonlinear string modeling for the purposes of musical instrument sound synthesis, there is generally a frequency-dependent summary loss filter in the loop making the small energy variation insignificant. However, there are a number of things that can be done to mitigate this small error further. One simple thing would be to compute the allpass filter one sample ahead with the first coefficient to see if the state will change signs. If it does change signs, then re-compute the filter with an intermediate interpolated filter coefficient for just one sample before switching to the second coefficient (Abel and Van Duyne, 2007). In addition, ways to eliminate allpass transients have been described in (Välimäki et al., 1995). Why u(n) is the Physically Correct Gating ignal From the allpass filter implementation in Figure 5.10, we may observe that, f l (n) = a 0 u(n) + u(n 1) (5.16)

163 CHAPTER 5. THE PAIVE NONLINEAR FILTER 147 Also we have, u(n) = f r (n) a 0 u(n 1) = f r (n) = u(n) + a 0 u(n 1) (5.17) ince, the actual physical force applied to the spring termination is equal to the sum of the input and output force waves, we may derive an expression of the actual force on the spring, f(n), from (5.16) and (5.17), f(n) = f r (n) + f l (n) (5.18) = [u(n) + a 0 u(n 1)] + [a 0 u(n) + u(n 1)] (5.19) = (1 + a 0 )[u(n) + u(n 1)] (5.20) Equation (5.20) says that the actual physical force on the spring is proportional to a linearly interpolated value of signal u at time n 0.5. From Equation (6.22), displacement of the spring termination is zero when force is zero, and f(n) is zero when u(n)+u(n 1) is zero. Therefore, when u changes sign between times n 1 and n, the spring displacement is closest to zero. This is the physically correct time to let the spring stiffness coefficient change for the nonlinear spring termination system given in Figure 5.6. Digital Interpretation The internal filter state signal, u(n), represents the energy stored in the filter. Assuming no input signal, i. e., f r (n) 0, and some internal state value at time n = 1, namely, u( 1) = u 0, we may then compute the output of the filter caused only by this internal energy state value as, f l (n) = (1 a 2 0 )( a 0 ) n u 0 (5.21) This method of gating the coefficient change is both physically correct and digitally correct Implementation Figure 5.11 shows a digital system diagram for the nonlinear string/spring system of Figure 5.6. Note that, for convenience, we use a look up table notation to show how u(n) gates the coefficient change; but, in general, this would be implemented in simple conditional logic. Note that the rate of spreading, and the spectral region where it is most

164 CHAPTER 5. THE PAIVE NONLINEAR FILTER 148 excitation + N samples of delay f r (n) + a 1 u(n) a 2 z -1 output Loss De-tuning f l (n) + z -1 Figure 5.11: Nonlinear tring/pring ystem active, may be controlled by the choice of a 1 and a Why It Works from a Phase Modulation Perspective The time varying allpass termination filter shown in Figure 5.11 is essentially lossless and passive. However, for it to be useful it must behave in the desired manner. Energy in existing resonant modes of the main system must be caused to spread locally in the spectrum to nearby modes of the system, as is observed in real musical instruments (Fletcher and Rossing, 1991). Empirically, this seems to happen, as seen in Figures 5.17 through However, this filter is difficult to analyze strictly, due to its signal dependent time variation and due to its inclusion in a feedback loop system. Nonetheless, we may obtain an intuitive understanding of its operation by considering a simpler, but non-passive, form. The termination filter in Figure 5.11 is essentially a one pole allpass filter with a time varying coefficient. We may study the effects of this filter in a feedback loop by studying the effects of coefficient variation on a one pole allpass filter. We, first, consider how the phase response of such a filter depends on its coefficient, then, how sinusoidal variation of that coefficient generates sidebands in the output signal. From there, we will see how the sort of time variation defined in this filter structure will generate desirable energy spreading in a feedback loop.

165 CHAPTER 5. THE PAIVE NONLINEAR FILTER H(e jω ) ω a0 = -.8 a0 =.8-3 Figure 5.12: Phase Response of the One Pole Allpass Filter Phase Response of the One Pole Allpass Filter Consider the force wave transfer function given in Equation (5.8). This is a one pole allpass filter. Its gain is unity and, in general, its phase response, H(e jω ), decreases monotonically from 0 to π/2 as ω goes from 0 (DC) to π (Nyquist frequency). Figure 5.12 shows several overlaid phase response plots for this filter with different coefficient values, a 0 ranging from 0.8 to 0.8. Now, consider two allpass filters, H 1 (z) and H 2 (z) which have two different coefficients, a 1 and a 2, respectively. Let a 1 = a center + a/2 and a 2 = a center a/2, where a center is the center of variation (a center = (a 1 + a 2 )/2), and a is the maximum deviation ( a = a 2 a 1 ). Figure 5.13 shows the difference in phase responses of the two filters, H 1 (e jω ) H 2 (e jω ), for a series of coefficient pairs generated by letting a center range from 0.8 to 0.8, and holding a constant at 0.3. What the plot shows is that a center determines which region of the spectrum has the greatest phase response variation for a given a. Figure 5.14 shows the phase response difference for a series of coefficient pairs generated by holding a center constant at 0.5 and letting a range from 0.1 to 0.6. This plot shows

166 CHAPTER 5. THE PAIVE NONLINEAR FILTER H 1 (e jω ) H 2 (e jω ) ω a 1,2 = -.8 ±.15 a 1,2 =.8 ±.15 Figure 5.13: Effect of Varying a center how a determines the amount of phase response variation for a given a center inusoidal Variation of the Coefficient If we drive the one pole allpass filter, H(z), with a sinusoid of frequency f 1, and vary the coefficient, a 0, sinusoidally at frequency f 2 around some center value, a center, with deviation a, we should expect the filter to apply a quasi sinusoidal phase modulation to the input signal due to the phase response variation predicted in the preceding paragraphs. The resultant output signal of the filter should contain sidebands around the driving frequency, f 1, separated by the coefficient modulating frequency, f 2. Furthermore, the deviation, a, should determine the index of modulation, in the FM sense, and thus, the amount of energy in the sidebands. Figure 5.15 shows the magnitude response on a db scale of H(z), with sinusoidally varying coefficient, a 0 (n) = 0.7 cos(2πf 2 nt ), driven by an input sinusoid, cos(2πf 1 nt ), where f 1 = 8000 Hz, f 2 = 2000 Hz, and the sampling interval, T = 1/44100 seconds. Figure 5.15 verifies that the filter output is very near to the predicted phase modulation, containing a set of sidebands of the form, cos(2πf 1 T ± k2πf 2 T ).

167 CHAPTER 5. THE PAIVE NONLINEAR FILTER H 1 (e jω ) H 2 (e jω ) a 1,2 = -.5 ±.05 ω a 1,2 = -.5 ±.3-3 Figure 5.14: Effect of Varying a Figure 5.15: Output pectrum from inusoidally Driven, inusoidally-modulated Allpass Filter

168 CHAPTER 5. THE PAIVE NONLINEAR FILTER 152 Figure 5.16: Evolving pectrum of tring/pnf ystem tep Variation of the Coefficient In general, if we flip the coefficient of a one pole allpass filter between two values periodically, the coefficient signal, a 0 (n), is then a square wave with a spectrum containing rolling off odd harmonics. The output signal spectrum produced by this kind of coefficient modulation will contain greater emphasis in the odd sidebands than a simple sinusoidallymodulated filter, due to the odd harmonics in the coefficient modulation signal. For coupling to occur in the resonant system, the sidebands produced by the modulated allpass filter must fall on supported modes of the system. When a sideband coincides with a supported mode, that mode will be driven by the energy in the appropriate sideband. Energy from sidebands which do not fall on supported modes will not drive any particular mode and will simply be absorbed back into the system. In the passive nonlinear filter structure, we choose to gate the coefficient alternations on the state signal u(n) as shown in Figure ince the coefficient signal will have the same effective fundamental as the driving input signal, we can expect the resultant sidebands to fall on multiples of the effective fundamental of the input signal, thereby driving at least some supported modes of the system. The sidebands are, therefore, tuned well for energy spreading to occur into nearby system modes on a string. Figure 5.16 shows the gradual spreading out of spectral energy of a waveguide string system terminated with the passive nonlinear filter.

169 CHAPTER 5. THE PAIVE NONLINEAR FILTER 153 khz Figure 5.17: Harmonic Loop with Lowpass Filter 10.0 sec khz sec Figure 5.18: Harmonic Loop with Lowpass Filter and Passive Nonlinear Filter

170 CHAPTER 5. THE PAIVE NONLINEAR FILTER 154 khz Figure 5.19: Inharmonic Loop with Lowpass Filter 20.0 sec khz sec Figure 5.20: Inharmonic Loop with Lowpass Filter and Passive Nonlinear Filter 5.6 imple Models of pectrally Active ounds We tested the passive nonlinear filter in a variety of musical situations. hown here are comparisons of the spectral evolution, with and without nonlinearity, of two sounds generated by essentially the model in Figure In the first example, Figure 5.17 shows the spectral evolution of a simple delay line plus lowpass filter loop excited in such a way that the third harmonic is highly attenuated, and in which the nonlinear filter is de-activated. We see a natural exponential decay with higher frequency modes decaying faster than low frequency modes. In Figure 5.18, the passive nonlinear filter has been activated with the result that the spectrum brightens over time; in particular, the initially missing third harmonic builds up energy, as do several higher harmonics. After a few seconds, the effect of the lowpass filter in the loop takes over and the loop decays out.

171 CHAPTER 5. THE PAIVE NONLINEAR FILTER 155 In the second example, the same system is used with the addition of an allpass filter in the loop to detune the modes slightly giving it a more bell-like tone. Figure 5.19 shows the spectral evolution when the nonlinear filter is de-activated. Figure 5.20 shows the result when the nonlinear filter is operating. Note that the modes exchange energy among themselves in a more dynamic manner in this inharmonic case. In addition to these simple loop cases, we have produced promising gong sounds by incorporating passive nonlinearities into the 2-D digital waveguide mesh membrane model (Van Duyne and mith, 1993b; Van Duyne et al., 1994). Figure 6.14 in the next chapter shows the structure of the waveguide mesh gong model, with passive nonlinear filters terminating the sides. 5.7 ummary The passive nonlinear filter structure has many musically useful features: 1. It is not a look up table, nor is it a memoryless combination of two or more separate signals. Rather, it has an internal state: Its effect is dependent not only on the current input sample, but also on previous input and output samples. 2. The coefficient variation is specialized: we change the coefficient only when the stored energy in the internal state is crossing zero. When the energy state is building up or dissipating, we hold the coefficient constant. Therefore, there is neither creation nor loss of energy. The result is that we may introduce a filter of this type into a feedback loop with no worries about system stability; and the nonlinear effect is completely decoupled from system loss considerations. 3. The coefficient variation is independent of the overall evolution of the musical tone. This means that multiple attack transients may be introduced into the system while it is still running without having to reset the parameters. The variation control parameters are constant for a given physical model. 4. The nonlinear filter is actually a correct physical model of a real passive nonlinear physical system. It may, therefore, be connected into any physical model in a physically intuitive way.

172 CHAPTER 5. THE PAIVE NONLINEAR FILTER It spreads energy smoothly and locally in the spectrum in a manner qualitatively equivalent to nonlinear energy spreading observed in real musical instruments, such as the cymbal and the Chinese gong. The nature of the energy spreading is controllable in the following ways: (a) The rate of spreading may be adjusted continuously from very slow to very fast with one parameter. (b) The region of the spectrum affected by the nonlinearity may be tuned, so that energy in modes of a particular region of the spectrum will spread more quickly than energy in other regions. (c) Combining these control parameters, one may construct a group of cascaded, or individually attached filters tuned to particular regions of the spectrum, and given specific spreading rate parameters, thereby, shape the way in which energy will spread through the various regions of the spectrum over time. 6. We have been able to create gong-like sounds, easily and intuitively, using a tuned set of nonlinear filters attached to the boundary terminations of a 2 D Digital Waveguide Mesh. The addition of the nonlinear filters changed the mesh sound from that of a spoon hitting a tin plate, to that of a smoothly evolving large cymbal crash. 7. The structure can be generalized. We use a one pole allpass formulation here, because it is easy to understand; it is efficient; and it works well enough for our immediate purposes. However, the passivity preserving method of coefficient variation we use may be applied to any filter with an internal feedback state.

173 Chapter 6 The Wave-Decomposed Mass-pring 6.1 Lumped ystems and Distributed ystems We wish to distinguish between two general kinds of physical systems: lumped systems and distributed systems. Lumped systems include such physical elements as masses, springs, and dashpots, or such electrical elements as inductors, capacitors and resistors. Lumped systems are generally characterized by their having no pure time delay in them. That is, when something acts on them, the reaction is instantaneous. Distributed systems include vibrating strings (Kock, 1937), acoustic tubes (Hirschman, 1991; Cook, 1990; Berners, 1999; cavone, 1997), and electrical transmission lines (Magnusson, 1970). Distributed systems are characterized by the presence of time delay in their response. As a comparison of a lumped system and a distributed system, consider an ideal spring attached to a wall. When you push on the end of it the reaction is instantaneous: the spring is compressed to a distance proportional to how hard you push on it, and the compression velocity is proportional to the rate of change of force applied. This is a lumped system. On the other hand, consider a very long spring attached to a wall, which has mass and springiness distributed along its length. In this case, when a force pulse is applied at the end, a spring compression wave travels down the spring until it reaches the wall and then bounces off the wall, returning to the driving point. In this distributed case, you feel a resistive impedance at first, then later, after a time delay associated with the round trip travel time of the compression wave, you feel the end of the spring push back at you. 157

174 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING z -1 H Figure 6.1: The Tuned One-Pole Allpass Filter Feedback Loop Thus far we have worked with the digital waveguide modeling of distributed systems, using delay lines to model the time delay in the system, and we have converted lumped impedances at string terminations into traveling wave transfer functions. In this chapter, we will re-interpret lumped systems as distributed systems a through change of variables. This will allow us to combine lumped systems in modular ways, and to access specialized internal state signals within the wave-decomposed lumped impedances. In the first part of the chapter, we will study a small tunable feedback loop, and re-interpret it as a wave-decomposed model of a mass-spring oscillator. We will then couple several of these mass-spring systems together in a wave-decomposed manner at a scattering junction. This work was first published in (Van Duyne, 1997; Van Duyne, 1998). In the remainder of the chapter, we will use these basic concepts and re-derive a nonlinear mass-spring system as a piano hammer or felt mallet and couple it to a string or a membrane. The piano hammer work was first published in (Van Duyne et al., 1994; Van Duyne and mith, 1995d) 6.2 The Tuned One-Pole Allpass Feedback Loop Figure 6.1 shows a simple feedback loop containing one delay unit, one first-order allpass filter and a sign inversion. A first-order allpass filter has a monotonic phase response and the coefficient can be chosen such that the phase delay resulting from the sample delay unit is compensated for at some particular frequency θ by the phase advance caused by

175 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 159 the allpass filter. This will result in a delay loop that oscillates at that frequency. That is, we want, If we choose H(z) to be of the standard form, H(e jθt ) = e jθt (6.1) H(z) = a 0 + z 1, (6.2) 1 + a 0 z 1 there is in fact no solution for a 0 given arbitrary θ. This should be obvious since the phase response of a one-pole allpass is a phase delay, not an advance, ranging from 0 to π. Hence, we put a sign inversion in the loop, as in Figure 6.1 to introduce a phase shift of π which makes the equation solvable in the following form, H(e jθt ) = e jθt (6.3) is solved by a 0 = cos θ, or, H(z) = cos θ + z 1 1 cos θz 1 (6.4) Note that H may be implemented in a one-multiply form, and that the frequency of oscillation can be controlled by one parameter The Wave-Decomposed Mass-pring Oscillator An alternative view of this loop is shown in Figure 6.2. It can be viewed as a waveguide of half-sample length, terminated on one end reflectively and on the other end by an allpass filter representing some purely reactive mass- or spring-like termination. ince the feedback loop in Figure 6.2 is a waveguide, and therefore a traveling wave structure of some kind, and since it only oscillates at one frequency, it is natural to imagine that it may be some kind of a traveling wave decomposition of a second-order mass-spring (inductor-capacitor) oscillator. If we open up the loop in Figure 6.2 into the form shown in Figure 6.3, and assign traveling velocity wave variables to it, we may write, V = z 1 HV + (6.5) If we interpret the input and output signals to be a velocity wave decomposition, then we

176 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 160 z -1/2 1 H z -1/2 Figure 6.2: The Very hort Waveguide v + (n) z -1 v (n) H Figure 6.3: The Wave-Decomposed econd-order Oscillator

177 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 161 z-plane 1 + e jθt H e jθt H Figure 6.4: Geometric Computation of Impedance Phase Response may define the physical velocity to be, V = V + + V (6.6) imilarly, we may choose an arbitrary reference impedance, R 0, and form the following force wave relation, F = F + + F (6.7) where F + = R0V +, and F = R 0 V. Defining the impedance of this system to be R(z) = F/V, we obtain, R(z) = F + + F V + + V (6.8) = R 0 V + V V + + V (6.9) = R 0 1 z 1 H 1 + z 1 H (6.10) Using a geometric argument, it can be seen from Figure 6.4 that the numerator and denominator of R(e jθt ) lie on a diameter of a unit radius circle with center z = 1. By the

178 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 162 f v k m Figure 6.5: Impedance of This ystem is F (s)/v (s) = ks/(s 2 + k/m) basic geometrical theorem, the numerator and denominator vectors form a right angle at the origin, and their phase difference is therefore π/2. R(e jθt ) must be purely imaginary, i.e., it represents a purely reactive mass-spring-like system. Making the bilinear transformation to the s-plane, z 1 α s α + s (6.11) we obtain, R(s) = ( ) 2R0α (1 a0) s s 2 + α 2 ( 1+a0 1 a0 ) (6.12) Noting that the impedance function of the mass-spring system in Figure 6.5 system can be described as F (s)/v (s) = ks/(s 2 + k/m), Equation 6.12 is to take and, Recalling that a 0 = cos θ, we have, we see that a convenient interpretation of k = 2R 0α 1 a 0, (6.13) m = k = 2R 0 α(1 + a 0 ). (6.14) 2R 0α 1 + cos θ, (6.15) and, m = 2R 0 α(1 cos θ). (6.16)

179 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 163 m 1 m 2 m 4 m 3 k 1 k 2 k3 k 4 k L Figure 6.6: Mass-pring Oscillators Coupled at a pring-loaded Junction As θ approaches DC, m becomes larger and larger. And as θ approaches π, or the Nyquist frequency (which maps onto infinite frequency in the s-plane), k becomes stiffer and stiffer. This is consistent with real mass and spring systems Coupling the Oscillators with a cattering Junction Now that we have the mass-spring oscillator in a wave decomposed form, we can couple them together via the standard sort of scattering junctions used in digital waveguide modeling or transmission line theory. Figure 6.6 shows a set of N mass-spring oscillators (in this case N = 4) joined together at a massless rigid rod which is in turn connected to a coupling impedance, in this case a stiff spring with stiffness coefficient, k L. We can see that this is a series junction since the velocity of the individual mass-spring systems, measured at the spring end of the system, are constrained to equal junction velocity, V J. Further, the sum of the mass-spring forces balance the junction force, F J. We have the equations, V i = V J, i = 1, 2,..., N (6.17)

180 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 164 H i V i + z 1 V i Σ V J Σ ~ 2 Σ R i V + i 1 R L + Σ R i Σ R i + F J Figure 6.7: Digital Implementation of econd-order Oscillators Coupled at a Loaded Junction and, N F i = F J (6.18) i=1 Note that this system is equivalent to a set of parallel LC-circuit oscillators connected in series and terminated with a capacitor load, also in series. For the sake of understanding the load element, if the mass-spring system is terminated with a very stiff spring, that is k L is very large, then the system behaves much as if the four spring oscillators were just nailed to the floor. There would be very slight coupling and the modes of the coupled system would be essentially the same as the modes of the independent oscillators. In the electrical domain, this would be equivalent to terminating the loop with a very small capacitance, which would be much like opening up the circuit. Now the modes of interest in such systems are the poles of the impedance function. These poles are at frequencies where a driving force produces a zero velocity. Or, saying it the other way, these are the natural frequencies in the force signal felt at the driving point when the driving point is constrained to very slight motion (or held fixed in position).

181 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 165 Figure 6.7 shows a digital implementation of this mildly coupled system. ince the V J signal is so close to zero in the very stiff spring junction loading case (in which we are interested), it is therefore a useless output signal. Instead, F J may be easily computed as shown. The multi-dimensional signal on the left is just a set of one-multiply oscillators as described earlier (which may be implemented in parallel if desired). The summation element without a tilde computes the values, vi = v J v i +. The summation element with the tilde computes a scaled sum as shown in the diagram. If the number of mass-springs in the system, N, is chosen as some power of 2, and the arbitrary reference impedances of the wave-decomposed mass-spring systems are all taken to be equal to one over the number of mass-springs (so that R i = 1), then the number of multiplies can be reduced to one per mode plus possibly two more for the first-order junction filter, 1/(R L + R i ) Calibrating the Coupling Filter While it is easy to tune the oscillating loop, it is a little tricky to see what to do with the coupling filter. However, it seems that an approach such as that described in Chapter 2 for coupled strings, previously published in (Van Duyne and mith, 1995b), can be applied here, since the coupling of wave-decomposed mass-spring systems and the coupling of waveguide string systems are anatomically identical from the scattering junction perspective. This calibration approach was first published in (Van Duyne, 1997). A theoretical single mode loop filter, L(z), may be found whose magnitude response at the various targeted modal frequencies is equal to the per sample attenuation rate of the respective modes; then, by manipulating the loaded scattering junction equations, it can be seen that the coupling filter, 1/(R L + R i ), may be expressed as a function of L(z) as follows: CouplingF ilter = 2 (1 L(z)) 1 + N + (1 N)L(z) (6.19) where N is the number of modes in the coupled mode system. Note that the order of the coupling filters is the same as the order of L(z). Metal vs. Wood ince the frequency-dependent decay rate profile of the coupled mode filter is localized in one coupling filter, it is easy to make qualitative modifications to the sound color. It is usual in most materials that high frequencies tend to die out more quickly, than

182 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 166 lower frequencies. Therefore, the theoretical loop filter L(z) described in the preceding paragraph, which represents the frequency dependent decay rate profile, is lowpass in nature. ince high frequencies in metal tend to resonate a little longer than they do in wood, it is also straightforward to control the metallic vs. wood-like quality of the sound generated by this coupled mode model with a single slider which adjusts the amount of lowpass characteristic in the L(z) filter. Calibrated examples of this were presented in (Porcaro et al., 1996). 6.3 Mass-pring Oscillator vs. Mass-pring Hammer The allpass/delay loop application just discussed is intended to resonate (make sound) at a predetermined frequency. The allpass filter is linear (fixed coefficients), and it is tuned to a predetermined desired modal frequency of the musical sound being modeled. The allpass/delay loop can be attached to a coupling filter adapted to attenuate signals at frequency, f, by a predetermined factor using a calibration method similar to that described in Chapter 2. In this way, the resonating tones decay away at a rate simulating the musical sound being modeled. On the other hand, as will be studied for the remainder of the chapter, the allpass/delay loop can also be used to simulate a felt piano hammer coming into contact with the string, squishing in a nonlinear way, un-squishing, and leaving the string. The allpass filter coefficient is not fixed: it is time varying and dependent on the state of the system in such a way as to vary resonant frequency of the allpass/delay loop from DC (0 Hz), up to some frequency determined by how much the hammer gets squished at maximum, and then back to DC, all within half a period of a wave form. The signal generated is a hump, in effect, just the first half of a sine wave period, smoothed out by the continuous frequency variation. The implementation of a nonlinear felt hammer model based on the traveling-wave decomposition of the lumped hammer system may be a useful development for string and mesh models which extends their usefulness: a physical model for a piano hammer.

183 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING Motivation for the Hammer ince the development of the 2-D digital waveguide mesh to model wave propagation in membranes and plates (Van Duyne and mith, 1993a), it has been evident that an efficient and physically accurate excitation means was necessary to make the models more useful as sound synthesis algorithms. The musical effect of a struck string or drum is greatly determined by the nature of the hammer or mallet which strikes it. The attack transient of a struck instrument can be approximated by the injection of an appropriate, pre-computed excitation signal into the resonant system. However, this excitation method is not sufficient to cope with the complexities of certain real musical situations. For example, when a mallet strikes an ideal membrane, it sinks down into it, feeling a pure resistive impedance. The depression induces a circular traveling wave outward. If the membrane were infinite, the waves would never return, and the mallet would come to rest, losing all its energy into the membrane. If the membrane is bounded, however, reflected waves return to the strike point to throw the mallet away from the membrane. The first reflected wave to reach the mallet may not be sufficiently powerful to throw the mallet all the way clear, or may only slow down its motion; and later reflected waves may finally provide the energy to finish the job. This complex mallet membrane interaction can have very different and difficult to predict acoustical effects, particularly when a second or third strike occurs while the membrane is still in motion, such as in a drum roll. Recent work in the piano hammer area has been informative in the development of our hammer/mallet model. Boutillon used finite difference schemes to model a non-dispersive piano string interacting with a felt hammer with an exponential felt compression function which took the effect of hysteresis into account (Boutillon, 1988). uzuki modeled the piano string with lumped elements tuned to partial frequencies using a nonlinear hammer model with a fourth-order polynomial felt compression law (uzuki, 1987). Chaigne and Askenfelt formulated a numerically stable finite difference scheme which accounted for loss and dispersion in the string. The hammer force follows an exponential felt compression law and is distributed over a small spatial window on the string (Chaigne and Askenfelt, 1994a). While these methods are extremely interesting and effective analytically, they are less efficient than the digital waveguide approach to string or membrane simulations for the

184 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 168 HAMMER m, k, µ v 0 δ(n) initial hammer velocity WAVEGUIDE TRING R h (n) velocity waves delay A 1 (z) L 2 (z) delay CATTERING 1 R 0 R JUNCTION 0 1 delay L 1 (z) A 2 (z) delay Figure 6.8: The Digital Waveguide tring/hammer ystem purpose of real-time sound synthesis. We have therefore sought to find an efficient and natural wave theoretic model of the piano hammer, or felt mallet, which may be attached to the digital waveguide string model and to the 2-D digital waveguide mesh membrane model. 6.5 The Hammer Model We view the piano hammer, or felt mallet, as a nonlinear mass and spring system, the spring representing the felt portion of the hammer or mallet. ince the felt is very compliant when the hammer is just barely touching the string, yet very stiff when fully compressed, we must use a nonlinear spring in the model, whose stiffness constant varies with felt compression. In deriving the wave digital hammer filter, we first make a wave decomposition of the linear mass and spring system, then attach it to a waveguide string or membrane model via a scattering junction. Next we find a method to vary felt stiffness with compression, and finally account for hysteresis loss in the felt Overview of the Digital Waveguide tring and Hammer Model The hammer system is decomposed into wave variables to simplify computation and to expedite interconnection with the traveling wave string model. The hammer felt is viewed

185 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 169 v k f v k v m m Figure 6.9: Mass and pring Force Diagram as a spring with time varying stiffness dependent on compression, f(t) = k (x(t)) x(t). The stiffness function, k(x), is exactly zero when the hammer is not in contact with the string, and increases smoothly as compression increases. In addition, we will allow for nonlinear loss in the spring, µ(x, v), which may be dependent on both compression and compression velocity of the felt. While both k(x) and µ(x, v) may be arbitrary, as long as both are sufficiently smooth, we have found a useful family of stiffness and loss functions which allow easy real-time computation. Figure 6.8 shows a general implementation of the string/hammer model. The string is represented as bi-directional traveling velocity waves, and the hammer system is attached via a series scattering junction. The L 1 and L 2 filters in the string loop are frequency dependent summary loss filters for the string segment in which they function, and the A 1 and A 2 filters are allpass filters correcting the phase dispersion in the respective string halves. These filters are placed at the inputs to the scattering junction so that the hammer system will see the physically correct velocity wave values The Mass and pring ystem First we consider a linear mass and spring system, as shown in Figure 6.9. We wish to define the equations of motion for a mass and spring system driven at the spring end by an external force, where the mass has an initial velocity at time zero. ince the mass and spring are in parallel, we may observe that the driving point force applied to the left side

186 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 170 of the spring, f, is equally applied to the spring compression and to the mass, f = f k = f m (6.20) Also, the driving point velocity, v, is equal to the sum of the spring compression velocity and the mass velocity, v = v k + v m (6.21) The force equation for the spring alone is, f(t) = kx(t) = df(t)/dt = kv(t) (6.22) where f(t) is the force applied on the spring, x(t) is the compression distance of the spring, v(t) is the velocity of compression, and k is the spring stiffness constant. Taking the Laplace transform of (6.22), we can find an expression for V k (s), V k (s) = (s/k)f k (s) (6.23) imilarly, taking the Laplace transform of, f m (t) = m dv m(t) dt mv 0 δ(t) (6.24) where mv 0 δ(t) represents an initial momentum impulse setting the mass in motion at velocity v 0, we may find an expression for V m (s), V m (s) = F k (s)/ms + v 0 /s (6.25) Combining Equations (6.20), (6.21), (6.23) (6.25), we compute the driving point admittance relation for the mass and spring system in Figure 6.9, V (s) = V k (s) + V m (s) (6.26) = s k F k(s) + 1 ms F m(s) + v 0 ( s s 2 ) + k/m = F (s) + v 0 ks s (6.27) (6.28)

187 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 171 f(t) v 0 δ(t) s 2 + k/m ks 1/s v(t) Figure 6.10: The Continuous-Time Mass-pring ystem with Initial Velocity The admittance function, (s 2 + k/m)/ks, is the steady state response of this secondorder system. Note the admittance zeros are at ±j k/m, and the system oscillates at that frequency. The v 0 /s term represents the transient effect of the time zero momentum impulse on the mass. Figure 6.10 interprets Equation (6.28) as a system with one output, V (s), and two inputs, F (s) and (s): F (s) drives the steady state part of the system, while (s) drives the transient part Traveling Wave Decomposition of the Lumped ystem Earlier in the chapter, we applied a more intuitive approach to deriving the wave variable decomposition for a mass and spring oscillator. Here, we apply more rigor, in order to carry forward the physical variables, and apply a momentum pulse excitation, and to model the nonlinear hammer/string interactions. We begin by defining wave variables for the lumped impedance in a manner analogous to distributed systems (Kuo, 1966; Fettweis, 1986). We may define F = F in + F out, where F in is viewed as a force wave traveling into the impedance, and F out is viewed as a force wave traveling out of the impedance. imilarly, we may define V = V in + V out. In the distributed case, waves actually travel a distance over time; and there is a wave impedance relation between the force and velocity waves traveling in the same direction determined by the parameters of the medium in which the waves are traveling. In the lumped case, the waves may only be understood to be traveling instantaneously; and the waves are

188 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 172 not traveling in any particular medium. However, we may still apply distributed system analysis methods to the system to obtain a wave-decomposed interpretation of the lumped impedance. Defining an Arbitrary Wave Impedance We may define an arbitrary reference impedance, R h, and obtain a wave impedance relation between force and velocity waves, F in = R h V in F out = R h V out (6.29) Note that R h is truly arbitrary, aside from being a positive real number. We will make good use of this fact later on. Making the change of variables from F and V to V in and V out, we obtain a velocity wave transfer function from Equation (6.28), V out (s) = s2 (k/r h )s + k/m s 2 + (k/r h )s + k/m V in(s) + v 0 k/r h s 2 + (k/r h )s + k/m (6.30) Moving to the Digital Domain To move from the continuous physical system to the discrete digital filter, we again use the bilinear transform from the s-plane to the z-plane, s α 1 z z 1 (6.31) taking α = 2/T, where T is the sampling interval, to obtain best frequency response at the low end of the frequency range. Band Limiting the Momentum Impulse Converting a continuous time system to the digital domain often involves excitation impulses, which are infinite bandwidth in the continuous domain. The internal force or velocity wave signals within the digital system, after a band-limited conversion using the bilinear transform will be inherently band limited since they will be coming from some other well-defined digital system. However, the impulse signal which drives the transient

189 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 173 portion of the system response had been defined in continuous time. (s) (defined as the Laplace transform of the continuous impulse function) has infinite frequency bandwidth, but a digital impulse may only have bandwidth up to half the sampling rate, π/t, where T is the sampling interval. To make a proper conversion from the continuous time impulse to the discrete time impulse, we must first band limit the continuous time impulse to π/t and then sample it at T. δ(t) F Band Limit (jω) T (jω) = = δ(t)e jωt dt 1, ω (jω) = 1, ω π/t 0, ω > π/t F 1 δ T (t) = 1 T (jω)e iωt dω = 1 π/t e iωt dω 2π 2π π/t (6.32) = ejπt/t e jπt/t 2πjt sin πt/t = (1/T ) πt/t = (1/T ) sinc t/t ample 1 T δ d(n) where, δ d (n) = 1, n = 0 0, n 0 (6.33) This result says that when we move the impulse function from continuous time to discrete time, we must scale it by the sampling rate. (s) Band Limit (1/T ) (z) (6.34) This makes intuitive sense, since we would desire integration over a continuous impulse function to be equivalent to making a weighted rectangular sum over the digital impulse. δ a (t) dt = 1 = n= ( δd (n) T ) T (6.35)

190 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 174 v h (n) = vin (n) z 1 (R h ) H(z) v h + (n) = vout (n) G(z) v 0 δ(n) Figure 6.11: The Digital Wave-Decomposed Mass and pring Filter The econd-order Digital Transfer Function Picking up the argument from Equation 6.30, we must apply the bilinear transform and we must also band limit the continuous time impulse function mapping δ(t) δ(n)/t. This leads to the correct second-order digital transfer function, with the coefficients defined as V out (z) = b 0 + b 1 z 1 + z b 1 z 1 + b 0 z 2 V in(z) + (v 0/2αT )(1 + 2z 1 + z 2 ) 1 + b 1 z 1 + b 0 z 2 (6.36) b 0 = mr h α 2 mkα + kr h mr h α 2 + mkα + kr h, (6.37) b 1 = 2(kR h mr h α 2 ) mr h α 2 + mkα + kr h (6.38) Taking Advantage of the Arbitrary Reference Impedance Choosing the arbitrary reference impedance such that b 0 = 0, R h = mkα mα 2 + k, (6.39) a unit of delay may be factored out of the second-order transfer function. The result is

191 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 175 m v 0 R 0 k(x) Figure 6.12: tring Loaded with Mass and Nonlinear pring the efficient digital system shown in Figure 6.11 defined by V out (z) = z 1 H(z)V in (z) + G(z) v 0 (6.40) where with a 0 defined as H(z) = a 0 + z a 0 z 1 (6.41) ( ) z 1 + z 2 G(z) = 2αT 1 + a 0 z 1 (6.42) a 0 = k mα2 k + mα 2 (6.43) Combining Equations (6.39) and (6.43), we arrive at a simple relationship between R h and a 0 : cattering Junction Connection R h = mα 2 (1 + a 0) (6.44) The next step is to connect the mass and spring system to a string, as shown in Figure ince we have decomposed the lumped mass and spring system into traveling waves, and have picked an associated wave impedance, R h, we may join the system to the string system at a lossless 3 port scattering junction as shown in Figure 6.13.

192 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 176 v h v h + z Μ z Μ v 1 + v 1 v 2 v 2 + z Ν z Ν Figure 6.13: Attaching the Wave Digital Hammer We define v out = vh + and v in = vh, as is shown in Figure 6.11, so that traveling wave signals entering the scattering junction are superscripted with a plus sign, and traveling wave signals leaving the junction are superscripted with a minus sign. At the junction point where the mass and spring system connects to the string, the velocity of both sides of the string, v 1 and v 2, and the driving point velocity of the spring, v h, must all equal v J, the junction velocity. v 1 = v 2 = v h = vj (6.45) In addition, the sum of the forces exerted by the string halves and the mass and spring at that point must be zero, since it is a massless point, f 1 + f 2 + f h = fj = 0 (6.46) Combining the two series junction constraints given in (6.45) and (6.46) with the wave variable definitions and wave impedance relations, we can derive the lossless scattering equations for the interconnection of the wave decomposed mass and spring with the string halves: v J = 2 (R 0v R 0 v R h v h + ) 2R 0 + R h (6.47) v 1 = v J v 1 + (6.48) v 2 = v J v 2 + (6.49)

193 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 177 v h = v J v h + (6.50) These equations indicate that, as a wave is coming into a junction, some portion of the wave reflects off the junction and travels back where it came from, while the rest of it travels into the junction and is divided among the other outgoing waves. The relative proportions of this scattering effect is dependent only on the relative wave impedances of the interconnected elements. Figure 6.14 shows how the mass and spring system may be attached to a membrane modeled using the 2-D digital waveguide mesh. Junctions marked J are lossless 4-port junctions. The mass and spring system is attached at the 5-port scattering junction marked. Equations (6.47) through (6.50) must be modified appropriately to compute the 5-port junction. Note PNF, or passive nonlinear filter components as described in the last chapter are attached at the edges of the 2-D mesh. This is a basic structure to model a gong with energy spreading through the modes using the 2-D mesh, the passive nonlinear filter and the wave-decomposed hammer models together. That felt hammer, or mallet, will sink into the membrane until it is thrown away by sufficiently strong returning force waves. 6.6 Making the Felt Nonlinear Now, to convert our string loaded with a mass and spring to a string being hit with a felt hammer, we must cope with the nonlinearity of the spring constant, k(x k ), which depends on the compression distance, x k, of the felt. Fortunately, we have signals in the mass spring loop which can give us this distance directly. In general, f k = kx k or x k = f k /k for a spring system. If we can find the force being applied to the spring, we may divide it by k to obtain the compression distance. But, the driving point force on the mass and spring system of Figure 6.9 is equal to the compression force on the spring alone. Hence, x k = (1/k)(f h + f h + ) (6.51) = (R h /k)(v h v h + ). (6.52) R h /k in Equation (6.52) may be rewritten in terms of a 0 by combining Equations (6.39)

194 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 178 A Piece of the Waveguide Gong PNF PNF PNF z -1 z -1 z -1 z -1 z -1 z -1 z -1 z -1 J z -1 z -1 J z -1 z -1 J z -1 z -1 z -1 z -1 z -1 z -1 z -1 z -1 v WDH h z -1 z -1 v v v + h J z -1 v + 2 z -1 v 2 v 3 v 3 + v z -1 4 v + z -1 4 z -1 z -1 z -1 z -1 z -1 z -1 J z -1 z -1 z -1 z -1 J z -1 z -1 J z -1 z -1 J z -1 z -1 z -1 z -1 z -1 z -1 z -1 z -1 Figure 6.14: Attaching the Wave Digital Hammer to a 2-D Digital Waveguide Mesh

195 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 179 v + 1 (n) v 1 (n) v + 2 (n) v 2 (n) R h (n) v h (n) v + h (n) u 3 (n) + z 1 v h (n 1) v I (n) H G u 1 (n) u 2 (n) a 0 (n) a 0 (n) R X a 0 (n) a 0 (n) x k (n) L u 4 (n) u 5 (n) K a 0 (n+1) z 1 a 0 (n) Figure 6.15: The Wave Digital Hammer and (6.43), to obtain x k = 1 a 0 2α (v h v h + ) (6.53) With this final piece of the puzzle, we can complete the lossless wave digital (Fettweis, 1986) hammer system as shown in Figure The Lossless Digital Model Referring to Figure 6.15, the system loop containing, H, and one unit of delay, z 1, performs the essential mass and spring modeling. is the scattering junction defined by Equations (6.47) through (6.50). H is the time varying allpass filter defined by Equation (6.41). This loop oscillates at an instantaneous frequency of arccos( a 0 (n)) and models the second-order mass and spring system. Incidentally, if the computation of is replaced with, v h (n) = v + h (n), (6.54)

196 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 180 which is physically equivalent to replacing the string or membrane portion of the system with a rigid wall, then the z 1 H loop stands alone as an efficient, one-multiply sinusoidal oscillator. G is the modified integrator defined by Equation (6.42) which integrates the incoming initial hammer velocity impulse signal, v I (n), taking into account the wave decomposition and the nonlinear effects of the hammer felt. ignal u 3 (n) is a combination of the velocity waves traveling in the hammer system which represents a normalized force of compression on the hammer felt. X computes the actual felt compression according to Equation (6.53), taking advantage of the fact that the force of compression on the felt is instantaneously proportional to the felt compression. K is a look up table for the stiffness coefficient, a 0 (n), indexed by felt compression, which may be defined by (6.43), replacing k with the compression dependent stiffness function, k(x k ). R computes the time varying wave impedance of the hammer system from a 0 according to Equation (6.44). Note that R h (n) is zero when the hammer is not touching the string, that is when k(x k ) = 0, which means that there is no effect on the rest of the system when the hammer is not in contact with the string, although the motion of the hammer is still computed by the loop. As the hammer felt compresses, R h (n) ramps up, representing the increased impedance of the compressed felt on the string. For the moment, assume L multiplies by 0, so that u 4 (n) 0. This represents the full lossless hammer model. We will return to the definition of L after studying the effect of loss in the felt in the following section Hysteresis Loss in the Felt Hysteresis has been identified as an important factor in the piano tone (Boutillon, 1988; tulov, 1995). Consider a model of the piano hammer where the felt is represented as a nonlinear spring in series with a nonlinear dashpot whose loss coefficient, µ, is dependent on felt compression, as shown in Figure In the linear case we may say, f(t) = kx(t) + µv(t) (6.55) where f(t) is the force on the felt, x(t) is the felt compression, and v(t) = ẋ(t) is the velocity of compression. In the nonlinear case, we take the spring stiffness coefficient and

197 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 181 k(x) m µ(x) x(t), v(t) Figure 6.16: Nonlinear pring and Dashpot the resistive loss coefficient for the dashpot both to be compression dependent giving us k(x) and µ(x). For times t near t 0, defining x(t 0 ) = x 0 and v(t 0 ) = v 0, we may say that the force on the felt is, f(t) = k(x 0 ) x(t) + µ(x 0 ) v(t) (6.56) [ = k(x 0 ) + µ(x ] 0) v(t) x(t) (6.57) x(t) k(x 0, v 0 ) x(t) (6.58) where we have defined the equivalent nonlinear spring as shown in Figure 6.17 to have a stiffness function which accounts for both the springiness and the loss in the felt model thus, k(x 0, v 0 ) = lim k(x 0 ) + µ(x 0) v(t) (6.59) t t0 x(t) Our first assumption must be that we can define a k(x 0, v 0 ) at all. The fundamental nonlinear assumption is that both k(x) and µ(x) are zero when the hammer is not in contact with the string. ince we take t = 0 to be the time of initial contact, x(0) is zero, but v(0) may be anything. We therefore require µ(x 0 )/x 0 to be defined at x 0 = 0. We have µ(x 0 ) lim = µ (0) (6.60) x 0 0 x 0 Therefore, we require now that µ(x) be continuous at x 0 and have a first derivative there.

198 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 182 k(x,v) m x(t), v(t) Figure 6.17: Equivalent Nonlinear pring Now k(x 0, v 0 ) is well defined, but it is still a function of both displacement and velocity, requiring a two-dimensional look-up table to implement. It would be convenient if we could find a way to compute it by consulting two one-dimensional tables in sequence, instead of indexing a true two-dimensional table. Let us assume that we could find k(x 0, v 0 ) by adjusting the indexing of k(x 0 ) according to some function of velocity, k(x 0, v 0 ) = k(x 0 + ε(x 0 ) v 0 ) (6.61) for some small valued function, ε(x 0 ). If this is possible, we can compute k by adjusting x 0 according to the ε table and velocity, and then index the k table. If ε(x 0 ) v 0 is small, we may approximate k(x 0 + ε(x 0 ) v 0 ) by a truncated Taylor series expansion as k(x 0 + ε(x 0 ) v 0 ) k(x 0 ) + k (x 0 ) ε(x 0 ) v 0 (6.62) Plugging (6.59) into the left hand side of Equation (6.61) and (6.62) into the right hand side, we can solve for ε(x 0 ): ε(x 0 ) µ(x 0) x 0 k (x 0 ) (6.63) Fortunately, ε is a function of x 0 alone. Therefore, the ε table may be designed as a one-dimensional table indexed by x 0. However, its definition leaves it undefined at

199 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 183 x 0 = 0. By applying l Hôpital s rule repeatedly, we may obtain an appropriate definition of ε(0) as long as higher-order derivatives of µ do not become non-zero before higher-order derivatives of k at x 0 = 0: ε(0) = lim x 0 0 = lim x 0 0 µ(x 0 ) x 0 k (x 0 ) µ (x 0 ) x 0 k (x 0 ) + k (x 0 ) µ (x 0 ) = lim x 0 0 x 0 k (x 0 ) + 2k (x 0 ). µ (n) (x 0 ) = lim x 0 0 x 0 k (n+1) (x 0 ) + nk (n) (x 0 ) (6.64) We can only model nonlinear mass/spring/dashpot systems as nonlinear mass/spring systems when the dashpot resistance function, µ(x), is continuous at x = 0 and is at least as smooth as the stiffness function, k(x), at x = 0. Referring back to the digital implementation shown in Figure 6.15, L is intended to compute ε(x 0 )v 0, the small offset of the indexing signal x k (n). The modified indexing signal is then input to the felt stiffness table K. L should generally be of the form, u 5 (n) = ε(x k (n))[x k (n) x k (n 1)]/T (6.65) where (x k (n) x k (n 1))/T approximates the velocity of felt compression. We have derived the mathematical justification for this offset, along with its basic limitations. However, we may understand this offset to the stiffness table index as a direct implementation of felt hysteresis by realizing that a resistive loss in the felt will cause the felt to feel stiffer when being compressed and to feel less stiff when decompressing. The springiness of the felt is proportional to the felt compression, whereas the effect of loss is in the direction of felt compression velocity. Therefore, (6.65) offsets the index to the stiffness look-up table, K, such that, when the felt is compressing, the spring constant is greater, and when the felt is relaxing, the spring constant is smaller. ε(x k ) should be zero when the hammer is not in contact with the string and should ramp up smoothly from zero as defined in (6.63).

200 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 184 Hammer Force (N) Time from Impact (ms) Figure 6.18: Calculated Forces on Hammer Felt for v 0 = 1,2,3, and 4 m/s 6.7 Empirical Evaluation with Published Data We have been able to produce a variety of realistic struck string and struck membrane sounds using the wave digital hammer algorithm in combination with the digital waveguide string model and the 2-D digital waveguide mesh membrane model. While the hammer model easily proves its usefulness in the area of efficient sound synthesis, we also believe that, after some further development, it will compute physically correct, analytically useful interaction transients between hammers and strings. For the moment, we can compare our traveling wave model of hammer and string with the difference equation model proposed by Chaigne and Askenfelt. We tested our model computing the filter parameters using data provided in (Chaigne and Askenfelt, 1994a; Chaigne and Askenfelt, 1994b) for a hammer hitting a middle C piano string.

201 CHAPTER 6. THE WAVE-DECOMPOED MA-PRING 185 Figure 6.18 shows the hammer force response curves, computed at an audio sampling rate of 1/T = samples per second, given initial hammer strike velocities of v 0 = 1, 2, 3, and 4 m/sec. Note the multiple force peaks which are caused by hammer interaction with return waves from the agraffe. In this case, we used the lossless version of our model and ignored felt hysteresis; in addition, we did not account for loss and stiffness in the string itself; further, we let the hammer interaction be localized at one point, rather than use a weighting function to spread the force interaction over a finite area. In these respects, we differ from Chaigne and Askenfelt. Nevertheless, despite these variations, our results are qualitatively similar, and fairly close in magnitude. Our model generated slightly lower hammer forces and slightly longer interaction times. Further work will include the careful measurement of piano hammer and string data, and the calibration of our models to the full extent permitted within the digital waveguide approach. In addition, we plan to develop physically correct calibrated 2-D waveguide mesh drum and mallet models.

202 Chapter 7 The Commutable Piano Hammer Much effort has been undertaken in the automated but musical performance of acoustic piano (Risset and Van Duyne, 1996; Risset and Van Duyne, 1992), and in the development of new microtonal keyboards (Van Duyne, 1990) supporting up 72 notes per octave (Maneri and Van Duyne, 1986). In addition, work has been done on modeling the haptic interface (Gillespie, 1996). We present here several developments for piano synthesis using digital waveguides and a commuted body response. The musical use of commuted body response filter structures appears to have been first published independently in (Karjalainen et al., 1993) and (mith, 1993). The basic commuted synthesis for piano approach is described in (mith and Van Duyne, 1995) and (Van Duyne and mith, 1998). Work presented in this chapter was originally published in (Van Duyne and mith, 1995b). 7.1 Background The piano and its parts have long been a topic of study, with an eye toward better understanding of the acoustics (Weinreich, 1977), toward more reliable numerical modeling of the piano physics (Chaigne and Askenfelt, 1994a; Chaigne and Askenfelt, 1994b) and understanding the piano hammer (Boutillon, 1988; Zhu and Mote, 1994; tulov, 1995; uzuki, 1987; Hall, 1986; Hall, 1987a; Hall, 1987b; Hall, 1987c; Hall, 1988; Hall, 1992), toward the development of high-quality sound synthesis (Van Duyne et al., 1994; Van Duyne and mith, 1993b), and toward the development of cost-effective sound synthesis (Karjalainen et al., 1993; mith, 1993; mith and Van Duyne, 1995; Van Duyne and mith, 1992; Van Duyne and mith, 1994). Our interest in this chapter is in the category of sound 186

203 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 187 synthesis informed by physics and acoustics. A high-quality physical approach to piano synthesis can be cobbled together with gadgetry already described herein combining the wave digital hammer (Van Duyne et al., 1994) described in the last chapter with coupled string synthesis (mith, 1993; mith and Van Duyne, 1995) discussed in Chapter 2, using the 2-D digital waveguide mesh (Van Duyne and mith, 1993b) described in Chapters 3 and 4 as a soundboard resonator, and using allpass filtering methods to stiffen the soundboard and the piano strings (Van Duyne and mith, 1994) as discussed in Chapter 3. ee Figure 7.1 for a high-level diagram of this proposed model, topped off with a haptic interface modeling the physical forces in the piano action (Gillespie, 1996). On the other hand, we have proposed an algorithmic method of synthesizing the inharmonic piano tones constructing spectral regions with specially tuned FM oscillator pairs (Van Duyne and mith, 1992). The basis of this chapter is a hybrid method known as commuted piano synthesis (mith, 1993; mith and Van Duyne, 1995) which combines the high quality and control of physical modeling synthesis with the compute-effectiveness of sampling synthesis. This method takes advantage of the commutativity of linear systems, and replaces the high-order soundboard resonator with its own sampled impulse response played into the string at its excitation point. In order to implement Commuted ynthesis, we must linearize the hammer-string interaction, which is the focus of the first part of this paper. We have further hybridized and simplified the commuted piano synthesis method by replacing the sampled soundboard impulse response with a simple algorithmic synthesis method which idealizes the soundboard and makes its physical characteristics easier to control. Lastly, we offer a method to calibrate the coupled piano string algorithm to real physical data using only a simple recording of a hammer hitting one string. 7.2 Linearizing the Piano Hammer A fully physical nonlinear model of the hammer-string system has been presented already (Van Duyne et al., 1994) in Chapter 6. However, in order to implement commuted piano synthesis (mith and Van Duyne, 1995), we must commute the resonant soundboard system through the hammer system to the point of excitation in the commuted piano model. This requires that we replace the entire hammer-string interaction with a linear filter. Rather inconveniently, the hammer-string interaction is highly nonlinear in two

204 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 188 Figure 7.1: The Elaborate Physically Modeled Piano

205 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 189 (R 0 ) V F (R 0 ) Figure 7.2: tring Terminated on One ide Only important respects: First, the felt itself is nonlinear in that it gets stiffer the more it is compressed (Chaigne and Askenfelt, 1994a). econd, the hammer leaves the string at some point, which corresponds to a shift in the models from a string interacting with a hammer to a string vibrating freely. A linearized analysis of the piano hammer-string system follows Impedance of the Un-Terminated Ideal tring The impedance experienced at some point on an un-terminated string is purely resistive: R = F /V = 2R 0, (7.1) where F and V are the Laplace transforms of force and velocity at the driving point and R 0 is the wave impedance of the string, which is dependent on the square root of string tension times string density. The 2R 0 in the above equation results from taking into account the impedance of both halves of the string, as seen at the driving point Impedance of the Terminated Ideal tring In the case of the piano hammer-string interaction, waves from the agraffe return and interact with the hammer before it leaves the string for most notes. However, the return waves from the bridge end of the string do not make it back before the hammer leaves the string, except in the very highest notes. Therefore, we formulate a half-terminated string impedance taking into account a one-sided termination at the agraffe end, as shown in Figure 7.2. The velocity response of a force impulse at the strike position is an impulse followed by an inverted impulse which returns reflected off the essentially rigid agraffe end

206 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 190 v 0 m k R H V F H Figure 7.3: The Linear Mass-pring Hammer Model of the string T seconds later: V = F 2R 0 ( 1 e st ) = R = F V = 2R 0 1 e st (7.2) Impedance of the Ideal Linear Hammer Let us assume that the hammer is of the form shown in Figure 7.3, essentially a mass and spring system, where the spring represents the felt portion of the hammer. We find that the impedance relation is: ( F H = R H V v ) 0 s where R H = ks s 2 + k/m (7.3) and where v 0 /s represents the step input of the initial striking velocity. R H has a zero at DC and two conjugate poles indicating an oscillation frequency of k/m Connecting the Hammer to the tring When the hammer is in contact with the string, we take the velocity of the string equal to the velocity of the spring end of the hammer, and the force on the string equal and opposite to the force on the spring, F = F H. Plugging in the string impedance relation,

207 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 191 V = F /R, we find: ( F = F H = RH V v ) 0 s ( F = R H v ) 0 R s (7.4) ( RH R = F = R H + R ) v0 s ( ) R v0 = R H s (7.5) In the un-terminated string case, we define H as the transfer function from the initial striking velocity step to the force experienced by the string (and, equivalently, by the hammer felt). Taking the hammer to be a simple mass-spring system, we find that the H transfer function is now a damped second-order system, which looks just like the R H except for the under-bracketed damping term (7.6). For practical physical parameters, this is an over-damped system with real poles. ( ) R ks ks H = RH = 2R0 s 2 = + k/m s 2 + k 2R 0 s + k m }{{} (7.6) For the one side terminated string case, we define H T. Again, we find H T is like R H but for the under-bracketed damping term, which in this case contains an interesting time delay part. ( R H T = RH = Implementation ks s 2 + k/m ) ( ) 2R0 1 e st = k ks s 2 + 2R 0 (1 ) e st s }{{} + k m (7.7) Conveniently, we find a recursion relationship between H and H T, which is independent of the exact nature of the hammer impedance, R H. H T = H 1 e st H (7.8) This allows a simple recursive hammer filter implementation of the form in Figure 7.4. ince, in this case, the hammer never leaves the string (from the linear system assumption), we may prefer to include a cutoff envelope in the feedback loop to terminate the reflections from the agraffe at some point, or better, break out the first few reflections in a feed-forward formulation as in Figure 7.5.

208 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 192 v 0s + H F Delay Figure 7.4: tep-driven Recursive Hammer Filter v 0s H Delay H + F Delay H Figure 7.5: Feed-Forward Hammer Filter Noting that H is a differentiated lowpass filter, H = ks s 2 + k 2R 0 s + k = sl p, (7.9) m the step-driven hammer system of Figure 7.4 may be commuted to an impulse-driven system, as preferred for Commuted Piano ynthesis (mith and Van Duyne, 1995). This is shown in Figure 7.6. In this formulation, the hammer feedback loop contains what is fundamentally a lowpass filter and a DC-blocker. It is easy to break this out into a feed-forward form as in Figure 7.5. v 0 δ + Lp F s Delay Figure 7.6: Impulse-Driven Recursive Hammer Filter

209 CHAPTER 7. THE COMMUTABLE PIANO HAMMER Analysis of Real Hammer-tring Interaction Data Using the Wave Digital Hammer (Van Duyne et al., 1994) parameterized with measured data provided by (Chaigne and Askenfelt, 1994a; Chaigne and Askenfelt, 1994b), we were able to compute the forces experienced by terminated and un-terminated middle-c (261 Hz) strings during a hard hammer strike. In the upper left plot of Figure 7.7, we see the felt compression force curves for a hammer hitting an un-terminated middle-c string (dashed line) and a terminated middle-c string (solid line). The multiple pulses correspond to return waves from the agraffe interacting with the hammer while it is still in contact with the string. Note that in the un-terminated string case, the force curve ramps smoothly to zero and the hammer apparently comes to rest on the string as in an over-damped secondorder system. However, in the terminated string case, the hammer leaves the string when the return waves finally throw it away. The upper right plot of Figure 7.7 shows the db magnitude spectra of these force curves. Note that the overall bandwidth of both the terminated string and un-terminated string hammer shock spectra are about the same. The multi-pulse spectrum (solid line) differs from the single-pulse spectrum (dashed line) primarily in a slight ringing of the lower spectrum region. The lower right plot is the db magnitude of the complex ratio of the multi-pulse spectrum and the single-pulse spectrum. The several low-frequency peaks correspond to the spectral peaks one would expect from the hammer staying in contact with the string at the strike point (about 1/8 the way along the string) for some finite duration. It is of some interest that keeping the hammer in contact with the string introduces spectral peaks about every eight harmonics, whereas an impulsive strike at the same position on the string introduces spectral nulls every eight harmonics. The piano hammer interaction is a compromise between these two extremes of behavior. We further note that there are odd looking wiggles in the ratio spectrum, clearly visible around the 5 10 khz range. These correspond in width to the side lobes one would expect from rectangularly windowing the time domain signal at exactly the point where the hammer leaves the terminated string. Hence, the severe nonlinear effect of the hammer leaving the string (which changes the entire linear system model) turns out in the spectral domain to be a simple convolution by the appropriate rectangular windowed sinc function. The lower left plot in Figure 7.7 shows the inverse transform of the ratio spectrum. This is what is left of the multi-pulse hammer force signal if we de-convolve the single pulse

210 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 194 HAMMER FORCE 0 FORCE PECTRA amp ms DECONVOLUTION 0.4 db khz RATIO PECTRUM amp 0.2 db ms khz Figure 7.7: Middle-C (261 Hz) truck Hard: Force ignals Computed Using the WDH Parameterized with Physical Data Taken from (Chaigne and Askenfelt, 1994b)

211 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 195 v 0 δ Lowpass Filter (4th Order) EQ Filter (6th Order) F Figure 7.8: pectral EQ Method of Modeling the Hammer Filter MULTI-PULE REULT 20 RATIO PECTRUM FIT amp db ms khz Figure 7.9: ixth-order Filter Fit to Ratio pectrum force signal out of it. It appears to be a recursively damped impulse train, with some DC blocking, eventually centering the signal around zero. This is what was predicted by the linear hammer analysis as shown in Figure pectral Modeling Approach to the Multi-Pulse Effect An alternative approach to hammer filter design is to model the complex ratio spectrum as shown in the lower right plot of Figure 7.7 directly as a low-order filter. This reduces the recursive or feed-forward filter design methods of modeling multiple force pulses to a simple spectral equalization filter, as shown in Figure 7.8. In this case, we used a fourth-order fit for the single-pulse hammer lowpass filter. We then made a sixth-order equalization filter fit to a few of the significant low-frequency features of the ratio spectrum. The right hand plot of Figure 7.9 shows the equalization filter fit. The left-hand plot shows the time domain output of the hammer filter system shown in Figure 7.8. The thick dotted lines are actual data as generated by the Wave

212 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 196 Digital Hammer and the solid lines are the result of the filter fits. Note that the phase information in the sixth-order ratio spectrum fit results in a very good time domain approximation. In general, the coefficients of the lowpass filter part of this structure will be highly dependent on strike velocity, the harder the strike, the wider the bandwidth. However, the equalization part of this structure is reasonably consistent over strike velocity, and, in the simplified model, may be held constant over strike velocity, although it will vary with piano key number. 7.5 Excitation ynthesis with Nonlinearly Filtered Noise The impulse response of the piano soundboard is fundamentally a superposition of many exponentially decaying sinusoids, at least in its linear approximation. The reverberant effect of the soundboard occurs as energy from the struck piano strings is coupled into these modes and reverberated. However, if there were some particular modes of the soundboard which were unusually prominent, exhibiting a clear peak in the impulse response spectrum, and having an unusually long decay time, then a string which contained this frequency in one of its partials would couple into this mode more significantly than a string which did not have that frequency among its partials. This could produce unwanted unevenness in the piano tone from note to note. In general, much effort has been applied to the design of real piano soundboards to avoid such situations as these. The idealized piano soundboard should have a smooth, or flat spectral response locally, although it is evident that higher frequency modes decay a little faster than low-frequency modes (Wogram, 1980; uzuki, 1986; Nakamura, 1983). It is difficult to design a resonant system with such a flat response without using a very high-order filter, for example the 2-D Digital Waveguide Mesh (Van Duyne and mith, 1993b) described in Chapters 3 and 4. A finite element approach is described in (Kindel and Wang, 1987). On the other hand, it is easy to model the impulse response of such a system as exponentially decaying white noise, with the possible extension of a timevarying lowpass filter applied to model high-frequency modes decaying more quickly than low-frequency modes. Using such a nonlinearly filtered noise model, we may synthesize any number of reverberant systems which have the characteristic that they have more or less smooth responses over the frequency spectrum, with no particular peaks of importance. The piano soundboard is a system of this kind.

213 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 197 NOIE TIME VARYING FILTER brightness control gain control ENV1 ENV2 Figure 7.10: ynthesis of oundboard Tap with Nonlinearly Filtered Noise NOIE x(n) 1-POLE LOWPA FILTER WITH TIME VARYING COEFFICIENT y(n) a(n) ENV y(n) = [1+a(n)]x(n) - a(n) y(n-1), where a(n) ramps from 0 to -1 EXCITATION IGNAL Figure 7.11: 1-Pole oundboard Resonance Implementation ynthesized Highpass Portion of oundboard Response Low band excitation pulse for low mode resonator Low Mode oundboard Resonator + Hammer Filter tring Model Figure 7.12: Noise-Plus-Resonator oundboard ynthesis

214 CHAPTER 7. THE COMMUTABLE PIANO HAMMER RECORDED OUNDBOARD TAP PECTRUM 0 db Hz db Hz Figure 7.13: db Frequency Response of a Recorded Piano oundboard Tap (above) and a Close-Up of the Lower Frequencies (below)

215 CHAPTER 7. THE COMMUTABLE PIANO HAMMER YNTHEIZED OUNDBOARD TAP PECTRUM 20 db 0 db Hz Hz Figure 7.14: ynthetic oundboard Tap Using a wept 1-Pole and Noise

216 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 200 NOIE TIME VARYING FILTERING (T60 1/3 sec.) TIME VARYING FILTERING (T60 15 sec.) + ynthesized Wet oundboard Response Figure 7.15: Pedal-Down ynthesis of Dry oundboard Tap Plus Wet Open trings Tap In Figure 7.10 we show such a soundboard impulse response synthesis system. White noise is being fed into a time-varying lowpass filter whose gain and bandwidth are both being controlled by envelopes. One possible implementation of this would use a one-pole lowpass filter whose denominator coefficient is being swept toward 1, thereby shrinking the bandwidth. If the numerator coefficient is modified to keep gain at DC constant, the amplitude envelope might even be dispensed with in a simplified system as shown in Figure Alternatively, more elaborate noise filtering systems may be developed, possibly breaking the noise into frequency bands which could be treated independently to model to some particular impulse response. Figure 7.12 shows such an example. Figures 7.13 and 7.14 compare the db frequency response of a real measured piano soundboard tap and a synthesized soundboard tap based on the algorithm in Figure ynthesizing ustain Pedal Effect One of the signature sound effects of piano performance is carefully articulated use of the sustain pedal, i.e. raising and lowering the string dampers. A full set of pen strings coupled into the soundboard obviously increases the resonator complexity. However, just as the dry soundboard impulse response may be commuted to the point of excitation, similarly we may commute the entire sampled impulse response of the soundboard plus open strings with dampers raised to the point of excitation to obtain the resonant effect of the sustain pedal. Further, since there are so many resonating partials, the spectral

217 CHAPTER 7. THE COMMUTABLE PIANO HAMMER 201 response is essentially flat and filtered white noise with a long slow decay rate makes a good synthetic approximation. Figure 7.15 hows a simple implementation taking the dry soundboard tap to have a T60 decay time of 1/3 second, and taking the decay time of the open strings to be approximately 15 seconds. Other Applications The piano excitation model described above, comprising the linear hammer filter in conjunction with the dry and wet soundboard synthesis methods, makes a very efficient way to enhance other percussive instrument models ranging from simple modal synthesis, modal stochastic event modeling (Cook, 1996) or the coupled mode synthesis (Chapter 6), to the waveguide mesh models in Chapters 3 and 4. Numerous examples were demonstrated live at (Porcaro et al., 1996). 7.6 Wrap Up We have wandered through the wave equations, difference representations and multidimensional waveguide mesh representations, applications of traveling wave decomposition of lumped impedances, nonlinearities and coupled systems. This last chapter investigated some simplified approaches to piano sound synthesis. The Appendices will outline several synthesis techniques tangentially related to and extending the work presented in the main body of this thesis. Much of this work has been published already in separate conference proceedings and journal articles in the 1990s; follow-on work is addressed only lightly herein. It is my hope that the presentation of the material in this form may be helpful to readers just entering the field to give them a flavor of the tools, techniques, and potential applications.

218 Appendix A Pick-Up Point Modulation A.1 Implementation of a Variable Pick-Up Point on a Waveguide tring Model with FM/AM Applications The waveguide string model can be extended through the addition of a movable pick-up point along the string. As the pick-up slides along the string, a flanging effect results. Accelerating the pick-up produces glissandi effects. Modulating the placement of the pick-up sinusoidally at audio rates produces modified FM sidebands around each partial on the string, with control over the presence of even and odd sidebands. This non-physical effect can be used to enrich the timbre of physical models, taking advantage of the wellunderstood theory of FM synthesis. This research was first published in (Van Duyne and mith, 1992). A.2 Background and Description of the Model The bi-directional traveling displacement waves on an ideal string can be represented by a waveguide synthesis model. The actual displacement of the string at any point is determined by adding the displacements associated with the left- and right-going traveling waves in the bi-directional delay lines. The ideal reflection of the traveling waves at each end of the string, is modeled by multiplying the incoming wave by 1 and sending it through in the other direction. Figure A.1 illustrates the ideal string model. In order to listen to the vibrations on this string, a pick-up must be placed at some point on the string. Placement of a pick-up precisely on a sample point in the delay lines 202

219 APPENDIX A. PICK-UP POINT MODULATION 203 y + (n) 1 1 y(n) y (n) 0 x p 1 Figure A.1: Terminated tring and Pick-up Placement Model is straightforward. For our purposes, we would like to place a pick-up at any continuous point along the string. This necessitates an interpolation of some kind. If the pick-up is placed exactly at a sample point, the values of the upper and lower delay lines at that point are simply added. If the pick-up is to be placed at a fractional distance, α, between two sample points, then a weighted average of the two adjacent sample values must be performed. In these preliminary inquiries, linear interpolation is used. The results are excellent, but there is room for a better interpolation method in extreme cases of pickup point motion. Figure A.2 shows a close-up of the implementation of an interpolated pick-up point. A.3 Moving the Pick-Up Point Acoustically, the position of a pick-up on a string determines the relative magnitudes of the partials heard. If it is placed at one of the end points, no sound will be present as the end points do not move. If the pick-up is placed in the exact center of the string, only odd harmonics will be present in the spectrum as all even harmonics will have a node at that point. In general, placing the pick-up at a position 1/k across the string will zero out partials whose number is a multiple of k, and reduce levels of near multiples of k. The

220 APPENDIX A. PICK-UP POINT MODULATION Z -1 Z -1 Z -1 α 1 α y + (n) y(n) y - (n) α 1 α Z -1 Z -1 Z -1 Figure A.2: Close-up of the Interpolated Position of the Pick-up placement of a pick-up is therefore essentially a comb filter. liding the pick-up along the string slowly creates a flanging effect as the nodes of the various harmonics are crossed. Figure A.3 shows a sonograph view of the spectrum of the audio signal output from a sliding pick-up point. In this picture, the time axis is horizontal, and the frequency axis is vertical. The magnitude is indicated by relative lightness and darkness. Here, the pick-up slides across the length of the string at constant speed over the duration of the sound. The amplitude evolution of the first twelve harmonics on the string is shown in this sonograph view. When we slide the pick-up along the string, we are, in effect, catching up with one of the waves and losing ground with the other. This results in a separation of their frequencies through frequency modulation. Alternatively, one can view sliding the pickup point across the string as an amplitude modulation of each harmonic on the string at a frequency equal to half the harmonic number times the number of string lengths per second that the pick-up is moving. Figure A.4 shows a sonograph of a pick-up making discontinuous speed increases. Notice that the higher harmonics spread more than the lower in this linear frequency plot. This phenomenon is short-lived, however, if we are

221 APPENDIX A. PICK-UP POINT MODULATION 205 Figure A.3: low Continuous Pick-up Point Motion Over the tring Length

222 APPENDIX A. PICK-UP POINT MODULATION 206 Figure A.4: Fast Discontinuous Pick-up Point peeds

223 APPENDIX A. PICK-UP POINT MODULATION 207 bounded by the string end points. It is convenient to contrive a theoretical placement of the pick-up point beyond the ends of the string by extrapolation of the standing wave on the string. To generalize pick-up point motion we must define what it means to place the pick-up somewhere off the end of the actual string, that is, to extend the string in some way without discontinuity of the traveling waves in the delay lines. We do this by reading the separate upper and lower traveling waves back through the end point filters (here perfect reflections) and around backwards on the other delay line. To read at a pick-up located theoretically at some 1+δ, where the string length is 1, and δ is a positive number less than 1, we have the upper displacement, y + (1 + δ) = y (1 δ) and the lower displacement, y (1 + δ) = y + (1 δ). Therefore the composite displacement of the string, y, at pick-up point, 1 + δ, is as follows: y(1 + δ) = y + (1 + δ) + y (1 + δ) (A.1) = y (1 δ) y + (1 δ) (A.2) = y(1 δ) (A.3) In other words, to obtain a hypothetical displacement beyond the end of the string, just flip the sign and read backwards along the string. Now that we can maintain a continuous motion of the pick-up in one direction indefinitely, we may introduce the notion of acceleration as well as speed of the pick-up point along the string. Figure A.5 shows a string loaded with two harmonics at I khz and 5 khz with an accelerating pick-up point to produce expanding glissandi. In this four-second example, the pick-up point speed accelerates from 0 to 1000 string lengths per second. ince a string length is half the wavelength of the string fundamental, the downward gliding frequencies make it half the way to DC. Note there are also some aliasing sidebands in the picture relating to the error of linear interpolation. In the four seconds of sound depicted in Figure A.6, the pick-up point position is being modulated sinusoidally at a rate of 5 Hz, but its deviation from center is 10 string lengths. Where the double vibratos are at their furthest separation is when the pick-up point is flying past its center point of modulation at its greatest speed. Notice that the double vibratos in the upper harmonics cross over each other.

224 APPENDIX A. PICK-UP POINT MODULATION 208 Figure A.5: Effect of Accelerating Pick-up Point Position

225 APPENDIX A. PICK-UP POINT MODULATION 209 Figure A.6: inusoidally Oscillating Pick-up Point Position

226 APPENDIX A. PICK-UP POINT MODULATION 210 A.4 Modulating the Pick-Up Position at Audio Rates The next logical step is to modulate the pick-up point at audio rates. This results in a hybrid synthesis method akin to amplitude modulation (Dodge and Jerse, 1985) and/or frequency modulation (Chowning, 1973; Chowning and Bristow, 1987). We define the pick-up point modulation as follows: x p (t) = x p0 + d sin ω xp t, (A.4) where x p (t) is the resultant pick-up point placement measured in string lengths, x p0 is the center point of modulation, d is the deviation measured in string lengths, and ω xp is the frequency of the pick-up point modulation in radians. An excellent presentation of how standard FM math works can be found in (chottstaedt, 1992). With some follow on analysis, a closed form expression for the resultant spectrum heard from this modulating pick-up can be found as follows: y(t) = y k (t), where kεh (A.5) y k (t) = A k J 0 (I k ) sin φ k cos ω k t (A.6) + A k J i (I k ) cos φ k (sin (ω k + iω xp )t + sin ω k = iω xp t) (A.7) + i=odd i=even A k J i (I k ) sin φ k (cos (ω k + iω xp )t + cos ω k = iω xp t), (A.8) (A.9) where k is the harmonic number, H is the set of harmonics on the string, y k is the contribution to the total spectrum resulting from the k th harmonic, I k = πkd is the modulation index, φ k = πkxp0 is the phase offset determined by the position of the modulation center point, ω k is the frequency of the k th harmonic in radians, and ω xp is the radian frequency of the pick-up point placement modulation. This expression indicates that around each of the harmonics on the string, ω k, sidebands are produced at plus and minus multiples of the pick-up modulation frequency, ω xp, and that their magnitudes are dependent on Bessel functions of the first kind operating on an index based on d, the deviation of pick-up point modulation. These equations differ from ordinary FM, however, in that the odd sidebands are scaled by cos φ k and the even

227 APPENDIX A. PICK-UP POINT MODULATION 211 Figure A.7: Effects of Constant peed Plus Modulation Modulating on Pick-up Position sidebands are scaled by sin φ k, where φ k is, in effect, the relative position of the pick-up point modulation center point measured along the standing wave components of each of the harmonics on the string. When x p0 is at a harmonic node, that is at a position n/k on the string where n is an integer and k is the harmonic number, then sin φ k evaluates to zero and the even harmonics are zeroed out. On the other hand, when x p0 is at an anti-node of a harmonic, that is, at a position (n +.5)/k along the string, cosφ k evaluates to zero and the odd harmonics are zeroed out. liding the center point between a node and an anti-node produces a gradual exchange of energy from the even sidebands to the odd sidebands. Figure A.7 illustrates a four-second sound created by sliding the center point of pickup modulation from one end of the string to the other over the duration of the tone. The fundamental frequency of the string is 1000 Hz. Four harmonics were loaded onto the string, at start up. The modulation frequency was 100 Hz and the deviation was 0.1 string lengths. There are more side bands around the upper harmonics due to the greater effect of the deviation distance on the shorter wavelengths. Observe how the odd and even sidebands fade in and out as the center point of pick-up modulation glides over the nodes

228 APPENDIX A. PICK-UP POINT MODULATION 212 Figure A.8: Effects of Accelerating Pick-up Position with Modulation and anti-nodes of the various harmonics. Figure A.8 shows how speed and modulation can be combined. Here the first and fifth harmonics are loaded onto a 1000 Hz string at start-up time. The center point of modulation accelerates across the string from a speed of 200 string lengths per second up to 500 string lengths per second. Meanwhile, with a modulation frequency of 200 Hz, the deviation ramps from 0 to 1 string lengths back down to 0 over the course of the sound. Note that we lose the nice feature of individual control of odd and even sidebands when using speed or acceleration in combination with modulation. A.5 Conclusion While it is true that the results in the simple case of the ideal string with perfect reflections at the end points could be duplicated with traditional FM means, nonetheless, the interesting synthesis area that this opens up is combining FM and physical modeling techniques. There are many possibilities when a low pass or other system filter is placed at the

229 APPENDIX A. PICK-UP POINT MODULATION 213 end of the string instead of the perfect reflection. Waveguide models can be enriched by a modulating pick-up point, while on the other hand, traditional FM instruments can be rejuvenated by the loop filtering methods of physical modeling and waveguide synthesis.

230 Appendix B Pitchbendable Allpass Interpolation An efficient method for signal controllable fractional delay implementation is described here. It combines the flexible control of linear interpolation with frequency independent losslessness of allpass interpolation, avoiding the undesirable effects of each method. These results were first published in (Van Duyne et al., 1997) and (Van Duyne et al., 1998). B.1 The Problem tatement The development of high quality well calibrated physical modeling synthesis algorithms based on Karplus-trong-style feedback loops requires the use of non-integer length delay lines. These delay lines, ideally, should have two important features: (1) Their lengths must be smoothly and fractionally variable by some control signal in order to implement glissando and vibrato effects; (2) they must be lossless at all frequencies to minimize unwanted decay in physical modeling feedback loop structures. Linear interpolation can be easily calculated and varied smoothly, however the energy losses in the FIR structures are unsatisfactory, especially in high notes where they introduce unwanted and uncontrollable loop loss. On the other hand, allpass interpolation is lossless, but it is hard to interpolate the delay line length when the allpass filter coefficient gets out of range, and the sample length of the delay line needs to be changed. There is a discontinuity, or click, introduced into the loop. ome steps toward click-elimination are taken in (Välimäki et al., 1995) 214

231 APPENDIX B. PITCHBENDABLE ALLPA INTERPOLATION 215 By combining work done in legato crossfading (Jaffe and mith, 1995), allpass coefficient analysis (Välimäki et al., 1995), and taking note of some basic psychoacoustic research in just noticeable differences in pitch (Olson, 1967), we find a solution to the problem. B.2 Puzzle Pieces Implementation of linear interpolation using FIR filters and allpass interpolation was described in Chapter 2. We note here, that for a fractional delay of d samples, the corresponding first order allpass coefficient, a d, is approximated by the expression, a d (1 d)/(1 d) (B.1) o, if an output, y(n), is desired from a fractional point d fractional samples between samples x(n 1) and x(n), the output signal can be written: y(n) = a d x(n) + x(n 1) a d y(n 1) (B.2) B.2.1 Minimizing the Transient Effect The discontinuity resulting from changing the coefficient, a 0, can be minimized by keeping the coefficient value as close to zero as possible. The transient effect of changing the coefficient rings out at a rate proportional to the series: a, a 2, a 3,... We note that if the fraction delay, d, is kept within the unit range, to 1.618, then the corresponding allpass coefficient, a d remains between and This means that, with d in this range, the transient effect of a discontinuity in the coefficient after 5 samples is a maximum of , of about 62 db down. In effect, the allpass interpolation filter may be held to a 5 sample warm up time. B.2.2 Legato Crossfade of Digital Waveguide tring Models If a delay line length within a feedback loop changes suddenly, there will be a discontinuity in the signal. If the delay line length is changed gradually or smoothly (using fractional interpolation of some kind), audio artifacts may not result, but a glissando effect will result, which may not be desired. An algorithm to create a legitimate legato crossfade

232 APPENDIX B. PITCHBENDABLE ALLPA INTERPOLATION 216 DLEN_INT AP_COEF Parameter Generator DLEN crossfade orientation Crossfade Ramp Timing Controller AP_COEF2 1 AP_COEF1 DLEN_INT2 0 index DLEN_INT1 AUDIO IN u 1 (n) direction of signal flow Delay Line u 2 (n) Reader 1 AP 1 Reader 2 u 4 (n) AP 2 u 3 (n) Alternating Crossfader u 5 (n) AUDIO OUT u 6 (n) Figure B.1: The Interpolated Allpass Crossfade tructure effect is proposed in (Jaffe and mith, 1995) to solve this problem: Delay line memory is allocated using a circular buffer and setting up two delay line outputs, or read pointers and crossfading the output signal between them over a period of milliseconds to produce a realistic legato (not glissando). This works with such a long crossfade time because the circular buffer is already filled naturally with appropriate waveform material for the milliseconds of the crossfade. B.3 Implementation By combining the allpass interpolation method, and the legato crossfade method, we can find a practical structure for a flexible lossless fractional delay line implementation. The basic principle is to view glissando as lots and lots of very fast, tiny, legato crossfades. Construct a circular buffer delay line with two allpass interpolated read point outputs;

233 APPENDIX B. PITCHBENDABLE ALLPA INTERPOLATION 217 Warm-up Time Pan Position Function Cross Fade pan postion between AP1 and AP2 AP1 AP2 AP_COEF1, DLEN_INT1 Updates AP_COEF2, DLEN_INT2 Updates Audio ample Rate Time Figure B.2: Timing Diagram for the Alternating Crossfade Between Read Point Outputs then send updated allpass interpolation coefficients to the allpass every 16 samples and begin a crossfade. Figure B.1 shows a block diagram of this structure. The problem with this, as it stands, is that the allpass interpolation filters will be producing clicks every time a reader is set to a new position. However, the transient effect lasts only 5 samples if the fractional delay range is maintained between 0618 and 1.618, as we have shown. The 5 sample warm up period can be ignored by using a special crossfading function which waits 5 samples before beginning the crossfade over to the newly set allpass reader. When using a 16 sample alternation rate, this leaves 11 samples to do the actual crossfade, which in practice, is enough. Figure B.2 shows the critical timing of setting the new allpass coefficients and performing the delayed crossfade. B.3.1 Psychoacoustical Detail The human hearing system is only able to detect a finite number of different pitches. Two tones which are sufficiently close together in pitch become indistinguishable. There is a just noticeable difference (JND) threshold for human pitch differentiation. The number of JNDs per octave varies with register, but a representative worst case for our problem is that there are approximately 280 JNDs between 1000 Hz and 2000Hz. (or, in musical pitch, this it the approximate range, c6 to c7). (Olson, 1967). A JND in this worst case range comes out to be about 0.1 samples in a Karplus-trong feedback loop delay line

234 APPENDIX B. PITCHBENDABLE ALLPA INTERPOLATION 218 length for a 1000 Hz tone being computed at a sampling rate of 44.1kHz. It is easy to show that running the alternating crossfader at a rate of once per clock tick of 16 samples, and using a maximum glissando rate of one JND per clock tick, that we can gliss an octave from C6 to C7 in about one tenth of a second (280 16/ ). Moreover we do this very quick glissando crossfading between tones different by one JND, and we wait 5 samples for each new allpass state to settle down before crossfading. B.3.2 A DP Implementation Trick Many fixed-point DP chips can perform very fast multiply-add operations but do not support fast divide operations. o computing the allpass coefficient, a d, is hard. On the other hand, building an interpolation table is also fraught with the trade off between error and memory wastage. Fortunately, expanding a d in a Taylor s eries around the point d = 1 (which is in the middle of its working range, to 1.618) provides a solution: a d 1 d 1 + d d 1 (d 1)2 (d 1) (B.3) This is a very efficient implementation using only a few multiplies, adds, and possibly, right shifts. Maximum error in three terms is samples. Recall a JND in our worst case range, 1000Hz, is 0.1 samples. The allpass error using three terms of the expansion is on the order of a quarter of a JND (meaning it is not noticeable standing alone).

235 Appendix C tiffness Using Regions of FM C.1 Analysis/ynthesis Model of the pectral tructure The work presented in this Chapter was first published in (Van Duyne, 1992). There are two fundamental elements to the spectral structure of low piano tones which work together to create their characteristic sound. First, the magnitude spectrum is arranged in groupings of eight or nine partials. These groupings are not related to any kind of formant phenomenon, but are apparently the result of the hammer strike position on the string. The hammer position on the low piano strings has traditionally been placed very carefully at some point near 1/8 or 1/9 the distance across the length of the string. The acoustics of such a system dictates these kind of near nulls in the string spectrum at harmonics which are near multiples of eight or nine. Figure C.1 shows the partials grouping in sets of 8 or 9. In another view, the sonograph in Figure C.2 shows these groupings as well, the horizontal axis is time. The vertical axis is frequency (0 Hz to 2000 Hz). Lightness and darkness indicate the relative magnitudes. The second element of the spectral structure is that the harmonics of the low piano string are in fact not harmonic, but instead stretched at a fairly linear rate throughout the spectrum. The stiffness of thick piano strings in the lowest register causes the sinusoidal components of the traveling wave on the string to travel faster when at higher frequencies, thereby spawning harmonic resonances in the string at ever increasing partial spacings through the spectrum. tretching was measured for A0 (the lowest note on a conventional piano) at a rate of 10 Hz over 1000 Hz of spectrum. For example, near the A0 fundamental, 219

236 APPENDIX C. TIFFNE UING REGION OF FM 220 Figure C.1: Plotter Data howing Natural Groupings of Partials of A0

237 APPENDIX C. TIFFNE UING REGION OF FM 221 Figure C.2: pectral Evolution of A0

Smith, Kuroda, Perng, Van Heusen, Abel CCRMA, Stanford University ASA November 16, Smith, Kuroda, Perng, Van Heusen, Abel ASA / 31

Smith, Kuroda, Perng, Van Heusen, Abel CCRMA, Stanford University ASA November 16, Smith, Kuroda, Perng, Van Heusen, Abel ASA / 31 Efficient computational modeling of piano strings for real-time synthesis using mass-spring chains, coupled finite differences, and digital waveguide sections Smith, Kuroda, Perng, Van Heusen, Abel CCRMA,

More information

Vibrations of string. Henna Tahvanainen. November 8, ELEC-E5610 Acoustics and the Physics of Sound, Lecture 4

Vibrations of string. Henna Tahvanainen. November 8, ELEC-E5610 Acoustics and the Physics of Sound, Lecture 4 Vibrations of string EEC-E5610 Acoustics and the Physics of Sound, ecture 4 Henna Tahvanainen Department of Signal Processing and Acoustics Aalto University School of Electrical Engineering November 8,

More information

CMPT 889: Lecture 8 Digital Waveguides

CMPT 889: Lecture 8 Digital Waveguides CMPT 889: Lecture 8 Digital Waveguides Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University February 10, 2012 1 Motion for a Wave For the string, we are interested in the

More information

Music 206: Digital Waveguides

Music 206: Digital Waveguides Music 206: Digital Waveguides Tamara Smyth, trsmyth@ucsd.edu Department of Music, University of California, San Diego (UCSD) January 22, 2016 1 Motion for a Wave The 1-dimensional digital waveguide model

More information

Physical Modeling Synthesis

Physical Modeling Synthesis Physical Modeling Synthesis ECE 272/472 Audio Signal Processing Yujia Yan University of Rochester Table of contents 1. Introduction 2. Basics of Digital Waveguide Synthesis 3. Fractional Delay Line 4.

More information

Ideal String Struck by a Mass

Ideal String Struck by a Mass Ideal String Struck by a Mass MUS420/EE367A Lecture 7 Mass Striking a String (Simplified Piano Model) Julius O. Smith III (jos@ccrma.stanford.edu) Center for Computer Research in Music and Acoustics (CCRMA)

More information

MUS420 Lecture Mass Striking a String (Simplified Piano Model)

MUS420 Lecture Mass Striking a String (Simplified Piano Model) MUS420 Lecture Mass Striking a String (Simplified Piano Model) Julius O. Smith III (jos@ccrma.stanford.edu) Center for Computer Research in Music and Acoustics (CCRMA) Department of Music, Stanford University

More information

1.3 Sinusoidal Steady State

1.3 Sinusoidal Steady State 1.3 Sinusoidal Steady State Electromagnetics applications can be divided into two broad classes: Time-domain: Excitation is not sinusoidal (pulsed, broadband, etc.) Ultrawideband communications Pulsed

More information

CMPT 889: Lecture 9 Wind Instrument Modelling

CMPT 889: Lecture 9 Wind Instrument Modelling CMPT 889: Lecture 9 Wind Instrument Modelling Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 20, 2006 1 Scattering Scattering is a phenomenon in which the

More information

EECS 117 Lecture 3: Transmission Line Junctions / Time Harmonic Excitation

EECS 117 Lecture 3: Transmission Line Junctions / Time Harmonic Excitation EECS 117 Lecture 3: Transmission Line Junctions / Time Harmonic Excitation Prof. Niknejad University of California, Berkeley University of California, Berkeley EECS 117 Lecture 3 p. 1/23 Transmission Line

More information

Lecture 3: Acoustics

Lecture 3: Acoustics CSC 83060: Speech & Audio Understanding Lecture 3: Acoustics Michael Mandel mim@sci.brooklyn.cuny.edu CUNY Graduate Center, Computer Science Program http://mr-pc.org/t/csc83060 With much content from Dan

More information

Transform Representation of Signals

Transform Representation of Signals C H A P T E R 3 Transform Representation of Signals and LTI Systems As you have seen in your prior studies of signals and systems, and as emphasized in the review in Chapter 2, transforms play a central

More information

Numerical Sound Synthesis

Numerical Sound Synthesis Numerical Sound Synthesis Finite Difference Schemes and Simulation in Musical Acoustics Stefan Bilbao Acoustics and Fluid Dynamics Group/Music, University 01 Edinburgh, UK @WILEY A John Wiley and Sons,

More information

A Real Time Piano Model Including Longitudinal Modes

A Real Time Piano Model Including Longitudinal Modes Introduction String Modeling Implementation Issues A Real Time Piano Model Including Longitudinal Modes Stefano Zambon and Federico Fontana Dipartimento di Informatica Università degli Studi di Verona

More information

General Appendix A Transmission Line Resonance due to Reflections (1-D Cavity Resonances)

General Appendix A Transmission Line Resonance due to Reflections (1-D Cavity Resonances) A 1 General Appendix A Transmission Line Resonance due to Reflections (1-D Cavity Resonances) 1. Waves Propagating on a Transmission Line General A transmission line is a 1-dimensional medium which can

More information

A system that is both linear and time-invariant is called linear time-invariant (LTI).

A system that is both linear and time-invariant is called linear time-invariant (LTI). The Cooper Union Department of Electrical Engineering ECE111 Signal Processing & Systems Analysis Lecture Notes: Time, Frequency & Transform Domains February 28, 2012 Signals & Systems Signals are mapped

More information

Transmission Lines. Plane wave propagating in air Y unguided wave propagation. Transmission lines / waveguides Y. guided wave propagation

Transmission Lines. Plane wave propagating in air Y unguided wave propagation. Transmission lines / waveguides Y. guided wave propagation Transmission Lines Transmission lines and waveguides may be defined as devices used to guide energy from one point to another (from a source to a load). Transmission lines can consist of a set of conductors,

More information

Scattering. N-port Parallel Scattering Junctions. Physical Variables at the Junction. CMPT 889: Lecture 9 Wind Instrument Modelling

Scattering. N-port Parallel Scattering Junctions. Physical Variables at the Junction. CMPT 889: Lecture 9 Wind Instrument Modelling Scattering CMPT 889: Lecture 9 Wind Instrument Modelling Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser niversity November 2, 26 Scattering is a phenomenon in which the wave

More information

Musimathics The Mathematical Foundations of Music Volume 2. Gareth Loy. Foreword by John Chowning

Musimathics The Mathematical Foundations of Music Volume 2. Gareth Loy. Foreword by John Chowning Musimathics The Mathematical Foundations of Music Volume 2 Gareth Loy Foreword by John Chowning The MIT Press Cambridge, Massachusetts London, England ..2.3.4.5.6.7.8.9.0..2.3.4 2 2. 2.2 2.3 2.4 2.5 2.6

More information

Chapter 9. Reflection, Refraction and Polarization

Chapter 9. Reflection, Refraction and Polarization Reflection, Refraction and Polarization Introduction When you solved Problem 5.2 using the standing-wave approach, you found a rather curious behavior as the wave propagates and meets the boundary. A new

More information

Lecture 2: Acoustics. Acoustics & sound

Lecture 2: Acoustics. Acoustics & sound EE E680: Speech & Audio Processing & Recognition Lecture : Acoustics 1 3 4 The wave equation Acoustic tubes: reflections & resonance Oscillations & musical acoustics Spherical waves & room acoustics Dan

More information

Transmission lines. Shouri Chatterjee. October 22, 2014

Transmission lines. Shouri Chatterjee. October 22, 2014 Transmission lines Shouri Chatterjee October 22, 2014 The transmission line is a very commonly used distributed circuit: a pair of wires. Unfortunately, a pair of wires used to apply a time-varying voltage,

More information

Basic. Theory. ircuit. Charles A. Desoer. Ernest S. Kuh. and. McGraw-Hill Book Company

Basic. Theory. ircuit. Charles A. Desoer. Ernest S. Kuh. and. McGraw-Hill Book Company Basic C m ш ircuit Theory Charles A. Desoer and Ernest S. Kuh Department of Electrical Engineering and Computer Sciences University of California, Berkeley McGraw-Hill Book Company New York St. Louis San

More information

Dynamic circuits: Frequency domain analysis

Dynamic circuits: Frequency domain analysis Electronic Circuits 1 Dynamic circuits: Contents Free oscillation and natural frequency Transfer functions Frequency response Bode plots 1 System behaviour: overview 2 System behaviour : review solution

More information

kg meter ii) Note the dimensions of ρ τ are kg 2 velocity 2 meter = 1 sec 2 We will interpret this velocity in upcoming slides.

kg meter ii) Note the dimensions of ρ τ are kg 2 velocity 2 meter = 1 sec 2 We will interpret this velocity in upcoming slides. II. Generalizing the 1-dimensional wave equation First generalize the notation. i) "q" has meant transverse deflection of the string. Replace q Ψ, where Ψ may indicate other properties of the medium that

More information

A REVERBERATOR BASED ON ABSORBENT ALL-PASS FILTERS. Luke Dahl, Jean-Marc Jot

A REVERBERATOR BASED ON ABSORBENT ALL-PASS FILTERS. Luke Dahl, Jean-Marc Jot Proceedings of the COST G-6 Conference on Digital Audio Effects (DAFX-00), Verona, Italy, December 7-9, 000 A REVERBERATOR BASED ON ABSORBENT ALL-PASS FILTERS Lue Dahl, Jean-Marc Jot Creative Advanced

More information

A PIANO MODEL INCLUDING LONGITUDINAL STRING VIBRATIONS

A PIANO MODEL INCLUDING LONGITUDINAL STRING VIBRATIONS 04 DAFx A PIANO MODEL INCLUDING LONGITUDINAL STRING VIBRATIONS Balázs Bank and László Sujbert Department of Measurement and Information Systems Budapest University of Technology and Economics {bank sujbert}@mit.bme.hu

More information

Index. Index. More information. in this web service Cambridge University Press

Index. Index. More information.  in this web service Cambridge University Press A-type elements, 4 7, 18, 31, 168, 198, 202, 219, 220, 222, 225 A-type variables. See Across variable ac current, 172, 251 ac induction motor, 251 Acceleration rotational, 30 translational, 16 Accumulator,

More information

ME 563 HOMEWORK # 7 SOLUTIONS Fall 2010

ME 563 HOMEWORK # 7 SOLUTIONS Fall 2010 ME 563 HOMEWORK # 7 SOLUTIONS Fall 2010 PROBLEM 1: Given the mass matrix and two undamped natural frequencies for a general two degree-of-freedom system with a symmetric stiffness matrix, find the stiffness

More information

Scattering Parameters

Scattering Parameters Berkeley Scattering Parameters Prof. Ali M. Niknejad U.C. Berkeley Copyright c 2016 by Ali M. Niknejad September 7, 2017 1 / 57 Scattering Parameters 2 / 57 Scattering Matrix Voltages and currents are

More information

L = 1 2 a(q) q2 V (q).

L = 1 2 a(q) q2 V (q). Physics 3550, Fall 2011 Motion near equilibrium - Small Oscillations Relevant Sections in Text: 5.1 5.6 Motion near equilibrium 1 degree of freedom One of the most important situations in physics is motion

More information

EE40 Lecture 11 Josh Hug 7/19/2010

EE40 Lecture 11 Josh Hug 7/19/2010 EE40 Lecture Josh 7/9/200 Logistical Things Lab 4 tomorrow Lab 5 (active filter lab) on Wednesday Prototype for future lab for EE40 Prelab is very short, sorry. Please give us our feedback Google docs

More information

Q. 1 Q. 25 carry one mark each.

Q. 1 Q. 25 carry one mark each. GATE 5 SET- ELECTRONICS AND COMMUNICATION ENGINEERING - EC Q. Q. 5 carry one mark each. Q. The bilateral Laplace transform of a function is if a t b f() t = otherwise (A) a b s (B) s e ( a b) s (C) e as

More information

SEISMIC WAVE PROPAGATION. Lecture 2: Fourier Analysis

SEISMIC WAVE PROPAGATION. Lecture 2: Fourier Analysis SEISMIC WAVE PROPAGATION Lecture 2: Fourier Analysis Fourier Series & Fourier Transforms Fourier Series Review of trigonometric identities Analysing the square wave Fourier Transform Transforms of some

More information

Chapter 16 Waves in One Dimension

Chapter 16 Waves in One Dimension Chapter 16 Waves in One Dimension Slide 16-1 Reading Quiz 16.05 f = c Slide 16-2 Reading Quiz 16.06 Slide 16-3 Reading Quiz 16.07 Heavier portion looks like a fixed end, pulse is inverted on reflection.

More information

LAB MANUAL EXPERIMENT NO. 7

LAB MANUAL EXPERIMENT NO. 7 LAB MANUAL EXPERIMENT NO. 7 Aim of the Experiment: Concept of Generalized N-port scattering parameters, and formulation of these parameters into 2-port reflection and transmission coefficients. Requirement:

More information

Partial Differential Equations

Partial Differential Equations Partial Differential Equations Partial differential equations (PDEs) are equations involving functions of more than one variable and their partial derivatives with respect to those variables. Most (but

More information

Transmission Lines in the Frequency Domain

Transmission Lines in the Frequency Domain Berkeley Transmission Lines in the Frequency Domain Prof. Ali M. Niknejad U.C. Berkeley Copyright c 2016 by Ali M. Niknejad August 30, 2017 1 / 38 Why Sinusoidal Steady-State? 2 / 38 Time Harmonic Steady-State

More information

R-L-C Circuits and Resonant Circuits

R-L-C Circuits and Resonant Circuits P517/617 Lec4, P1 R-L-C Circuits and Resonant Circuits Consider the following RLC series circuit What's R? Simplest way to solve for is to use voltage divider equation in complex notation. X L X C in 0

More information

Music 420 Lecture Elementary Finite Different Schemes

Music 420 Lecture Elementary Finite Different Schemes Music 420 Lecture Elementary Finite Different Schemes Julius O. Smith III (jos@ccrma.stanford.edu) Center for Computer Research in Music and Acoustics (CCRMA) Department of Music, Stanford University Stanford,

More information

Introduction to Vibration. Mike Brennan UNESP, Ilha Solteira São Paulo Brazil

Introduction to Vibration. Mike Brennan UNESP, Ilha Solteira São Paulo Brazil Introduction to Vibration Mike Brennan UNESP, Ilha Solteira São Paulo Brazil Vibration Most vibrations are undesirable, but there are many instances where vibrations are useful Ultrasonic (very high

More information

Methods for Synthesizing Very High Q Parametrically Well Behaved Two Pole Filters

Methods for Synthesizing Very High Q Parametrically Well Behaved Two Pole Filters Methods for Synthesizing Very High Q Parametrically Well Behaved Two Pole Filters Max Mathews Julius O. Smith III Center for Computer Research in Music and Acoustics (CCRMA) Department of Music, Stanford

More information

CMPT 889: Lecture 2 Sinusoids, Complex Exponentials, Spectrum Representation

CMPT 889: Lecture 2 Sinusoids, Complex Exponentials, Spectrum Representation CMPT 889: Lecture 2 Sinusoids, Complex Exponentials, Spectrum Representation Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University September 26, 2005 1 Sinusoids Sinusoids

More information

Review of Linear Time-Invariant Network Analysis

Review of Linear Time-Invariant Network Analysis D1 APPENDIX D Review of Linear Time-Invariant Network Analysis Consider a network with input x(t) and output y(t) as shown in Figure D-1. If an input x 1 (t) produces an output y 1 (t), and an input x

More information

Laplace Transform Analysis of Signals and Systems

Laplace Transform Analysis of Signals and Systems Laplace Transform Analysis of Signals and Systems Transfer Functions Transfer functions of CT systems can be found from analysis of Differential Equations Block Diagrams Circuit Diagrams 5/10/04 M. J.

More information

Cylinder with Conical Cap

Cylinder with Conical Cap Cylinder with Conical Cap MUS420/EE367A Supplement to Lecture 11 Stability Proof for a Cylindrical Bore with Conical Cap Julius O. Smith III (jos@ccrma.stanford.edu) Center for Computer Research in Music

More information

Physical and Biological Properties of Agricultural Products Acoustic, Electrical and Optical Properties and Biochemical Property

Physical and Biological Properties of Agricultural Products Acoustic, Electrical and Optical Properties and Biochemical Property Physical and Biological Properties of Agricultural Products Acoustic, Electrical and Optical Properties and Biochemical Property 1. Acoustic and Vibrational Properties 1.1 Acoustics and Vibration Engineering

More information

Oversampling Converters

Oversampling Converters Oversampling Converters David Johns and Ken Martin (johns@eecg.toronto.edu) (martin@eecg.toronto.edu) slide 1 of 56 Motivation Popular approach for medium-to-low speed A/D and D/A applications requiring

More information

phantoms those which appear at the sum f m f n or difference

phantoms those which appear at the sum f m f n or difference Generation of longitudinal vibrations in piano strings: From physics to sound synthesis a) Balázs Bank b) and ászló Sujbert Department of Measurement and Information Systems, Budapest University of Technology

More information

Discrete-Time David Johns and Ken Martin University of Toronto

Discrete-Time David Johns and Ken Martin University of Toronto Discrete-Time David Johns and Ken Martin University of Toronto (johns@eecg.toronto.edu) (martin@eecg.toronto.edu) University of Toronto 1 of 40 Overview of Some Signal Spectra x c () t st () x s () t xn

More information

Honors Differential Equations

Honors Differential Equations MIT OpenCourseWare http://ocw.mit.edu 18.034 Honors Differential Equations Spring 009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. LECTURE 7. MECHANICAL

More information

Some of the different forms of a signal, obtained by transformations, are shown in the figure. jwt e z. jwt z e

Some of the different forms of a signal, obtained by transformations, are shown in the figure. jwt e z. jwt z e Transform methods Some of the different forms of a signal, obtained by transformations, are shown in the figure. X(s) X(t) L - L F - F jw s s jw X(jw) X*(t) F - F X*(jw) jwt e z jwt z e X(nT) Z - Z X(z)

More information

2.0 Theory. 2.1 Ground Vibration Test

2.0 Theory. 2.1 Ground Vibration Test 2.0 Theory The following section provides a comprehensive overview of the theory behind the concepts and requirements of a GVT (Ground Vibration Test), as well as some of the background knowledge required

More information

Microwave Phase Shift Using Ferrite Filled Waveguide Below Cutoff

Microwave Phase Shift Using Ferrite Filled Waveguide Below Cutoff Microwave Phase Shift Using Ferrite Filled Waveguide Below Cutoff CHARLES R. BOYD, JR. Microwave Applications Group, Santa Maria, California, U. S. A. ABSTRACT Unlike conventional waveguides, lossless

More information

ECE 6340 Intermediate EM Waves. Fall Prof. David R. Jackson Dept. of ECE. Notes 7

ECE 6340 Intermediate EM Waves. Fall Prof. David R. Jackson Dept. of ECE. Notes 7 ECE 634 Intermediate EM Waves Fall 16 Prof. David R. Jackson Dept. of ECE Notes 7 1 TEM Transmission Line conductors 4 parameters C capacitance/length [F/m] L inductance/length [H/m] R resistance/length

More information

Accelerator Physics. Tip World Scientific NEW JERSEY LONDON SINGAPORE BEIJING SHANGHAI HONG KONG TAIPEI BANGALORE. Second Edition. S. Y.

Accelerator Physics. Tip World Scientific NEW JERSEY LONDON SINGAPORE BEIJING SHANGHAI HONG KONG TAIPEI BANGALORE. Second Edition. S. Y. Accelerator Physics Second Edition S. Y. Lee Department of Physics, Indiana University Tip World Scientific NEW JERSEY LONDON SINGAPORE BEIJING SHANGHAI HONG KONG TAIPEI BANGALORE Contents Preface Preface

More information

THE SYRINX: NATURE S HYBRID WIND INSTRUMENT

THE SYRINX: NATURE S HYBRID WIND INSTRUMENT THE SYRINX: NATURE S HYBRID WIND INSTRUMENT Tamara Smyth, Julius O. Smith Center for Computer Research in Music and Acoustics Department of Music, Stanford University Stanford, California 94305-8180 USA

More information

Lecture 9 Infinite Impulse Response Filters

Lecture 9 Infinite Impulse Response Filters Lecture 9 Infinite Impulse Response Filters Outline 9 Infinite Impulse Response Filters 9 First-Order Low-Pass Filter 93 IIR Filter Design 5 93 CT Butterworth filter design 5 93 Bilinear transform 7 9

More information

Sinusoids and Phasors

Sinusoids and Phasors CHAPTER 9 Sinusoids and Phasors We now begins the analysis of circuits in which the voltage or current sources are time-varying. In this chapter, we are particularly interested in sinusoidally time-varying

More information

The simulation of piano string vibration: From physical models to finite difference schemes and digital waveguides

The simulation of piano string vibration: From physical models to finite difference schemes and digital waveguides The simulation of piano string vibration: From physical models to finite difference schemes and digital waveguides Julien Bensa, Stefan Bilbao, Richard Kronland-Martinet, Julius Smith Iii To cite this

More information

EE482: Digital Signal Processing Applications

EE482: Digital Signal Processing Applications Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu EE482: Digital Signal Processing Applications Spring 2014 TTh 14:30-15:45 CBC C222 Lecture 05 IIR Design 14/03/04 http://www.ee.unlv.edu/~b1morris/ee482/

More information

Sinusoids. Amplitude and Magnitude. Phase and Period. CMPT 889: Lecture 2 Sinusoids, Complex Exponentials, Spectrum Representation

Sinusoids. Amplitude and Magnitude. Phase and Period. CMPT 889: Lecture 2 Sinusoids, Complex Exponentials, Spectrum Representation Sinusoids CMPT 889: Lecture Sinusoids, Complex Exponentials, Spectrum Representation Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University September 6, 005 Sinusoids are

More information

Damped harmonic motion

Damped harmonic motion Damped harmonic motion March 3, 016 Harmonic motion is studied in the presence of a damping force proportional to the velocity. The complex method is introduced, and the different cases of under-damping,

More information

E : Lecture 1 Introduction

E : Lecture 1 Introduction E85.2607: Lecture 1 Introduction 1 Administrivia 2 DSP review 3 Fun with Matlab E85.2607: Lecture 1 Introduction 2010-01-21 1 / 24 Course overview Advanced Digital Signal Theory Design, analysis, and implementation

More information

16 SUPERPOSITION & STANDING WAVES

16 SUPERPOSITION & STANDING WAVES Chapter 6 SUPERPOSITION & STANDING WAVES 6. Superposition of waves Principle of superposition: When two or more waves overlap, the resultant wave is the algebraic sum of the individual waves. Illustration:

More information

Chapter 5 Frequency Domain Analysis of Systems

Chapter 5 Frequency Domain Analysis of Systems Chapter 5 Frequency Domain Analysis of Systems CT, LTI Systems Consider the following CT LTI system: xt () ht () yt () Assumption: the impulse response h(t) is absolutely integrable, i.e., ht ( ) dt< (this

More information

7.2 Relationship between Z Transforms and Laplace Transforms

7.2 Relationship between Z Transforms and Laplace Transforms Chapter 7 Z Transforms 7.1 Introduction In continuous time, the linear systems we try to analyse and design have output responses y(t) that satisfy differential equations. In general, it is hard to solve

More information

Lecture 4: R-L-C Circuits and Resonant Circuits

Lecture 4: R-L-C Circuits and Resonant Circuits Lecture 4: R-L-C Circuits and Resonant Circuits RLC series circuit: What's V R? Simplest way to solve for V is to use voltage divider equation in complex notation: V X L X C V R = in R R + X C + X L L

More information

Real Sound Synthesis for Interactive Applications

Real Sound Synthesis for Interactive Applications Real Sound Synthesis for Interactive Applications Perry R. Cook я А К Peters Natick, Massachusetts Contents Introduction xi 1. Digital Audio Signals 1 1.0 Introduction 1 1.1 Digital Audio Signals 1 1.2

More information

Refinements to Incremental Transistor Model

Refinements to Incremental Transistor Model Refinements to Incremental Transistor Model This section presents modifications to the incremental models that account for non-ideal transistor behavior Incremental output port resistance Incremental changes

More information

Often, in this class, we will analyze a closed-loop feedback control system, and end up with an equation of the form

Often, in this class, we will analyze a closed-loop feedback control system, and end up with an equation of the form ME 32, Spring 25, UC Berkeley, A. Packard 55 7 Review of SLODEs Throughout this section, if y denotes a function (of time, say), then y [k or y (k) denotes the k th derivative of the function y, y [k =

More information

Electric Circuit Theory

Electric Circuit Theory Electric Circuit Theory Nam Ki Min nkmin@korea.ac.kr 010-9419-2320 Chapter 11 Sinusoidal Steady-State Analysis Nam Ki Min nkmin@korea.ac.kr 010-9419-2320 Contents and Objectives 3 Chapter Contents 11.1

More information

Electromagnetic Waves

Electromagnetic Waves Electromagnetic Waves Our discussion on dynamic electromagnetic field is incomplete. I H E An AC current induces a magnetic field, which is also AC and thus induces an AC electric field. H dl Edl J ds

More information

An example of answers for the final report of Electronics"

An example of answers for the final report of Electronics An example of answers for the final report of Electronics" Shingo Katsumoto February 7, 07 Here is an example of answers. There are many other possibilities. DA conversion circuits. Resistance-ladder type

More information

The Harmonic Oscillator

The Harmonic Oscillator The Harmonic Oscillator Math 4: Ordinary Differential Equations Chris Meyer May 3, 008 Introduction The harmonic oscillator is a common model used in physics because of the wide range of problems it can

More information

Chapter 23: Principles of Passive Vibration Control: Design of absorber

Chapter 23: Principles of Passive Vibration Control: Design of absorber Chapter 23: Principles of Passive Vibration Control: Design of absorber INTRODUCTION The term 'vibration absorber' is used for passive devices attached to the vibrating structure. Such devices are made

More information

Superposition and Standing Waves

Superposition and Standing Waves Physics 1051 Lecture 9 Superposition and Standing Waves Lecture 09 - Contents 14.5 Standing Waves in Air Columns 14.6 Beats: Interference in Time 14.7 Non-sinusoidal Waves Trivia Questions 1 How many wavelengths

More information

CIRCUIT ANALYSIS II. (AC Circuits)

CIRCUIT ANALYSIS II. (AC Circuits) Will Moore MT & MT CIRCUIT ANALYSIS II (AC Circuits) Syllabus Complex impedance, power factor, frequency response of AC networks including Bode diagrams, second-order and resonant circuits, damping and

More information

Sound, acoustics Slides based on: Rossing, The science of sound, 1990, and Pulkki, Karjalainen, Communication acoutics, 2015

Sound, acoustics Slides based on: Rossing, The science of sound, 1990, and Pulkki, Karjalainen, Communication acoutics, 2015 Acoustics 1 Sound, acoustics Slides based on: Rossing, The science of sound, 1990, and Pulkki, Karjalainen, Communication acoutics, 2015 Contents: 1. Introduction 2. Vibrating systems 3. Waves 4. Resonance

More information

THE SYRINX: NATURE S HYBRID WIND INSTRUMENT

THE SYRINX: NATURE S HYBRID WIND INSTRUMENT THE SYRINX: NTURE S HYBRID WIND INSTRUMENT Tamara Smyth, Julius O. Smith Center for Computer Research in Music and coustics Department of Music, Stanford University Stanford, California 94305-8180 US tamara@ccrma.stanford.edu,

More information

EQUIVALENT SINGLE-DEGREE-OF-FREEDOM SYSTEM AND FREE VIBRATION

EQUIVALENT SINGLE-DEGREE-OF-FREEDOM SYSTEM AND FREE VIBRATION 1 EQUIVALENT SINGLE-DEGREE-OF-FREEDOM SYSTEM AND FREE VIBRATION The course on Mechanical Vibration is an important part of the Mechanical Engineering undergraduate curriculum. It is necessary for the development

More information

ECEN689: Special Topics in High-Speed Links Circuits and Systems Spring 2012

ECEN689: Special Topics in High-Speed Links Circuits and Systems Spring 2012 ECEN689: pecial Topics in High-peed Links Circuits and ystems pring 01 Lecture 3: Time-Domain Reflectometry & -Parameter Channel Models am Palermo Analog & Mixed-ignal Center Texas A&M University Announcements

More information

Driven RLC Circuits Challenge Problem Solutions

Driven RLC Circuits Challenge Problem Solutions Driven LC Circuits Challenge Problem Solutions Problem : Using the same circuit as in problem 6, only this time leaving the function generator on and driving below resonance, which in the following pairs

More information

Physics 121H Fall Homework #15 23-November-2015 Due Date : 2-December-2015

Physics 121H Fall Homework #15 23-November-2015 Due Date : 2-December-2015 Reading : Chapters 16 and 17 Note: Reminder: Physics 121H Fall 2015 Homework #15 23-November-2015 Due Date : 2-December-2015 This is a two-week homework assignment that will be worth 2 homework grades

More information

EE221 Circuits II. Chapter 14 Frequency Response

EE221 Circuits II. Chapter 14 Frequency Response EE22 Circuits II Chapter 4 Frequency Response Frequency Response Chapter 4 4. Introduction 4.2 Transfer Function 4.3 Bode Plots 4.4 Series Resonance 4.5 Parallel Resonance 4.6 Passive Filters 4.7 Active

More information

Notes on Fourier Series and Integrals Fourier Series

Notes on Fourier Series and Integrals Fourier Series Notes on Fourier Series and Integrals Fourier Series et f(x) be a piecewise linear function on [, ] (This means that f(x) may possess a finite number of finite discontinuities on the interval). Then f(x)

More information

Chapter 15 Mechanical Waves

Chapter 15 Mechanical Waves Chapter 15 Mechanical Waves 1 Types of Mechanical Waves This chapter and the next are about mechanical waves waves that travel within some material called a medium. Waves play an important role in how

More information

Wave Phenomena Physics 15c. Lecture 9 Wave Reflection Standing Waves

Wave Phenomena Physics 15c. Lecture 9 Wave Reflection Standing Waves Wave Phenomena Physics 15c Lecture 9 Wave Reflection Standing Waves What We Did Last Time Energy and momentum in LC transmission lines Transfer rates for normal modes: and The energy is carried by the

More information

Dynamic Systems. Modeling and Analysis. Hung V. Vu. Ramin S. Esfandiari. THE McGRAW-HILL COMPANIES, INC. California State University, Long Beach

Dynamic Systems. Modeling and Analysis. Hung V. Vu. Ramin S. Esfandiari. THE McGRAW-HILL COMPANIES, INC. California State University, Long Beach Dynamic Systems Modeling and Analysis Hung V. Vu California State University, Long Beach Ramin S. Esfandiari California State University, Long Beach THE McGRAW-HILL COMPANIES, INC. New York St. Louis San

More information

Static & Dynamic. Analysis of Structures. Edward L.Wilson. University of California, Berkeley. Fourth Edition. Professor Emeritus of Civil Engineering

Static & Dynamic. Analysis of Structures. Edward L.Wilson. University of California, Berkeley. Fourth Edition. Professor Emeritus of Civil Engineering Static & Dynamic Analysis of Structures A Physical Approach With Emphasis on Earthquake Engineering Edward LWilson Professor Emeritus of Civil Engineering University of California, Berkeley Fourth Edition

More information

Schedule. ECEN 301 Discussion #20 Exam 2 Review 1. Lab Due date. Title Chapters HW Due date. Date Day Class No. 10 Nov Mon 20 Exam Review.

Schedule. ECEN 301 Discussion #20 Exam 2 Review 1. Lab Due date. Title Chapters HW Due date. Date Day Class No. 10 Nov Mon 20 Exam Review. Schedule Date Day lass No. 0 Nov Mon 0 Exam Review Nov Tue Title hapters HW Due date Nov Wed Boolean Algebra 3. 3.3 ab Due date AB 7 Exam EXAM 3 Nov Thu 4 Nov Fri Recitation 5 Nov Sat 6 Nov Sun 7 Nov Mon

More information

Physics 142 AC Circuits Page 1. AC Circuits. I ve had a perfectly lovely evening but this wasn t it. Groucho Marx

Physics 142 AC Circuits Page 1. AC Circuits. I ve had a perfectly lovely evening but this wasn t it. Groucho Marx Physics 142 A ircuits Page 1 A ircuits I ve had a perfectly lovely evening but this wasn t it. Groucho Marx Alternating current: generators and values It is relatively easy to devise a source (a generator

More information

EE221 Circuits II. Chapter 14 Frequency Response

EE221 Circuits II. Chapter 14 Frequency Response EE22 Circuits II Chapter 4 Frequency Response Frequency Response Chapter 4 4. Introduction 4.2 Transfer Function 4.3 Bode Plots 4.4 Series Resonance 4.5 Parallel Resonance 4.6 Passive Filters 4.7 Active

More information

Q. 1 Q. 25 carry one mark each.

Q. 1 Q. 25 carry one mark each. Q. Q. 5 carry one mark each. Q. Consider a system of linear equations: x y 3z =, x 3y 4z =, and x 4y 6 z = k. The value of k for which the system has infinitely many solutions is. Q. A function 3 = is

More information

ELECTROMAGNETISM. Second Edition. I. S. Grant W. R. Phillips. John Wiley & Sons. Department of Physics University of Manchester

ELECTROMAGNETISM. Second Edition. I. S. Grant W. R. Phillips. John Wiley & Sons. Department of Physics University of Manchester ELECTROMAGNETISM Second Edition I. S. Grant W. R. Phillips Department of Physics University of Manchester John Wiley & Sons CHICHESTER NEW YORK BRISBANE TORONTO SINGAPORE Flow diagram inside front cover

More information

Lecture 4 Notes: 06 / 30. Energy carried by a wave

Lecture 4 Notes: 06 / 30. Energy carried by a wave Lecture 4 Notes: 06 / 30 Energy carried by a wave We want to find the total energy (kinetic and potential) in a sine wave on a string. A small segment of a string at a fixed point x 0 behaves as a harmonic

More information

Chapter 1 Fundamental Concepts

Chapter 1 Fundamental Concepts Chapter 1 Fundamental Concepts Signals A signal is a pattern of variation of a physical quantity as a function of time, space, distance, position, temperature, pressure, etc. These quantities are usually

More information

Excitation Optimization of a Standard LRC Circuit with Impulsive Forces Selected via Simulated Annealing

Excitation Optimization of a Standard LRC Circuit with Impulsive Forces Selected via Simulated Annealing Hamline University DigitalCommons@Hamline Departmental Honors Projects College of Liberal Arts Spring 2013 Excitation Optimization of a Standard LRC Circuit with Impulsive Forces Selected via Simulated

More information

Notes on the Periodically Forced Harmonic Oscillator

Notes on the Periodically Forced Harmonic Oscillator Notes on the Periodically orced Harmonic Oscillator Warren Weckesser Math 38 - Differential Equations 1 The Periodically orced Harmonic Oscillator. By periodically forced harmonic oscillator, we mean the

More information

4. Complex Oscillations

4. Complex Oscillations 4. Complex Oscillations The most common use of complex numbers in physics is for analyzing oscillations and waves. We will illustrate this with a simple but crucially important model, the damped harmonic

More information