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

    Function relatedKeysOf

    • The six closely related keys of a key, each tagged with its relation.

      These are the keys the German and Japanese teaching tradition counts as a key's near relations: the relative and parallel keys, the dominant and the subdominant, and the relatives of those two. For C major they are A minor, C minor, G major, F major, E minor and D minor, in that order. For a plain major or minor key five of them are written within one accidental of the key's own signature — the relative shares it exactly and the other four stand one away; the parallel key does not — C minor is three flats away from C major — and belongs to the set for the tonic it shares rather than for the signature it carries.

      A key that is not a plain major or minor is read through the mode its third names, so its relations are walked from where its tonic stands on the circle rather than from its own signature, and the accidental counts above do not describe them: the relative of D dorian is F major, one flat against dorian's none.

      Parameters

      • tonic: NoteLike

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

      • key: KeyLike

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

      Returns (ResolvedKey & { relation: KeyRelation })[]

      The six related keys, in relation order, each with its tonic spelling and its relation tag.

      If the tonic or the mask is malformed, or if a neighbouring signature falls outside [-12, 12] fifths.

      import { majorKey, parseNote, relatedKeysOf } from '@libraz/libcantus';
      relatedKeysOf(parseNote('C'), majorKey(0)).map((related) => related.relation);
      // ['relative', 'parallel', 'dominant', 'subdominant', 'relativeOfDominant', 'relativeOfSubdominant']