@libraz/libcantus - v0.9.3
    Preparing search index...

    Function generateProgression

    • Generate a chord progression laid out one chord per bar.

      A preset is chosen by presetId when given, otherwise deterministically from the presets matching style, seeded by seed. An unknown presetId is a caller error and throws rather than silently falling back to a random preset. The preset's degrees cycle to fill bars; each bar is four beats, so startBeat is barIndex * 4. Chord roots come from the key's diatonic scale-degree mapping. When ext is omitted or 'auto', each chord takes its diatonic triad quality; otherwise ext is forced on every chord. When reharmonize is set, some chords are deterministically replaced with the secondary dominant (V7) of the following chord, flagged with secondaryDominant.

      Parameters

      Returns ChordSpan[]

      One chord per bar in timeline order.

      If presetId is given but does not match any built-in preset.

      import { generateProgression, majorKey } from '@libraz/libcantus';
      const chords = generateProgression({ key: majorKey(0), style: 'dance', bars: 4 });
      // Deterministic for a given seed (defaults to 0); one ChordSpan per bar.