Initial key signature incorrrect in scores created from template with transposing instrument

• Feb 25, 2015 - 17:15
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Ubuntu 14.04, GIT commit: e75affa

1) new score, choose Jazz Combo or Big Band template, key of Bb

Result: trumpets & tenor saxophones have incorrect key signature (two sharps rather than none)

I can reproduce this in a template created from scratch as well:

1) new score, trumept & trombone, key of C
2) save into Templates

Create a score in Bb based on this template and you see the same effect. I think the key is the template needs to be saved with concert pitch off and the key chosen when creating the score has to be one that results in "C" for one of the transposing instruments.

The problem fixes itself if you toggle concert pitch on & off again.

Presumably, there is another missing/incorrect special case for initial "C" key signatures somewhere.


Comments

This issue occurs on January 5

- Between this Nightly: 712522e
With this result, correct:
2 result on 712522e January5.jpg

- And this one (so: probably the cause is here): 9abad76
With result:
1 result on 9abad76.jpg
It was to fix this issue: #43301: Implied C major key signature at beginning of score does not transpose, corrupts on create new score

There is only an intermediate commit between the two mentionned Nightlies. This one: possibly also invoked (don't know?) : https://github.com/musescore/MuseScore/commit/58fec699cef10febff1b99c5c…

-Note: test only with the "first step" ie with Jazz Combo Template

This one is tricky, but I think I have it.

In MuseScore::newFile(), we read the template as is, and because it was saved with concert pitch off, that means there is a D major key signature at tick 0 in the trumpet staff. We then delete all the key signature segments, but we do *not* clear the key maps. We then go through and add new key signatures based on the key selected in the wizard, which replaces whatever was in the key map. However, if the transposed key is C, we don't add a new key signature. So the old D key signature remains in the key map. And then later on in layoutSystemRow(), we notice this and add a key signature.

The solution is presumably to clear the key map, either for all staves when deleting the key signature segments, or perhaps just for the staves that we do not explicitly add a key signature to.

Based on this analysis, BTW, I can see another bug that has nothing to do with transposing insturments. Save a template for piano that has a key signature other than C. Now try to create a score from this template, key of C. Same issue occurs: Ab is still in the key map, so you end up with Ab instead of C.

I should have a fix in soon.