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

    Function dominantKeyOf

    • The dominant key: the key a fifth above, in the mode this key's third names.

      The fifth is measured from the tonic, so a key that is not a plain major or minor answers with the same move: the dominant of G mixolydian is D major and the dominant of D dorian is A minor.

      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; its mask decides the mode of the result.

      Returns ResolvedKey

      The key a fifth above, in the mode this key's third names.

      If the tonic or the mask is malformed, or if the resulting signature falls outside [-12, 12] fifths — the dominant of a key already at +12.

      import { dominantKeyOf, formatNote, majorKey, parseNote } from '@libraz/libcantus';
      formatNote(dominantKeyOf(parseNote('C'), majorKey(0)).tonic); // 'G'