Musimathics

The Mathematical Foundations of Music

Volume I: Musical Elements

Volume II: Musical Signals

by Dr. Gareth Loy

Availability

About Musimathics

"Mathematics can be as effortless as humming a tune, if you know the tune," writes Gareth Loy. In Musimathics, Loy teaches us the tune, providing a friendly and spirited tour of the mathematics of music--a commonsense, self-contained introduction for the nonspecialist reader. It is designed for musicians who find their art increasingly mediated by technology, and for anyone who is interested in the intersection of art and science.

In this volume, Loy presents the materials of music (notes, intervals, and scales); the physical properties of music (frequency, amplitude, duration, and timbre); the perception of music and sound (how we hear); and music composition. Musimathics is carefully structured so that new topics depend strictly on topics already presented, carrying the reader progressively from basic subjects to more advanced ones. Cross-references point to related topics and an extensive glossary defines commonly used terms. The book explains the mathematics and physics of music for the reader whose mathematics may not have gone beyond the early undergraduate level. Calling himself "a composer seduced into mathematics," Loy provides answers to foundational questions about the mathematics of music accessibly yet rigorously. The topics are all subjects that contemporary composers, musicians, and musical engineers have found to be important. The examples given are all practical problems in music and audio. The level of scholarship and the pedagogical approach also make Musimathics ideal for classroom use. Additional material can be found at a companion web site.

About Gareth Loy

Gareth Loy is a musician and award-winning composer. He has published widely and, during a long and successful career at the cutting edge of multimedia computing, has worked as a researcher, lecturer, programmer, software architect, and digital systems engineer. He is President of Gareth, Inc., a provider of software engineering and consulting services internationally.

You can visit my professional home page at http://www.GarethInc.com.
You can visit my personal home page at http://www.GarethLoy.com.

Endorsements

"Musimathics is destined to be required reading and a valued reference for every composer, music researcher, multimedia engineer, and anyone else interested in the interplay between acoustics and music theory. This is truly a landmark work of scholarship and pedagogy, and Gareth Loy presents it with quite remarkable rigor and humor."

– Stephen Travis Pope, CREATE Lab, Department of Music, University of California, Santa Barbara

"From his long and successful experience as a composer and computer-music researcher, Gareth Loy knows what is challenging and what is important. That comprehensiveness makes Musimathics both exciting and enlightening. The book is crystal clear, so that even advanced issues appear simple. Musimathics will be essential for those who want to understand the scientific foundations of music, and for anyone wishing to create or process musical sounds with computers."

– Jean-Claude Risset, Laboratoire de Mécanique et d'Acoustique, CNRS, France

Table of Contents

Volume 1

Volume 2

Foreword by Max Mathews xiii

Preface xv

About the Author xvi

Acknowledgments xvii

1 Music and Sound 1

1.1 Basic Properties of Sound 1

1.2 Waves 3

1.3 Summary 9

2 Representing Music 11

2.1 Notation 11

2.2 Tones, Notes, and Scores 12

2.3 Pitch 13

2.4 Scales 16

2.5 Interval Sonorities 18

2.6 Onset and Duration 26

2.7 Musical Loudness 27

2.8 Timbre 28

2.9 Summary 37

3 Musical Scales, Tuning, and Intonation 39

3.1 Equal-Tempered Intervals 39

3.2 Equal-Tempered Scale 40

3.3 Just Intervals and Scales 43

3.4 The Cent Scale 45

3.5 A Taxonomy of Scales 46

3.6 Do Scales Come from Timbre or Proportion? 47

3.7 Harmonic Proportion 48

3.8 Pythagorean Diatonic Scale 49

3.9 The Problem of Transposing Just Scales 51

3.10 Consonance of Intervals 56

3.11 The Powers of the Fifth and the Octave Do Not Form a Closed System 66

3.12 Designing Useful Scales Requires Compromise 67

3.13 Tempered Tuning Systems 68

3.14 Microtonality 72

3.15 Rule of 18 82

3.16 Deconstructing Tonal Harmony 85

3.17 Deconstructing the Octave 86

3.18 The Prospects for Alternative Tunings 93

3.19 Summary 93

3.20 Suggested Reading 95

4 Physical Basis of Sound 97

4.1 Distance 97

4.2 Dimension 97

4.3 Time 98

4.4 Mass 99

4.5 Density 100

4.6 Displacement 100

4.7 Speed 101

4.8 Velocity 102

4.9 Instantaneous Velocity 102

4.10 Acceleration 104

4.11 Relating Displacement,Velocity, Acceleration, and Time 106

4.12 Newton's Laws of Motion 108

4.13 Types of Force 109

4.14 Work and Energy 110

4.15 Internal and External Forces 112

4.16 The Work-Energy Theorem 112

4.17 Conservative and Nonconservative Forces 113

4.18 Power 114

4.19 Power of Vibrating Systems 114

4.20 Wave Propagation 116

4.21 Amplitude and Pressure 117

4.22 Intensity 118

4.23 Inverse Square Law 118

4.24 Measuring Sound Intensity 119

4.25 Summary 125

5 Geometrical Basis of Sound 129

5.1 Circular Motion and Simple Harmonic Motion 129

5.2 Rotational Motion 129

5.3 Projection of Circular Motion 136

5.4 Constructing a Sinusoid 139

5.5 Energy of Waveforms 143

5.6 Summary 147

6 Psychophysical Basis of Sound 149

6.1 Signaling Systems 149

6.2 The Ear 150

6.3 Psychoacoustics and Psychophysics 154

6.4 Pitch 156

6.5 Loudness 166

6.6 Frequency Domain Masking 171

6.7 Beats 173

6.8 Combination Tones 175

6.9 Critical Bands 176

6.10 Duration 182

6.11 Consonance and Dissonance 184

6.12 Localization 187

6.13 Externalization 191

6.14 Timbre 195

6.15 Summary 198

6.16 Suggested Reading 198

7 Introduction to Acoustics 199

7.1 Sound and Signal 199

7.2 A Simple Transmission Model 199

7.3 How Vibrations Travel in Air 200

7.4 Speed of Sound 202

7.5 Pressure Waves 207

7.6 Sound Radiation Models 208

7.7 Superposition and Interference 210

7.8 Reflection 210

7.9 Refraction 218

7.10 Absorption 221

7.11 Diffraction 222

7.12 Doppler Effect 228

7.13 Room Acoustics 233

7.14 Summary 238

7.15 Suggested Reading 238

8 Vibrating Systems 239

8.1 Simple Harmonic Motion Revisited 239

8.2 Frequency of Vibrating Systems 241

8.3 Some Simple Vibrating Systems 243

8.4 The Harmonic Oscillator 247

8.5 Modes of Vibration 249

8.6 A Taxonomy of Vibrating Systems 251

8.7 One-Dimensional Vibrating Systems 252

8.8 Two-Dimensional Vibrating Elements 266

8.9 Resonance (Continued) 270

8.10 Transiently Driven Vibrating Systems 278

8.11 Summary 282

8.12 Suggested Reading 283

9 Composition and Methodology 285

9.1 Guido's Method 285

9.2 Methodology and Composition 288

9.3 Musimat: A Simple Programming Language for Music 290

9.4 Program for Guido's Method 291

9.5 Other Music Representation Systems 292

9.6 Delegating Choice 293

9.7 Randomness 299

9.8 Chaos and Determinism 304

9.9 Combinatorics 306

9.10 Atonality 311

9.11 Composing Functions 317

9.12 Traversing and Manipulating Musical Materials 319

9.13 Stochastic Techniques 332

9.14 Probability 333

9.15 Information Theory and the Mathematics of Expectation 343

9.16 Music, Information, and Expectation 347

9.17 Form in Unpredictability 350

9.18 Monte Carlo Methods 360

9.19 Markov Chains 363

9.20 Causality and Composition 371

9.21 Learning 372

9.22 Music and Connectionism 376

9.23 Representing Musical Knowledge 390

9.24 Next-Generation Musikalische Würfelspiel 400

9.25 Calculating Beauty 406

Appendix A 409

A.1 Exponents 409

A.2 Logarithms 409

A.3 Series and Summations 410

A.4 About Trigonometry 411

A.5 Xeno's Paradox 414

A.6 Modulo Arithmetic and Congruence 414

A.7 Whence 0.161 in Sabine's Equation? 416

A.8 Excerpts from Pope John XXII's Bull Regarding Church Music 418

A.9 Greek Alphabet 419

Appendix B 421

B.1 Musimat 421

B.2 Music Datatypes in Musimat 439

B.3 Unicode (ASCII) Character Codes 450

B.4 Operator Associativity and Precedence in Musimat 450

Glossary 453

Notes 459

References 465

Equation Index 473

Subject Index 000

Foreword by John Chowning

Preface

1 Digital Signals and Sampling

1.1 Measuring the Ephemeral

1.2 Analog-to-digital Conversion

1.3 Aliasing

1.4 Digital-to-analog Conversion

1.5 Binary Numbers

1.6 Synchronization

1.7 Discretization

1.8 Precision and Accuracy

1.9 Quantization

1.10 Noise and Distortion

1.11 Information Density of Digital Audio

1.12 Codecs

1.13 Further Refinements

1.14 Cultural Impact of Digital Audio

1.15 Summary

2 Musical Signals

2.1 Why Imaginary Numbers?

2.2 Operating with Imaginary Numbers

2.3 Complex Numbers

2.4 de Moivre's Theorem

2.5 Euler's Formula

2.6 Phasors

2.7 Graphing Complex Signals

2.8 Spectra of Complex Sampled Signals

2.9 Multiplying Phasors

2.10 Graphing Complex Spectra

2.11 Analytic Signals

2.12 Summary

3 Spectral Analysis and Synthesis

3.1 Introduction to the Fourier Transform

3.2 Discrete Fourier Transform

3.3 The DFT in Action

3.4 The Inverse Discrete Fourier Transform

3.5 Analyzing Real-world Signals

3.6 Windowing

3.7 Fast Fourier Transform

3.8 Properties of the Discrete Fourier Transform

3.9 A Practical Hilbert Transform

3.10 Summary

4 Convolution

4.1 The Rolling Shutter Camera

4.2 Defining Convolution

4.3 Numerical Examples of Convolution

4.4 Convolving Spectra

4.5 Convolving Signals

4.6 Convolution and the Fourier Transform

4.7 Using the FFT for Convolution

4.8 The Domain Symmetry between Signals and Spectra

4.9 Convolution and Sampling Theory

4.10 Convolution and Windowing

4.11 Correlation Functions

4.12 Summary

4.13 Suggested Reading

5 Filtering

5.1 Tape Recorder as a Model of Filtering

5.2 Introduction to Filtering

5.3 A Simple Filter

5.4 Finding the Frequency Response

5.5 Linearity and Time Invariance of Filters

5.6 FIR Filters

5.7 IIR Filters

5.8 Canonical Filter

5.9 Time-Domain Behavior of Filters

5.10 Filtering as Convolution

5.11 The Z Transform

5.12 The Z Transform of the General Difference Equation

5.13 Filter Families

5.14 Summary

6 Resonance

6.1 The Derivative

6.2 Differential Equations

6.3 Transient Vibrations

6.4 Mathematics of Resonance

6.5 Summary

7 Wave Equation

7.1 One-dimensional Wave Equation and String Motion

7.2 An Example

7.3 Modeling Vibration with Finite Difference Equations

7.4 Striking Points, Plucking Points, and Spectra

7.5 Summary

8 Acoustical Systems

8.1 Dissipation and Radiation

8.2 Acoustical Current

8.3 Linearity of Frictional Force

8.4 Inertance, Inductive Reactance

8.5 Compliance, Capacitive Reactance

8.6 Reactance and Alternating Current

8.7 Capacitive Reactance and Frequency

8.8 Inductive Reactance and Frequency

8.9 Combining Resistance, Reactance and Alternating Current

8.10 Resistance and Alternating Current

8.11 Capacitance and alternating current

8.12 Acoustical Impedance

8.13 Sound Propagation and Sound Transmission

8.14 Input Impedance: Fingerprinting a Resonant System

8.15 Scattering Junctions

8.16 Summary

8.17 Suggested Reading

9 Sound Synthesis

9.1 Forms of Synthesis

9.2 A Graphical Patch Language for Synthesis

9.3 Amplitude Modulation

9.4 Frequency Modulation

9.5 Vocal Synthesis

9.6 Synthesizing Concert Hall Acoustics

9.7 Physical Modeling

9.8 Source Models and Receiver Models

9.9 Summary

10 Dynamic Spectra

10.1 Gabor's Elementary Signal

10.2 The Short-time Fourier Transform

10.3 Phase Vocoder

10.4 Improving on the Fourier Transform

10.5 Summary

10.6 Suggested Reading

10.7 Foundations

11 Epilogue

Appendix

A.1 About Algebra

A.2 About Trigonometry

A.3 Series and Summations

A.4 Trigonometric Identities

A.5 Modulo Arithmetic And Congruence

A.6 Finite Difference Approximations

A.7 Walsh-Hadamard Transform

A.8 Sampling, Reconstruction, and the Sinc Function

A.9 Fourier Shift Theorem

A.10 Spectral Effects of Ring Modulation

Glossary

Equation Index

Subject Index