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

    Function figuredBassRealization

    • Read a figured bass in full: the chord, its spelled notes, and its suspensions.

      The figure grammar, in the forms this accepts:

      • Nothing at all, 5, 3 or 53 — the root-position triad.
      • 6 or 63 — the first-inversion triad; 64 — the second-inversion triad.
      • 7 — the root-position seventh chord; 65, 43, and 42 (also written 2) — its first, second, and third inversions. The full stacks 753, 653, 643 and 642 name the same four chords.
      • Stacked figures may be written run together (64) or separated by a slash, a comma or a space (6/4), which is the same figure either way.
      • An accidental in front of a figure names that interval's note, exactly as the same sign does on the staff: #6, b7, #43, and n3 for a note the signature would otherwise flatten. ## and bb name the double accidentals. An accidental with no figure applies to the third above the bass, so a lone n over the dominant of C minor names its leading tone. The Unicode accidentals are accepted alongside the typed ones.
      • A slashed or crossed figure raises the interval the key gives by a semitone, whatever accidental that lands on, and is typed +. It is the one sign here that moves an interval rather than naming it, which is why the notation carries it beside the printed accidentals: +3 over the dominant of C minor and +3 over the dominant of A minor are each that key's leading tone, written n3 and #3 respectively.
      • A figure that moves is written with a hyphen: 4-3, 9-8, 7-6, and any other pair. Each side may carry its own accidental, as 4-#3 does in a minor key. Moving figures may stand beside static ones (5 4-3).

      Every interval no accidental touches is the one the key's scale gives, which is why the key is required and why the same figure names different qualities over different degrees.

      A moving figure resolves into the chord: 4-3 over a G in C major returns the G major triad, and the suspended C is reported as a suspension rather than as a chord tone. A suspension is a melodic event over a single harmony — the sounding chord does not change when it resolves — so naming the resolution is the reading that answers "which chord is this", and the record of what was suspended is kept beside it rather than thrown away.

      Parameters

      • bass: NoteLike

        The bass note, spelled: a note name, a MIDI number, note data, or a Note; its octave, if any, is not used.

      • figures: string

        The figures written under the bass; empty for an unfigured note.

      • key: KeyLike

        The prevailing key, which supplies every unaltered interval, as a key name, a key/scale, or a Key.

      Returns FiguredBassRealization

      The chord, its spelled notes, and any suspensions.

      If the figures are malformed or name no chord (InvalidInputError), if the key is not heptatonic (InvalidInputError), or if the figures sound a chord no ChordQuality names, such as an augmented sixth (NoSolutionError).

      import { figuredBassRealization, majorKey, noteNames, parseNote } from '@libraz/libcantus';
      const realized = figuredBassRealization(parseNote('G'), '4-3', majorKey(0));
      noteNames(realized.notes); // ['G', 'B', 'D']
      realized.suspensions[0]?.from; // 4 — the suspended C above the bass