scamp.score.NoteLike¶
-
class
scamp.score.
NoteLike
(pitch: Optional[Union[expenvelope.envelope.Envelope, float, Tuple]], written_length: float, properties: scamp.note_properties.NoteProperties)[source]¶ Bases:
scamp.score.ScoreComponent
Represents a note, chord, or rest that can be notated without ties
- Parameters
pitch – float if single pitch, Envelope if a glissando, tuple if a chord, None if a rest
written_length – the notated length of the note, disregarding any tuplets it is part of
properties – a properties dictionary, same as found in a PerformanceNote
- Variables
pitch – float if single pitch, Envelope if a glissando, tuple if a chord, None if a rest
written_length – the notated length of the note, disregarding any tuplets it is part of
properties – a properties dictionary, same as found in a PerformanceNote
Methods
Averages the pitch of this note, accounting for if it’s a glissando or a chord
Returns whether or not this does a glissando.
is_chord
()Returns whether or not this is a chord.
is_rest
()Returns whether or not this is a rest.
merge_with
(other)Merges other into this note, adding its length and combining its articulations
ID representing the original PerformanceNote that this came from.
to_music_xml
([source_id_dict])Convert this score component to its corresponding pymusicxml component
Inherited 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.
export_pdf
(file_path)Exports score as a PDF file and saves it to the given file_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
Convert and wrap as a abjad.LilyPondFile object
to_lilypond
([wrap_as_file])Convert to LilyPond code.
-
average_pitch
() → float[source]¶ Averages the pitch of this note, accounting for if it’s a glissando or a chord
- Returns
the averaged pitch as a float
-
merge_with
(other: scamp.score.NoteLike) → scamp.score.NoteLike[source]¶ Merges other into this note, adding its length and combining its articulations
- Parameters
other – another NoteLike
- Returns
self, having been merged with other
-
to_music_xml
(source_id_dict=None) → Sequence[pymusicxml.score_components._XMLNote][source]¶ Convert this score component to its corresponding pymusicxml component
-
source_id
() → Optional[int][source]¶ ID representing the original PerformanceNote that this came from. Since PerformanceNotes are split up into tied segments, we need to keep track of which ones belonged together so that we can rejoin them with ties, glissandi, etc. (This is done via _join_same_source_abjad_note_group or _join_same_source_xml_note_group)
-
export_lilypond
(file_path) → None¶ Convert and wrap as a LilyPond (.ly) file, and save to the given path.
- Parameters
file_path – file path to save to
-
export_music_xml
(file_path: str, pretty_print: bool = True) → None¶ 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.
-
export_pdf
(file_path) → None¶ Exports score as a PDF file and saves it to the given file_path
- Parameters
file_path – where to save the PDF
-
print_lilypond
(wrap_as_file=False) → None¶ 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.
-
print_music_xml
(pretty_print: bool = True) → None¶ 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
() → None¶ Using the abjad.show command, generates and opens a PDF of the music represented by this component
-
show_xml
() → None¶ 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.score.Component¶ Convert this score component to its corresponding abjad component
-
to_abjad_lilypond_file
() → abjad.lilypondfile.LilyPondFile¶ Convert and wrap as a abjad.LilyPondFile object
-
to_lilypond
(wrap_as_file=False) → str¶ 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