musicscore.clef

class musicscore.clef.Clef(sign: str = 'G', line: int | None = 2, octave_change: int = None, show: bool = True, default: bool = False, *args, **kwargs)[source]

Bases: XMLWrapper

XMLClass

alias of XMLClef

to_string(*args, **kwargs) str

XMLWrapper method

Calls to_string method of self.xml_object

Returns:

musicxml snippet

property line: int | None

Set and get value_ of XMLLine

Returns:

self.xml_object.xml_line.value_

Return type:

int, None

property octave_change: int | None

Set and get value_ (int) of XMLOctaveChange child object of associated XMLClef which indicates how many octaves must be added to get from written pitch to the sounding pitch.

Returns:

self.xml_object.xml_clef_octave_change.value_

property show: bool

Set and get show attribute. If False Clef element is not shown.

property sign: str | None

Set and get value_ of XMLSign child object of associated XMLClef

Returns:

self.xml_object.xml_sign.value_

Return type:

str, None

property xml_object: XMLElement

XMLWrapper method

This musicscore class has an equivalent MusicXML class which can be reached via this property.

If an attribute is not found directly in the main class, it wll be passed on to __get_attribute__ or __set__attribute__ methods of self.xml_object. It can also use the short cut attributes of XMLElement to get or set the first child.

Returns:

wrapped MusicXML element of type XMLClass

class musicscore.clef.TrebleClef(show: bool = True, octave_change: int | None = None, **kwargs)[source]

Bases: Clef

Default parameters:
  • sign=’G’

  • line=2

class musicscore.clef.AltoClef(show: bool = True, octave_change: int | None = None, **kwargs)[source]

Bases: Clef

Default parameters:
  • sign=’C’

  • line=3

class musicscore.clef.TenorClef(show: bool = True, octave_change: int | None = None, **kwargs)[source]

Bases: Clef

Default parameters:
  • sign=’C’

  • line=4

class musicscore.clef.BassClef(show: bool = True, octave_change: int | None = None, **kwargs)[source]

Bases: Clef

Default parameters:
  • sign=’F’

  • line=4