From 763eb543a5a5ba769379e65291a4ab0c6d9db2e8 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Tue, 30 Oct 2007 17:58:16 +0100 Subject: [PATCH] MusicXML: Don't crash when a note has multiple <notations> children --- .../02h-MultipleNotationChildren-RFK.xml | 101 ++++++++++++++++++ scripts/musicxml2ly.py | 4 +- 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml diff --git a/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml b/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml new file mode 100644 index 0000000000..ae2a60cf67 --- /dev/null +++ b/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN" + "http://www.musicxml.org/dtds/partwise.dtd"> +<score-partwise> + <movement-title>Multiple notation and articulation children</movement-title> + <identification> + <rights>Public Domain</rights> + <encoding> + <software>Hand-crafted MusicXML</software> + </encoding> + <miscellaneous> + <miscellaneous-field name="comment"> + It should not make any difference whether two articulations are given + inside to different notation elements, inside two different articulations + children of the same notation element or inside the same articulations + element. Thus, all three notes should have a staccato and an accent. + </miscellaneous-field> + </miscellaneous> + </identification> + <part-list> + <score-part id="P1"> + <part-name>MusicXML Part</part-name> + </score-part> + </part-list> + <!--=========================================================--> + <part id="P1"> + <measure number="1"> + <attributes> + <divisions>4</divisions> + <clef> + <sign>G</sign> + <line>2</line> + </clef> + <key> + <fifths>0</fifths> + </key> + <time> + <beats>3</beats> + <beat-type>4</beat-type> + </time> + </attributes> + <note> + <pitch> + <step>A</step> + <octave>4</octave> + </pitch> + <duration>4</duration> + <voice>1</voice> + <type>quarter</type> + <accidental>sharp</accidental> + <stem>down</stem> + <notations> + <articulations> + <staccato placement="above"/> + </articulations> + </notations> + <notations> + <articulations> + <accent placement="above"/> + </articulations> + </notations> + </note> + <note> + <pitch> + <step>A</step> + <octave>4</octave> + </pitch> + <duration>4</duration> + <voice>1</voice> + <type>quarter</type> + <accidental>sharp</accidental> + <stem>down</stem> + <notations> + <articulations> + <staccato placement="above"/> + </articulations> + <articulations> + <accent placement="above"/> + </articulations> + </notations> + </note> + <note> + <pitch> + <step>A</step> + <octave>4</octave> + </pitch> + <duration>4</duration> + <voice>1</voice> + <type>quarter</type> + <accidental>sharp</accidental> + <stem>down</stem> + <notations> + <articulations> + <staccato placement="above"/> + <accent placement="above"/> + </articulations> + </notations> + </note> + </measure> + </part> +</score-partwise> diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 3adc084450..d9ebfc3ff6 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -1157,7 +1157,7 @@ def musicxml_voice_to_lily_voice (voice): if voice_builder.current_duration () == 0 and n._duration > 0: voice_builder.set_duration (n._duration) - notations = n.get_maybe_exist_typed_child (musicxml.Notations) + notations_children = n.get_typed_children (musicxml.Notations) tuplet_event = None span_events = [] @@ -1166,7 +1166,7 @@ def musicxml_voice_to_lily_voice (voice): # ornaments | technical | articulations | dynamics | # +fermata | arpeggiate | non-arpeggiate | # accidental-mark | other-notation - if notations: + for notations in notations_children: if notations.get_tuplet(): tuplet_event = notations.get_tuplet() mod = n.get_maybe_exist_typed_child (musicxml.Time_modification) -- 2.39.5