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

    Function spellChord

    • Spell a chord's tones, in the chord's own (tertian) order, relative to a key.

      Diatonic chords spell exactly (e.g. G7 in C major -> G B D F). Chromatic chord tones take their conventional spelling; enharmonically ambiguous altered tensions may be spelled by the general convention rather than by chord function.

      A chord carrying its own tone spellings is spelled by them, since a chord whose letters do not follow from stacking thirds can say so no other way: that is what keeps the German sixth of C major on its F#, the note that resolves outward to the dominant, rather than the Gb a dominant seventh would put there.

      Parameters

      • chord: ChordData

        The chord.

      • tonic: NoteLike

        The spelled tonic of the key, as a note name, a MIDI number, note data, or a Note.

      • key: KeyLike

        The key/scale, as a key name, a key/scale, or a Key.

      Returns NoteData[]

      Spelled chord tones, root first.

      If tonic does not sound the key's root pitch class.

      import { spellChord, noteNames, parseNote, majorKey, makeChord } from '@libraz/libcantus';
      // G7 in C major
      noteNames(spellChord(makeChord(7, 'dom7'), parseNote('C'), majorKey(0)));
      // ['G', 'B', 'D', 'F']