5. Tonal Grammar
The rules so far judge notes and lines. This chapter judges sentences: how phrases end, how the music borrows chords from neighboring keys, and how it travels to a new key and back. These checks need more context than an interval — the validator reads them against the declared harmonic plan.
What is V to I?
Roman numerals describe chords relative to the key. In C major, I is C major, IV is F major, V is G major, vi is A minor. Upper case marks a major chord, lower case a minor one. A cadence is a closing gesture; V to I is the common dominant-to-tonic closure, but the validator also checks how the individual voices arrive there.
Reading the chord symbols
This chapter's tables use three decorations on Roman numerals. A small 6 (as in iv6) marks first inversion: the chord's third is the lowest note instead of its root — that is how the Phrygian cadence gets its half-step bass descent. A ° (as in vii°) marks a diminished chord, stacked from two minor thirds. A superscript 7 (as in V7) adds a fourth note a seventh above the root; that added note is the "chordal seventh" whose doubling is banned below. Combining the two gives vii°7, the diminished seventh chord: three minor thirds stacked, its outer span the diminished seventh (9 semitones) the chord is named after — Baroque music's most dramatic dominant substitute. Inverted seventh chords carry two figures: V6/5 has the chord's third in the bass, V4/3 its fifth, V4/2 its seventh (chord positions).
Cadences are voice-leading contracts
A cadence is more specific than "the harmony is V then I". In polyphonic music, each declared type promises particular outer-voice behavior — the highest and lowest sounding lines at the cadence. In a monophonic form, cadence_voice_leading checks the single line as a melodic cadence instead of requiring a separate bass. The engine knows seven types.
The two approaches are sampled differently. The upper line is read at cadence.tick - 1, immediately before the arrival, so a fast run inside the final beat is preserved. The bass remains structural and is read one quarter-note beat earlier.
Authentic: the period
In standard tonal theory, a perfect authentic cadence (PAC) has three conditions: V–I harmony, both chords in root position, and scale degree 1 in the highest voice of the final tonic chord. The soprano may approach that tonic by step from scale degree 2 as well as from the leading tone 7. Within an authentic V–I close, if any one of those conditions is missing — for example, an inverted chord or a final soprano other than scale degree 1 — the close is an imperfect authentic cadence (IAC). See the three PAC conditions and IAC distinction.
The engine keeps a separate contract for its named perfect cadence cell. The sampled upper line must make the 7→1 leading-tone resolution, rising at most two semitones, and the bass must move from the dominant in root position (scale degree 5 → 1). It is narrower than the textbook on the soprano, which must make the 7→1 move, and matches it on the bass: an inverted dominant such as V4/3 → I does not pass the perfect cell, and belongs to the imperfect authentic type, as standard theory has it. The figure above shows the root-position case.
Bach’s Goldberg Aria includes a close with this 7→1 realization:
cadence_voice_leading verifies for a perfect authentic close. The final notes are held under a fermata in performance; the excerpt trims them at the double bar.Imperfect authentic: the softer period
The two common ways to miss a perfect cadence are a soprano that ends on 3 (or 5) of the tonic chord, and a dominant chord that stands on an inverted bass. Switch the figure to hear both. The engine's imperfect cell checks the bass V→I, in the inversion the plan declares, and asks only that the upper voice land on a tone of the tonic triad. Deceptive and Picardy closes accept the planned inversion in the same way.
Plagal: the amen
Half: the comma
Deceptive: the feint
Here is the feint in the wild — three voices of the F major fugue assemble a complete V7, the upper voices resolve exactly as promised, and only the bass slips upward to vi:
Phrygian: the archaic close
The name comes from the Phrygian mode, the church mode whose scale has a half step directly above its final note (E–F on the white keys). The bass's half-step fall onto the dominant borrows that sound.
Bach ends an entire movement this way. The Largo of the fifth organ trio sonata closes on V — phrygian descent in the pedal, a pair of suspensions resolving above — and hands the open door to the finale:
Picardy: minor ends major
picardy_third rule checks that the final chord sounds C♯ and never C♮ while it lasts.The engine checks a declared Picardy close in two places. cadence_voice_leading wants the bass to move V→I and the upper voice either to resolve the leading tone or to step onto the raised third. The separate picardy_third rule checks the harmony: in a minor key, the chord the plan flags as Picardy must sound its major third and never its minor third.
And here is the convention at work — the very last bar of the C minor fugue from WTC I, dominant tension over a tonic pedal melting into a major chord:
picardy_third rule asks. One difference remains: the engine's cadence check also wants the bass to move V→I, and Bach's bass holds its tonic pedal instead. (One inner voice is omitted; the score doubles the pedal an octave lower.)| Cadence type | Validator checks |
|---|---|
| Perfect authentic | Upper voice rises 7→1 (at most two semitones); bass moves from the root of V to the tonic (5→1), so an inverted V does not pass. Standard theory also allows a 2→1 soprano. |
| Imperfect authentic | Bass moves V → I, in the inversion the plan declares; the upper voice lands on any tone of the tonic triad. |
| Plagal | Bass moves IV → I; the upper voice lands on a tonic-triad tone. |
| Half | The bass arrives on the dominant; a rest just before the arrival is allowed. |
| Deceptive | The bass moves from V to the sixth degree (vi, or ♭VI in minor) instead of the tonic. |
| Phrygian | In minor: the bass falls exactly a semitone ♭6 → 5, and in polyphony the top voice rises 4 → 5 by at most two semitones. A single line may state either shape. |
| Picardy third | Bass V → I; the upper voice resolves the leading tone or steps onto the raised third. The chord's major third itself is checked by picardy_third. |
Doubling: tendency tones stay single
Some scale degrees carry an obligation (the leading tone wants the tonic; a chordal seventh wants to fall). Giving the same obligation to two voices guarantees one of them breaks it — or they resolve in parallel octaves.
Cross relations: chromatic contradictions
When one voice sounds F♯ while another sounds F♮, the listener hears the key contradict itself: one line claims the chromatic form of a degree while another insists on the diatonic form. The completed-score validator checks simultaneous notes and adjacent note onsets. For an adjacent pair, neither voice may start another note strictly between the two onsets, regardless of their distance in ticks; the pair is judged in the local key at the later onset. Natural half-step pairs (in C major, E–F and B–C; in C minor, D–E♭ and G–A♭) are not cross relations — they are different scale degrees, not chromatic alterations of the same degree. The candidate-placement helper still uses a beat-wide pre-check because the rest of a partial score is not known yet.
Secondary dominants: borrowed tension
secondary_dominant_resolution checks that the next chord really is V. The region also suspends the forbidden-leap rules, so a leap inside the D major chord such as C→F♯, a tritone, would pass there.A secondary (applied) dominant treats a diatonic chord as a momentary tonic and approaches it with its own dominant — written with a slash and read "of": V/V is "the V of V" (in C major: D major, the dominant of G), V/vi the dominant of the vi chord, and so on. This is the engine's main source of legal chromaticism:
- Inside the declared applied region, the melodic rules (
augmented_melodic,diminished_melodic,tritone_melodic) are exempt — the chromatic motion is the device. - In exchange,
secondary_dominant_resolutionverifies the promise: the next chord must actually be the targeted degree. The rise of the borrowed leading tone is tracked descriptively via provenance, while the hard check is the degree-level resolution.
Pivot-chord modulation
To modulate convincingly, Baroque practice routes through a pivot chord — one that is diatonic in both the old key and the new key, so the ear can reinterpret it mid-phrase. For pivot-type modulations, modulation_pivot_chord_required verifies that the declared pivot really belongs to both keys. (The engine also models common-tone and phrase modulations, which carry their own declared shapes rather than a pivot.)
How the validator sees this chapter
| Rule | FailKind | Check |
|---|---|---|
cadence_voice_leading | StructuralFail / MusicalFail | At the cadence tick, polyphonic outer voices or the single monophonic line match the declared cadence type. The upper approach is sampled one tick before arrival; a distinct bass is sampled one beat before. A missing cadence voice or a cadence earlier than one beat is StructuralFail; a voice-leading mismatch is MusicalFail. |
picardy_third | MusicalFail | In a minor key, a chord the harmonic plan flags as Picardy must sound its major third and never its minor third anywhere in its span. In a major key the rule is idle. |
doubling_no_leading_tone | MusicalFail | The leading-tone pitch class sounds in at most one voice when the chord contains it (V, vii°, V7, vii°7). |
doubling_no_seventh | MusicalFail | A seventh-quality chord's seventh is not doubled. |
cross_relation | MusicalFail | Voices sound the same scale degree in the local key at the later onset, with different inflections, either simultaneously or at adjacent note onsets (neither voice has another onset strictly between them). Natural semitone pairs between different degrees are excluded. The partial-placement pre-check remains beat-wide; FinalScore uses completed-score onset adjacency. Both-material pairs are exempt during Generation only; FinalScore audits every source, and the form's vertical budget decides whether observed findings close the form. |
secondary_dominant_resolution | MusicalFail | A chord marked V/x is followed by degree x. |
modulation_pivot_chord_required | MusicalFail | A pivot modulation's pivot chord is diatonic in both keys. |
Continue with Chapter 6 — Fugal Devices.