Single-click courtesy accidentals

• Sep 10, 2011 - 21:47
S5 - Suggestion

Courtesy accidentals would be much easier to insert in MuseScore if the user could highlight a note and then double click on the parentheses button in the toolbox. The necessary accidental would then be automatically added to the note, and parentheses would be added to that accidental. Currently, MuseScore users must click on the note, click on the appropriate accidental, click on the newly-inserted accidental, and then click on the parentheses in the accidental palette.


I agree, a one-click "add courtesy accidental" would be nice, although traditionally, parentheses are *not* used by default - only in certain special cases, like if you are simply reminding a player about an accidental that occurred earlier in the measure, or when encountering the same note in a different octave, etc.

Meanwhile, though, you don't need all that clicking - you can assign keyboard shortcuts to each of the accidentals. I forget if you can assign one to the parens or not.

I would like to see this as well. Writing compositions/arrangements for high school students, courtesy accidentals are frequently needed. I've always seen them with a parenthesis around them, and I can't find any way to add a keyboard shortcut. Right now it's 4 clicks, and I have to go out of Note Entry mode to do it, which is way more difficult than it should be and breaks my flow. There should be a customizable shortcut for the flat, natural, and sharp with the parenthesis, even if it's not enabled by default.

Fwiw, as I said anove, usual music notation guidelines call for parens *not* to be used for courtesy accidentals except in certain special cases, like a courtesy accidentl in the same measure as the original measure, or perhaps when applying one to a note in a different octave as the original. So the need for parens shouldn't come up often. If you're seeing them often, it must be from a publisher who doesn't follow modern guidelines, but I wouldn't take that as reason for you not to do so, either.

Even so, I'm always in favor of making as many commands as possible *available* for shortcut assignment, even if default shortcuts aren't defined for all of them.

Status (old) active patch (code needs review)

I have attached a patch for that applies to da595cce883b36d13cf62f9d2517dd73d6a68f17. After applying this patch, when the parentheses are dragged onto a note, the appropriate accidental will be inserted and parentheses will be added around it.

Attachment Size
auto_courtesy.patch 1.46 KB

1) Yes, I think a Github pull request should be made; separate patches, as the one posted above, are no longer supported, the recommended way is to create a pull request on Github.

2) I am not sure I agree with the mechanism implemented by the patch: if a note head is selected and the parenteses symbol double-clicked, I would expect the parentheses to be placed around the note head itself. This would come handy occasionally to notate a note missing in a source and supplied by the editor.

I still believe a more consistent way of implementing the request would be by adding customizable shortcuts.



I agree with you that the ability to put parentheses around a note would be useful. Jazz music frequently uses ghosted notes. However, I don't have enough experience with the MuseScore codebase to implement it. When I have needed this in the past, I have used the hack of putting parentheses in a text object and putting them around the note... far from optimal, but it sort of worked.

However, I am hoping that the parentheses symbol in the "Accidentals" section will be enough of a signal to the users. Additionally, I can't think of any other graphic that would be more informative if the parentheses were used exclusively for notes.

Not sure if you were aware, but there is already a mechanism for adding parentheses around notes: they are found on the symbols palette (press "Z"). But it's still possible there could be a way to make it easier to access this functionality, and tying in to any commands used for parentheses around courtesy accidentals makes sense to me.

Yes, I am aware of this and have used it myself already, but it is pretty cumbersome to use: you'd have to add the open paren and the close paren separatly and the close paren needs to get repositioned to be after the note head. The "()" palette entry does it right out of the box, but only for (courtesy) accidentials.

I tend to agree with Miwarre on this one. I can understand that having a direct option to auto add a courtesy accidental with or without parenthesis is interesting but the () in the accidentals palette apply to accidentals normally. If I understand the commit correctly, this will make the same palette element work differently depending if an accidental or a note is selected. It looks counter intuitive to me. And I bet users will find it disturbing.

If there is a need for this function, it should be added as another function. The same is true for noteheads between parenthesis.

Trying to summarize the current situation, I think we have 3 different 'things':

A) With an accidental selected, placing parentheses around it
B) With a note head selected, placing parentheses around it
C) With a note head selected, attaching a parenthesized (courtesy) accidental to it.

A) is covered in the code and achieved in the UI with the '( )' symbol in the Accidentals palette

B) is not covered in the code which does not even have the concept of parenthesized note head and of course not in the UI. Work-arounds involving textual elements are possible, but sub-optimal under many respects. This is probably the topic of a separate feature request.

C) is actually a shortcut for: 1) creating an accidental, 2) adding parentheses around it. Both actions are individually covered in the code; in the UI this requires 3 actions: i) creating the needed accidental, ii) selecting it, iii) adding the parentheses via the palette.

If a quicker UI way is needed and assuming that parenthesized accidentals are commonly needed for the 3 'basic' accidentals only (sharp, natural, flat), I see at least two possibilities which extend the current framework concepts without creating 'special cases':

a) Adding 3 keyboard shortcuts for '(#)', '(h)', '(b)'
b) Adding those 3 symbols to the Accidental palette

Both would apply to a selected note head (as other accidentals do) and directly create and attach the parenthesized accidental to it. Notice that both ways could coexist, they are not mutually exclusive. The code kindly supplied by trombonechanp could be the base for the underlying code (rather similar in both cases).

Less used parenthesized accidentals (parenthesized double sharp, parenthesized half-sharp, parenthesized sori, ...) would be still achievable with the i), ii), iii) steps listed above in case C) as they are now.

Comment? Suggestions? Flames? Priorities?



Good summary. Let's talk about C only in this thread.

The feature request and the pull request go a bit further. It let you add automatically the *right* courtesy accidental *between parenthesis* in one (double) click. But it reuses the () palette cell in the accidental palette.

If we want to keep this automatic behavior, we need two new actions or palette element.

  • One to automagically add a courtesy accidental (without parenthesis)
  • One to automagically add a courtesy accidental with parenthesis

Probably I'm no longer that familiar with the concept of courtesy accidental (in Renaissance music the usage is a bit different), bur are we sure that the 'right' courtesy accidental can always be guessed correctly by a routine?


shouldn't that be easy? An accidential is a courtesy accidential, if the note doesn't have an accidential of it's own but has that pitch already, either due to the current key sig, or an accitential to a note of the same pitch earlier in the same measure.

I agree that the best situation would be to have two unique symbols to add a courtesy accidental with or without the parentheses. However I'm not quite sure what this symbol would look like. Maybe something with a ♯/♭/♮ sign? It might be clearer if it included the letter "A" next to it, but this also probably wouldn't be able to be translated.

Also, this routine will be able to determine the correct courtesy accidental 100% of the time. Courtesy accidentals are used in cases where the musician needs to be reminded of an accidental in the key signature or from earlier in the measure.

Curtesy accidentals without oarens are the norm; parents are the exception for most publishers. I think people think they are more common they are because the ones we see without oarens barely even register - we take them for granted, they are so common. So while two different shortcuts for adding courtesy accidentals is fine, I think it might make more sense to have one shortcut to add the accidentals, a second to parenthesize it, and have both be toggles.

The only use I see for a parenthesized accidental is if you are publishing a score from sources that disagree as to whether the accidental exists or not, or if you think your source has an error and the accidental is needed, but omitted in your source score. Otherwise, the parenthesis would have no meaning since the second F in a measure with a sharp in it is still F# whether or not the accidental is there. Making this feature a common part of the GUI with shortcuts etc. would only encourage misuse.
By the way, I take the same issue with 8va lines that are continued after a line break--I always have to delete the parenthesis in the line properties since the 8va is not editorial.

The role of MuseScore is not to take a stance on what is correct or not.

I had a composition teacher and very well-known composer who believed all courtesy accidentals should have parentheses because it helped instrumentalists remember to apply that accidental in future measures. As a musician, I also appreciate it when composers do this. Whether or not you think this is "correct" or not, the truth is that some composers use this convention.

Of course MuseScore needs to take a stance on what is correct or standard - that's how its defaults must be set. For instance, MuseScore uses the notion of what is correct / standard to decide on stem direction and length, notehead position, beaming, etc. but then it also makes it as painless as possible to override those defaults so that option is available when the situation warrants. Similarly, MuseScore must create correct / standard courtesy accidentals by default - and regardless of what any one eacher may have told you, even a cursory examination of the published literature should convince you beyond any possible doubt that unparenthesized courtesy accidentals are the rule. so there can be no question that MuseScore should honor this and produce unparenthesized couresy accidentals *by default*. And I mention that beause elsewhere there have been requests to make the non-standard parenthesized form the default.

But as with stem direction et al, the fact that MuseScore does the standard thing by default shouldn't make it unduly awkward to override this. A single keystroke to add parentheses immediately after adding the accidental make perfect sense to me, as does making the double click action of parentheses work with the note selected. This would not interfere with the default operation of MuseScore at all. So I do hope the proposed change goes through.

As I explained here, the proposed change doesn't add parenthesis to the accidental if the note is selected, it adds a courtesy accidental + the parenthesis by going through the measure and looking for the current accidental for this pitch.

If I understand the discussion correctly, there is another proposal on the table: adding parenthesis around the accidental if the accidental or the note is selected, but don't do anything automatically to detect the right accidental.

Which one do you prefer?

Good point; I had forgotten the actual pull request didn't actually do what I was expecting.

I think the most straightforward answer is that an accidental icon/key should add an accidental and a parentheses icon should add parentheses. That is, the accidental icon/key would not also add parentheses, and the parentheses icon/key would not also add an accidental. The only change, then, would be that double clicking the parentheses icon or pressing the corresponding shortcut would work with the note selected!, meaning it could be applied immediately after entering the accidental.

However, the idea of "automatic" courtesy accidentals - with or without parentheses - is certainly intriguing. The idea as I see it being proposed above in #13 would add two new commands: one to calculate and add a normal courtesy accidental, and the other to calculate and add a parenthesized one. At first glance, I don't see the command to calculate the appropriate accidental to be difficult.

So I am fine with this idea, although I have absolutely no idea what a "calculate and add courtesy accidental" icon should look like. Which leads to another issue that is at least partially related and probably needs to be thought about in designing the UI for this new proposed feature.

I see a fair amount of confusion among new users trying to add ordinary (not courtesy) accidentals using the palette and wondering why they are appearing on repeaed notes (eg, a series of F#'s with a measure in C all showing the accidental). And I remember being confused by the different ways of applying accidentals myself at first.

We're now talking about having *three* different ways of applying accidentals, which is potentially more confusing even than two. Definitely important to get this right from a UI perspective.

I have no particular stance about adding a "courtesy accidental+parentheses" group with a single command (mouse operation), as in my way of working -- and also in general usage, I believe -- it is a very rare occurrence.

I am more concerned about the effect of the pull request on current behaviour, if any. What would happen, if the parehteses symbol is clicked when an accidental (or a note with an accidental) is selected:

1) the accidental is kept and parentheses are added to it: OK, fine


2) the "right" accidental is guessed and substituted and parentheses added to it: NO NO! Once the user has added an accidental, it MUST not be changed.

The ability to add parentheses to an accidental while the note head is selected (without the need to manually select the accidental) is welcome, though.



This patch doesn't do any guessing. It keeps the same accidental that is already on the note. However, if it is hidden (due to the key signature) it shows it and puts parentheses around it. If the user did specify an accidental, parentheses would be added.

Also, for those questioning whether it is standard to put parentheses around courtesy accidentals, a very well known reference (Elaine Gould's Behind Bars) suggests using parentheses to increase clarity. I haven't looked at any other sources regarding this, though.

In addition, now the feature for adding parentheses around notes is implemented in 2.0, which was previously cited as a reason for not committing this patch. I suppose we might as well commit it now?

Status PR created active
Reported version 2.1  

The pull request has been archived, please open a new pull request for this feature.