scamp.score.ScoreComponent

class scamp.score.ScoreComponent[source]

Bases: abc.ABC

Abstract class from which all of the user-facing classes in this module inherit. Provides a consistent interface for wrapping any object up as a Score and converting to LilyPond and MusicXML output.

Methods

export_lilypond(file_path)

Convert and wrap as a LilyPond (.ly) file, and save to the given path.

export_music_xml(file_path[, pretty_print])

Convert and wrap as a MusicXML score, and save to the given path.

print_lilypond([wrap_as_file])

Convert and print LilyPond code.

print_music_xml([pretty_print])

Convert and wrap as a MusicXML score, and print the resulting XML.

show()

Using the abjad.show command, generates and opens a PDF of the music represented by this component

show_xml()

Convert and wrap as a MusicXML score, and open it up in notation software.

to_abjad()

Convert this score component to its corresponding abjad component

to_abjad_lilypond_file()

Convert and wrap as a abjad.LilyPondFile object

to_lilypond([wrap_as_file])

Convert to LilyPond code.

to_music_xml()

Convert this score component to its corresponding pymusicxml component

abstract to_music_xml()pymusicxml.music_xml_objects.MusicXMLComponent[source]

Convert this score component to its corresponding pymusicxml component

export_music_xml(file_path: str, pretty_print: bool = True) → None[source]

Convert and wrap as a MusicXML score, and save to the given path.

Parameters
  • file_path – file path to save to

  • pretty_print – whether or not to take the extra space and format the file with indentations, etc.

print_music_xml(pretty_print: bool = True) → None[source]

Convert and wrap as a MusicXML score, and print the resulting XML.

Parameters

pretty_print – whether or not to take the extra space and format the file with indentations, etc.

show_xml() → None[source]

Convert and wrap as a MusicXML score, and open it up in notation software. (The software to use is defined in engraving_settings.show_music_xml_command_line.)

to_abjad() → abjad.core.Component.Component[source]

Convert this score component to its corresponding abjad component

to_abjad_lilypond_file() → abjad.lilypondfile.LilyPondFile.LilyPondFile[source]

Convert and wrap as a abjad.LilyPondFile object

export_lilypond(file_path) → None[source]

Convert and wrap as a LilyPond (.ly) file, and save to the given path.

Parameters

file_path – file path to save to

to_lilypond(wrap_as_file=False) → str[source]

Convert to LilyPond code.

Parameters

wrap_as_file – if True, wraps this object up as a full LilyPond file, ready for compilation. If False, we just get the code for the component itself.

Returns

a string containing the LilyPond code

print_lilypond(wrap_as_file=False) → None[source]

Convert and print LilyPond code.

Parameters

wrap_as_file – if True, wraps this object up as a full LilyPond file, ready for compilation. If False, we just get the code for the component itself.

show() → None[source]

Using the abjad.show command, generates and opens a PDF of the music represented by this component