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

    Function diatonicTriad

    • Build the diatonic triad rooted on a scale degree by stacking scale thirds.

      Unlike chordFromDegree, the chord quality is derived from the scale rather than supplied, so degrees yield their scale-correct triads (e.g. a diminished triad on the leading tone of a major key).

      Parameters

      • degree: number

        1-based scale degree of the chord root: 1 is the tonic.

      • key: KeyLike

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

      Returns ChordData

      The diatonic triad.

      If the scale is not heptatonic. Stacking thirds means skipping every other degree, which only lands on a triad when there are seven of them, so the pentatonic, blues, whole-tone, octatonic and chromatic scales have no diatonic triad; use chordFromDegree with an explicit quality there.

      import { majorKey, diatonicTriad } from '@libraz/libcantus';
      const tonic = diatonicTriad(1, majorKey(0)); // C major triad (degree 1 of C major)