Final barlines wrongly and only partially assumed from musicxml import from musicxml import lacking barlines

• Oct 22, 2021 - 14:14
Reported version
3.6
Type
Functional
Frequency
Few
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
  1. Produce a musicxml file consisting of an excerpt (attached). Thus, it will not finish with a final barline. According to musicxml spec, this means all barline tags can be omitted:
    https://w3c.github.io/musicxml/musicxml-reference/elements/barline/

  2. Import in MuseScore. Observe final barlines are added to each part after the first. This is both undesired and internally inconsistent.

We noticed at the music21 project: https://github.com/cuthbertLab/music21/issues/1154

A bug report from 2019 https://musescore.org/node/282855 contains some discussion, and a maintainer asked for someone to break out into separate issues with repro steps. Marking as regression per that discussion.

Attachment Size
no-barlines.musicxml 2.09 KB
undesired-final-barline.png 79.13 KB

Comments

Testfiles affected:
- testDivsDefinedTooLate2.xml
- testDynamics2.xml
- testDynamics3.xml
- testInstrumentSound.xml
- testSystemBrackets2.xml
- testVoicePiano1.xml
- testWords2.xml

Issue is caused by an incomplete fix in commit f579b0e23 on May 18, 2016. It only sets the barline in track 0, leaving a final barline in place in every staff except the first one. See TODO in MusicXMLParserPass2::scorePartwise().

Assuming the barline type is the same in every staff, the solution would be trivial.

Is it conceivable there are situations where it would make sense to support different barline types in different staves ? This is legal in MusicXML and (incompletely) supported by MuseScore: imported, displayed and saved correctly, but impossible to create in the GUI.

Yes, Measure::endBarLineType() returns BarLineType::NORMAL if no barline has been created by the importer, which is what happens with the original attached MusicXML file created by music21.

For extra fun and to further understand MuseScore's behaviour, I also attached a file with different barline types in every staff.

Attachment Size
different_barlines_in_xml_parts.xml 11.2 KB

Thank you for investigating. I suggest pursuing the trivial solution for the no-barlines scenario and just punting the mixed-barlines scenario to the future. If it would help, we could retitle this issue to "... from musicxml import lacking barlines" to clarify how the scenarios are distinct.

Title Final barlines wrongly and only partially assumed from musicxml import Final barlines wrongly and only partially assumed from musicxml import from musicxml import lacking barlines

good idea

Title Final barlines wrongly and only partially assumed from musicxml import from musicxml import lacking barlines [MusicXML import] Final barlines wrongly and only partially assumed from musicxml import lacking barlines
Fix version
4.0.0