The chord timeline to scan.
The prevailing key.
The cadences found, in time order.
import { chordTimelineFromNotes, detectCadences } from '@libraz/libcantus';
const notes = [
{ pitch: 67, startBeat: 0, durationBeat: 4 }, // G, a dominant
{ pitch: 60, startBeat: 4, durationBeat: 4 }, // C, the tonic
];
const { timeline, key } = chordTimelineFromNotes(notes);
const cadences = detectCadences(timeline, key);
Find cadences between consecutive segments of a chord timeline.
Each temporally adjacent segment pair is classified with detectCadence; pairs forming no cadence are skipped. Segments separated by a gap (a rest in the timeline) are not a chord-to-chord progression, so they are never paired.