pymusicxml.spanners.StartOctaveLine

class pymusicxml.spanners.StartOctaveLine(label: Any = 1, octaves: int = 1, dash_length: Real = None, space_length: Real = None, placement: str | StaffPlacement = 'above', voice: int = 1, staff: int = None)[source]

Bases: Direction, StartNumberedSpanner

Start of an octave-shift line, i.e. an “8va”/”8vb”/”15ma” bracket with a dashed line and terminal hook.

Parameters:
  • label – See NumberedSpanner.

  • octaves – how many octaves, and in which direction, the notes are displaced. Positive means the notes sound higher than written (8va, drawn above): 1 = 8va, 2 = 15ma, 3 = 22ma. Negative means the notes sound lower than written (8vb, drawn below). (Note that the resulting musicxml looks backwards because it describes the modification of the written notes relative to how they would be written with no ottava.)

  • dash_length – Length of the dashes (in tenths). (Note: some renderers, e.g. verovio, ignore this.)

  • space_length – Length of the space between dashes (in tenths).

  • placement – Where to place the direction in relation to the staff (“above” or “below”)

  • voice – Which voice to attach to

  • staff – Which staff to attach to if the part has multiple staves

Methods

render_direction_type()

Renders the <direction-type> element that constitutes the main substance of a <direction> element.

Inherited Methods

export_to_file(file_path[, pretty_print])

Exports this musical object (wrapped as a score) to the given file path.

render()

Renders this component to a tuple of ElementTree.Element.

to_xml([pretty_print])

Renders this component to MusicXML, adding a version tag, but not wrapping it up as a full score.

view_in_software(command)

Uses the given terminal command to create a score out of this musical object, and open it in music notation software.

wrap_as_score()

Wraps this component in a Score so that it can be exported and viewed

Attributes

MID_TYPES

size

STOP_TYPE

alias of StopOctaveLine

property size: int
render_direction_type() → Sequence[Element][source]

Renders the <direction-type> element that constitutes the main substance of a <direction> element.

MID_TYPES: Sequence[MidNumberedSpanner] = ()
export_to_file(file_path: str, pretty_print: bool = True) → None

Exports this musical object (wrapped as a score) to the given file path.

Parameters:
  • file_path – The path of the file we want to write to.

  • pretty_print – If True, breaks the MusicXML onto multiple lines, with indentation

render() → Sequence[Element]

Renders this component to a tuple of ElementTree.Element. (The reason for making it a tuple is that musical objects like chords are represented by several notes side by side, with all but the first containing a </chord> tag.)

to_xml(pretty_print: bool = False) → str

Renders this component to MusicXML, adding a version tag, but not wrapping it up as a full score.

Parameters:

pretty_print – If True, breaks the MusicXML onto multiple lines, with indentation

view_in_software(command: str) → None

Uses the given terminal command to create a score out of this musical object, and open it in music notation software.

Parameters:

command – The terminal command corresponding to the software with which we want to open the score.

wrap_as_score() → Score

Wraps this component in a Score so that it can be exported and viewed