The source motif.
Chord segments to snap against.
Key context, as a key name such as 'C major' or as a key/scale;
the notes off the structural positions are kept in it.
Number of bars to fill.
Meter the bars are counted in. Asked for rather than defaulted: a development laid on the wrong bar length drifts off the part it plays under, and a caller who leaves it out has no way to hear that.
The developed, harmony-aware cell, its notes in time order.
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, '4/4');
developed.notes.map((n) => n.pitch); // [60, 62, 60, 60, 62, 60] — the C-D-C cell, twice
Lay a motif across
barsand snap it to a chord timeline.The cell is tiled back-to-back to fill the requested span. Notes that carry structural weight — the head of each tile and every bar line — are pulled to the nearest chord tone of the segment sounding at that onset, so the developed line spells the underlying harmony. The notes between them are kept in the key as passing and neighbour tones, and two pitches that differ in the cell still differ in the development, so the development is still recognizably the motif rather than a chord arpeggiated over the cell's rhythm.