scamp.score.ScoreComponent
- class scamp.score.ScoreComponent[source]
Bases:
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[, non_score_blocks])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.
export_pdf
(file_path[, non_score_blocks])Exports score as a PDF file and saves it to the given file_path
print_lilypond
([wrap_as_file, non_score_blocks])Convert and print LilyPond code, via the abjad library.
print_music_xml
([pretty_print])Convert and wrap as a MusicXML score, and print the resulting XML.
show
([non_score_blocks])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
([wrap_as_file, non_score_blocks])Convert this score component to its corresponding abjad component
to_lilypond
([wrap_as_file, non_score_blocks])Convert to LilyPond code, via the abjad library.
Convert this score component to its corresponding pymusicxml component
- abstract to_music_xml() 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(wrap_as_file: bool = False, non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) Component [source]
Convert this score component to its corresponding abjad component
- Parameters:
wrap_as_file – if True, wraps this as an
abjad.LilypondFile
non_score_blocks – (Only applicable if wrap_as_file is set to True). A list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad). Typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.
- export_lilypond(file_path: str, non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) None [source]
Convert and wrap as a LilyPond (.ly) file, and save to the given path.
- Parameters:
file_path – file path to save to
non_score_blocks – a list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad); typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.
- export_pdf(file_path: str, non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) None [source]
Exports score as a PDF file and saves it to the given file_path
- Parameters:
file_path – where to save the PDF
non_score_blocks – a list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad); typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.
- to_lilypond(wrap_as_file: bool = False, non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) str [source]
Convert to LilyPond code, via the abjad library.
- Parameters:
wrap_as_file – if True, wraps this as an
abjad.LilypondFile
non_score_blocks – (Only applicable if wrap_as_file is set to True). A list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad). Typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.
- Returns:
a string containing the LilyPond code
- print_lilypond(wrap_as_file: bool = False, non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) None [source]
Convert and print LilyPond code, via the abjad library.
- Parameters:
wrap_as_file – if True, wraps this as an
abjad.LilypondFile
non_score_blocks – (Only applicable if wrap_as_file is set to True). A list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad). Typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.
- show(non_score_blocks: Optional[Sequence] = None, **lilypond_file_args) None [source]
Using the abjad.show command, generates and opens a PDF of the music represented by this component
- Parameters:
non_score_blocks – a list of
abjad.Block
objects (or strings containing the LilyPond code for such a block, which are then parsed by abjad); typical blocks might be a header block, a layout block, or a paper block. If no header block is specified, one will be created with the score’s title and composer. If a header is specified, title and composer will be added if not present.lilypond_file_args – any additional keyword arguments will be passed along to the constructor of
abjad.LilyPondFile
(assuming wrap_as_file is True). This allows for setting staff size and various other customizations.