librosa.display.ChromaFifthsFormatter#

class librosa.display.ChromaFifthsFormatter(key='C:maj', unicode=True, fifths_base='C')[source]#

A formatter for chroma axes ordered by the circle of fifths.

Maps display coordinates 0..11 to pitch classes in ascending circle-of-fifths order starting from fifths_base (default 'C').

Parameters:
keystr

The key in which to display pitch class labels. See core.midi_to_note for supported values.

unicodebool

If True, use unicode symbols for accidentals.

If False, use ASCII symbols for accidentals.

fifths_basestr or int

The starting pitch class at coordinate 0, specified either as a pitch class string (e.g., 'C', 'F', 'Eb', 'F♯') or an integer chromatic note number (reduced modulo 12, where 0 is C). Default is 'C'.

Attributes:
fifths_baseint

Normalized starting chromatic pitch class in [0, 11] (where 0 is C).

order_np.ndarray [shape=(12,), dtype=int]

Chromatic pitch-class indices ordered by ascending fifths starting from fifths_base.

Examples

Format positions in ascending circle-of-fifths order starting from 'C'

>>> fmt = librosa.display.ChromaFifthsFormatter()
>>> [fmt(i) for i in range(12)]
['C', 'G', 'D', 'A', 'E', 'B', 'F♯', 'C♯', 'G♯', 'D♯', 'A♯', 'F']

Start from 'F' and spell enharmonic accidentals in 'F:maj'

>>> fmt = librosa.display.ChromaFifthsFormatter(key="F:maj", fifths_base="F")
>>> [fmt(i) for i in range(12)]
['F', 'C', 'G', 'D', 'A', 'E', 'B', 'G♭', 'D♭', 'A♭', 'E♭', 'B♭']
__init__(key='C:maj', unicode=True, fifths_base='C')[source]#

Attributes

axis = None#
fifths_base#
order_#
key#
unicode#