pymusicxml.music_xml_objects.GraceChord¶
-
class
pymusicxml.music_xml_objects.
GraceChord
(pitches: Sequence[Union[pymusicxml.music_xml_objects.Pitch, str]], duration: Union[pymusicxml.music_xml_objects.Duration, str, float], ties: Union[str, Sequence[Optional[str]]] = None, notations=(), articulations=(), noteheads=None, directions=(), stemless: bool = False, slashed=False)[source]¶ Bases:
pymusicxml.music_xml_objects.Chord
Subclass of
Chord
representing a durationless grace chord.- Parameters
pitches – see
Chord
duration – see
Chord
. This will be the displayed duration of the chord, even though it takes up no metric space in the bar.ties – see
Chord
notations – see
Chord
articulations – see
Chord
notations – see
Chord
articulations – see
Chord
noteheads – see
Chord
directions – see
Chord
stemless – see
Chord
slashed – whether or not this grace chord is rendered with a slash.
Inherited Methods
export_to_file
(file_path[, pretty_print])Exports this musical object (wrapped as a score) to the given file path.
Minimum divisor of a quarter note that would be needed to represent the duration of this note accurately.
Returns the number of beams needed to represent this duration.
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
Score
so that it can be exported and viewedAttributes
Articulations attached to this chord.
Dictionary describing the notation of all the beams for this Chord.
Directions attached to this chord.
Subdivision used when representing this duration.
The
Duration
of this chord.Length in terms of subdivisions.
Notations attached to this chord.
Tuple of the pitches of the notes in this chord.
Either a string representing the tie state of all the notes, if all notes have the same tie state, or a tuple representing the tie state of each note individually.
True length in terms of the number of quarter notes, taking into tuplet time modification.
Whether or not this chord starts or stops a tuplet bracket.
Which voice this chord resides in.
Written length in terms of the number of quarter notes.
-
property
articulations
¶ Articulations attached to this chord.
-
property
beams
¶ Dictionary describing the notation of all the beams for this Chord.
-
property
directions
¶ Directions attached to this chord.
-
property
divisions
¶ Subdivision used when representing this duration.
-
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
-
property
length_in_divisions
¶ Length in terms of subdivisions. (See description of “divisions” attribute in
Duration
)
-
min_denominator
() → int¶ Minimum divisor of a quarter note that would be needed to represent the duration of this note accurately. For instance, a triplet quarter note would have min_denominator 3, since it is 2/3 of a quarter.
-
property
notations
¶ Notations attached to this chord.
-
num_beams
() → int¶ Returns the number of beams needed to represent this duration.
-
property
pitches
¶ Tuple of the pitches of the notes in this chord.
-
render
() → Sequence[xml.etree.ElementTree.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.)
-
property
ties
¶ Either a string representing the tie state of all the notes, if all notes have the same tie state, or a tuple representing the tie state of each note individually.
-
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
-
property
true_length
¶ True length in terms of the number of quarter notes, taking into tuplet time modification. Returns 0 in the case of grace notes.
-
property
tuplet_bracket
¶ Whether or not this chord starts or stops a tuplet bracket.
-
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.
-
property
voice
¶ Which voice this chord resides in.
-
wrap_as_score
() → pymusicxml.music_xml_objects.Score¶ Wraps this component in a
Score
so that it can be exported and viewed
-
property
written_length
¶ Written length in terms of the number of quarter notes.