Skip to content

Commit

Permalink
Export ornaments in MusicXML export
Browse files Browse the repository at this point in the history
  • Loading branch information
leleogere committed Feb 27, 2025
1 parent 5c5b85b commit c595d94
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions partitura/io/exportmusicxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@
"tenuto",
"unstress",
]
ORNAMENTS = [
"trill-mark",
"turn",
"delayed-turn",
"inverted-turn",
"delayed-inverted-turn",
"vertical-turn",
"inverted-vertical-turn",
"shake",
"wavy-line",
"mordent",
"inverted-mordent",
"schleifer",
"tremolo",
"haydn",
"other-ornament",
]


def range_number_from_counter(e, label, counter):
Expand Down Expand Up @@ -154,6 +171,16 @@ def make_note_el(note, dur, voice, counter, n_of_staves):
articulations_e.extend(articulations)
notations.append(articulations_e)

if note.ornaments:
ornaments = []
for ornament in note.ornaments:
if ornament in ORNAMENTS:
ornaments.append(etree.Element(ornament))
if ornaments:
ornaments_e = etree.Element("ornaments")
ornaments_e.extend(ornaments)
notations.append(ornaments_e)

if note.technical:
technical = []
for technical_notation in note.technical:
Expand Down

0 comments on commit c595d94

Please sign in to comment.