Programs that write harmony by solving explicit music-theory rules can guarantee that their output has no forbidden parallel fifths and that every tense chord resolves properly. They stay fast only because their chord vocabulary is tiny. A rule-based model of four-voice tonal harmony allows only diatonic triads and dominant sevenths, and even then it needs minutes to prove that its best answer really is best. Systems that handle chord progressions and key changes do the same thing: they shrink harmony to a handful of chord types so the search stays small. When the vocabulary grows to the ninths, elevenths, thirteenths and altered chords that define jazz and much popular music, the number of candidate voicings multiplies, and the solver runs into state-space explosion, the exponential growth in the number of configurations a search procedure must consider.
This note proposes to borrow a mechanism from robot task-and-motion planning. When a low-level check fails, the system finds the smallest set of decisions that caused the failure and feeds that cause back to the high-level planner as a ban. Harmony has a property that makes this mechanism unusually strong. A voice-leading failure depends on intervals, not on absolute pitch or on position in the piece, so a conflict found once can be rewritten as a transposition-invariant, position-free rule. Each rule then forbids the same mistake in every key, at every point in the phrase, and in every later problem. Our bet is that the number of such rules levels off as the vocabulary grows, while the raw search space keeps exploding. If so, a growing library of learned conflicts makes extended-vocabulary harmonization tractable without discarding the chords that matter.
Core Claim
Harmony solvers today either plan chord symbols and voicings jointly in one large constraint model, or plan them in decoupled layers. The joint approach is Diatony, a constraint-programming model of four-part harmony that uses restarts with generic "nogood" recording (clauses that forbid a specific failed partial assignment) and branches backward from the cadence. The layered approach is the Harmoniser chord-progression layer, which generates 28-chord progressions with modulations in milliseconds but never checks whether those progressions can be voiced. We claim that a third design scales better as the chord vocabulary grows. In this design, a progression planner works over factorized chord symbols, a voicing solver checks each proposal, and every voicing failure is shrunk to a minimal, lifted conflict pattern that the planner may never propose again.
The difference from Diatony's nogoods is what gets learned. Generic nogoods record concrete variable assignments, such as "alto = E4 at beat 7 and tenor = A3 at beat 8," and are thrown away when the instance ends. Our conflicts are expressed in relative terms: root interval, chord qualities, active extensions, bass factor, and melody scale-degree relative to the root. They therefore apply anywhere in the phrase and in every key, and we keep them across instances.
Research Program
The system has two layers joined by a feedback loop.
The upper layer is a constraint model in the style of the Harmoniser chord-progression layer. It differs in one respect: each chord is a tuple of factors rather than a single symbol. We use the six-way decomposition that Jiang et al. introduced for audio chord recognition: root and triad, bass, seventh, ninth, eleventh, and thirteenth. That paper used the factorization to share statistics across rare chords. We use it to make conflicts expressible at the level of individual factors. The model works on any input melody and is unrelated to the template bank of AccoMontage2.
The lower layer extends Diatony's hard rules to extended chords. These rules include no parallel perfect intervals, resolution of tritones and sevenths, and range and spacing limits. The extension adds explicit omission and doubling conventions, such as dropping the fifth when a ninth is present and allowing a fifth voice for thirteenths. The soft preferences, such as small melodic leaps, are kept lexicographic as in the original. Extended-chord voicing conventions are less codified than chorale rules. We will therefore publish the rule set as a versioned artifact, so that the choices are open to criticism instead of hidden in code.
Conflict extraction follows the structure of the Graph-NLP Planner. That planner locates a minimal infeasible subgraph with a double binary search over the timeline. It also uses "semantic relaxations," such as ignoring collisions, to separate causes cheaply, and these relaxations caught roughly 90% of geometric failures almost instantly. Our version has three steps.
First, when the voicing layer rejects a progression, we binary-search the start and then the end of the time window to find the shortest infeasible span.
Second, inside that window we test two relaxations. One drops the absolute-register constraints: if the span is still infeasible, the conflict is purely intervallic and fully transposition-invariant. The other drops individual chord factors one at a time, for example removing the ninth of chord $t$, to find which factors are necessary for the failure.
Third, the surviving core is rewritten in relative coordinates. If it depended on register, it is rewritten with an explicit register parameter. It is then added to the upper layer as a table constraint over every adjacent window of the same length.
The library persists across problems. The working hypothesis is that it saturates: most extended-vocabulary failures reduce to a modest set of short, recurring patterns. A typical example would be "a dominant thirteenth with the thirteenth in the soprano moving to a major ninth a fourth up, with the melody stepping down, forces a parallel octave or an unresolved seventh."
For optimization, the upper layer orders candidates by the composer's preferences, and the voicing layer proves optimality for each fixed progression. Lifted conflicts prune entire classes of progressions before any voicing search begins. We keep Diatony's reverse-chronological branching in both layers, since the file reports it as a large gain on cadence-anchored phrases.
Baselines
The naive reference point is the decoupled pipeline. The Harmoniser-style progression layer, expanded to the same factorized vocabulary, proposes progressions by satisfaction search. Each one is handed to the voicing layer, and on failure the pipeline simply asks for the next progression, with no feedback. This measures how much effort is wasted when the layers do not talk to each other. It also gives the downstream infeasibility rate of satisfaction-only progression generation, which the Harmoniser paper leaves open. Beating it means solving strictly more instances within the timeout, with lower median time.
The strongest existing method is a monolithic joint model in Diatony's style: progression and voicing variables together in one Gecode model, using restart search with nogood recording and reverse-chronological branching. It is the strongest competitor because it already does conflict learning, only the generic, concrete kind. On the original diatonic vocabulary, Sprockeels and Van Roy report that proving optimality on hard phrases timed out at 450 seconds with standard depth-first search and took 200 to 300 seconds with restart-based search. We will first reproduce this on our reimplementation of their rules, then run it on every vocabulary tier. Both systems get the same rule set, solver, hardware, 450-second timeout, and tuning budget for branching heuristics. Beating it means two things. On the diatonic tier, we must match its 200 to 300 second range. On the ninth-chord tier and above, we must prove optimality on a clearly larger fraction of instances, with a time-versus-vocabulary curve that grows visibly more slowly. For extended vocabularies, no reported result was found on Lacuna, so our own runs of this baseline define the comparison.
A precomputed transition table is the obvious cheap alternative. Offline, we enumerate every chord-factor pair under transposition invariance, condition on the melody step, and record which pairs admit a legal voicing. The planner then uses the table as a hard constraint. Beating this baseline requires showing that a meaningful share of conflicts span three or more chords or depend on register drift, which pairwise feasibility cannot express.
A coarse-to-fine baseline follows the pattern of Flax, which solves a rule-relaxed rough plan and then re-expands it in robot planning. Here the system first solves with triads plus sevenths only, then tries to add extensions to the voiced skeleton.
For learned generation, a DeepBach-style pseudo-Gibbs sampler (Hadjeres et al.) is trained on the Bach corpus. Its samples are filtered by our rule checker and given the same wall-clock budget, which yields a rate of valid outputs per second.
Ablations isolate the key ingredient. One stores conflicts concretely instead of lifted. One skips relaxation-based factor minimization and keeps only time-window minimization. One clears the library between instances.
Why not just…?
Why not just let the monolithic constraint solver's own nogood learning do the work? This is the most serious threat, because Diatony shows generic nogoods already help. The argument against it is structural. A concrete nogood about specific pitches at specific beats cannot fire in another key or at another position, while the same intervallic failure recurs everywhere. The concrete-versus-lifted ablation tests this directly, with search held fixed. If lifting adds little over the monolithic solver at the higher vocabulary tiers, the core claim is wrong, and we will report it that way.
Why not just precompute which chord-to-chord transitions are voiceable? For conflicts between two adjacent chords, this probably works as well as our approach and costs nothing at run time. That is why it is a baseline rather than a straw man. The open question is how much infeasibility is non-local: spans of three or more chords, accumulated range pressure, or a sustained melody note that constrains several transitions. Our extractor reports the length and register-dependence of every conflict. If nearly all conflicts are pairwise, the table is the right engineering answer, and the lifted library reduces to a lazy way of building it. That outcome would still tell us something useful about the structure of extended harmony.
Why not just collapse to triads, or voice a triad skeleton and decorate it afterward? Collapsing to 24 triads makes search trivial, as Expert-MusiComb and the Harmoniser show, but it removes exactly the chords whose absence defines the complexity gap for jazz and popular genres (Kong et al.). Decorating a skeleton afterward is cheap, but adding a ninth can create parallels or force a doubling the skeleton never anticipated. We will measure how often decoration fails or degrades the soft-preference score compared with joint optimization.
Why not just train a neural sampler and filter its outputs? Pseudo-Gibbs sampling gives DeepBach bidirectional control, and its chorales were judged to be Bach about half the time, but it offers no guarantee against rule violations. Rare extended chords are also long-tail events that learned models see too seldom (Chuan et al.). The sample-and-filter baseline reports the rate of valid outputs per second on each tier, so the comparison rests on measured throughput rather than argument.
Proposed Experiments
Instances come from three sources: the soprano lines of the 389 Bach chorales, the roughly 1,000 Nottingham melodies used by AccoMontage2, and melodies from POP909. Phrases are cut at annotated cadences. Vocabulary tiers are nested subsets of the 301-class dictionary of Jiang et al.: diatonic triads plus V7 (Diatony's tier), then all sevenths, then ninths, then elevenths and thirteenths, then altered dominants. The library is built on a training split of phrases and evaluated on held-out phrases and on a held-out corpus, which tests whether the learned conflicts transfer.
The metrics are fraction of instances solved and proven optimal within 450 seconds, time to first solution, time to prove optimality, number of voicing-layer calls, and library size as a function of training phrases seen. Musical checks cover three things: zero hard-rule violations for the solver systems versus a measured violation rate for the sampler, how closely the distribution of chord factors matches POP909 and Billboard annotations, and a small blind listening comparison between the extended and triad-collapsed outputs for the same melodies.
Three outcomes would settle the question. The first is whether library size levels off as training phrases are added within each tier, which is required for the approach to scale. The second is whether, at the ninth-chord tier and above, the lifted-conflict system proves optimality on substantially more held-out phrases than the joint restart-and-nogood baseline, while remaining within Diatony's reported 200 to 300 seconds on the diatonic tier. The third is the measured share of conflicts longer than two chords, which determines whether the precomputed table is enough. A plateau in library size, a widening gap over the joint baseline as the vocabulary grows, and a non-trivial share of non-local conflicts would together confirm the claim. Failure on any one of them points to the simpler alternative that wins.
References
- Expressing Musical Ideas with Constraint Programming Using a Model of Tonal Harmony
- Towards a Practical Tool for Music Composition: Using Constraint Programming to Model Chord Progressions and Modulations
- Large-vocabulary Chord Transcription Via Chord Structure Decomposition
- AccoMontage2: A Complete Harmonization and Accompaniment Arrangement System
- A Conflict-driven Interface between Symbolic Planning and Nonlinear Constraint Solving
- Fast Task Planning with Neuro-Symbolic Relaxation
- DeepBach: a Steerable Model for Bach Chorales Generation
- Expert-MusiComb: Injective Domain Knowledge in a Neuro-Symbolic Approach for Music Generation
- S-KEY: Self-supervised Learning of Major and Minor Keys from Audio
- From context to concept: exploring semantic relationships in music with word2vec
- POP909: A Pop-Song Dataset for Music Arrangement Generation