Jojo-Schmitz / MuseScore

MuseScore is a open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
http://musescore.org
Other
39 stars 5 forks source link

Opening MuS 4.2.1 Score in MuS 3.7 Evolution (and 3.6.2) results in wrong key signature #443

Closed K-Hilde closed 6 months ago

K-Hilde commented 6 months ago

A MuseScore 4.2.1 mscz file can normally be opened in MuS 3.7 without key errors. So far I have not found any problems with this issue. But now I found a file that gives a different key in 3.7 than in 4.2.1. The score was originally written in Fmaj and shows the correct key signature for the transposing instruments. If you open it in MuS 3.7, the score is displayed in concert key for all instruments - transposing or non-transposing - while the concert key button is not pressed.

If you open the extracted mscx in 3.6.2 (and delete the tag 'LastEID'), you get a similar result, but now all instruments are displayed in Cmaj key. Applying the correct concert key in both 3.x versions fixes the score.

Here is the score, from the secondary discussion in https://musescore.org/en/comment/1238635#comment-1238635 Watermelon Man.zip

Jojo-Schmitz commented 6 months ago

Simple score, Flute and Clarinet in Bb, shows the same bogus behavoir

Debug output:

Debug: tag in <TransposingInstrumentsText> line 12 col 10: open (...\libmscore\xmlreader.cpp:208, void Ms::XmlReader::unknown())
Debug: remove keysig c at tick 0 (...\libmscore\measure.cpp:2335, void Ms::Measure::readVoice(Ms::XmlReader&, int, bool))
Debug: tag in <TransposingInstrumentsText> line 449 col 23: actualKey (C...\libmscore\xmlreader.cpp:208, void Ms::XmlReader::unknown())
Debug: remove keysig c at tick 0 (...\libmscore\measure.cpp:2335, void Ms::Measure::readVoice(Ms::XmlReader&, int, bool))

So the tags <open> and, probably much more important here, <actualKey> from Mu4 are not understood in Mu3

<open> shows in the score header. Let's deal with it later...

    <showFrames>1</showFrames>
    <showMargins>0</showMargins>
    <open>1</open>
    <metaTag name="arranger"></metaTag>
    <metaTag name="composer">Komponist / Arrangeur</metaTag>

<actualKey> looks like this:

          <KeySig>
            <eid>167503724566</eid>
            <concertKey>0</concertKey>
            <actualKey>2</actualKey>
            </KeySig>
Jojo-Schmitz commented 6 months ago

in Mu3 that Clarinet's start looks like this:

            <accidental>2</accidental>
            </KeySig>
          <TimeSig>

So we'd just need to map <actualKey to <accidental>?

Ah! The mistakes seems to happen here:

            else if (tag == "accidental" || tag == "concertKey") // + 4.x compat
                  _sig.setKey(Key(e.readInt()));

(I already started to wonder why there debug log didn't complain about <concertKey>)

Might turn out to be a very easy fix...

Jojo-Schmitz commented 6 months ago

See #446

Jojo-Schmitz commented 6 months ago

There's still an issue left: if a Mu4 score got saved in concert pitch, Mu3 doesn't detect that, and then 'reverses' the transpositions (like turns 3 sharps into 2 flats)

Has to do with a problem reading score_style.css and applying that to the current score. Well, the reading works just fine, but not the applying it to the just read in score.

See #447