Skip to content

1. Intervals & Consonance ​

Counterpoint starts with one measurement: the vertical distance between two voices sounding at the same time. Everything else in this course — parallels, dissonance treatment, cadences — is built on how that distance is classified.

What is an interval?

An interval is the distance between two notes. Count letter names inclusively from the lower note to the upper note: C-D-E-F-G is five letter steps, so C to G is a fifth. MIDI stores pitches as semitones, so the engine also sees that C to G is 7 semitones. The validator works in semitones modulo 12 — an octave plus a third is still "a third" for consonance purposes.

The three families ​

Baroque practice sorts intervals into three families, and the engine encodes exactly this taxonomy in its consonant interval-class set {0, 3, 4, 5, 7, 8, 9} (semitones mod 12):

FamilyIntervalsSemitones (mod 12)Engine treatment
Perfect consonanceunison, 5th, octave0, 7Stable pillars — but repeating them by parallel motion is forbidden (chapter 2).
Imperfect consonance3rds, 6ths3, 4, 8, 9The everyday contrapuntal sound; may move in parallel freely.
Dissonance2nds, 7ths, tritone1, 2, 6, 10, 11Needs a declared or recognizable job: passing motion, suspension, pedal context (chapter 3).
Special caseperfect 4th5Bass-sensitive: dissonant above the actual bass, but legal between upper voices when both are consonant above that bass.

The staff figures label intervals with the standard shorthand — P5 (perfect fifth), M3 (major third), m10 (minor tenth), A4 (augmented fourth, the tritone). If the letters are new, the interval name legend in the primer decodes them all.

Perfect consonances: stable but hollow ​

Perfect consonancePerfect consonances: fifth, octave, twelfth
Perfect consonances are acoustically hollow and stable. They anchor beginnings and endings, but two voices that keep landing on them in parallel stop sounding independent — that is why the parallel rules in the next chapter exist.
Each upper note forms a perfect consonance with the held C.

In just intonation, perfect intervals have simple frequency ratios (2:1 for the octave, 3:2 for the fifth). MIDI's usual 12-tone equal temperament gives the fifth the ratio 2^(7/12), so it is not exactly 3:2. Bach-era practice did not prescribe one universally accepted temperament; this page describes semitone classes, not a historical tuning. See the Oxford Early Music discussion of Bach-era temperament. Two voices locked in perfect intervals blend so well that the ear stops hearing two voices. Counterpoint wants stability at anchor points (openings, cadences) and independence everywhere else.

Imperfect consonances: the workhorses ​

Imperfect consonanceThirds, sixths, and tenths
Imperfect consonances are the workhorses of two-voice counterpoint: rich enough to sound full, unstable enough to keep moving. Unlike perfect intervals, voices may travel in parallel thirds or sixths freely.
Thirds and sixths against the held C — full but mobile sonorities.

Thirds, sixths, and their compounds (tenths, thirteenths) are full but mobile. Most of the vertical sonorities in a generated two-voice texture are imperfect consonances, and chains of parallel thirds or sixths are idiomatic — the engine never penalizes them.

Bach exploits that license in two short runs. In bar 32 of the E♭ major prelude from WTC I, two sixteenth-note lines move in strict parallel tenths at positions 1–7 and 9–15, with rests at positions 0 and 8:

From BachBach: WTC I Prelude in E♭ — two runs of parallel tenths
Bar 32 of the E♭ major prelude (WTC I, BWV 852): two lines move in two seven-note runs of parallel tenths, at positions 1–7 and 9–15; rests occupy positions 0 and 8. Each sounding pair is a compound third, with the quality flexing between major and minor as the scale dictates. The family never leaves imperfect consonance, so the parallel rules of chapter 2 have nothing to say. Compare what happens when voices try the same trick with fifths or octaves. (The sustained notes that ring above each run — B♭ and G, then E♭ and C — are omitted here.)
Two sixteenth-note lines move in strict parallel tenths in two seven-note runs, separated by rests — and no rule objects.

And one bar of the C minor prelude shows the two families dividing the labor — perfect consonances standing as pillars on the strong positions, sixths carrying all the motion between them:

From BachBach: WTC I Prelude in C minor — perfect pillars, imperfect motion
Bar 1 of the C minor prelude (WTC I, BWV 847) divides the labor exactly as this chapter describes. On the strong half-bars the hands meet in a bare double octave — the perfect consonance, stable and hollow, used as a pillar. Every sixteenth in between is a sixth — the imperfect consonance, full and mobile, carrying all the motion. Neither family does the other's job: the octaves never move in parallel (that would fuse the hands into one voice), and the sixths never have to bear structural weight. One bar of churning texture, and the whole division of labor is on display.
The strong positions anchor on bare octaves; every sixteenth between them runs in sixths.

Dissonances: tension with an obligation ​

DissonanceSeconds, sevenths, and the tritone
Dissonance is not forbidden — counterpoint runs on the tension it creates. What the validator rejects is unmanaged dissonance: a clash that arrives without preparation or leaves without resolution. Chapter 3 covers the legal patterns.
vertical_dissonanceEach red interval is dissonant: it demands preparation and resolution.

Consonance and dissonance are roles, not aesthetics

Consonance means the interval can stand as a structural sonority. Dissonance means the interval needs a job: passing motion, suspension, preparation, or resolution. The validator is not judging "nice" versus "ugly"; it is checking whether an unstable interval has a declared musical reason. Chapter 3 catalogs the legal jobs.

The fourth: counterpoint's boundary case ​

Context-dependentThe perfect fourth: consonant or dissonant?
The fourth is the boundary case of interval theory. Between upper voices over a supporting bass it sounds consonant; directly against the bass it behaves as a dissonance and resolves to a third. The engine encodes this ambivalence in vertical_dissonance: it judges the whole sonority against the actual lowest sounding pitch, while allowing declared suspensions and cadential 6/4 chords.
vertical_dissonanceThe fourth above the bass resolves down to a third, like a dissonance.

The perfect fourth has been argued about for centuries, and the engine's treatment mirrors the historical compromise:

  • Against the actual lowest sounding voice, a fourth is dissonant at a structural accent. vertical_dissonance rejects it unless a fully declared 4-3 suspension or cadential 6/4 supplies the required preparation and resolution.
  • Between upper voices over a supporting bass, a fourth is legal when each upper note is consonant above that bass. It is not rejected merely because octave inversion would turn it into a fifth (chapter 2).

How the validator sees this chapter ​

The interval families are not a rule themselves; they are the lookup table that the vertical rules consult.

ConceptWhere it is enforced
Consonant interval-class set {0, 3, 4, 5, 7, 8, 9} plus bass-sensitive treatment of class 5vertical_dissonance (chapter 3), suspension preparation checks
Perfect intervals (0, 7 mod 12)parallel and hidden-parallel rules (chapter 2)
Fourth above the actual bassvertical_dissonance, with declared suspension and cadential 6/4 licenses (chapter 3)

Continue with Chapter 2 — Motion & Forbidden Parallels.

Dual-licensed: AGPL-3.0 · commercial licensing available. Generated MIDI is yours to use freely.