neoscore.western.clef_type

neoscore.western.clef_type.KeySignatureLayout

A layout specification for accidentals in key signatures.

Instances should have a key for every pitch letter a-g (lowercase), and each value should be an (x, y) tuple of pseudo staff positions to be plugged into a staff’s unit.

alias of Dict[str, Tuple[float, float]]

neoscore.western.clef_type.StaffPosFunc

A function which takes a number of staff lines and returns a staff position.

alias of Callable[[int], float]

class neoscore.western.clef_type.ClefType[source]

Bases: object

A logical clef specifier.

Many standard clefs are pre-defined in this module, but users can also create custom clef types using this class.

glyph_name: str

The SMuFL glyph name used to represent the clef.

staff_pos: Union[float, StaffPosFunc]

Where the clef should be vertically drawn in a staff.

This is given in pseudo staff units relative to the staff’s top line. When positioning clefs, this should be passed into the staff’s unit to find the appropriate y position.

For clefs whose position depends on the number of staff lines, this can be a StaffPosFunc.

middle_c_staff_pos: Union[float, StaffPosFunc]

Where this clef places middle C in a staff.

Like staff_pos, this is given in pseudo staff units relative to the staff’s top line.

For clefs whose middle C position depends on the number of staff lines, this can be a StaffPosFunc.

key_signature_flat_layout: Optional[KeySignatureLayout]

Set of positions for flat key sigantures, if applicable.

key_signature_sharp_layout: Optional[KeySignatureLayout]

Set of positions for sharp key sigantures, if applicable.

classmethod from_def(clef_type_def: ClefTypeDef) ClefType[source]
__init__(glyph_name: str, staff_pos: Union[float, StaffPosFunc], middle_c_staff_pos: Union[float, StaffPosFunc], key_signature_flat_layout: Optional[KeySignatureLayout], key_signature_sharp_layout: Optional[KeySignatureLayout]) None
neoscore.western.clef_type.TREBLE

A conventional treble clef.

neoscore.western.clef_type.TREBLE_8VB

A treble clef one octave below, like often used in tenor vocal parts.

neoscore.western.clef_type.BASS

A conventional bass clef.

neoscore.western.clef_type.BASS_8VB

A bass clef one octave below, like often used in double bass parts.

neoscore.western.clef_type.TENOR

A tenor C-clef.

neoscore.western.clef_type.ALTO

An alto C-clef.

neoscore.western.clef_type.PERCUSSION_1

A percussion clef consisting of 2 solid bars.

Percussion clefs are treated as C clefs always centered at the middle of the staff. This works with any number of staff lines.

neoscore.western.clef_type.PERCUSSION_2

A percussion clef consisting of an open rectangle.

See also PERCUSSION_1

neoscore.western.clef_type.ClefTypeDef

ClefTypes can be given by the string name of any pre-defined ClefType in this module.

String lookup is case-insensitive.

alias of Union[ClefType, str]