NUMERICAL SOUND SYNTHESIS Ii Numerical Sound Synthesis
Total Page:16
File Type:pdf, Size:1020Kb
NUMERICAL SOUND SYNTHESIS ii Numerical Sound Synthesis Stefan Bilbao November 27, 2007 iii iv Contents Preface xiii 1 Sound Synthesis and Physical Modeling 1 1.1 AbstractDigitalSoundSynthesis . .......... 2 1.1.1 AdditiveSynthesis . .. .. .. .. .. .. .. .. .. .. .. .. .... 3 1.1.2 SubtractiveSynthesis . ..... 5 1.1.3 WavetableSynthesis . .... 5 1.1.4 AMandFMSynthesis.............................. 7 1.1.5 OtherMethods .................................. 8 1.2 PhysicalModeling ................................ ..... 9 1.2.1 LumpedMass-SpringNetworks . ..... 10 1.2.2 ModalSynthesis ................................ .. 11 1.2.3 DigitalWaveguides. .... 13 1.2.4 HybridMethods ................................. 16 1.2.5 DirectNumericalSimulation . ...... 17 1.3 PhysicalModeling: ALargerView . ........ 20 1.3.1 Physical Models as Descended from Abstract Synthesis ............ 20 1.3.2 Connections: Direct Simulation and Other Methods . ........... 21 1.3.3 ComplexityofMusicalSystems . ...... 22 1.3.4 Why? ........................................ 25 2 Time Series and Difference Operators 27 2.1 TimeSeries ...................................... ... 28 2.2 Shift, Difference and AveragingOperators . ............ 29 2.2.1 TemporalWidth ofDifference Operators. ........ 30 2.2.2 CombiningDifferenceOperators . ...... 31 2.2.3 TaylorSeriesandAccuracy . ..... 32 2.2.4 Identities .................................... .. 33 2.3 FrequencyDomainAnalysis . ....... 34 2.3.1 Laplace and z transforms ............................. 34 2.3.2 Frequency Domain Interpretation of Differential and Difference Operators . 35 2.3.3 Recursions and Polynomials in z ......................... 36 2.3.4 Difference Operatorsand Digital Filters . .......... 38 2.4 Energetic Manipulations and Identities . ............. 41 v 2.4.1 Time Derivatives of Products of Functions or Time Series........... 42 2.4.2 ProductIdentities ............................. .... 44 2.4.3 QuadraticForms ................................ .. 44 2.5 Problems ........................................ .. 46 3 The Oscillator 49 3.1 TheSimpleHarmonicOscillator . ........ 50 3.1.1 SinusoidalSolution. ..... 50 3.1.2 Energy........................................ 52 3.1.3 AsFirst-OrderSystem. .... 52 3.1.4 CoupledSystemsofOscillators . ....... 53 3.2 ASimpleScheme................................... ... 53 3.2.1 AsRecursion ................................... 54 3.2.2 Initialization ................................ .... 54 3.2.3 NumericalInstability. ...... 54 3.2.4 FrequencyDomainAnalysis . ..... 55 3.2.5 Accuracy ...................................... 56 3.2.6 EnergyAnalysis ................................ .. 57 3.2.7 ComputationalConsiderations . ....... 58 3.3 OtherSchemes .................................... ... 59 3.3.1 UsingTime-averagingOperators . ....... 59 3.3.2 ASecond-orderFamilyofSchemes . ...... 60 3.3.3 WaveDigitalFilters .. .. .. .. .. .. .. .. .. .. .. .. .... 61 3.3.4 AnExactSolution ............................... .. 64 3.3.5 FurtherMethods ................................ .. 65 3.4 LumpedMass-SpringNetworks . ....... 65 3.5 Loss ............................................ 66 3.5.1 Energy........................................ 67 3.5.2 FiniteDifferenceScheme. ..... 68 3.5.3 NumericalDecayTime. ... 69 3.5.4 AnExactSolution ............................... .. 71 3.6 Sources ......................................... .. 71 3.7 Problems ........................................ .. 72 3.8 ProgrammingExercises . ...... 75 4 The Oscillator in Musical Acoustics 77 4.1 NonlinearOscillators. ........ 78 4.2 LosslessOscillators.. .. .. .. .. .. .. .. .. .. .. .. ........ 78 4.2.1 TheCubicNonlinearOscillator . ....... 79 4.2.2 PowerLawNonlinearities . ..... 82 4.2.3 One-sided Nonlinearities and Collisions: Hammers andMallets ........ 82 4.2.4 Center-limited Nonlinearities . ......... 86 4.3 LossyOscillators ................................ ...... 87 4.3.1 TheBow ...................................... 87 4.3.2 ReedandLipModels .............................. 91 4.4 Problems ........................................ .. 91 vi 4.5 ProgrammingExercises . ...... 93 5 Grid Functions and Finite Difference Operators in One Dimension 95 5.1 PartialDifferentialOperators . .......... 95 5.1.1 ClassificationofPDEs . .... 96 5.1.2 LaplaceandFourierTransforms. ....... 97 5.1.3 Inner Products and Energetic Manipulations . .......... 99 5.2 Grid Functions and Difference Operators in One Dimension .............. 100 5.2.1 Time Difference andAveragingOperators . ........ 101 5.2.2 SpatialDifferenceOperators . ...... 101 5.2.3 Mixed Spatial-Temporal Difference Operators . ........... 102 5.2.4 Interpolation and Spreading Operators . .......... 103 5.2.5 AccuracyofDifferenceOperators . ....... 105 5.2.6 FrequencyDomainInterpretation. ........ 106 5.2.7 Matrix Interpretation of Difference Operators . ............ 108 5.2.8 Boundary Conditions and Imaginary Grid Points . .......... 108 5.2.9 InnerProductsandIdentities . ....... 110 5.2.10 SummationbyParts .. .. .. .. .. .. .. .. .. .. .. .. .. 111 5.2.11 SomeBounds................................... 111 5.2.12 Interpolation and Spreading Revisited . ........... 112 5.3 CoordinateChanges ............................... ..... 112 5.4 Problems ........................................ 113 5.5 ProgrammingExercises . ...... 115 6 The 1D Wave Equation 117 6.1 DefinitionandProperties . ....... 118 6.1.1 LinearArrayofMassesandSprings . ...... 119 6.1.2 Non-dimensionalizedForm. ...... 120 6.1.3 InitialConditions.. .. .. .. .. .. .. .. .. .. .. .. ..... 120 6.1.4 Strikes and Plucks: Time Evolution of Solution . ........... 121 6.1.5 DispersionRelation .. .. .. .. .. .. .. .. .. .. .. .. .... 122 6.1.6 PhaseandGroupVelocity. .... 122 6.1.7 Travelling Wave Solutions . ...... 123 6.1.8 EnergyAnalysis ................................ 123 6.1.9 BoundaryConditions . .. .. .. .. .. .. .. .. .. .. .. .. 124 6.1.10 BoundsonSolutionSize . ..... 126 6.1.11 Modes........................................ 128 6.2 A Simple Finite Difference Scheme . ........ 131 6.2.1 Initialization ................................ .... 132 6.2.2 vonNeumannAnalysis. .. 132 6.2.3 NumericalDispersion . .... 134 6.2.4 Accuracy ...................................... 136 6.2.5 EnergyAnalysis ................................ 137 6.2.6 NumericalBoundaryConditions . ...... 138 6.2.7 Bounds on Solution Size and Numerical Stability . ........... 139 6.2.8 StateSpaceFormandModes . .. 142 vii 6.2.9 OutputandInterpolation . ..... 144 6.2.10 Implementation Details and Computational Requirements........... 145 6.2.11 Digital Waveguide Interpretation . .......... 147 6.3 OtherSchemes .................................... .. 149 6.3.1 A Stencil-width Five Scheme . ..... 149 6.3.2 ACompactImplicitScheme. .... 150 6.4 ModalSynthesis .................................. .... 153 6.5 Loss ............................................ 153 6.5.1 FiniteDifferenceScheme. ..... 154 6.6 A Comparative Study: Physical Modeling Sound Synthesis Methods . 155 6.6.1 Accuracy ...................................... 155 6.6.2 MemoryUse .................................... 155 6.6.3 Precomputation ................................ 156 6.6.4 OperationCount ................................ 156 6.6.5 Stability..................................... 156 6.6.6 GeneralityandFlexibility . ....... 156 6.7 Problems ........................................ 156 6.8 ProgrammingExercises . ...... 159 7 Bars and Linear Strings 161 7.1 TheIdealUniformBar.............................. ..... 161 7.1.1 Dispersion.................................... 162 7.1.2 Energy Analysis and Boundary Conditions . ........ 163 7.1.3 Modes........................................ 164 7.1.4 A Simple Finite Difference Scheme . ...... 166 7.1.5 AnImplicitScheme .............................. 170 7.2 StiffStrings..................................... .... 172 7.2.1 EnergyandBoundaryConditions. ...... 173 7.2.2 Modes........................................ 174 7.2.3 FiniteDifferenceSchemes . ..... 174 7.3 FrequencyDependentLoss. ....... 175 7.3.1 EnergyandBoundaryConditions. ...... 177 7.3.2 FiniteDifferenceSchemes . ..... 177 7.4 CouplingwithBowModels .. .. .. .. .. .. .. .. .. .. .. ..... 178 7.5 Coupling with Hammer and Mallet Models . ........ 180 7.6 MultipleStrings ................................. ..... 181 7.7 PreparedStrings ................................. ..... 183 7.7.1 SpringsandDampers ............................. 183 7.7.2 Masses........................................ 187 7.7.3 RattlingElements .............................. .. 188 7.8 CoupledStringsandBars . ...... 188 7.8.1 ConnectionTypes ............................... 190 7.8.2 FiniteDifferenceSchemes . ..... 191 7.9 Spatial Variation and Stretched Coordinates . .............. 193 7.9.1 StringsofVaryingDensity. ...... 193 7.9.2 BarsofVaryingCross-sectionalArea . ......... 196 viii 7.10Problems ....................................... .. 199 7.11 ProgrammingExercises . ....... 201 8 Nonlinear String Vibration 203 8.1 TheKirchhoff-CarrierStringModel. .......... 203 8.1.1 Amplitude-dependent Pitch . ...... 204 8.1.2 Energy Analysis and Boundary Conditions . ........ 205 8.1.3 FiniteDifferenceSchemes . ..... 205 8.1.4 AQuasi-modalForm.............................. 208 8.1.5 LossandPitchGlides ............................ .. 209 8.1.6 ADigitalWaveguideForm . .. 209 8.1.7 ANonlinearBarModel ............................ 209 8.2 General Planar Nonlinear String Motion . ........... 209 8.2.1 Coupling Between Transverse and Longitudinal Modes and Phantom Partials