Music and Mathematics: A love story

Music and mathematics share a profound connection that has shaped the way we understand rhythm, melody, harmony, and sound throughout history.

Music, although an art, is built upon rigorous mathematical foundations. Rhythm, melody, timbre and harmony can be described through equations, frequencies and ratios.

Analysing music is a demanding undertaking that combines physics (acoustics), mathematics (ratios, structures and group theory), psychology (sound perception) and computer science (digital sound representation). Mathematical tools can reveal symmetry and order within musical structures.

Rhythm: Time as the Ultimate Ruler

Rhythm is the mathematical heartbeat of music. It is expressed through metric patterns and time intervals. Time signatures, such as 4/4 and 3/8, establish a framework for the organisation of beats. Repetition and symmetry are important principles of rhythmic structure, while periodicity shapes our perception of pulse.

Mathematical Analysis and the Arithmetic of Time

Rhythm is the arrangement of sonic events in time: the temporal geometry of music. Mathematically, it can be modelled as a discrete sequence of durations or onset times.

Forms of analysis

  • Time signatures: 4/4 (common time) and 7/8 (an asymmetrical grouping) indicate metrical organisation. They are not, by themselves, frequency ratios.
  • Rhythmic patterns: repeating patterns can be described by periodic sequences.
  • Polyrhythms: relationships such as 3:2 describe three equally spaced attacks against two within the same span of time.

Mathematical tools

  • Set theory can describe the positions of attacks in percussion patterns.
  • Cyclic groups model repeated patterns within a fixed cycle.
  • Euclidean rhythms distribute a chosen number of pulses as evenly as possible around a cycle. Related rhythmic structures occur in musical traditions around the world.

Rhythmic geometry

  • Rhythmic attacks can be plotted on a circle, making periodicity and spacing visible.
  • Euclidean rhythms, discussed by Godfried Toussaint (2005), offer a mathematical model for balanced distributions of beats.

Complex rhythms

  • Polyrhythms involve the simultaneous organisation of different rhythmic subdivisions. For example, a 12/8 pulse can be heard alongside a grouping of three quarter-note beats (3/4) across the same duration, depending on tempo and accentuation.
  • The least common multiple (LCM) helps determine when repeating subdivisions align; the greatest common divisor (GCD) helps analyse their shared numerical structure.

Music and Mathematics of Melody: Frequencies in Time

Melody is a sequence of pitches distributed through time. In a conventional pitched sound, each note has an associated fundamental frequency: for example, the standard tuning reference A4 is 440 Hz. Melodic relationships can be analysed numerically, while transposition and inversion can be represented algebraically.

music and mathematics

Harmonic Analysis over Time

Melody is the linear progression of successive pitches. Transitions between notes can be described using frequency ratios.

Mathematical analysis

  • An octave corresponds to a frequency ratio of 2:1: the higher note has twice the frequency of the lower one.
  • Twelve-tone equal temperament divides the octave into twelve equal logarithmic intervals, each with the same frequency ratio.
r = 2^{1/12} \approx 1.05946

Consequently, the frequency of a note n semitones above a reference frequency f0 is:

f_n = f_0 \cdot 2^{n/12}

Theoretical tools

  • Pitch-class analysis: the study of pitches modulo 12.
  • Melodic vectors: representations of successive intervals.
  • Algebraic structures: tools for examining transformations, modes and ordered pitch series, including serial music.

The mathematical description of sound is one example of how physical reality can be expressed through equations. At a deeper level, Planck’s constant, ℏ, plays a fundamental role in the mathematical framework of quantum physics.

The Geometry of Frequencies in Time

A melody is a sequence of pitch values associated with durations.

Frequency and pitch

  • A pitched note has a fundamental frequency f, measured in hertz (Hz). For example, A4 = 440 Hz.
  • Musical scales consist of notes arranged according to particular interval relationships, expressible as frequency ratios.

Examples from just intonation

  • Just major third: ratio 5:4. Starting from A = 440 Hz gives 550 Hz, a justly tuned C-sharp (not the equal-tempered frequency).
  • Just perfect fifth: ratio 3:2. Starting from A = 440 Hz gives 660 Hz, a justly tuned E.

Melodic structure

A simplified melody can be represented as an ordered sequence of frequencies:

M = (f_1, f_2, \ldots, f_n)

Here, each fi is a frequency. For a fuller model, the duration and onset time of each note must also be included. Melodies are often described in terms of intervals, such as “ascending fourth” or “descending second”.

Timbre: The Spectrum of Frequencies

Timbre is shaped by a sound’s spectral composition and its evolution over time. Fourier analysis helps identify the frequency components of a sound. Differences in these components, together with the sound envelope and other acoustic characteristics, help explain why a violin and a piano sound different even when playing the same note.

Physics and Spectral Analysis

Timbre is the perceptual quality that helps us distinguish sounds with similar pitch and loudness. It depends on the distribution of spectral components as well as their temporal behaviour.

Physical analysis

  • Many pitched sound sources produce a harmonic series: frequency components at integer multiples of a fundamental frequency.
  • For a fundamental frequency of 100 Hz, ideal harmonics occur at 100, 200, 300, 400 Hz and so forth. Their relative amplitudes vary with the source.
f_n = n f_0, \qquad n = 1,2,3,\ldots

Mathematical tools

  • Fourier transform: analyses the frequency components of a signal.
  • Spectrograms: visualise how spectral energy changes over time.
  • Harmonic analysis: investigates the structure and relative contributions of a sound’s frequency components.

The Spectrum of Sound

Many musical tones combine a fundamental component with upper partials or overtones. The amplitudes and evolution of these components influence the perceived colour of the sound. Some instruments also produce inharmonic partials and noise, so not every spectrum is a perfect harmonic series.

Spectral analysis

  • The Fourier transform represents a signal in terms of frequency components. For a periodic signal, a Fourier series can express the waveform as a sum of sinusoidal terms.
  • Each instrument has characteristic spectral and temporal patterns, although these change with technique, register and dynamics.
x(t) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \left[a_n\cos(n\omega_0 t) + b_n\sin(n\omega_0 t)\right]

In this Fourier-series expression, the fundamental angular frequency is given by:

\omega_0 = \frac{2\pi}{T}

Examples

  • Piano: a sharp attack followed by decay, with a complex spectrum that changes over time.
  • Flute: often a comparatively strong fundamental with weaker upper harmonics, producing a relatively pure tone in many registers.
  • Violin: sustained excitation from the bow and a rich, changing spectrum.

Applications

  • Spectrograms display the development of the sound spectrum over time.
  • Machine learning systems can use spectral features to help identify instruments, speech and other audio sources.

For a deeper understanding of how complex sounds can be analyzed into their frequency components, explore the Fourier analysis resources from MIT OpenCourseWare.

Harmony: Relationships and Frequency Ratios

Harmony concerns the relationships between notes, especially when they sound simultaneously. Simple frequency ratios, such as 2:1 for an octave and 3:2 for a just perfect fifth, are central to the acoustic study of musical intervals. Mathematical approaches to harmony also include vector spaces, lattices and group-theoretical models.

Relationships Between Frequencies

Harmony studies the combination of pitches. One mathematical way to describe their relationships is through frequency ratios.

Selected ratios in just intonation

  • Octave: 2:1
  • Perfect fifth: 3:2
  • Just major third: 5:4
  • Just minor third: 6:5
\frac{f_2}{f_1} \in \left\{2,\frac{3}{2},\frac{5}{4},\frac{6}{5}\right\}

Theoretical models

  • Tonal spaces: geometric representations of musical relationships.
  • Tonnetz: a network representing pitch and chord relationships, widely used in neo-Riemannian theory.
  • Group theory: a framework for understanding transformations and symmetries of scales and chords.
  • Topological data analysis: methods that can be applied to patterns in large musical datasets.

The Mathematical Coexistence of Sounds

From a physical perspective, simultaneous sounds interact through wave superposition. Their acoustic interaction is only one part of musical harmony, however: consonance and dissonance also depend on tuning, timbre, listening context and cultural experience.

Frequency ratios

  • Simple ratios such as 2:1 (octave), 3:2 (perfect fifth) and 5:4 (just major third) are commonly associated with consonant intervals in particular tuning and listening contexts.

Beats and interference

  • Two nearby frequencies, such as 440 Hz and 442 Hz, produce audible beats through interference.
  • The interaction of partials can contribute to roughness or blending, depending on their spacing, strength and the listener’s perception.
f_{\mathrm{beat}} = |f_2 - f_1| = |442-440|\,\mathrm{Hz} = 2\,\mathrm{Hz}

Harmonic space

  • Chord spaces and the Tonnetz provide geometric models of musical relationships. In a conventional Tonnetz, nodes represent pitch classes and connections represent selected intervals; chord shapes and transformations can be traced through the network.
  • Such approaches are used in neo-Riemannian analysis and in studies of harmonic movement in repertoire ranging from Wagner to some contemporary popular music.

Topological models

  • Some models represent musical configurations in spaces with toroidal topology. A torus is not simply a map in which every point is a single pitch class; its coordinates depend on the particular musical model.
  • These models can illuminate relationships involving voice leading, modulation and harmonic proximity.

Summary: Mathematical Concepts in the Elements of Music

Musical elementMathematical and physical concepts
RhythmSequences, Euclidean patterns, group theory, cyclic geometry
MelodyFrequency ratios, pitch classes modulo 12, vectors, functions
TimbreSpectral analysis, Fourier transform, harmonics, waveforms
HarmonyFrequency ratios, superposition, Tonnetz, chord spaces, topology

Music is not merely an art: it is a mathematical marvel. And mathematical formulas are not cold. They are poems written in symbols.

We can study this ongoing relationship, which offers profound emotion and genuine intellectual enrichment, for a lifetime.

Change is the only Constant

We don't send spam! Read our privacy policy for more details.

io

io

I studied Physics at the Department of Physics of the National and Kapodistrian University of Athens, and I remain actively engaged in independent research into fundamental questions in physics, with a particular interest in their philosophical implications. My work also extends to programming, web development, and writing. Above all, however, I consider myself a devotee of Music, which I strive to serve through composition and production.

Articles: 49

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

seventeen + nine =