The source motif.
Chord segments to snap against.
Key context (used to keep snapped pitches sensible).
Number of four-beat bars to fill.
The developed, harmony-aware cell.
import { chordTimelineFromChords, developMotif, generateMotif, majorKey } from '@libraz/libcantus';
const key = majorKey(0);
const timeline = chordTimelineFromChords([{ rootPc: 0, quality: 'maj', startBeat: 0 }], 8);
const developed = developMotif(generateMotif({ key, bars: 1 }), timeline, key, 2);
Lay a motif across
barsand snap it to a chord timeline.The cell is tiled back-to-back to fill the requested span; each note is then pulled to the nearest chord tone of the segment sounding at its onset, so the developed line spells the underlying harmony.