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

    Function generateBassLine

    • Generate a bass line following a chord placement.

      Each segment contributes notes in the chosen bass register per the selected style; consecutive notes are kept within roughly a fifth. Every note's duration extends to the next onset (the final note extends to the last segment's end). Given a seed the output is fully reproducible.

      The pop style's pickups are drawn per position, so raising complexity.rhythmic adds pickups without moving the notes already written.

      With an instrument the line is written for that instrument: the register band is moved into its range and any note still outside comes back an octave, so every pitch has a fret. Nothing is dropped or replaced — the rhythm and the note count are the same either way.

      Parameters

      Returns NoteEvent[]

      Bass notes sorted by onset, non-overlapping.

      import { generateBassLine, makeChord, majorKey } from '@libraz/libcantus';
      const segments = [
      { startBeat: 0, endBeat: 4, chord: makeChord(0, 'maj') },
      { startBeat: 4, endBeat: 8, chord: makeChord(7, 'maj') },
      ];
      const notes = generateBassLine({ segments, key: majorKey(0), style: 'walking' });