Skip to content

Commit

Permalink
Fix #319776: [MusicXML export] Invalid MusicXML will be generated if …
Browse files Browse the repository at this point in the history
…exported sheet contains tied cue notes

MusicXML does not allow a cue note to have a child element.
The reason is that is designed for sound information, but cue notes are silent.
Simply having a element under will be enough.

Duplicate of musescore#7935, resp. backport ot musescore#8019
  • Loading branch information
lvinken authored and Jojo-Schmitz committed Sep 2, 2021
1 parent 6804b84 commit ce8f220
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 23 deletions.
10 changes: 6 additions & 4 deletions importexport/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3327,10 +3327,12 @@ void ExportMusicXml::chord(Chord* chord, int staff, const std::vector<Lyrics*>*
if (!grace)
_xml.tag("duration", stretchCorrActFraction(note).ticks() / div);

if (note->tieBack())
_xml.tagE("tie type=\"stop\"");
if (note->tieFor())
_xml.tagE("tie type=\"start\"");
if (!isCueNote(note)) {
if (note->tieBack())
_xml.tagE("tie type=\"stop\"");
if (note->tieFor())
_xml.tagE("tie type=\"start\"");
}

// instrument for multi-instrument or unpitched parts
if (!useDrumset) {
Expand Down
66 changes: 62 additions & 4 deletions mtest/musicxml/io/testCueNotes2.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,47 @@
<voice>
<Chord>
<small>1</small>
<durationType>quarter</durationType>
<durationType>eighth</durationType>
<Lyrics>
<text>cue</text>
<text>tiedcue</text>
</Lyrics>
<StemDirection>up</StemDirection>
<Note>
<Spanner type="Tie">
<Tie>
</Tie>
<next>
<location>
<fractions>1/8</fractions>
</location>
</next>
</Spanner>
<pitch>72</pitch>
<tpc>14</tpc>
<play>0</play>
</Note>
</Chord>
<Chord>
<small>1</small>
<durationType>eighth</durationType>
<Note>
<Spanner type="Tie">
<prev>
<location>
<fractions>-1/8</fractions>
</location>
</prev>
</Spanner>
<pitch>72</pitch>
<tpc>14</tpc>
<play>0</play>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Lyrics>
<text>cue</text>
</Lyrics>
<StemDirection>up</StemDirection>
<Note>
<pitch>74</pitch>
Expand Down Expand Up @@ -242,12 +270,39 @@
<!-- Measure 3 -->
<Measure>
<voice>
<Beam>
<StemDirection>up</StemDirection>
</Beam>
<Chord>
<durationType>quarter</durationType>
<durationType>eighth</durationType>
<Lyrics>
<text>small</text>
<text>tiedsmall</text>
</Lyrics>
<Note>
<Spanner type="Tie">
<Tie>
</Tie>
<next>
<location>
<fractions>1/8</fractions>
</location>
</next>
</Spanner>
<pitch>72</pitch>
<tpc>14</tpc>
<small>1</small>
</Note>
</Chord>
<Chord>
<durationType>eighth</durationType>
<Note>
<Spanner type="Tie">
<prev>
<location>
<fractions>-1/8</fractions>
</location>
</prev>
</Spanner>
<pitch>72</pitch>
<tpc>14</tpc>
<small>1</small>
Expand All @@ -256,6 +311,9 @@
<Chord>
<small>1</small>
<durationType>quarter</durationType>
<Lyrics>
<text>small</text>
</Lyrics>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
Expand Down
Binary file modified mtest/musicxml/io/testCueNotes2.pdf
Binary file not shown.
77 changes: 62 additions & 15 deletions mtest/musicxml/io/testCueNotes2_ref.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<divisions>2</divisions>
<key>
<fifths>0</fifths>
</key>
Expand Down Expand Up @@ -67,7 +67,7 @@
<step>G</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<duration>4</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
Expand Down Expand Up @@ -97,7 +97,7 @@
<step>G</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<duration>4</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
Expand All @@ -119,31 +119,54 @@
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<type>eighth</type>
<stem>up</stem>
<beam number="1">begin</beam>
<notations>
<tied type="start"/>
</notations>
<lyric number="1">
<syllabic>single</syllabic>
<text>cue</text>
<text>tiedcue</text>
</lyric>
</note>
<note>
<cue/>
<pitch>
<step>D</step>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>eighth</type>
<stem>up</stem>
<beam number="1">end</beam>
<notations>
<tied type="stop"/>
</notations>
</note>
<note>
<cue/>
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>cue</text>
</lyric>
</note>
<note>
<cue/>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
Expand All @@ -155,7 +178,7 @@
<step>G</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
Expand All @@ -166,7 +189,7 @@
<step>F</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
Expand All @@ -179,38 +202,62 @@
<octave>5</octave>
</pitch>
<duration>1</duration>
<tie type="start"/>
<voice>1</voice>
<type size="cue">quarter</type>
<stem>down</stem>
<type size="cue">eighth</type>
<stem>up</stem>
<beam number="1">begin</beam>
<notations>
<tied type="start"/>
</notations>
<lyric number="1">
<syllabic>single</syllabic>
<text>small</text>
<text>tiedsmall</text>
</lyric>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<tie type="stop"/>
<voice>1</voice>
<type size="cue">eighth</type>
<stem>up</stem>
<beam number="1">end</beam>
<notations>
<tied type="stop"/>
</notations>
</note>
<note>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<duration>2</duration>
<voice>1</voice>
<type size="cue">quarter</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>small</text>
</lyric>
</note>
<note>
<chord/>
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<duration>2</duration>
<voice>1</voice>
<type size="cue">quarter</type>
<stem>up</stem>
</note>
<note>
<rest/>
<duration>2</duration>
<duration>4</duration>
<voice>1</voice>
<type size="cue">half</type>
</note>
Expand Down

0 comments on commit ce8f220

Please sign in to comment.