pymusicxml.score_components.MusicXMLComponent
- class pymusicxml.score_components.MusicXMLComponent[source]
Bases:
ABCAbstract base class of all musical objects, providing functionality for rendering and exporting to a file.
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.
Wraps this component in a
Scoreso that it can be exported and viewed- abstract render() Sequence[Element][source]
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.)
- abstract wrap_as_score() Score[source]
Wraps this component in a
Scoreso that it can be exported and viewed
- to_xml(pretty_print: bool = False) str[source]
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