Chord segments to play over; they need not be pre-sorted, and each segment's chord may be written as a chord symbol.
Key context, which answers for the degrees the chords do not; a
key name such as 'C major' is read as that key.
Genre, density, ceiling and seed.
Bass notes sorted by onset, non-overlapping.
If a segment has a non-positive duration, two segments overlap, or the genre is not one this library names. A bass part is monophonic, so overlapping segments are refused here exactly as generateBassLine refuses them rather than being laid over each other.
import { majorKey, makeChord, placeLicks } from '@libraz/libcantus';
const timeline = [
{ startBeat: 0, endBeat: 4, chord: makeChord(0, 'maj7') },
{ startBeat: 4, endBeat: 8, chord: makeChord(5, 'maj7') },
];
const notes = placeLicks(timeline, majorKey(0), { genre: 'motown', ctx: { seed: 7 } });
Lay licks over a chord placement.
Each segment is offered the figures whose conditions it meets — the genre, the chord quality, the tempo, and the difficulty ceiling — and one of them is chosen by a draw addressed to that segment, so changing a chord elsewhere leaves this segment's figure where it was. A segment that takes no figure gets its root, and the last note before a chord change leads into the next root by step, the way a walking line does.