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.

Perfect intervals have the simplest frequency ratios (2:1 for the octave, close to 3:2 for the fifth), and two voices locked in them blend so well that the ear stops hearing two voices. Counterpoint wants stability at anchor points (openings, cadences) and independence everywhere else. (The engine works in semitone classes, not in any particular tuning.)

Imperfect consonances: the workhorses ​

Imperfect consonanceThirds, sixths, and tenths, major and minor
Each imperfect consonance comes in two sizes, a semitone apart: the minor third (3 semitones) and major third (4), the minor sixth (8) and major sixth (9), and their compounds an octave higher. Both sizes count as consonant. 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.
Minor and major thirds, sixths, and tenths against the held C: all imperfect consonances.

Thirds, sixths, and their compounds (tenths, thirteenths) are full but mobile, and each comes in a major and a minor size; both are consonant. Most of the vertical sonorities in a generated two-voice texture are imperfect consonances, and chains of parallel thirds or sixths are idiomatic: none of the parallel rules fires on them. One form-level score does notice them. In the trio sonata, voice_independence_threshold counts every boundary where two voices move in the same direction as dependent, so a long run of parallel thirds lowers that score (chapter 7).

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 on a strong beat with no declared suspension behind it, or a weak-beat clash that is not entered and left by step. Chapter 3 covers the legal patterns.
vertical_dissonanceEach red interval is dissonant: it needs a job, such as a passing or neighbor tone on a weak beat, or a prepared suspension that resolves.

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 same fourth, two places —
Over the bass, the fourth needs the full suspension treatment: C sounds first as an octave over the bass C, is held while the bass moves to G, becomes a fourth on the stronger beat, and resolves down to B, a third. Switch to the upper-voice view: the same fourth, C over G, now sits above a bass C, and both notes are consonant with that bass, so nothing needs resolving. The engine encodes this in vertical_dissonance: it judges each pair against the actual lowest sounding pitch, and lets a fourth over the bass stand only inside a declared suspension or cadential 6/4.
vertical_dissonanceAgainst the bass, the fourth is held over from a consonance and falls to a third, the way a dissonance behaves.

The perfect fourth has been argued about for centuries, and the engine's treatment mirrors the historical compromise. Toggle the example to hear both cases:

  • 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 (chapter 3) 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.