musescore / musescore/MuseScore

Clef change appears after barline when imported from musicxml

Open
#27,273 14 comments 0 reactions 1 assignee View on GitHub

@miiizen is already working on this.

Since Mar 21, 2025.

MusicXML P3 regression MS4
Dominant language
C++
Stars
15.1k
Forks
3.3k
Avg merge
2d 2h
Merged PRs (30d)
91

Description

Issue type

Import/export issue

Description with steps to reproduce

This issue is based on a report from https://musescore.org/en/node/376356
Project file in musicxml format

Since Musescore 4.5, there are changes to how the Clef change is displayed when importing from musicxml.
If the Clef change is recorded at the end of the previous measure, it will be displayed after the barline:

    <measure number="3">
      <note>
        <rest measure="yes"/>
        <duration>4</duration>
        <voice>1</voice>
        </note>
       <attributes>
          <clef>
            <sign>G</sign>
            <line>2</line>
          </clef>
        </attributes>
      </measure>
    <measure number="4">
      <note>
        <rest measure="yes"/>
        <duration>4</duration>
        <voice>1</voice>
        </note>
      </measure>

Image

If the Clef change is recorded at the beginning of the current measure, it will be displayed before the barline:

    <measure number="3">
      <note>
        <rest measure="yes"/>
        <duration>4</duration>
        <voice>1</voice>
        </note>
      </measure>
    <measure number="4">
      <attributes>
          <clef>
            <sign>G</sign>
            <line>2</line>
          </clef>
      </attributes>
      <note>

Image

I have a suspicion that this is intentional behavior, but the musicxml spec has a separate attribute for specifying where to draw the clef. And it is missing from the file mentioned above.
I also attach a sample file
clef_change_test.zip

What is the latest version of MuseScore Studio where this issue is present?

MuseScore Studio version (64-bit): 4.5.0-250721848, revision: github-musescore-musescore-7c55023

Regression

Yes, this used to work in a previous version of MuseScore 4.x

Operating system

windows 10

Additional context

No response

Checklist
  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.