Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Score "loses" key signature when removing last instrument #18906

Closed
frenno opened this issue Aug 3, 2023 · 4 comments · Fixed by #18949
Closed

Score "loses" key signature when removing last instrument #18906

frenno opened this issue Aug 3, 2023 · 4 comments · Fixed by #18949
Assignees
Labels
engraving P3 Priority: Low regression_ms3 Regression from MS3 (3.6.2)

Comments

@frenno
Copy link

frenno commented Aug 3, 2023

Issue type

Engraving bug

Bug description

When using the Add or remove instruments dialog to remove and then add an instrument, the key signature is lost. I often do this when using the Jazz Lead Sheet template, to remove piano as the instrument and add Trumpet in Bb. In Musescore 3 a key signature which is already present (may have been selected in the new score wizard) is retained in the new instrument (with appropriate transposition).

However in Musescore 4.1.1, the key signature is lost (i.e. becomes C Major/A minor concert, regardless of what was previously set)

Steps to reproduce

  1. In the new score wizard, select "Jazz Lead Sheet", click Next, select Db Major as key signature, click Done
  2. The new score displays 5 flats in the key signature
  3. In the new score press "i" to go to "add or remove instruments" dialog
  4. Add "Trumpet in Bb" to Your Score, remove Piano, press Ok
  5. The key signature should show 3 flats (due to transposition) but instead shows 2 sharps (C major concert)

If you add a different instrument instead of Trumpet in Bb at step 3, it still ends up with a key signature of C major concert eg no sharps/flats for violin, 3 sharps for alto sax

Screenshots/Screen recordings

No response

MuseScore Version

4.1.1

Regression

Yes, this used to work in MuseScore 3.x and now is broken

Operating system

Linux

Additional context

Workaround: add instrument, close dialog, reopen dialog and remove the other instrument

may be related to #18590

@muse-bot muse-bot added engraving regression_ms3 Regression from MS3 (3.6.2) labels Aug 3, 2023
@zacjansheski zacjansheski self-assigned this Aug 4, 2023
@zacjansheski
Copy link
Contributor

A simpler workaround that might help you would be to use "Replace Instrument" in the Instruments panel.

What is happening is all instruments are removed before the new one is added, which also removes the initial key signature.

@sammik maybe you can take a look at this.

@MarcSabatella
Copy link
Contributor

Same story if you delete all measures. To some extent this is by design and unavoidable, since the only place the key signature is actually stored is in the first measure of each instrument in the score itself, so if there are no measures or no instruments, there is nothing to tell MuseScore what the key used to be.

I guess it could be fixed by just adding a global field to the Score object - and then make sure it's updated each time the key is updated, and manage it through transposition, local key signatures, etc. Not sure it's worth the trouble or risk, but maybe there is a more clever way I'm not seeing.

@MarcSabatella
Copy link
Contributor

Also, regarding workarounds - if you are often creating scores from Jazz Lead Sheet then changing the instrument to trumpet, simpler still would be to do that once, then just save the result to your Templates folder, and then from now on just select this template when creating a new core instead of the Jazz Lead Sheet template.

@sammik
Copy link
Contributor

sammik commented Aug 6, 2023

So, this issue (regression from 3.6) is not just about initial key sig, but about whole key map - if there are more key signatures in score, all should be preserved.

Problem is, key map is red from first staff, and if user removes all instruments in score and add another instruments, existing instruments are removed first, so there is no staff to read keylist for new staf from.

I fixed this, PR on the way.

But I think, there definitely should be property _keyMap (or _keyList?) in master score, same, as _timeMap and _tempoMap is.

I propose, to create another issue (task) for masterScore.keyMap.

sammik added a commit to sammik/MuseScore that referenced this issue Aug 6, 2023
@oktophonie oktophonie added P2 Priority: Medium P3 Priority: Low and removed P2 Priority: Medium labels Aug 8, 2023
RomanPudashkin added a commit that referenced this issue Aug 14, 2023
fix #18906 preserve keyList if removes all instruments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engraving P3 Priority: Low regression_ms3 Regression from MS3 (3.6.2)
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants