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

    Function spellVoicing

    • Spell a voicing given as MIDI pitches, so it can be checked by checkPartWriting.

      Each pitch is named against the chord sounding under it and then the key, so a chord tone takes the letter the degree it plays in that chord implies: the third of a D major chord in C major spells F#, not Gb. The chord is passed whole rather than by its root, so a chord carrying its own spelling names its tones here exactly as spellChord names them — the German sixth keeps the F# that resolves outward to the dominant. The octave is kept, since the rules measure real distances.

      Parameters

      • voicing: readonly number[]

        MIDI pitches in voice order (index 0 = bass).

      • chord: ChordData

        The chord sounding, supplying the enharmonic evidence.

      • key: SpelledKeyLike

        The key the exercise is written in.

      Returns SpelledVoicing

      One spelled note per pitch, in the same order.

      import { majorKey, makeChord, noteNames, spellVoicing } from '@libraz/libcantus';
      noteNames(spellVoicing([50, 57, 66, 69], makeChord(2, 'maj'), majorKey(0)));
      // ['D3', 'A3', 'F#4', 'A4'] — the third of D spells F# in C major