pymusicxml.score_components.GraceChord

class pymusicxml.score_components.GraceChord(pitches: Sequence[Union[pymusicxml.score_components.Pitch, str]], duration: Union[pymusicxml.score_components.Duration, str, float], ties: Union[str, Sequence[Optional[str]]] = None, notations=(), articulations=(), noteheads=None, directions=(), stemless: bool = False, slashed=False)[source]

Bases: pymusicxml.score_components.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.

min_denominator()

Minimum divisor of a quarter note that would be needed to represent the duration of this note accurately.

num_beams()

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.

wrap_as_score()

Wraps this component in a Score so that it can be exported and viewed

Attributes

articulations

Articulations attached to this chord.

beams

Dictionary describing the notation of all the beams for this Chord.

directions

Directions attached to this chord.

divisions

Subdivision used when representing this duration.

duration

The Duration of this chord.

length_in_divisions

Length in terms of subdivisions.

notations

Notations attached to this chord.

pitches

Tuple of the pitches of the notes in this chord.

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.

true_length

True length in terms of the number of quarter notes, taking into tuplet time modification.

tuplet_bracket

Whether or not this chord starts or stops a tuplet bracket.

voice

Which voice this chord resides in.

written_length

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.

property duration

The Duration of this chord.

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.score_components.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.