Skip to content

Validator Rule Reference

This page is the flat index of all 47 validator rules. Use the Counterpoint Course to learn the musical ideas; use this page when you see a rule ID in an error, log, or event-debugging session and need to jump straight to its explanation.

How to read a rule ID

A rule ID names a specific musical contract that failed in the current validation pass. The same bad musical passage may violate several contracts at once; each violation is reported with the span it blames, so start from the first failure in the report.

Rule layers

The validator protects different layers of the composition. A local note rule and a form identity rule are both failures, but they need different context to understand.

LayerWhat it protectsTypical context needed
Local vertical soundStable intervals and chord membershipTwo voices at one beat
Melodic plausibilityNatural movement inside one voicePrevious and current notes in one voice
Voice independenceSeparate readable linesTwo voices across two time points
Tonal syntaxCadences, applied dominants, modulationHarmonic plan and phrase position
Fugal structureSubject, answer, countersubject, imitationDeclared material and entry spans
Phrase structureBar-grid consistencyPhrase metadata and meter
Form identityFixed grounds, cantus firmus, figuration rolesMaterial carriers and form layout
Physical boundsPlayable range and instrument compassVoice range, pedal range, instrument profile

Every failure also carries a FailKind: MusicalFail (counterpoint/harmony contract, the default), StructuralFail (the form's structural promise — immutable carriers and malformed cadence layouts), or ConfigFail (invalid request, reported before composition).

Voice motion and independence

Rule IDCourse chapterHow to read it
parallel_fifth2. MotionTwo voices both move, and the previous and current vertical intervals are perfect fifths.
parallel_octave2. MotionTwo voices both move, and the previous and current intervals are unisons or octaves.
hidden_parallel_fifth2. MotionSimilar motion lands on a perfect fifth from a non-fifth interval.
hidden_parallel_octave2. MotionSimilar motion lands on an octave in an upper-voice pair on a strong beat.
voice_crossing2. MotionA lower voice moves above a higher voice (voice order is part of the texture contract).
spacing_adjacent_voices_within_octave2. MotionAdjacent upper voices are spaced more than an octave apart in a 3+ voice texture.
invertible_at_octave2. MotionAn upper-voice pair creates strong-beat parallel octaves, which would invert to parallel unisons.
fourth_only_on_weak_beat2. MotionA perfect fourth appears as a strong-beat pillar in an upper-voice pair.

Dissonance treatment

Rule IDCourse chapterHow to read it
strong_beat_dissonance3. DissonanceA downbeat note is outside the active triad.
vertical_dissonance3. DissonanceSimultaneous voices form an unsupported dissonant interval on a strong beat.
unprepared_dissonance3. DissonanceA weak-beat dissonance is not approached and left by step.
suspension_preparation3. DissonanceA suspension's preparation is not consonant, or does not tie into the suspension.
suspension_resolution_step_down3. DissonanceA suspension fails to resolve by step in its prescribed direction (down for 4-3/7-6/9-8, up for 2-3).
suspension_seventh_sixth3. DissonanceA declared 7-6 suspension does not form a genuine seventh resolving to a genuine sixth over the bass.

Melodic rules

Rule IDCourse chapterHow to read it
augmented_melodic4. MelodyA voice moves by an augmented melodic interval (exempt in secondary-dominant regions).
diminished_melodic4. MelodyA voice moves by a diminished melodic interval (same exemption).
tritone_melodic4. MelodyA voice leaps a tritone (same exemption).
consecutive_leaps4. MelodyTwo consecutive large leaps (a fifth or more each, in any direction).
leading_tone_resolution4. MelodyA marked leading tone does not step up to the tonic.
voice_range_integrity4. MelodyA note falls outside its voice's declared MIDI range.

Tonal syntax

Rule IDCourse chapterHow to read it
cadence_voice_leading5. TonalityThe outer voices do not match the declared cadence type (perfect, imperfect authentic, plagal, half, deceptive, Phrygian, Picardy). StructuralFail when the cadence layout is malformed (fewer than two voices, no distinct bass); the voice-leading mismatch itself is MusicalFail.
doubling_no_leading_tone5. TonalityThe leading tone is doubled in a chord that contains it.
doubling_no_seventh5. TonalityA chordal seventh is doubled.
cross_relation5. TonalityVoices contradict the same scale degree chromatically within a beat window.
secondary_dominant_resolution5. TonalityAn applied dominant is not followed by its target degree.
modulation_pivot_chord_required5. TonalityA pivot modulation's pivot chord is not diatonic in both keys.

Fugal structure

Rule IDCourse chapterHow to read it
tonal_answer_dominant_mapping6. FugueA tonal answer's head does not map the subject's opening pitch class I↔V.
countersubject_continuous6. FugueThe countersubject falls silent during the answer's window.
episode_motif_derived6. FugueEpisode notes do not equal the declared motif transform of the declared source slice.
sequence_pattern_consistency6. FugueA sequence step is not an exact transposition of the seed by the declared offset.
imitation_entry_match6. FugueA follower entry misses the declared time distance or interval from the leader.
middle_entry_in_related_key6. FugueA development entry is not in V/vi/IV/ii, or strays from that key's scale.
stretto_overlap_valid6. FugueStretto entries do not overlap, or the follower is not an exact transposition.
pedal_point_tonic_or_dominant6. FugueA pedal point sits on a degree other than tonic or dominant.

Phrase, texture, and physical bounds

Rule IDCourse chapterHow to read it
phrase_periodicity_4_or_8_bar7. FormDeclared phrase starts are not 4 or 8 bars apart.
anacrusis_consistent7. FormUpbeat metadata and phrase-start metadata disagree.
pedal_range_soft_penalty7. FormAn organ pedal note leaves the playable compass (MIDI 12–62).
voice_independence_threshold7. FormTrio-sonata voices score below 0.6 pairwise independence.
section_contrast_required7. FormAdjacent fantasia sections do not contrast in density or register.

Form identity

Rule IDCourse chapterHow to read it
ground_bass_immutable7. FormA chaconne ground bass changed between cycles. StructuralFail.
passacaglia_ground_immutable7. FormThe passacaglia's 8-bar ground changed between cycles. StructuralFail.
cantus_firmus_immutable7. FormA chorale-prelude downbeat does not restate the declared skeleton tone. StructuralFail.
variation_role_ornament_constraint7. FormA ground-role variation subdivides below quarter notes.
figuration_harmonic_consistency7. FormA figuration bar opens on a non-chord tone.
toccata_archetype_compatible7. FormThe toccata's sectional archetype conflicts with the declared character.
implicit_voice_counterpoint7. FormA solo-string arpeggio's implied bass/top streams break the melodic rules.
arpeggio_no_parallel_perfect7. FormImplied streams move in parallel perfect intervals across cells.

Debugging checklist

  1. Identify the rule ID and its FailKind.
  2. Check whether the offending note is source: "material", "compose", or "ornament" in the event JSON.
  3. For local rules, inspect the previous and current note pair.
  4. For structural rules, inspect the declared form, material span, phrase span, or harmonic plan.
  5. If the rule is musical rather than API-level, read the linked course chapter.

Useful mental model

The form director declares what kind of musical object is being built. Candidate search fills editable spans. Material carriers replay fixed spans. The validator rejects results that break the declared musical contract.

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