MusicXML import: Lyrics extender goes on for too long
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 70/100
Research direction
Start in importmusicxmlpass2.cpp, in MusicXmlLyricsExtend::setExtend, where pending extenders are ended only for lyrics matching the same verse, staff and placement. Also check how a lyric holding only extend type="stop" is skipped. Reproduce by importing the attached MusicXML and confirming the extender of "Ah," stops at the second-voice "my" rather than running into bar 2. Done when the sample imports as expected and an explicit stop extender is honoured.
Written by the indexing model from the issue text.
Description
Steps to reproduce
- Import the MusicXML below.
Expected results:
The "Ah,__" should stop at the note where the second voice has the "my". It should not extend beyond the first bar.
There's a <lyric number="1" placement="above"><extend type="stop"/></lyric> in the code where it should stop.
Actual results
The lyrics extender keeps going, into the next bar. It only stops at the next "above" lyric which can be arbitrarily far away.
The <extend type="stop"/> is ignored.
MusicXML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
<part-list>
<score-part id="P1"><part-name>Soprano</part-name></score-part>
</part-list>
<part id="P1">
<!-- Divided: the upper voice holds "Ah," (above the stave, its own words)
while the lower voice sings "I hung my" (below). -->
<measure number="1">
<attributes>
<divisions>1</divisions>
<key><fifths>0</fifths></key>
<time><beats>4</beats><beat-type>4</beat-type></time>
<clef><sign>G</sign><line>2</line></clef>
</attributes>
<note><pitch><step>E</step><octave>5</octave></pitch><duration>2</duration><voice>1</voice><type>half</type><stem>up</stem>
<notations><slur type="start" number="1"/></notations>
<lyric number="1" placement="above"><syllabic>single</syllabic><text>Ah,</text><extend type="start"/></lyric>
</note>
<note><pitch><step>D</step><octave>5</octave></pitch><duration>2</duration><voice>1</voice><type>half</type><stem>up</stem>
<notations><slur type="stop" number="1"/></notations>
<lyric number="1" placement="above"><extend type="stop"/></lyric>
</note>
<backup><duration>4</duration></backup>
<note><pitch><step>C</step><octave>5</octave></pitch><duration>1</duration><voice>2</voice><type>quarter</type><stem>down</stem>
<lyric number="1"><syllabic>single</syllabic><text>I</text></lyric>
</note>
<note><pitch><step>B</step><octave>4</octave></pitch><duration>1</duration><voice>2</voice><type>quarter</type><stem>down</stem>
<lyric number="1"><syllabic>single</syllabic><text>hung</text></lyric>
</note>
<note><pitch><step>A</step><octave>4</octave></pitch><duration>2</duration><voice>2</voice><type>half</type><stem>down</stem>
<lyric number="1"><syllabic>single</syllabic><text>my</text></lyric>
</note>
</measure>
<!-- Together again: one voice, the shared words below the stave.
The upper voice's next syllable ("head.") should end its extender. -->
<measure number="2">
<note><pitch><step>G</step><octave>4</octave></pitch><duration>2</duration><voice>1</voice><type>half</type>
<lyric number="1"><syllabic>single</syllabic><text>head.</text></lyric>
</note>
<note><pitch><step>G</step><octave>4</octave></pitch><duration>2</duration><voice>1</voice><type>half</type>
<lyric number="1"><syllabic>single</syllabic><text>So</text></lyric>
</note>
</measure>
<!-- Divided again: upper voice "Ah" above, lower voice "one by" below.
MuseScore 4.7.6 ends the extender of bar 1's "Ah," only here. -->
<measure number="3">
<note><pitch><step>E</step><octave>5</octave></pitch><duration>4</duration><voice>1</voice><type>whole</type><stem>up</stem>
<lyric number="1" placement="above"><syllabic>single</syllabic><text>Ah</text></lyric>
</note>
<backup><duration>4</duration></backup>
<note><pitch><step>C</step><octave>5</octave></pitch><duration>2</duration><voice>2</voice><type>half</type><stem>down</stem>
<lyric number="1"><syllabic>single</syllabic><text>one</text></lyric>
</note>
<note><pitch><step>B</step><octave>4</octave></pitch><duration>2</duration><voice>2</voice><type>half</type><stem>down</stem>
<lyric number="1"><syllabic>single</syllabic><text>by</text></lyric>
</note>
</measure>
<measure number="4">
<note><pitch><step>A</step><octave>4</octave></pitch><duration>4</duration><voice>1</voice><type>whole</type>
<lyric number="1"><syllabic>single</syllabic><text>one.</text></lyric>
</note>
<barline location="right"><bar-style>light-heavy</bar-style></barline>
</measure>
</part>
</score-partwise>
MuseScore version
4.7.7
Cause
MusicXmlLyricsExtend::setExtend (importmusicxmlpass2.cpp) ends a pending extender only for a lyric of the same verse on the same staff with the same placement (or at a rest on the same track, or at the end of the part). A lyric of the same verse in the same voice, placed on the other side of the stave, doesn't end it. Also, a <lyric> holding only <extend type="stop"/> is skipped ("no further action required"), so the explicit stop has no effect.
Suggested fix
Also end the extenders of the same track and verse, whatever their placement:
if ((verse == -1 && par->track() == track)
|| (l->verse() == verse && par->track() == track)
|| (l->verse() == verse && track2staff(par->track()) == track2staff(track) && prevAddedLyrics
&& prevAddedLyrics->placement() == l->placement())) {
With this change the attached file imports as expected. Honouring <extend type="stop"/> would fix it as well.
- Dominant language
- C++
- Stars
- 15.5k
- Forks
- 3.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 124
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from musescore/MuseScore
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Edit string data dialog opens empty, with no strings and 0 frets, from "Instrument/Staff properties"Possibly taken @igorkorsukov claimed this 3 days ago. OpenP2 regression nightly UX/interaction
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
musescore/MuseScore#35829 · 1 assignee ·
Maintainers usually reply within 1 day
-
MusicXML export: overlapping dashed text lines (<dashes>) are all exported with duplicate number="1"Opencommunity MusicXML
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
MusicXML import loses explicit slur direction when the stop precedes the start in document orderOpenneeds review
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
needs review
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
All issues in musescore/MuseScore
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
bug low priority
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
eclipse-score/logging#531 ·
Maintainers usually reply within 2 days
-
scope:docs status:needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PX4/PX4-Autopilot#30166 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day