Species Loom

Play a short subject, then watch a machine grow it into a three-voice fugue whose every note is chosen to obey real species-counterpoint rules — illegal moves flash red and are rejected on the score in front of you.

ghost is composing
Counter ISubjectCounter II

Play the subject

Use your computer keyboard — the home row is a D-dorian scale. Play 4–10 notes, then press Compose fugue.

accidentals:

Your subject

No notes yet — play some keys.

How the rule engine works

From the subject (the cantus firmus, plus a stepwise cadential tail to the tonic D), a backtracking legal-set search grows two voices note-by-note. At each bar it enumerates the in-scale candidate pitches and keeps only those that are consonant on the downbeat, avoid parallel and hidden perfect fifths/octaves, keep each line mostly stepwise with recoverable leaps, and end in a clausula-vera authentic cadence. The lower voice runs in second species (2:1), where a weak-beat dissonance is licensed only as a passing tone. When the search rejects a candidate for a parallel or hidden perfect it is drawn as a red ghost notehead and vetoed. After composing, an independent verifier re-scans every vertical and reports the violation count — it should always read zero.

The dream lab — Karel Barnoski