@libraz/libcantus - v1.1.0
    Preparing search index...

    Function developMotif

    • Lay a motif across bars and 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.

      Parameters

      • cell: MotifCell

        The source motif.

      • timeline: ChordTimeline

        Chord segments to snap against.

      • key: KeyLike

        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.

      • bars: number

        Number of bars to fill.

      • ts: MeterLike

        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.

      Returns MotifCell

      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