Kithairon
Kithairon turns a monophonic MIDI or MusicXML melody into playable two-voice canon candidates. It enumerates strict canon transforms, scores the results with explicit harmony and voice-leading rules, and can produce relaxed repair or CP-SAT solver candidates when strict results are weak.
Use the CLI:
uv run canonize validate examples/melodies/scale_c_major.musicxml
uv run canonize generate examples/melodies/scale_c_major.musicxml --out tmp/strict --engine strict
Each generation run writes:
results.jsonreport.mdresolved_config.tomlvisualization.jsonartifact_index.jsoncandidates/*.musicxmlcandidates/*.mid
Demo
The Demo page includes the Bach-derived preview from commit 7060228, with embedded MP3 players for the selected repair candidate and two strict comparison candidates.
Supported Input
- MIDI:
.mid,.midi - MusicXML:
.musicxml,.xml,.mxl
Inputs are monophonic by default. Chord input fails unless you set --chord-policy top-note or --chord-policy bottom-note.
Engines
strict: exact transform of the input melody, markedcanon_label: "strict canon".repair: local follower-note edits from a strict candidate, markedcanon_label: "relaxed canon".solver: optional OR-Tools CP-SAT relaxed candidate search.auto: strict first, then repair, and solver only when[solver].enabled = trueand the dependency is installed.
See Scoring And Rules for the rule weights, score profiles, and strict-versus-relaxed canon semantics.
See Architecture for the generation pipeline and FAQ for common setup and output questions.
See the repository README for command examples and output details.