Changing voice of grace notes creates corrupted score

• May 5, 2015 - 11:49
Type
Functional
Severity
S2 - Critical
Status
closed
Project

MuseScore 2.0.1 and 5b6da6a3e - Mac OSX

  1. Create a score for flute
  2. Add 4 quarter notes in a measure
  3. Add a grace note to the first note
  4. Select the grace note and press the second voice button in the voice selector

Actual result: the mesure becomes corrupted. Undo makes it even worse
Expected result: Not sure. Nothing would be already better. Maybe moving the grace notes and the main note.


Comments

I'd vote "nothing", unless the main note is also selected, in which case they both should move (although if for some reaosn that turns out to be complicated, I'd settle for "nothing" there too).

This issue occurs on February 17

_ With this Nightly (and all the previous since June 2014): 4c18e20, you get the same result: press the second voice button in the voice selector has no consequence:
grace1.jpg
i.e. the grace note (its default color) is simply "deselect":
grace2.jpg

- With this Nightly: ec8913a, the corruption appears:
grace3.jpg
grace note4.jpg
And after Undo:
undo grace.jpg

After checking, I see possibly two "candidates" (to verify) ?

- https://github.com/musescore/MuseScore/pull/1757
- or (same second mentionned Nightly) ? : https://github.com/musescore/MuseScore/commit/ec8913a19b87fb1fcc29b2597…

It's possible that the bug existed before but only in different circumstances - the "change voice" operation would simply fail in lots of cases. Like, I suspect you muight see the same bug moving from voice 2 to voice 1 in earlier builds. But now that the command works more often, we're more likely to see this.

The easy fix is to skip grace notes, and they get deleted automatically if the main note gets move to another voice. Better might be to try to copy the grace note too if the main note gets moved. Moving the grace note on its own might be possible as a special case, but there are a number of special cases here - the main note might have been just one note of a chord, the destination voice might have already a chord at that location, that destination might already have grace notes of its own, etc.

For the initial described bug, it's clear for me: the change moment is relevant (I verified on many nightlies and months in the past time)
But if "It's possible that the bug existed before but only in different circumstances - the "change voice" operation would simply fail in lots of cases", this is an other affair.
Which circumstances for example, with precise steps please, to check? Thanks.

Well, it's not really important - it's already pretty obvious to me where the problem in the code is. But I think you'd see it in your same example if thise same notes had been entered into voice 2 and then you tried to move the grace note to voice 1. Perhaps only if there were already a note of the same length on that beat (eighth probably, but maybe quarter) in voice 1; hard to say for sure. But again, it's not important to know since the cause of the bug is already apparent. Feel free to check to satisfy your curiosity though (mine too now :-)

Ok, if it's pretty obvious where the problem is in the code, it's the essential. And so, in despite my insatiable curiosity (!), I probably not be going to look further.

Because if I understand very well this ( "I think you'd see it in your same example if these same notes had been entered into voice 2 and then you tried to move the grace note to voice 1"), by contrast, I have trouble visualizing for the moment what you mean by this: "perhaps only if there were already a note of the same length on that beat (eighth probably, but maybe quarter) in voice 1" ?

Status (old) active patch (ready to commit)

https://github.com/musescore/MuseScore/pull/1994

With this change, grace notes cannot be moved individually, but if the note to which they are attached is moved, the grace notes follow along. If the grace note is attached to a chord of more than note note, the grace notes stay in the original chord unless all notes of the chord are moved. if the destination chord has grace notes, the new grace noters are added in front. Probably it would be better if they were merged into chords, but this PR fixes the corruption and produces the expected reuslt in the more common cases.