favor sharps / flats option in musescore 2.0?

• Jan 10, 2015 - 06:48

hello all

is there a setting where i can "favor sharps" or flats in enharmonic spellings, as per Finale?

or is selecting the note and then using the "j" command to cycle through enharmonics the fastest way?



musescore 2.0.0


Well, "J" is the fastest way to respell notes, yes, but if you have the correct key signature, MuseScore should already be doing a pretty good job of guessing spellings - I assume you are talking about note entry via MIDI or the Piano Keyboard toolbar, because the other methods would all have your entering the correct spelling from the beginning? Assuming I am understanding you correctly, the algorithm MuseScore uses ("closest" spelling according to circle of fifths) would produce good results more often than not, but in the cases where it doesn't, it would be equally likely to be wrong in the flat direction as the sharp direction. So I am not seeing how a "favor flats" or "favor sharps" would be musically useful - it's usually more important to spell notes *correctly* than to have them consistently flats or sharps. So maybe there is something else going on here. Can you a specific score where you are experiencing a problem that such an option would help with?

BTW, there is no MuseScore 2.0 yet, just experimental prerelease builds (eg, the Beta and Nightly builds). And the behavior definitely has been under change lately. So do include the specific build you are using when posting (you can find this in Help / About). In particular, there was a bug in the note spelling algorithm for MIDI in Beta 1 that was fixed for Beta 2, and anbother that was fixed more recently.

In reply to by Marc Sabatella

Marc, pardon me for butting in, but it occurs to me that the test file I posted in my question about MIDI import in 2.0 might be relevant here. This music is essentially in C major, but has temporary excursions into other keys that are not reflected in the key signature. Importing the file produces some odd spellings. For example, all the G-sharps in measure 2 should really be A-flats, and the C-sharp should be D-flat. (And in fact this MIDI was produced by nightly build R.83622b0 from a score containing no sharps.) I suppose the assignment of sharps and flats makes some kind of sense in relation to the underlying key of C major, but the sharps are out of context both horizontally (in terms of the notes that precede and follow them) and vertically (in terms of the chord spellings).

Perhaps a "favor flats" option would have been useful here.

Attachment Size
test2.mid 689 bytes
import accidentals.png 190.93 KB

In reply to by ghicks

Ah, good example. But there is actually a better solution already implemented for this type of case. Once you add the correct key signatures, use Notes / Respell Pitches. Now, if you don't really want a change of key signature but just want a certain passage to be notated "as if" it were in a different key, this won't help, but then, neither would a global "favor flats" or "favor sharps" option - you'd want flats in some places, sharps in others, and a mix in others. For instance, a passage in G should contain F#, sure, but still Bb rather than A#. There is no much that could be done about that latter case - where you want a mix of flats and sharps within a single passage - unless you use a key signature. However, to get the effect of respelling a given passage using flats, you can do this by selecting the passage, hitting up arrow then down arrow. This raises the pitch then lowers it again but with flats favored. The reverse, of course, to favor sharps.

So while there is no global command to favor flats on import - it's based on the key, as one would normally want - there *is* a way to respell a given passage using flats or sharps, which is actually more to the point.

In reply to by Marc Sabatella

OK, so there isnt a "favor" option. I can live with it. "J" command works well.

Perhaps in the distant future it could be considered as an option?

BTW, Musescore works great when notating tonal music. However, the issue I was having occurs with atonal, modal, or highly chromatic music, with rapid or frequent modulations and/or ambiguous tonal centres. In cases like this, including a key signature is more of a hindrance than a help, due to frequent accidentals & cancellations. *Correct* writing is determined more by the shape of the phrase & convenience of reading rather than by a key which may not even exist.

Additionally, when writing for individual instruments, one must take into account player preference & instrumental traditions.

For example, a Horn player is often more comfortable reading flats than sharps, since the Horn is a transposing instrument in a flat key(s), and orchestral repertoire written in concert pitch will necessitate the addition of a flat when transposed the Horn part.

Guitarists, however, would often rather see sharps than flats. This is partly due to the tuning of the instrument: since in guitaristic styles of writing, the open strings are often used as pedal points, etc, the leading tone to these strings will be a sharp, not a flat. (e.g. G# or D# rather than Ab and Eb).

In cases like these, being able to bump the *correct* spelling (can we call it "default" spelling instead?) one or two steps along the circle of 5ths would be a great timesaver.

In reply to by dircknagy

OK, but did you read my post above? First, I am not at all understanding when you would be trying to use this option. According to my understanding, it would only have any use when importing MIDI files. Or am I missing something? Is there some situation *other* than MIDI where you would have entered the notes the "wrong" way for some reason and then need a command to "fix" it?

Also, as I wrote above, it would be seldom that you would realistically want *all* notes respelled as flats or sharps. It is a mistake to assume horn players like seeing flats more than sharps. What helps readability is *correct* spelling. For one thing, if you are arpeggiating an E major triad, you must spell it E G# B, not E Ab B, or it becomes extremely difficult to read. Yet if there is a passage that is a fragment of a Eb major scale, you must spell it Eb F G Ab Bb, not D# F G G# A#, for the same reason. And this is true regardless of what instrument you play.

Perhaps you are thinking of *keys* - the fact that horn players are likely more comfortable in flat *keys* than sharp. But this isn't because they like flats. It's because flat keys, once transposed, become "less" flat, while sharp keys, once transposed, become *more* sharp. So actually, horn players are very accustomed to playing in sharp keys, because once the music is transposed for them, the key going to have fewer flats / more sharps than the original. But in any case, again, that's really moot, because *correct* spelling is almost always more readable than any arbtrary thought flats might be better than sharps overall (or vice versa).

So again, can you provide a specific use case - like maybe post a score showing a problem, explain how the score got to be in that state if it wasn't imported from MIDI, and why you believe that *globally* respelling all notes in this fashion would be better than the solution I described previously that is already present - selecting individual passages and using Up/Down or Down/Up to respell just in that passage. I quite honestly don't understand.

In reply to by dircknagy

OK, so you are definitely talking about MIDI, then? MIDI is indeed not ideal when there are a lot of enharmonic corrections necessary. Direct entry using the computer keybaord is often more efficient.

Still, I don't understand what about the suggestion I already gave seems insufficient - or, indeed, why it wouldn't be *superior to* a global option. If you want a given passage to be spelled in flats, select it, Up, then Down, and that *passage* will be spelled with flats. Surely this is preferable to a global option that locked you into having flats for the whole piece? Real music just doesn't generally work that way, as I have tried to explain. One passage might want flats, another sharps, another a mix. So you really aren't going to get better results with a global option than using the method I have described - select the passages individually and make the corrections one at time. Even if for some reason you really do have an entire piece of music that is literally all flats, you can still get that in exactly three clicks: Ctrl+A, Up, Down. And then change it to all sharps with another Down, Up.

I'm not saying there will never be any such global option, but it seems you may bne misunderstanding just how easy it is to get the results shown in your examples.

In reply to by Marc Sabatella

Marc, I'm having a difficult time with your unbelievably arrogant and increasingly offensive posts. I have to formally insist that you no longer answer my help requests, and refer my questions to someone else.

"Real music just doesn't generally work that way, as I have tried to explain."

Are you implying I don't understand what music is?

Seriously, to provide good user support, you have got to stop pontificating and stick to software development. Looking back at my history, the past several help requests I have sent have resulted in a Marc Sabatella homily of musical usage, which is not what i asked you for.

I asked a simple question: is there a setting, as per Finale. Finale has been doing it for at least 15 years; have you ever looked at this setting? Since you are a *software developer*, I would hope that you have, at least, tried out the competition's products.

I got an answer, part of which was satisfactory, once deciphered (Musescore apparently does not have such a setting) and part of which was completely uncalled for. (the rest of your reply).

You obviously don't have much experience with music outside of a tonal context. Not all music is triadic, *harmonically* or vertically organized. Composers, and i mean serious composers, have been writing outside a purely *tonal* context for well over a century. This is something that educated musicians should know.

You also didn’t understand the posts: i never asked for “all sharps” or “all flats”, and i do not believe this is what the venerable Finale setting does.

It shouldnt require too much of a stretch of your imagination to think of why this might be a valuable tool, but if you really need specific examples, how about trying to notate Bartok’s Mikrokosmos in Musescore? Really, try it. You will see how tedious it becomes, enharmonically altering one chord after another after another, simply because your program will not spell B D# F# in the absence of a key signature.

For the sake of the future of Musescore, (a program that I love), I suggest you consider Musescore as a notation program. It is like a word processing program. What we users do with it is our own business, regardless of whether it conforms to the Compendium of Notation Standards that Marc Sabatella Understands and Approves Of. Asserting your ignorance and belittling your clients is poor PR.

So, kindly stop acting like a wikipedia editor. This is a user support forum, not a blog for your aggressive self-promotion. To quote one of your previous posts to me: “Thats just meant as advice.”

In reply to by dircknagy

I am truly sorry you do not appreciate my attempts to help. I really did explain to you exactly how to do what you want, so should you wish to learn the answer, please read my posts with an open mind. And FYI, I have masters degrees is both software engineering and in music composition, so you are incorrect in assuming I don't know about atonal music. Feel free to continue the discussion in a calm, rational, and civilized manner, and I am happy to do the same. Otheriwse, good luck to you, and I will try to remember not to help you in the future as per your request, although not helping goes against my nature :-)

In reply to by Marc Sabatella

Seven years later, does someone knows if this has evolved? Temporary changes of keys are very common in jazz music and are rarely noted explicitely. I have 400 Big Band scores and nearly all of them have such temporary key changes. It is of the greatest importance to use the correct alteration, not in terms of theory, but in terms of ease of sight-reading. A third must always appear as a third and not a diminished fourth or an augmented second. The way such a function might work would be through three modes: favor flats, favor sharps or let MuseScore do the job. Compared to using "j", it would only save a few keystrokes, but these add up quickly! MuseScore is certainly the fastest program for score editing, but it could even be faster (although fixing the existing bugs is certainly much more important than adding functionalities.)

In reply to by Pierre-Yves Saumont

In general, it's impossible to know for sure which spelling would be preferred in any given context - that's kind of an AI task. I'm not aware of any proposed algorithms that would guess correctly more often than the current, but if you have references to some, feel free to post links,.

Meanwhile, though, this is one reason I don't generally find MIDI keyboards to be very efficient at entering music notation; this basic info is missing and needs to be guessed and corrected far too often. Computer keyboard has a corresponding issue with needing to guess octaves, but to me, that's easier to predict, and also, you get instant audible feedback, so it's easy to correct even without looking at the screen.

In reply to by Marc Sabatella

It's very easy to know for sure which spelling would be preferred in any given context: it is the spelling the user wants, whatever the reason for this. Other applications (Finale and Frescobaldi, for example) make this possible by offering an option to favor flats or sharps. If an "intelligent" option is offered, it should be an additional possibility, not a replacement, which basically means replacing what the users want with what the programmers want. But most importantly, what programmers call "intelligent" is sometimes far from what they think. Here is a part of a score written in F (one flat) for the Tenor saxophone, so transposed in G and entered with the default alteration chosen by MuseScore:

Screenshot from 2022-03-22 17-44-14.png

This is absolutely unreadable. Here is the same after fixing the alterations:

Screenshot from 2022-03-22 17-45-21.png

Obviously, an option to "prefer flats" would be much more efficient than an intelligent program. Furthermore, if we enter bA/#G for the third note, MuseScore chooses #G. If we change it for bA, shouldn't an "intelligent" program make the same choice for the fourth note? It doesn't and insists on using a #G.

In reply to by Pierre-Yves Saumont

Indeed, in an ideal world, a magic setting to do what the user wants would be great. But of course, a program can't read minds. All it can do is assume that the user wants correct results. And there are almost no real-world situations where all flats or all sharps is correct - the vast majority of situations call for a mixture.

The example you show is only a couple of measures long, and presumably in the measures before and after, sharps are needed. So it's a case where an intelligent algorithm would be good - except, it would need to be one based not only on the key, but one capable of recognizing the stepwise nature of the line and which spelling enhances that - the same thing you and I can both see for ourselves in recognizing that one is bad and the other good.

In this case at least, the existing "Respell pitches" algorithm does that, so one possibility would be to incorporate that. But, I believe it looks ahead as well as behind, though, so it might need to be run only after completing a measure. On the other hand, that algorithm isn't ideal either, and other better alternatives have been suggested, and maybe some of those would be able to work well without needing to do the lookahead. Or it would continue to retroactively respell as it went along.

Anyhow, the point is, yes, doing what the user wants is best. But in real life, exclusively flats or exclusively sharps is almost never correct, and therefore almost never what a user would actually want for an entire piece. They might want it for just a measure or two, but not for the whole piece - not if they want correct results. That is to say, the goal of an intelligent algorithm is to do what the user wants, which 99% of the time is not literally exclusively flats or sharps, but rather, the right spelling according to the context.

So, I agree the default should always be to try to do what the user really wants. But what the user wants is "the correct answer, regardless of whether it's flat or sharp". That's what we should strive for. And to the extent we can't always achieve it, then also providing an option to allow the user to temporarily favor flats or temporarily favor sharps so passages like this can be entered directly if the default algorithm isn't improved enough to achieve this automatically.

In reply to by Marc Sabatella

I agree that replacing the algorithm used to select flat and sharp with the option to have only sharps or only flats would be a bad solution. This is what we have in Frescobaldi/Lilypond, and although it is better on average for my specific use case (but I often forget to change from one to the other!). it would probably be worse for a majority of users. What might be a better solution would be to have the choice between the intelligent algorithm and favoring only flats or sharps. This means three options instead of one or two (all flats / all sharps / algorithm). Another idea would be to make the algorithm more intelligent. I think that when the same note has been entered in the measure, the algorithm should select the same alteration. I doubt anyone would want to use a G# and an Ab in the same measure. This would need no additional intelligence. There are other considerations that could be taken into accounts, such as intervals), but this would probably need more intelligence in the program. Of course, a configurable intelligent algorithm with user-selectable rules would be ideal, but this is another story.

The solution I use at the moment is to hit "j" on the computer keyboard to switch the alteration. I don't even look at the screen (I am mainly copying scores which means having to keep the eyes on the paper score is as essential for performance as keeping the hands on the keyboard), which means I have to guess what alteration has been used by the algorithm. The result is that it is more productive to have the algorithm always selecting the wrong alteration than having it right 50% of the time! More seriously, rather than risking to change the right alteration for a wrong one with "j" (without looking at the screen), it's sometimes safer (but longer) to systematically use the arrows: up - down for a flat, down - up for a sharp.

In reply to by Pierre-Yves Saumont

Actually, I just thought of a deviously simple hack that could help in some of these cases. Right now, the accidental buttons on the toolbar are used during mouse and computer keyboard entry to add the appropriate accidental to the next note entered, but they are ignored during MIDI input. What if they simply acted as "favor this spelling" buttons? No UI change required, no current behavior adversely affected, but you'd have an easy way to toggle between favoring sharps or favoring flats on the fly while you enter notes. Probably about a two-line code change.

For the case of a repeated note within a measure, that one indeed would also be an easy win that has been requested before. If you change one C# to Db in a measure, favor Db for the rest of the measure. I think the code to do that would be somewhat more involved as it requires either maintaining state or else searching backwards through the measure on each note entry, but neither involve rocket science.

Still, the idea of a much more intelligent default algorithm that could spell notes based on context and not just based on key really is worth pursuing even though it might be difficult. In many cases - not saying this is true for you! - people use MIDI input because they basically don't read music that well but have worked something out on the piano and want to see it notated (normally, they also want real-time MIDI input, which of course we only partially support). I recall one concert I played that was a world premiere of a new ballet by a well-known drummer who had clearly created the score this way, as it was full of obvious errors like spelling E major triads as E Ab B. If a smarter default algorithm could spare others the pain I went through on that gig, it would be worth it!

In reply to by Marc Sabatella

I often have the same problem, playing in a big band and having to sight-read scores in which intervals are not correct because people are reluctant to use Cb or E#, to say nothing about double sharps and double flats. This wouldn't be a problem if the correct change was applied to a consistent part of the score, but often, it is applied to a single note. I too find that reading B-Eb or C#-F and realizing they are in fact thirds is weird because we (or is it only me?) generally read intervals rather than absolute notes.

Using the sharp and flat buttons in the toolbar as "favor this spelling" buttons would be great provided there are keyboard equivalents for these (are there?) An additional possibility to assign MIDI events to these would even be better.

Regarding an improved algorithm, automatically applying the same alteration to the same note in the same measure would certainly be fine. Going further might be tricky because there is probably no single consistent way to do it. Each user might have their own motivations implying different choices. The program would have to be made of rules selectable by the user. This is certainly a very interesting challenge, but... I think letting the user make the decision is much simpler if the decision made by the program doesn't suit his needs. Having three options would be optimal: favor sharps, favor flats, or let the program decide. (Of course, the third option would be the default.) But of course, the minimum would be to apply the same alteration that was used previously for the same note in the same measure. When you have a chromatic descent with four notes in each measure, such as in "One note samba" which I am entering presently, it's really annoying to have to hit "J" four times in a measure. Of course, it can be applied once to the four notes, but you have to quit Re-pitch mode for that. (I make extensive use of Re-pitch!) It can also be done afterward, while fixing the other problems of Re-pitch, such as note disappearing in tied chords, or glissandos disappearing when the second note is repitched, but it would be much better to be able to do it on the fly with a single key stroke and no selection involved.

In reply to by Pierre-Yves Saumont

There are no default shortcuts for the accidental commands, but you can define them in Edit / Preferences / Shortcuts. Don't search for the words "flat" and "sharp" as the command name uses the actual symbol instead, but searching for "note input" will find them.

I do think the sort of enhancements discussed here could eventually make MIDI input less inefficient, but as a practical matter for now, I do recommend computer keyboard entry as usually being more direct, FWIW.

In reply to by Marc Sabatella

You have certainly much more experience than me, but I still find the MIDI keyboard very efficient for my use case. I work mainly on Big Band scores, where many instruments share the exact same rhythm, articulations, and more. I first create the needed number of bars with rehearsal marks, bar lines, and repeats. Then, I enter the rhythm in Rhythm input mode, including all articulations, slurs, glissandi, text indications, etc. for the first instrument of a section. Then I repitch in Re-pitch mode using the MIDI keyboard. It's exactly like playing the melody rubato, a very easy and efficient process. I then copy the whole staff to the next instrument, and so on. I am able to enter a 15 page Big Band score in one workday, which I find very good compared to what I did with Finale (often a week) or Frescobaldi/Lilypond (two days on average).

The problem which slows the process is the fact that Re-pitch mode is buggy. A glissando often disappears while repitching. (Sometimes, it appears somewhere else on the page, in a random location where there are no notes. Repitching tied chords also doesn't work, the first chord is replaced with a single note tied to the same note in the second (correct) chord. It is easy to step back and retype the first chord, but this makes the tie disappear. But even with these bugs, I find using the MIDI keyboard very practical and efficient. (typing a five notes chord with a single stroke is very satisfying compared to using the computer keyboard. Plus I am sure I can speed the process by learning new tricks since I am very new to MuseScore.

He is an example of the glissando problem after repitch:

Screenshot from 2022-03-22 14-32-50.png

Here, the first staff has been copied to the second and is being repitched. There were originally three glissandi. Not only they all have disappeared, but even the second one of the first staff (measure 66, ending on a grace note) has disappeared too, although nothing has been modified on this staff. One of the disappeared glissandi is showing outside the score! (By the way, a glissando with no end note would be a great addition. I know they are not real glissandi but falls, but it's what the musicians are used to. (Plus falls do not render in MIDI play back.)

Attachment Size
Screenshot from 2022-03-22 14-32-50.png 55.97 KB

In reply to by Pierre-Yves Saumont

Best to open a new thread regarding any repitch issues, and attach the score and precise steps to reproduce the problem. But indeed, it's not a mode that gets a ton of testing from users, and hence no doubt there are as-yet-unreported bugs (in addition to the reported ones). I would note, though, you can also use repitch with computer keyboard, and it's quite efficient since you don't have to worry about enharmonics. I do this quite often myself in big band scores.

And I do get that for whole chords, MIDI has the potential to be faster than computer keyboard - but only to the extent that enharmonics don't present problems, and in practice with almost any jazz arrangement, they do, since chromaticism is so prevalent. Entering a five-note chord and then having to go back and fix spelling for two of the notes pretty much erases any potential advantage MIDI might have had, in my experience. Becomes more six/half-dozen. I'm not saying you shouldn't do it if it's comfortable for you, but I am suggesting you might be surprised at how efficient you can actually become using the computer keyboard as well.

In that other thread, you might also explain how it comes up that you are repitching entire chords, though. I don't normally use repitch for rhythm section parts, only horns, so chords aren't really a thing. Maybe you're trying to use it in conjunction with explode as well? Although you mention "copying" to the next staff, so I'm guessing not. FWIW, explode also works to copy one staff to the next several al in one step. Anyhow, again, best to discuss repitch issues in a separate thread, or threads.

Regarding the gliss with no end, try adding a "grace note after" and glissing to that. ut alternate rendering for falls, and playback support, would also be nice additions someday.

Do you still have an unanswered question? Please log in first to post your question.