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

    Function formatKeyName

    • Render a spelled tonic and a mode as a key name.

      The inverse of parseKeyName. German is written the way it is read, with the mode in the case of the tonic as well as in the word.

      Parameters

      • key: KeyName

        The spelled tonic and mode; any octave on the tonic is dropped, since a key has no register.

      • Optionalopts: NoteNameOptions

        system writes the name in that notation system instead of English.

      Returns string

      The key name.

      If the tonic or the mode is not valid.

      import { formatKeyName, parseNote } from '@libraz/libcantus';
      formatKeyName({ tonic: parseNote('G#'), mode: 'minor' }); // 'G# minor'
      formatKeyName({ tonic: parseNote('G#'), mode: 'minor' }, { system: 'german' }); // 'gis moll'