You're reading the documentation for a development version. For the latest released version, please have a look at 0.10.1.


librosa.key_to_notes(key, *, unicode=True)[source]

List all 12 note names in the chromatic scale, as spelled according to a given key (major or minor) or mode (see below for details and accepted abbreviations).

This function exists to resolve enharmonic equivalences between different spellings for the same pitch (e.g. C♯ vs D♭), and is primarily useful when producing human-readable outputs (e.g. plotting) for pitch content.

Note names are decided by the following rules:

  1. If the tonic of the key has an accidental (sharp or flat), that accidental will be used consistently for all notes.

  2. If the tonic does not have an accidental, accidentals will be inferred to minimize the total number used for diatonic scale degrees.

  3. If there is a tie (e.g., in the case of C:maj vs A:min), sharps will be preferred.


Must be in the form TONIC:key. Tonic must be upper case (CDEFGAB), key must be lower-case (major, minor, ionian, dorian, phrygian, lydian, mixolydian, aeolian, locrian).

The following abbreviations are supported for the modes: either the first three letters of the mode name (e.g. “mix”) or the mode name without “ian” (e.g. “mixolyd”).

Both major and maj are supported as mode abbreviations.

Single and multiple accidentals (b!♭ for flat, or #♯ for sharp) are supported.

Examples: C:maj, C:major, Dbb:min, A♭:min, D:aeo, E𝄪:phryg.


If True (default), use Unicode symbols (♯𝄪♭𝄫)for accidentals.

If False, Unicode symbols will be mapped to low-order ASCII representations:

♯ -> #, 𝄪 -> ##, ♭ -> b, 𝄫 -> bb

notes[k] is the name for semitone k (starting from C) under the given key. All chromatic notes (0 through 11) are included.

See also



C:maj will use all sharps

>>> librosa.key_to_notes('C:maj')
['C', 'C♯', 'D', 'D♯', 'E', 'F', 'F♯', 'G', 'G♯', 'A', 'A♯', 'B']

A:min has the same notes

>>> librosa.key_to_notes('A:min')
['C', 'C♯', 'D', 'D♯', 'E', 'F', 'F♯', 'G', 'G♯', 'A', 'A♯', 'B']

A♯:min will use sharps, but spell note 0 (C) as B♯

>>> librosa.key_to_notes('A#:min')
['B♯', 'C♯', 'D', 'D♯', 'E', 'E♯', 'F♯', 'G', 'G♯', 'A', 'A♯', 'B']

G♯:maj will use a double-sharp to spell note 7 (G) as F𝄪:

>>> librosa.key_to_notes('G#:maj')
['B♯', 'C♯', 'D', 'D♯', 'E', 'E♯', 'F♯', 'F𝄪', 'G♯', 'A', 'A♯', 'B']

F♭:min will use double-flats

>>> librosa.key_to_notes('Fb:min')
['D𝄫', 'D♭', 'E𝄫', 'E♭', 'F♭', 'F', 'G♭', 'A𝄫', 'A♭', 'B𝄫', 'B♭', 'C♭']

G:loc uses flats

>>> librosa.key_to_notes('G:loc')
['C', 'D♭', 'D', 'E♭', 'E', 'F', 'G♭', 'G', 'A♭', 'A', 'B♭', 'B']