Musimathics

The Mathematical Foundations of Music

Volume I: Musical Elements

Volume II: Musical Signals

by Dr. Gareth Loy

AUTHOR'S REQUEST

There is a PDF version of Musimathics floating around the web. If you see these PDFs posted, please let me know so I can post a take-down request to the website owner. It took me ten years to write these books, working late into the night most days to get it published. I also respond to readers questions and errata notices. Please don't post the PDF version on the open internet; please either buy the paper books or buy the ebook, but don't just rip me off. You can reach me at errata > a t < musimathics.com if you have questions or concerns.

Availability

Reprint editions are now available for both volumes that correct (almost) all errata from the first printings. You can tell which print version you have by looking at the numbers at the bottom of the copyright page, which count down from 10. If the series stops at 1, you have the original printing. If the series stops with 2, you have the second printing, etc.

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, digital systems engineer, expert witness, and generally as 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 Basic Properties of Sound

1.2 Waves

1.3 Summary

2 Representing Music

2.1 Notation

2.2 Tones, Notes, and Scores

2.3 Pitch

2.4 Scales

2.5 Interval Sonorities

2.6 Onset and Duration

2.7 Musical Loudness

2.8 Timbre

2.9 Summary

3 Musical Scales, Tuning, and Intonation

3.1 Equal-Tempered Intervals

3.2 Equal-Tempered Scale

3.3 Just Intervals and Scales

3.4 The Cent Scale

3.5 A Taxonomy of Scales

3.6 Do Scales Come from Timbre or Proportion?

3.7 Harmonic Proportion

3.8 Pythagorean Diatonic Scale

3.9 The Problem of Transposing Just Scales

3.10 Consonance of Intervals

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

3.12 Designing Useful Scales Requires Compromise

3.13 Tempered Tuning Systems

3.14 Microtonality

3.15 Rule of 18

3.16 Deconstructing Tonal Harmony

3.17 Deconstructing the Octave

3.18 The Prospects for Alternative Tunings

3.19 Summary

3.20 Suggested Reading

4 Physical Basis of Sound

4.1 Distance

4.2 Dimension

4.3 Time

4.4 Mass

4.5 Density

4.6 Displacement

4.7 Speed

4.8 Velocity

4.9 Instantaneous Velocity

4.10 Acceleration

4.11 Relating Displacement,Velocity, Acceleration, and Time

4.12 Newton's Laws of Motion

4.13 Types of Force

4.14 Work and Energy

4.15 Internal and External Forces

4.16 The Work-Energy Theorem

4.17 Conservative and Nonconservative Forces

4.18 Power

4.19 Power of Vibrating Systems

4.20 Wave Propagation

4.21 Amplitude and Pressure

4.22 Intensity

4.23 Inverse Square Law

4.24 Measuring Sound Intensity

4.25 Summary

5 Geometrical Basis of Sound

5.1 Circular Motion and Simple Harmonic Motion

5.2 Rotational Motion

5.3 Projection of Circular Motion

5.4 Constructing a Sinusoid

5.5 Energy of Waveforms

5.6 Summary

6 Psychophysical Basis of Sound

6.1 Signaling Systems

6.2 The Ear

6.3 Psychoacoustics and Psychophysics

6.4 Pitch

6.5 Loudness

6.6 Frequency Domain Masking

6.7 Beats

6.8 Combination Tones

6.9 Critical Bands

6.10 Duration

6.11 Consonance and Dissonance

6.12 Localization

6.13 Externalization

6.14 Timbre

6.15 Summary

6.16 Suggested Reading

7 Introduction to Acoustics

7.1 Sound and Signal

7.2 A Simple Transmission Model

7.3 How Vibrations Travel in Air

7.4 Speed of Sound

7.5 Pressure Waves

7.6 Sound Radiation Models

7.7 Superposition and Interference

7.8 Reflection

7.9 Refraction

7.10 Absorption

7.11 Diffraction

7.12 Doppler Effect

7.13 Room Acoustics

7.14 Summary

7.15 Suggested Reading

8 Vibrating Systems 239

8.1 Simple Harmonic Motion Revisited

8.2 Frequency of Vibrating Systems

8.3 Some Simple Vibrating Systems

8.4 The Harmonic Oscillator

8.5 Modes of Vibration

8.6 A Taxonomy of Vibrating Systems

8.7 One-Dimensional Vibrating Systems

8.8 Two-Dimensional Vibrating Elements

8.9 Resonance (Continued)

8.10 Transiently Driven Vibrating Systems

8.11 Summary

8.12 Suggested Reading

9 Composition and Methodology

9.1 Guido's Method

9.2 Methodology and Composition

9.3 Musimat: A Simple Programming Language for Music

9.4 Program for Guido's Method

9.5 Other Music Representation Systems

9.6 Delegating Choice

9.7 Randomness

9.8 Chaos and Determinism

9.9 Combinatorics

9.10 Atonality

9.11 Composing Functions

9.12 Traversing and Manipulating Musical Materials

9.13 Stochastic Techniques

9.14 Probability

9.15 Information Theory and the Mathematics of Expectation

9.16 Music, Information, and Expectation

9.17 Form in Unpredictability

9.18 Monte Carlo Methods

9.19 Markov Chains

9.20 Causality and Composition

9.21 Learning

9.22 Music and Connectionism

9.23 Representing Musical Knowledge

9.24 Next-Generation Musikalische Würfelspiel

9.25 Calculating Beauty

Appendix A

A.1 Exponents

A.2 Logarithms

A.3 Series and Summations

A.4 About Trigonometry

A.5 Xeno's Paradox

A.6 Modulo Arithmetic and Congruence

A.7 Whence 0.161 in Sabine's Equation?

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

A.9 Greek Alphabet

Appendix B

B.1 Musimat

B.2 Music Datatypes in Musimat

B.3 Unicode (ASCII) Character Codes

B.4 Operator Associativity and Precedence in Musimat

Glossary

Notes

References

Equation Index

Subject Index

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