Skip to content

3. Dissonance Treatment

Dissonance is not forbidden — counterpoint runs on the tension it creates and releases. What the validator rejects is unmanaged dissonance. This chapter catalogs the legal patterns, from the metric rules that govern where dissonance may sit, to the suspension figures that stage it deliberately.

The engine distinguishes three questions:

  1. Is the vertical interval dissonant? (chapter 1's classification)
  2. Is the note a chord tone at a structurally strong point?
  3. If it is not stable, is there preparation and resolution?

Chord tone and non-chord tone

A chord tone is part of the active harmony. In a C major triad, C, E, and G are chord tones. A note such as D or F can still be musical, but it needs a function such as passing between stable notes — hence "non-chord tone" (NCT).

Strong beats demand chord tones

The downbeat of a bar is a structural anchor. The engine's definition of "strong beat" is exactly that and nothing more: a position where start_tick % ticks_per_bar == 0 (primer). The engine requires generated notes there to belong to the active triad — the chord's root, third, and fifth (primer) — and simultaneous voice pairs on strong beats to form consonant intervals.

Strong beatStrong-beat non-chord tone
Downbeats are structural anchors. Generated notes are expected to belong to the active triad there.
strong_beat_dissonanceThe red downbeat note is not root, third, or fifth of the active triad.
VerticalUnsupported vertical dissonance
This check samples simultaneous voices on strong beats and blames the editable Compose side of the pair.
vertical_dissonanceThe simultaneous red interval is dissonant and has no declared suspension or passing-tone context.
RuleFires when
strong_beat_dissonanceA Compose-source note on beat 1 of a bar is not the root, third, or fifth of the active chord at that tick.
vertical_dissonanceA voice pair sounding together on a strong beat forms an interval outside the consonant set {0, 3, 4, 5, 7, 8, 9}. Both-material pairs are exempt; blame falls on the Compose side.

Weak beats tolerate legible dissonance

Between downbeats, a dissonant non-chord tone is acceptable when the line makes its function audible — approached and left by step (motion to the adjacent scale note, at most 2 semitones). The two classic shapes:

Allowed weak beatPrepared passing dissonance
The same dissonance would be unsafe as a structural arrival; stepwise context makes it a passing tone.
unprepared_dissonanceThe middle non-chord tone is approached and left by step.
Allowed weak beatNeighbor tone
A neighbor tone decorates one pitch by stepping away and back. Like the passing tone, it is legible because both the approach and the departure are steps — the validator accepts it on a weak beat.
unprepared_dissonanceThe line steps down to a dissonance and returns to the same note.

A passing tone fills the gap between two chord tones a third apart; a neighbor tone steps off a chord tone and returns. Both read as ornamentation of a stable frame.

Bach runs the pattern at sixteenth-note speed. In bar 2 of the C major fugue (WTC I), the running line clashes twice with the answer above it — a fourth, then a seventh — and both clashes pass the contract:

From BachBach: WTC I Fugue in C major — passing tones in the wild
Bar 2 of the C major fugue (WTC I, BWV 846): the answer enters above in calm eighths — G, A, B — while the first voice keeps its sixteenths running underneath. Twice the running line clashes with the held note above it: a fourth against G, then a major seventh against B. Both dissonances sit on weak sixteenths, both are approached by step and left by step, and the seventh melts into a bare octave one sixteenth later. This is the passing-tone contract executed at speed — the textbook pattern of the previous figure, in real counterpoint, twice in a single bar.
unprepared_dissonanceA fourth and a seventh sound against the answer — both on weak sixteenths, both entered and left by step.

The same dissonance without that frame fails:

Weak beatUnprepared dissonance
Weak-beat non-chord tones are accepted only when approach and departure make the pattern legible.
unprepared_dissonanceThe weak-beat dissonance is left by leap, so it does not read as a passing tone.
RuleFires when
unprepared_dissonanceA weak-beat non-chord tone is approached or left by more than 2 semitones — it neither passes nor neighbors. Compose-source notes only. A voice's very first and last notes are exempt: with no neighbor on one side, "approached by step" cannot even be evaluated.

Suspensions: dissonance by appointment

A suspension is the most deliberate dissonance in tonal music — a three-stage figure that the engine's material model declares explicitly:

Suspension in plain language

A note that was safe gets held while the harmony underneath changes, becomes temporarily tense, then resolves by step. Think of it as a delayed update: the old value remains for one beat, then catches up.

  1. Preparation — the note sounds as a consonance.
  2. Suspension — the note is held over (a tie — one continuous sound across the boundary) while the other voice moves, creating the declared dissonance.
  3. Resolution — the suspended voice moves by a single diatonic step in the prescribed direction.

The engine supports the four classical figures. Each is named by the dissonant interval over the bass and the interval it resolves to:

Allowed pattern4-3 suspension
The most common suspension at cadences. Preparation: the note is consonant. Suspension: the bass moves underneath, turning it into a fourth. Resolution: the voice falls one step to the third of the chord.
suspension_preparationsuspension_resolution_step_downThe held note becomes a fourth over the new bass, then resolves down by step to a third.
Allowed pattern7-6 suspension
The bracket marks the three points the material declaration requires: preparation, suspension, resolution. The dedicated rule additionally verifies a genuine seventh above the bass that resolves to a genuine sixth.
suspension_preparationsuspension_resolution_step_downsuspension_seventh_sixthPreparation ties into the dissonance, then resolves down by step from 7 to 6.
Allowed pattern9-8 suspension
The 9-8 suspension resolves into a perfect interval, so it sounds more final than 7-6 or 4-3. Bach often reserves it for moments where the texture settles.
suspension_preparationsuspension_resolution_step_downThe held note forms a ninth over the bass and resolves down into the octave.
Allowed pattern2-3 suspension (ascending resolution)
The one suspension figure in the engine that resolves upward. The suspended voice is the lower one: it holds while the other voice moves onto it, then rises one step to restore consonance. The validator enforces the direction per figure: 4-3, 7-6, and 9-8 fall; 2-3 rises.
suspension_preparationsuspension_resolution_step_downThe suspended lower note clashes at a second, then resolves up by step to a third.

Chained, the suspension stops being an event and becomes a texture — each resolution doubles as the next preparation:

Allowed patternThe 7-6 chain
Chained, the 7-6 figure becomes a vehicle: the upper voice is tied over each bass step, clashes at a seventh, resolves to a sixth — and that sixth is already the preparation for the next seventh. The syncopated upper line against the steadily falling bass is one of the most recognizable sounds in Baroque sequences.
suspension_seventh_sixthsuspension_resolution_step_downEach resolution becomes the preparation of the next suspension as the bass walks down.

Bach opens the B minor prelude that closes WTC I with exactly this texture — except the suspensions are handed back and forth between two voices over a walking bass:

From BachBach: WTC I Prelude in B minor — suspensions passed between voices
The opening of the B minor prelude that closes WTC I (BWV 869). Three suspensions in two bars, handed between the voices: the alto holds B into a fourth over the bass's F♯ and falls to A; the soprano ties F♯ across the barline into a fourth over C♯ and falls to E; the alto holds C♯ into a ninth over B and falls to B. Every one follows the three-stage script — consonant preparation, tie, step-down resolution — that suspension_preparation and suspension_resolution_step_down enforce. The soprano's final D is itself tied on into bar 3, where it makes the next seventh: the chain simply keeps going.
suspension_preparationsuspension_resolution_step_downOver a walking bass, soprano and alto take turns holding a note into a dissonance and resolving it down by step.
FigureDissonance → resolutionDirectionTypical home
4-3fourth over the bass → thirddowncadences
7-6seventh → sixthdownsequential chains (the "7-6 chain")
9-8ninth → octavedownmoments of settling; resolves into a perfect interval
2-3second (suspended bass) → thirdupbass suspensions; the engine validates the ascending step

How the validator sees this chapter

RuleFailKindCheck
strong_beat_dissonanceMusicalFailDownbeat pitch class must be in the active triad. Compose notes only.
vertical_dissonanceMusicalFailStrong-beat simultaneities must be consonant. Both-material pairs exempt.
unprepared_dissonanceMusicalFailWeak-beat NCTs must be approached and left by step (≤2 semitones).
suspension_preparationMusicalFailThe preparation pitch is consonant against the lowest sounding voice and ties (same pitch) into the suspension.
suspension_resolution_step_downMusicalFailThe resolution is a 1–2 semitone step in the prescribed direction: down for 4-3 / 7-6 / 9-8, up for 2-3.
suspension_seventh_sixthMusicalFailA declared 7-6 figure must form a genuine seventh over the lowest sounding voice and resolve to a genuine sixth (verified via provenance bits, so the rule is inert where no suspension carrier shipped).

Continue with Chapter 4 — Melodic Writing.

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