Clef change export/import in MusicXML switches side of barline

• Jul 2, 2017 - 22:04
Reported version
S4 - Minor

When saving clef changes to a MusicXML file export, and then reloading the same MusicXML file back into MuseScore, the clef change is incorrectly displayed after the barline.

When creating a clef change initially in MuseScore, the position is correct:

Screen Shot 2017-07-02 at 10.19.16 PM.png

The clef change for the second measure was created by dragging the bass clef from the palette into the second measure. This caused the clef to be displayed at the end of the previous measure (as is conventional and expected).

When exporting the file as MusicXML and reloading the same file back into MuseScore, the clef change moves from before the barline to after it:

Screen Shot 2017-07-02 at 10.19.29 PM.png

Loading the same MusicXML file created with MuseScore into Finale 25.2, the clef position is correctly placed before the barline (even though the clef change is placed in the second measure in the MusicXML data).

Screen Shot 2017-07-02 at 10.49.21 PM.png

Saving the same data to a MusicXML file in Finale will place the clef in the second measure as well, so the problem is that when reading a MusicXML file, MuseScore should display clef changes properly at the end of the previous measure when they are stored at the start of a measure.

When saving and reloading a MSCZ file, the clef position remains correct on reload.

Attachment Size
oneclef-finale.xml 7.31 KB
oneclef.xml 6.07 KB
oneclef.mscz 4.26 KB


Type Functional EPIC
Frequency Few
Reproducibility Always
Reported version 3.4

This issue seems to relate to the attribute after-barline (yes/no) that should be exported if the clef in the beginning of a measure should really appear there (after the barline), rather than at the end of the previous measure (before barline).

To solve this issue, it seems to be necessary:
1) to add to the MusicXML export after-barline="yes" in (the rarer) cases of clefs appearing at the very beginning of a measure.
2) to add support for importing this attribute correctly from MusicXML (thus with after-barline="no" or as a default behavior putting it before the barline; with after-barline="yes" after the barline).