StaffClef

StaffClef(sign: ClefSign, line: int | None = None, octave_change: int = 0)

A WSMN clef: sign on staff line line (1 is the bottom line, MusicXML’s numbering), sounding octave_change octaves from where it is written (MusicXML’s clef-octave-change; -1 for the vocal tenor clef, the treble clef with an 8 below). The ready-made clefs are in symbols (treble_clef, bass_clef, alto_clef, treble_clef_8vb, percussion_clef, …).

Examples

>>> StaffClef(ClefSign.G, 2)
StaffClef(ClefSign.G, 2)
>>> StaffClef(ClefSign.G, 2, octave_change=-1).reference_tone
TonalVector((4, 7, -1))
>>> StaffClef(ClefSign.PERCUSSION).reference_tone is None
True
>>> StaffClef(ClefSign.F)
Traceback (most recent call last):
...
ValueError: An F clef sits on a staff line 1 to 5; got None.
>>> StaffClef(ClefSign.TAB, 3)
Traceback (most recent call last):
...
ValueError: A TAB clef sits on no particular line; got 3.

Attributes

Name Description
__slots__
sign
line
octave_change
reference_tone The tone the sign names on its line, shifted by the octave change;

Methods

Name Description
__repr__

__repr__

__repr__()