B# and Cb octave change

• Jun 19, 2019 - 06:47
Reported version
3.1
Priority
P2 - Medium
Type
Functional
Frequency
Many
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

After discussing this topic in the forum, seems it's definitely a bug.
(https://musescore.org/en/comment/928033#comment-928033)
OS: macOS Mojave (10.14),
Arch.: x86_64,
MuseScore version (64-bit): 3.1.0.22425,
revision: e26f7c4

When inserting a B# or a Cb into a score, Musescore names the note with the wrong octave.
e.g. a sharpened B3 becomes a B#4, and a lowered C5 becomes a Cb4.
Look at the status bar (see attached screenshots)
That is reflected in the exported musicXML file too (that's the reason I noticed this issue).
B.png B#.png
C.png Cb.png


Comments

Good call on the MusicXML, although chances are that would require a separate bit of code to fix. Not sure what context this is used in, but it suggests there might also be a corresponding situation where we need to fix import?

I'm looking at this (be patient I'm new at this). I'll ensure that the note name is displayed in the status bar correctly and export musicxml properly, I'm not far enough into the code to see if one thing will fix both or not. I'll open a second issue & PR if export is a different fix. We can revisit if import is an issue after the status bar is fixed.

Actually, I think MusicXML export/import gets this right already, which means we can use the same approach for determining which octave to show in the status bar. The fix would be as simple as this, which is based on these lines from the MusicXML export code.

I’d much prefer the fix from https://github.com/mattmcclinch/MuseScore/commit/31277ced3398953176b8c6… because it’s actually intellegible and it’s easy to see it DTRT. I’d probably cache tpc() though, unless the compiler can do that by itself.

I had just implemented the same thing in https://musescore.org/en/node/301857 – see https://github.com/mirabilos/mscore-plugins/blob/d21bbf15aac6cde654e749… – because from my work on a temperament tuner plugin I realised it was necessary (a C₅ respelled as B♯ is indeed B♯₄, not B♯₅).

It seems mike320 isn't here anymore and his Github account is deleted and as a result PR5307 will be lost which would be a shame.
@mattmcclinch Since the actual solution came from you, can you create a new PR for this? Or shall I do it?

Status PR created fixed

Fixed in branch master, commit 58d603b499

_fix #290987: B# and Cb octave change

Resolves: https://musescore.org/en/node/290987.

Make sure that B#, B##, Cb, and Cbb describe themselves as being in the correct octave. This is accomplished by calculating the octave based on what the pitch would be if there were no accidental. Thus, there is no need to special-case certain tpcs._

Fix version
3.5.0