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

    Function keyRelationBetween

    • How the second key stands to the first, or null when they are not related.

      The relations are tested in a fixed order — identity, enharmonic spelling, then the six closely related keys in the order relatedKeysOf lists them — and the first match is reported. Only the identity test looks at the tonic spelling; every other test compares root pitch class and mode, so C# minor and Db minor both read as the relative of E major.

      Both keys are read through the mode their third names, exactly as relatedKeysOf reads the key it is given, so A harmonic minor stands to C major as A minor does whichever of the two is asked about. That is what makes the answer symmetric: if one key's related keys name the other, the relation between them is reported from either side.

      Parameters

      Returns KeyRelation | null

      The relation, or null when b is none of a's related keys.

      If either key is malformed, or if a neighbouring signature of a falls outside [-12, 12] fifths.

      import { keyRelationBetween, majorKey, minorKey, spelledKeyOf } from '@libraz/libcantus';
      const cMajor = spelledKeyOf(majorKey(0));
      keyRelationBetween(cMajor, spelledKeyOf(minorKey(9))); // 'relative'
      keyRelationBetween(cMajor, spelledKeyOf(minorKey(3))); // null