|

The Math Behind Why Music Sounds Good (2026)

Frequency Ratios, the Harmonic Series, and Equal Temperament Explained

Strike a piano's A4 key and then the A5 key above it. Something clicks — the two notes feel like family. Play the A and the nearby B-flat together and it grates. The difference isn't taste or culture: it's arithmetic. The frequency ratio of A4 to A5 is exactly 2:1. The ratio of A to B-flat is 2^(1/12) to 1 — an irrational number. Your ears are doing mathematics every time they process sound.

This article walks through the complete mathematical picture: why simple integer ratios produce consonance, how the harmonic series encodes those ratios in every note you play, how a logarithmic unit called the cent lets us measure tuning error precisely, and why the piano — one of humanity's most sophisticated acoustic instruments — deliberately plays almost every interval slightly out of tune.

piano keys close-up, cinematic macro photography, soft natural light, 4K
Every key on a piano is tuned to a specific frequency. The relationships between those frequencies — the ratios — determine whether chords sound consonant or dissonant.
2:1
Octave
3:2
Perfect 5th
4:3
Perfect 4th
440 Hz
A4 (standard)

Why Do Some Note Combinations Sound Pleasant?

Notes sound consonant when their frequencies share a simple integer ratio — 2:1 (octave), 3:2 (perfect fifth), 4:3 (perfect fourth). Simple ratios mean the two sound waves align their peaks frequently, producing a stable, non-beating combined waveform. The simpler the ratio, the more "locked in" the sound feels to the ear. Ratios involving large or irrational numbers produce rapid amplitude fluctuations called beats, which the brain perceives as tension or roughness.

The physics is concrete. Sound is a pressure wave with a periodic frequency measured in hertz (cycles per second). When two notes play simultaneously, their waves combine. If note A vibrates at 440 Hz and note B at 880 Hz, the ratio is 880 ÷ 440 = 2.000 — exactly 2:1. Every single cycle of A aligns with every other cycle of B. The combined waveform repeats cleanly 440 times per second, and the result sounds smooth. That is an octave.

Now consider A4 (440 Hz) and E5 in pure tuning (660 Hz). The ratio is 660 ÷ 440 = 3:2. Every two cycles of A align with every three cycles of E. Still very regular — and the ear hears it as a perfect fifth, one of the most stable intervals in music across virtually every musical culture on earth.

How string division produces simple intervals
Full string (f₀)
A4 = 440 Hz
1:1 — unison
Half string (½)
A5
node
2:1 — octave
Two-thirds (⅔)
E5
node
3:2 — perfect fifth
Three-quarters (¾)
D5
node
4:3 — perfect fourth
Four-fifths (⅘)
C#5
node
5:4 — major third

Pressing a guitar string at the halfway point (the 12th fret) produces a note one octave higher than the open string — exactly double the frequency. Pressing at two-thirds of the string length (the 7th fret) raises the pitch by a fifth. Ancient Greek mathematician Pythagoras is credited with discovering these relationships around 500 BCE, observing the same principle in resonating strings.

The consonance rule: The simpler the integer ratio between two frequencies, the more consonant the interval sounds. 2:1 (octave) is the simplest non-trivial ratio; 3:2 (fifth) and 4:3 (fourth) follow. As numerators and denominators grow — 9:8 (whole tone), 16:15 (minor semitone) — intervals become progressively less stable.

The Harmonic Series: Nature's Built-In Chord

When a string, air column, or vocal cord vibrates at a fundamental frequency f₀, it simultaneously produces overtones (also called partials) at exact integer multiples: 2f₀, 3f₀, 4f₀, 5f₀, and so on. This is the harmonic series — a physical inevitability of vibrating systems, not a musical convention. The intervals encoded in the first several partials are exactly the simple-ratio consonances: octave (2:1), fifth (3:2), fourth (4:3), major third (5:4). Your brain hears a single note, but the instrument is playing a quiet chord every time.

The harmonic series is the reason why two notes with a simple ratio sound consonant: their overtones align. When you play A4 (440 Hz) and E5 (660 Hz) together, the second partial of E5 (1320 Hz) coincides with the third partial of A4 (1320 Hz). That shared overtone is a reinforcement, not a clash. The more shared overtones two notes have, the more consonant they sound — and simple integer ratios maximize those coincidences.

Harmonic Series from A2 (110 Hz)

Partial Frequency Nearest Note Interval above A2 Just Ratio (from A2)
1st (fundamental) 110 Hz A2 1:1
2nd 220 Hz A3 Octave 2:1
3rd 330 Hz E4 Perfect fifth (above A3) 3:2
4th 440 Hz A4 Octave (above E4) 4:1
5th 550 Hz C#5 slightly sharp in 12-TET Major third (above A4) 5:4
6th 660 Hz E5 Perfect fifth (above A4) 3:2
7th 770 Hz G5 very flat in 12-TET Minor seventh (above A4) 7:4
8th 880 Hz A5 Octave (above A4) 2:1

Notice the 5th partial (550 Hz, C#5) and 7th partial (770 Hz, G5): neither of these lands exactly on a piano key in equal temperament. The major third in the harmonic series (5:4 = 1.25) differs from the equal-tempered major third (2^(4/12) ≈ 1.2599) by about 13.7 cents — enough to hear a slight beating when comparing a string quartet playing in just intonation with a piano playing the same chord. The 7th partial is even further off — about 31 cents flat compared to the equal-tempered minor seventh.

Harmonic series heights (A2 = 110 Hz root) — bars proportional to partial number
1st
2nd
3rd
4th
5th
6th
7th
8th
A2
110 Hz
A3
220 Hz
E4
330 Hz
A4
440 Hz
C#5
550 Hz
E5
660 Hz
G5♭
770 Hz
A5
880 Hz

Bar heights represent relative amplitude of each partial in a typical acoustic instrument. Real instruments vary; bars are conceptual. Blue = A octaves, purple = octave, green = perfect fifth, amber = major third, red = 7th partial (between minor and major 7th in 12-TET).

This is why a single piano note sounds "richer" than a pure electronic sine wave at the same frequency: the sine wave has one partial; the piano has dozens. Timbre — the characteristic sound quality of an instrument — is almost entirely determined by the relative strength of each partial in the harmonic series. A flute produces a nearly pure fundamental with very few overtones. A violin produces a dense harmonic series with many strong partials. Same pitch; completely different sound.

Measuring Any Interval in Cents

A cent is a logarithmic unit for measuring musical intervals: 100 cents equals one equal-tempered semitone, and 1200 cents equals one octave. The formula is cents = 1200 · log₂(f₂ / f₁), where f₁ and f₂ are the two frequencies in hertz. Because the formula uses log base 2, doubling the frequency (one octave) always gives exactly 1200 cents, regardless of the starting pitch. This makes cents useful for comparing intervals across registers and for measuring tuning deviations with precision finer than human hearing can detect in isolation.

The Cents Formula cents = 1200 · log₂(f₂ / f₁) f₁ = lower frequency (Hz)  |  f₂ = higher frequency (Hz)
100 cents = 1 semitone  |  1200 cents = 1 octave
Equivalent: cents = 1200 · ln(f₂/f₁) / ln(2)

Why logarithms? Because pitch perception is itself logarithmic. The step from 220 Hz to 440 Hz sounds the same size as the step from 440 Hz to 880 Hz — both are octaves. Linear differences in Hz don't capture this: 220 Hz difference in the first case, 440 Hz in the second. A logarithmic scale converts multiplicative frequency relationships into additive cent values, so the same interval (e.g., a perfect fifth) always measures the same number of cents regardless of which octave you're in.

Worked Examples

Example 1 — Octave: A4 to A5

Givenf₁ = 440 Hz (A4), f₂ = 880 Hz (A5)
Ratio880 / 440 = 2.000 (exact)
log₂log₂(2) = 1.000
Cents1200 × 1.000 = 1200 cents
Result: 1200 cents = exactly 1 octave

Example 2 — Pure (just) Perfect Fifth: A4 to E5

Givenf₁ = 440 Hz (A4), f₂ = 660 Hz (E5 just = 440 × 3/2)
Ratio660 / 440 = 1.5000 (3:2)
log₂log₂(1.5) ≈ 0.58496
Cents1200 × 0.58496 ≈ 701.96 cents
Result: 701.96 cents — about 1.96 cents wider than the 12-TET fifth (700 cents)

Example 3 — Equal-Tempered Perfect Fifth: A4 to E5 (12-TET)

Givenf₁ = 440 Hz, f₂ = 440 × 2^(7/12) ≈ 659.26 Hz
Ratio659.26 / 440 ≈ 1.49831
log₂log₂(1.49831) ≈ 0.58333
Cents1200 × 0.58333 = 700.00 cents
Result: 700 cents exactly — 7 semitones × 100 cents. The 12-TET fifth is 1.96 cents narrower than the pure 3:2 ratio.

One cent is approximately 1/100th of a semitone, or about 0.06% of the frequency at A4. Most trained musicians can perceive differences of about 5–10 cents in isolation; differences below 2 cents are generally imperceptible in normal playing conditions. This is why the 1.96-cent error of the equal-tempered fifth is generally accepted, while the 13.7-cent error of the equal-tempered major third is large enough for trained ears to notice — particularly when sustaining a chord.

Practical check: The equal-tempered semitone is 21/12 ≈ 1.05946. Multiply by itself 12 times and you get 2.000 exactly — one octave. Multiply by itself 7 times for a fifth: 27/12 ≈ 1.49831, versus the pure ratio 1.5000. That difference of 0.00169 (about 0.11% of frequency) is the 1.96-cent temperament error.

Just Intonation vs Equal Temperament

Just intonation tunes every interval to exact integer ratios (3:2 for a fifth, 5:4 for a major third), producing the purest possible sound with zero beats. Twelve-tone equal temperament (12-TET) divides the octave into 12 logarithmically equal semitones — each exactly 2^(1/12) ≈ 1.0595 times the previous — so that all 12 major and minor keys are equally (slightly) impure. Just intonation sounds perfect in one key and badly mistuned in distant keys; 12-TET sounds consistent in all keys at the cost of small systematic errors in every interval except the octave.

The table below shows the six most common consonant intervals, comparing pure just intonation ratios against equal temperament. The "deviation" column shows how far 12-TET drifts from the pure ratio, in cents. A deviation of 0 cents means perfect agreement; positive means 12-TET is sharp; negative means flat.

Just Intonation vs 12-TET Comparison (root = A4 = 440 Hz)

Interval Just Ratio Just Hz
(from A4)
12-TET Hz
(from A4)
Deviation
(cents)
Perceptibility
Octave 2:1 880.00 Hz 880.00 Hz 0.00 None
Perfect Fifth 3:2 660.00 Hz 659.26 Hz −1.96 Barely audible
Perfect Fourth 4:3 586.67 Hz 587.33 Hz +1.96 Barely audible
Major Third 5:4 550.00 Hz 554.37 Hz +13.69 Audible to trained ears
Minor Third 6:5 528.00 Hz 523.25 Hz −15.64 Audible to trained ears
Major Sixth 5:3 733.33 Hz 739.99 Hz +15.64 Audible to trained ears

Hz values: just intonation = 440 × ratio (e.g. 440 × 3/2 = 660); 12-TET = 440 × 2^(n/12) where n = semitones above A4 (fifth = 7, fourth = 5, major third = 4, minor third = 3, major sixth = 9). Deviation = 1200 · log₂(just Hz / 12-TET Hz). Self-calculated; verifiable with a scientific calculator.

The most practically significant discrepancy is the major third: +13.69 cents. In a sustained piano chord in a resonant room, a trained musician can hear the equal-tempered major third "beating" slightly — a slow wobble in amplitude caused by the two close-but-not-matching frequencies. A pure just major third (5:4) beats at zero: the waves align perfectly. This is why barbershop quartets and a cappella groups — who can adjust their intonation freely without fixed-pitch constraints — often drift toward just intonation when sustaining major chords. The chord simply sounds more stable.

12-TET semitone formula: One semitone = 21/12 ≈ 1.05946. To find any note n semitones above a frequency f: multiply by (21/12)n = 2n/12. Example: E5 is 7 semitones above A4 = 440 × 27/12 ≈ 659.26 Hz.

Why Pianos Use Equal Temperament (and When Instruments Don't)

A piano's pitch is fixed at the moment of tuning — the player cannot adjust individual notes during performance. Just intonation would require a different tuning for each key: a piano tuned purely in A major would sound badly out of tune in E-flat major. Twelve-tone equal temperament solves this by distributing the unavoidable tuning error equally across all 12 keys, so that every key is equally (slightly) impure. The result is a fixed-pitch instrument that can play convincingly in all 24 major and minor keys without retuning.

The historical solution to this problem has a clear landmark: Johann Sebastian Bach's "Well-Tempered Clavier" (1722) — two books of preludes and fugues in all 24 major and minor keys — was written explicitly to demonstrate that keyboard instruments could be tuned to play in all keys. Bach did not necessarily use 12-TET as we know it today; various "well temperaments" circulated, each making different compromises. Modern 12-TET became the dominant keyboard standard in the 19th century, solidified by the industrialization of piano manufacturing.

Before equal temperament, mean-tone tuning (common from the 16th through 18th centuries) kept major thirds pure at 5:4 but produced a "wolf fifth" — a badly mistuned fifth that resulted from stacking pure thirds around the circle of fifths. Pieces were composed to avoid the wolf interval, restricting usable keys. Equal temperament eliminated the wolf at the cost of slightly mistuning every interval except the octave.

When Instruments Don't Use Equal Temperament

Flexible-pitch instruments and voices can — and do — adjust intonation in real time. A well-trained string quartet sustaining a major chord will instinctively adjust toward just intonation, particularly on the third and sixth. This is not a conscious decision; trained ears seek the resonance of shared overtones, and the ensemble adjusts until the beating stops. A solo violinist playing unaccompanied will often play leading tones slightly sharper than equal temperament for expressive effect — a practice sometimes called "expressive intonation."

  • Fretless strings (violin, cello, double bass): Can adjust pitch continuously. Chamber musicians actively listen for just intonation resonance in sustained chords.
  • Voice: Unaccompanied choirs often drift toward just intonation in sustained harmonies, particularly in Renaissance polyphony written before equal temperament was standardized.
  • Barbershop quartets: The style explicitly targets just intonation chords; the ringing "lock and ring" effect is produced by aligned overtones across all four parts.
  • Fretted strings (guitar, bass): Frets enforce equal temperament; players can compensate slightly with finger position, but it's limited. Even small intonation adjustments (bending) produce large cent deviations.
  • Synthesizers: Can be tuned to any temperament — Pythagorean, just, mean-tone, or custom microtonally. Software instruments support arbitrary tuning tables.
A4 = 440 Hz is an international standard. ISO 16:1975 defines A4 as 440 Hz for orchestral tuning. In practice, some orchestras tune higher (the Berlin Philharmonic has historically used A = 443 Hz; some Baroque ensembles tune to A = 415 Hz for period authenticity). The standard gives a reference point; professional ensembles adjust for acoustic and stylistic reasons. Whatever the reference pitch, the mathematical relationships between intervals remain the same.
person playing cello close-up, warm studio lighting, cinematic, 4K, no text
Fretless string players can continuously adjust pitch during performance, making them capable of true just intonation in ensemble playing — something no fixed-pitch keyboard instrument can do.

Frequently Asked Questions

Why do some musical intervals sound consonant and others dissonant?

Consonant intervals have simple integer frequency ratios — 2:1 (octave), 3:2 (perfect fifth), 4:3 (perfect fourth). When two notes with these ratios sound together, their overtones align, producing a stable, non-beating combined waveform. Dissonant intervals have complex ratios that cause the two waveforms to interfere with slightly different periodicities, creating amplitude fluctuations called beats that the ear perceives as roughness or tension. The simpler the ratio, the more consonant the interval.

What is the harmonic series in music?

The harmonic series is the sequence of overtones produced whenever a string, air column, or vocal cord vibrates. A fundamental frequency f₀ automatically generates additional partials at 2f₀, 3f₀, 4f₀, 5f₀, and so on — an inevitable consequence of how wave physics works in bounded systems. The intervals encoded in the first several partials (octave 2:1, fifth 3:2, fourth 4:3, major third 5:4) are exactly the simple-ratio consonances used in music worldwide. Timbre — how an instrument sounds — is determined by the relative strengths of these partials.

How do you calculate cents between two frequencies?

Use the formula: cents = 1200 · log₂(f₂ / f₁), where f₁ and f₂ are the two frequencies in hertz. For example, A4 (440 Hz) to E5 in just intonation (660 Hz): 660 / 440 = 1.5; log₂(1.5) ≈ 0.58496; 1200 × 0.58496 ≈ 701.96 cents. The equal-tempered fifth is 700 cents exactly (7 semitones × 100 cents), so the just fifth is about 1.96 cents wider. One cent equals 1/100th of an equal-tempered semitone, or approximately 0.06% of frequency at A4.

What is just intonation and how does it differ from equal temperament?

Just intonation tunes intervals to exact integer ratios — 3:2 for a perfect fifth, 5:4 for a major third — producing the purest possible sound with no beating between aligned overtones. Equal temperament (12-TET) divides the octave into 12 equal semitones, each a ratio of 2^(1/12) ≈ 1.0595. This makes all 12 keys equally (slightly) mistuned, versus just intonation which sounds perfect in one key but badly wrong in distant keys. The major third deviation is the most audible: 12-TET major thirds are 13.7 cents sharp of the pure 5:4 ratio.

Why does the piano use equal temperament instead of just intonation?

A piano's pitch is fixed at tuning — the performer cannot adjust individual notes during play. Just intonation would require a separate tuning for each key, making a single piano unable to modulate to different keys without retuning. Equal temperament distributes the unavoidable tuning error equally across all 12 keys, allowing one fixed-pitch instrument to play in all major and minor keys with consistent (if slightly impure) intervals. Johann Sebastian Bach's Well-Tempered Clavier (1722) famously demonstrated that keyboard instruments tuned this way could play convincingly in all 24 keys.

What does it mean when a note is "out of tune" by a few cents?

A cent is 1/100th of an equal-tempered semitone, or about 0.06% of frequency. Most trained musicians can detect differences of 5–10 cents in controlled conditions; differences below 2–3 cents are generally below the threshold of conscious perception in normal performance. The equal-tempered perfect fifth is 1.96 cents flat of the pure 3:2 ratio — nearly imperceptible. The equal-tempered major third is 13.7 cents sharp of 5:4 — audible as slight beating in sustained chords to trained ears. A note described as "sharp" is too high in pitch; "flat" is too low.

Sources: ISO 16:1975 (A4 = 440 Hz) · Hermann von Helmholtz, On the Sensations of Tone (1863) · J.M. Barbour, Tuning and Temperament (1951) · All Hz values self-calculated (f = 440 × 2n/12 for 12-TET; ratio multiplication for just intonation).

Tangents by my-blog.org · Published 2026-06-19

Comments

Comments (0)

Leave a Comment

← Back to List