Courtesy accidentals disappear after an octave change using Ctrl + Up/Down

• Jul 26, 2019 - 14:18
Reported version
P1 - High
S5 - Suggestion

I searched for it and it's actually included in #281272: Automatically apply accidentals, but that submit is like an integration of several different issues and suggestions, so I'd like to create a new one for your convenience.


Severity S3 - Major S5 - Suggestion
Priority P2 - Medium

Courtesy accidentals needed in one octave would not be needed in another, so it should normally be correct to lose them. That said, there could be special cases where it might be desired to keep them, so we could consider a new command for that. Better, I think, to add the automatic facility as discussed in the other issue. But I'll leave this open as a suggestion as well.

In reply to by Marc Sabatella

Yes it's indeed better to implement the automatic mechanism. The reason I think the courtesy accidentials should be kept is that I believe Ctrl + Up/Down is mostly useful to move large sections, for example letting the flute having the same melody with 1st violins but up an octave, so in this case the courtesy accidentials shouldn't be removed if you copy-and-paste 1st violins to flute and move up an octave.

Title Courtesy accidentials disappear after an octave change using Ctrl + Up/Down Courtesy accidentals disappear after an octave change using Ctrl + Up/Down

Fix typo.

Priority P2 - Medium P1 - High

The context being, now that the behavior of the accidental toolbar buttons has changed to affect the next note rather than the current one, it becomes harder to enter courtesy accidentals in note input mode using computer keyboqrd entry. If you want to enter an F# in the key of G, for example, you click the sharp button, then type F, and you get the courtesy accidental, but if the octave is wrong, you'll want to change the octave, and then it's lost. Meaning you need to leave note input mode to enter it. Not good. So whatever reservations I might have had in the past about changing the behavior of octave up/down, I think this change to the accidental behavior does necessitate a change to the octave up/down commands to preserve user accidentals.

Workaround No Yes

I do agree with your general sentiment Marc but need to leave note input mode to enter it... is not totally correct. You can double click the proper accidental in the palette while in note input mode, but I don't want to have to grab my mouse to accomplish this, it breaks up the workflow. This is a temporary workaround until the issue is resolved.

Ah, good point about the accidentals palette, I forget that even exists sometimes. FWIW, Shift+tab sends cursor control over to the palette, and it remembers the last-applied element, to Shift+tab, Enter will reapply it. Yyou can also define a shortcut specifically for "apply current palette element" to make it one click. This could be useful if you're entering notes only so you won't be mixing between adding accidentals and, say, articulations. I'm gradually getting accustomed to new ways of working with the palette, and this particular trick (not with accidentals, but with dynamics) is one I've been enjoying.

I think neither PR #132 nor PR #1084 is really about "adding automatic courtesy accidentals" ;-)
BTW, PR #132 is the oldest unmerged PR! PR #1084 is also very old too. I doubt if they will ever be merged... (and fun fact: among all 12 files PR #1084 changed, one surprisingly doesn't have any conflict!)

And there's already a plugin doing the automatic stuff, I guess if we decide to put this in the main project, it will be best for its author @heuchi to do it :)

The plugin is great, I use it all the time. It currently requires being run explicitly, but I gather maybe the recent enhancements to the plugin system may make it possible to eliminate the need to run it explicitly? That could be nice, although not so much if it has to process the entire score on every change, though. And actually, there is something to be said for still being able to control when/how/where it gets run. So personally, I'm likely to keep using the plugin. But a full automatic facility built into the program would still be a very good thing - and even more so if it could also be used semi-manually like the current plugin.

Anyhow, that's long-term thinking. Short term, I don't think the existing PR's in this area are valid - they are either very out of date, or they implement a design that doesn't represent any sort of consensus. But what has been proposed and would be very simple to implement is a new "add courtesy accidental" command you apply to the current note. I could see a couple of different ways it might work, but most straightforeard would be for it to simply add a natural, flat, or sharp according to the current TPC - not changing the pitch or TPC, just adding an accidental that confirms it.

Also consider my PR, which implements a different approach: a new command that retroactively applies the accidental you just selected. So, if you enter a note, then realize you forget the accidental (courtesy or otherwise), you simply press the accidental button as you might have in the past, then issue the command to apply it retroactively. I think of it more as an "oops" button, a way to enter accidentals after the note in cases where you simply forgot to enter them before for whatever reason. As a bonus, the command can also apply durations retroactively, as that's another common enough mistake that would be nice to be able to correct. We have had the Q & W commands for years to halve or double the duration of the most recent note, but the new command would allow you to simply any duration you wanted.

In reply to by Marc Sabatella

I'm favor of the "add courtesy accidental" command, but I cannot decide whether I like PR #5505 without trying it for some time. I don't see what is the shortcut (I cannot understand your additions to shortcut.cpp, there doesn't seem to have a specific shortcut defined?), could you tell me?

In reply to by Marc Sabatella

> But a full automatic facility built into the program would still be a very good thing - and even more so if it could also be used semi-manually like the current plugin

Did you mean automatically add courtesy accidentals just like other accidentals? That has always been my favourite choice. But I don't see why semi-manually is better than fully automatic. I would say a customizable option of whether or not add courtesy accidentals automatically is best. And yes, I know the concerns of UI clutter, but what I'm trying to say is, if an option is clearly needed (amount of users who prefer having courtesy accidentals and amount of those who don't are both considerable), then sacrificing some simplicity is reasonable. I know easy-to-use has always been MuseScore's strong point, but if a simple option can undoubtedly perfect the functionality, it isn't something we should avoid at all.

My PR doesn’t actually define a shortcut - just the command. You’d have to define the shortcut yourself in preferences to test it. Then if there is general agree this a good thing, we could worry about what the actual default should be.

Regarding an automatic facility, I meant something where courtesy accidentals are added or updated completely automatically - every time you add a note, we check to see if there was an alteration in the previous measure (or however it is configured to work) and add the courtesy of necessary. Similarly, every time an accidental is added or removed, we need to look ahead at the next measure(s) to see if courtesy accidentals need to be added or removed. Not sure what you mean about making it just like regular accidentals; by their very nature they are not like ordinary accidentals which are always contained within a single measure in terms of their context.

To be clear, I favoring providing a fully automatic system, where MuseScore continually checks your score and adds the courtesies needed according to its current settings regarding rules to follow, and removes the ones no longer needed. But I'm saying I personally wouldn't use it, because effective usage of courtesy accidentals is more subjective than any simple (or even not-so-simple) algorithm is likely to capture, no matter how customizable its rules are made. There will always be places where human decision making should come into play - a courtesy I add even though the currently-configured rules say it isn't needed, places where parentheses might not be appropriate even though the currently-configured rules say they should be used, etc. So I need the system to leave my decisions alone. That's what the current plugin gives me, I decide when and where to run it, when I want to add, when I want to remove, etc.

So, for truly professional purposes, one will likely not want full automatic. But for "pretty good default without having to think about it", the fully automatic solution is great.

In reply to by Marc Sabatella

Yes, that's what I have been thinking of. And I meant, if you ignore the barlines, courtesy accidentals are just like normal accidentals.

But still it isn't easy to do. I think implement "add courtesy accidental to note" command you mentioned earlier can alternatively resolve the issue in a fairly good way.

In reply to by Marc Sabatella

I agree that there're cases where automatic algorithms don't suit one's need, but we can add something like "if you add/delete manually, then it won't disappear/reappear without your further operation". Still these cases are rare enough to be fulfilled manually, at least in classical genre, according to my experiences of reading classical music scores.

And I heard that there are many genres which don't use courtesy accidentals at all (jazz or rock maybe?), so an option might still come in handy.

I'll write up a little proposal and submit it here to see what people think. I think there are a few ways we could implement a non-intrusive and reversible system that applies to notes as they are placed on the score.

I for one want to manage all of my courtesy accidentals, so as long as I can turn it off I'll be happy. As for the implementation, I think no matter what details there are, it needs to be beta testing to make sure it makes most people who want it happy.

@Howard-C yes, you are right that if we ignore (some) barlines, then courtesy accidentals become more like regular ones, so perhaps the existing AccidentalState construct could be extended to accommodate this. It's still different, though, because the presence or absenve of a regular accidental affects the pitch, whereas it doesn't for courtesy, so somehow these are still fundamentally different.

As for the automatic/semi-manual distinction, right now we have the "user" flag to track whether an accidental was user added or not, and this is the flag that needs to be set for a courtesy accidentals. I don't think we have a way to differentiate between "user accidental actually added by user" versus "user accidental actually added by automatic courtesy accidental system". Probably it would need to be done by introducing a new styled property or something like that, which instantly starts to sound like something that involves compatibility issues. Even so, it's not clear how we'd handle the case of an automatically added courtesy accidental that I then chose to remove, I don't a fully automatic system adding it back.

To me these issues lead me to suspect that getting a fully automatic system to play nice with people who want to take control just wouldn't be practical. And yet, I certainly want to take advantage of the possibilIty for automation - the current plugin is has saved me untold hours of work and no doubt it also kept me from missing hundreds of courtesy accidentals I might otherwise have missed over the years. So I do believe we need to address those concerns. Hence, my suggestion for providing both a fully-automatic and semi-automatic mode of operation.

Fix version