Improve code for chord extension and modifier attributes

• Jan 20, 2020 - 16:47

I like that since version 3.3, chords can have their extension and modifier formats specified. I have noticed a case where the code fails to represent what is needed. The following example shows what happens when I use the modifier 'add2'. I think because the word 'add' contains three chord letters, the code doesn't see this as a modifier and displays them without extension or modifier formatting. However, the 2 in 'add2' is seen as a modifier and is formatted as such. An idea for code modification would be to flag when the chord has been named, therefore indicating that any subsequent text becomes automatically extension and/or modifier. Although an exception would have to be made for specified chord roots - example: Cadd2/E. As a side note, I do know that indicating 2 is supposed to be the same as 'add2'. However, some people like to differentiate that a 2 chord can be a chord where the 3 is replaced by 2, as in a 4 chord (C4). In that case, indicating 'add2' becomes valid and is clearer in such a case.

Attachment Size
Screen Shot 2020-01-20 at 11.55.30.png 39.34 KB


Musescore 3.6
I red about the chord symbol syntax and the way to change it in style sheets. I'd appreciate some help with it:
what is the difference (or definition) between an extension and a modifier? Numbers and brackets can be both?

I realized that interval numbers are not alterated consistently, what is the rule behind it?
So in C-5 the "-" is neither recognized as min nor as -5. C+5 is recognized right, but C#5 is C#(5) and not C(#5)?

A rule could be that all interval numbers are alterated with +/- and all chord letters with #/b. Exception is the 7 with 7 and j7 (double lowered 7th interval would be properly -7). So things like C##9 are not possible.

Another rule could be that everything is labelled behind the character, then the alteration symbol is irrelevant. I don't like this, because the pronunciation is plus five and not five plus.
Anyhow, a consistant, easy to learn rule in the standard chord style would be great.

In reply to by Maaattt

The best way to explain the difference is by example:


C= root
m = quality
9 = extension
b13 = modifier

In other words, quality is what says major/minor/diminished/augmented, extension is the first number after that says how high to stack the unaltered chord, modifiers are anything that comes after that says how to modify the chord.

C-5 is not a thing - at least not a thing that makes sense. "-" normally means minor; it defines the quality of the basic triad, chord not anything to do with an extension that follows. 5, as an extension, normally means omit the third, meaning the triad is neither major nor minor. So saying C-5 is not nonsensical - it's saying the chord is minor, but also neither major nor minor.

C5 is just C and G - the root and fifth of a triad that is neither major nor minor. C#5 is C# and G#. It doesn't mean C with a #5.

Actually, "add" is recognized as a single token even though it happens to use the same letters that could be roots, it just doesn't fall neatly into the categories we (OK, mostly me) set up. If you're looking at the code and see a good solution, feel free to try your hand at it!

In reply to by Marc Sabatella

Thank you Marc,
so a modifier is just another extension after the first one and it's handled the same way?
How do you specify what an alteration does? e.g. that a "b" or a "-" lowers the following interval number?
How do you specify that "7" is not j7 but minor 7?
There is no class=seperators, so /,() are just for layout reasons defined as extensions and modifiers?
I guess these things cannot be done in the chord style file, but must be defined internally?

>C-5 is not a thing - at least not a thing that makes sense
It's c, e, bg. Like C+5 there is C-5, why not? Chopin Nocturne No. 20, bar 29. If I want to omit the 3, than it's no3. I hate that "-" is sometimes m...

> If you're looking at the code and see a good solution
My programming skills are a bit rusted, but I'll have a look at it. There should be first an agreement about the "one and only" chord notation. I know you can't do it right for everybody, but a clear allocation what every character in the chord does is essential.

In reply to by Maaattt

"Extension" has a pretty specifc musical meaning - it's a number specifying the top note of the chord, and then implying the presence of the full stack of other notes up to that point. So, in C13, 13 tells you there is a whole stack of notes up to that point (1,3,5,7,9,11,13). Modifiers are anything after the extension, and pretty much by definition, they'll never be plain numbers - C79 is not a thing (although C69 is, so we special case that).

So, alterations like b5 or #11 are modifiers, but so are things like "no5" or "alt" or really anything that comes after the main extension. In the cases where there is no extension - where you have just a root, possibly a quality indicator like "ma" or "mi", and then you start seeing things that are conceptually modifiers like "sus4" or "add2", somehow you need to make judgement calls about how to categorize them. As I said, originally it really didn't matter since we didn't actually treat them differently. Now that we do, it would make sense to tweak this to be more consistent.

As for finding agreement about the "one and only" chord notation, you might want to solve some easier problems first, like world peace :-).

In reply to by Marc Sabatella

Slowly I get the point.
>Modifiers are anything after the extension, and pretty much by definition, they'll never be plain numbers - C79 is not a thing (although C69 is, so we special case that).
More exceptions: C13 is normally the stack without 11 (so 13 is the extension). C11/13 is the 11-stack plus the modifier 13. So 13 can be an extension, then it's a stack, or a modifier, then it's only a single note (and here it's a plain number!).

>originally it really didn't matter since we didn't actually treat them differently. Now that we do, it would make sense to tweak this to be more consistent.
I still don't see the point why you treat them differently. What about treating everything as a stack:
13 is always a stack (except when add or no is in front). So 13 means: plus 7, 9 and 13.
11 is also always a stack: plus 7, 9 and 11.
C11/13 means stacking twice, but then 7 and 9 are doubled. At the end of chord assembly, all duplicates have to be removed.
Alterations: + or # rises the following number, but the rest of the stack remains the same. So C(+11)/13 can be assembled. Same with +5/-5/m...
add and no: is no stack, but adding or removing a single note

>you might want to solve some easier problems first, like world peace :-).
First I have to solve this corona bullshit, but tomorrow I make peace -promised

In reply to by Maaattt

Well, C13 does include the 11, it's just most musicians would be convention choose to not play it. So really, 69 chords are the only exception. For all else, the first number is the top of the stack. This isn't some sort of MuseScore invention, it's standard chord symbol nomenclature.

Not sure what you mean when you write "I still don't see the point why you treat them differently". What "them", and different from what? I was talking about extensions and modifiers. They are treated differently from each other internally because in order to parse and understand a chord symbol, you need to understand what the different things mean. Thus, we need to know a "13" used as an extension implies a whole stack of notes (and carries with it a MusicXML "kind" of "dominant-13th"), whereas a "13" appearing in another context means no such thing. My point is, for symbols like "add2", there is no such relevant distinction, it means the same thing regardless of where in the chord symbol it appears.

In reply to by Marc Sabatella

>it's standard chord symbol nomenclature
I don't know which standard you mean? Does a standard exist?

>So really, 69 chords are the only exception.
locrian: m/-5/7, Locrian9: m/-5/11/-13, Lydian: j/+11, arab minor: -9/-13...
shure, you can find some shortcut symbols for this, but if you want to be exact and have all degrees of freedom, you have to describe every tone.

At the end a symbol can express three things: add tone(s), delete tone(s) or both. And when you are able to define this in the style sheet, you have all possibilities, e.g:
definition of symbol sus4 is delete 3 and add 4
definition of symbol 9 is add b7 and 9
the parser can now go through all symbols from back to front:
sus4/9 means add b7, add 9, add 4, remove 3

just an idea

In reply to by Maaattt

First, an unchanged extension is written. So there is no problem.

m11b5b13 (1)
m7b9b13 (

*1: Instead of m11b5b13 chord, simply write m7b5.
*2: Instead of m7b9b13 it will be sufficient to just write m7.

You have to make sure that other extensions actually have a role in the chord. It is unnecessary to write them in chords just because these changes exist.

Note: Many types of chords that can be written like this are not available (except dominant chords). Because they are in b9 relationship with chord sounds. And they change (damage) the quality of the base chord notes (1, 3, 5).
For example: For the m7b5 chord in the major scale, there is only one extension available and it will be 11. And usually this is not written either. The player knows this is in the category of color-notes and adds if the melody allows. // b13 cannot be used because it impairs rootlessness. b9 cannot be used because it conflicts with root note. (and this chord is not in the dominant7 category.)

In reply to by Ziya Mete Demircan

Hi Ziya,
I fully agree that Jazz musicians don't need more than 3 or 4 extension and modifiers. m,7,b5 is enough to know the rest. But why do you want to limit the chord notation when you can have it all?

You need more when you want to learn chords, when you analyse music or when you want to name whole scales. The attached example is again chopin with a hispanic scale, I named it C#-9/11/-13. Any hispanic people here would say e.g. C#-9 is enough, we know the rest, but not me, because I'm not spanish.

Anyhow, my proposed notation would allow all of these spellings, because every hispanic guy can define -9 as add 7, -9, 11, -13. And when he writes nothing else but spanish music, it's enough.

Attachment Size
example.png 23.47 KB

In reply to by Maaattt

In my opinion:

It is enough to write C#7(b9) for this chord. When we look at the left hand (this is the part that contains the arpeggio of the chord) we only see the C#7 chord. It is also necessary to show (b9) so that the player does not hit the 9th degree by mistake.

But it doesn't make sense to show all the notes (degrees) of the melody in the chord. If necessary, the required scale can be written above the staff in text format: dorian, lydian or spanish xyz. for counter-melody or improvisation.

However: Of course, everyone can add any chord shape and any chord degrees to their own writing. Nobody can restrict this.

Let's look at the example you gave above:
Did the composer give more than the C#7 chord to the accompaniment? Answer is no.
I think we will have given enough information when we add (b9) degree to this to avoid uncertainty.

According to the rule of "Ockham's razor": "entities should not be multiplied without necessity"
In other words: It makes no sense to write more information than necessary. And it just confuses.

But I'm not saying "everyone should write chords like this".
I just share my knowledge.
How you do it is up to you.

In reply to by Ziya Mete Demircan

Thanks for sharing your knowledge. I know, in Jazz you just write the base chord and play what you want over it. But e.g. with chopin I wanted to understand what he has written. So I can write hispanic over his notes and everybody who plays it can take a music lexicon and learn the spanisch scale. A lot easier is to write C#-9/11/-13.
But my initial question that I don't understand is: why did you -in the software- make a differentiation between quality, extension and modifier? As I understood this was not the case in the original prog?
To describe a chord you need two octaves with 24 notes (bits). Every symbol, no matter if it's quality, extension or modifier, does the same thing -adding or removing bits to these 24 bits? You could define which bits in the style sheet.
So why did you introduce this distinction? It makes things more complicated.

In reply to by Maaattt

We didn't "introduce" the distinction, this is how chord symbols have been written for at least a century.

The reason the software honors this standard distinction is, as I said, so we can parse and understand chords correctly. This includes things like being able to import and export MusicXML as well as things like being able to automatically superscript extensions and modifiers, which we have done almost since the beginning in the Jazz style. The parser was written around 2012, before that we had no way to understand chords. So if you wrote C7b5b9 but the program expected you to write C7b9b5, it just wouldn't be recognized as a valid chord, etc.

Again, if we were ivnenting our own form of music notation, sure, we could invent a new chord symbol nomenclature while we're at it, try to teach the world to start using it, then wonder why no one chooses MuseScore. As it is, instead we try to support standard music notation the best we can, so people can write standard chord symbols in standard ways and have the program understand them.

In reply to by Marc Sabatella

Now I understand a little bit better what's the reason. < kind > in MusicXML is "quality" in musescore and < degree > is extension. So you tried it to make things compatible? What are the basic "quality" chords in musescore: same as in the lilypond test suite? (attached)
I think that is rather arbitrary chosen in musicxml. < kind > does not only affect the basic 3 tones like m, aug, but all other notes too, so m13 is also < kind >. And you cannot say that < kind > includes only the basic scale tones, even the tristan chord is < kind >. I cannot see any advantage or structure until now. It's a lot more difficult to distiguish when 13 is kind or degree for the software. And why I'd want to distinguish at all?

Attachment Size
71f-AllChordTypes.xml 16.42 KB

In reply to by Maaattt

Quality is related to kind, but the MusicXML elected to define things a bit different - they actually combine kind quality and extension into a single tag, "kind". So they consider dominant-seventh and dominant-ninth different kinds, whereas most musicians would say they have the same quality but different extensions. But, MusicXML they also provide text attributes to allow things to be separated out. It's not really ideal, but it works reasonably well.

Anyhow, again, the distinctions being made here are pretty much universal to how all musicians read and write chord symbols. It's not a distinction we invented in order to support MusicXML, it's more like both MuseScore and MusicXML are trying to model how chord symbols actually work,. but choose slightly different ways of going about it.

In reply to by Marc Sabatella

> So they consider dominant-seventh and dominant-ninth different kinds, whereas most musicians would say they have the same quality but different extensions.
>the distinctions being made here are pretty much universal to how all musicians read and write

Is Cm7 a 7th-chord? Not really, because the tritone is missing. Is it a minor chord? Not really, because Cm7=Eb6/C and you hear this Eb major too. At the end you have to invent a new kind or quality like m7. That was only an easy example, MusicXML defined about 40 kinds. Finale gave up and defined everything as kind, so I had to write about 200 kinds there. I don't know how much musescore has, but it doesn't look like all musicians have the same interpretation of chords.
It seems to me, that the only reason to make these complicated definitions is to be (a little bit) compatible to MusicXML, that doesn't need these definitions at all. You can define kind "none" and all other tones in "degree" (not tested). The only 2 definitions you need is the base tone and an alternate bass tone. Every additional tone can be defined with a symbol, extension or however you name it. And everybody could make it compatible to his interpretation.

In reply to by Maaattt

Of course a Cm7 is a seventh chord - just not a dominant seventh chord. The "quality" of the chord , "minor seventh". This is also the MusicXML kind, so for seventh chords at least, they map to each other well.

Considering triads, there are only four qualities: major, minor, diminished, augmented. Considering seventh chords, there are six basic qualities: dominant seventh, major seventh, minor seventh , minor-major seventh, fully diminished, half-diminished. Technically there would also be two qualities based on augmented triads, but no one normally considered those to be distinction qualities at all.

Anyhow, once again, the point is were are not in the business of arbitrarily inventing new terminology here. We are simply providing a facility that reflect how chord symbols are actually used in the real world by real musicians over the past century or so. We make the distinctions we do because musicians make these same distinctions. MusicXML has nothing to do with it really, they just happen to be trying to meet the same goals as we are - representing how chord symbols are actually used in the real world.

In reply to by Marc Sabatella

>Considering triads, there are only four qualities: major, minor, diminished, augmented
What is sus2, sus4, -5, no1, no3, no5, -5no3, -5no1, add2, add-2, add+5, mno1, mno5? own qualities?
Every additional note exponentiates the number of qualities.
What are 6th-chords, quality or extension?
What is +5/7 augmented or dom-seventh?

Again: these categorizations might be useful for the player, but I cannot see why the software needs it? The parser can build the chord FROM THE CHORD NAME CHARACTERS. There is no need for him to know what kind of dominant seventh chord it is. The MusicXML exporter could need it, but that could be bypassed with kind none.

In reply to by Maaattt

No, those are not qualities of chords in any meaningful musical sense, again, based on the centuries-old conventional usage of that term.

Once again, the software makes the distinction because so does virtually every musician who uses chord symbols. It's important to be able to provide different rendering for the extension of a chord versus its quality or any modifiers. If you don't have a use for this feature, that's fine, you don't need to use it.

In reply to by Marc Sabatella

The discussion last longer than corona, and I don't know if we talk about the same thing. All we want is the software to translate chord names into tones. No knowledge about music is needed for that, just translate every character to tone(s). In opposite direction, tones to chord names, conventions make sense, but we don't need that.
Can you please make an example when, in your opinion, the distinction between quality, extension and modifier is important for chord names to tones.

In reply to by Jojo-Schmitz

the C adds the triad and the 13 the rest. So every character adds note(s) or deletes a note or both. That could be defined in chord style file.
C: there is no character for the major triad, so we have to improvise and alwayx add 3 and 5.
m: add -3, delete 3
13: add 7, 9, 13 user can define if he wants also the 11

In reply to by Jojo-Schmitz

MusicXML is mainly for printing music, so you don't need it there, just do < kind > none. Even the finale XML exporter doesn't recognize the easiest chords:
<?DoletFinale Unrecognized chord suffix "+5(7)" exported as text in part P1, measure 1?>

In reply to by Maaattt

C+5(7) is kind of nonsense as chords go - it doesn't follow the standard ways chords are written. So no surprise that might not be recognized by many programs.

But in any case, not sure where you got the idea MusicXML is for printing, it has nothing to do with that. It's for exchange of information between programs.

In reply to by Maaattt

You don't need to know anything about that, and I have no idea where you got the idea you did. Knowing the difference between an extensions and a modifier is only relevant if you want to use the options in Format / Style / Chord Symbols to customize the amount of superscripting given to these different elements of the chord symbol. That's an advanced feature very few people will ever need. but those very few few advanced people - yes, they most definitely will want to be able to specify different amounts of superscripting for extensions and kofiers, because it's pretty common to want more for the modifer than the extension.

Sounds like you are confused about something pretty fundamental here, but it isn't clear what. So, how about we start over, and pretend none of this discussion ever happened.

What is it you are actually having trouble doing, and how can we help you do it?

In reply to by Marc Sabatella

Thanks for help Marc. I just want always the same note(s) for the same symbol, the moment we have 3 different "interpretations" for 7.
C7 plays correct with minor7
Co plays no 7
Co7 plays a diminished 7
Cm-5/7 plays a major 7, no superscription
Cm-5/-7 plays a minor 7, no superscription

Why should a "quality 7" be another note than an "extension 7"?
The software thinks to much, just always the same note for the same symbol, e.g. 7 for minor, j7 for major, -7 for diminished. Could be user defined.

You are right, for superscription it can make sense to distinguish, but that could be easily solved in another way. Superscript everything after the first symbol or the first separator or define a separator like a dot after which is superscripted.

In reply to by Maaattt

So to be clear: it seems you are actually asking about playback. That wasn't at all clear, as the original subject of this thread had nothing to do with playback. It was always about how the chord symbol appears in the score, and the superscripting applied.

So, now that we've clarified you are talking about playback, I have no idea what you mean by "quality 7" or "extension 7" though. 7 is not a quality, it's an extension, but again, this has nothing to do with playback, nor is that something you would normally need think about unless you are trying to customize the appearance of the symbols.

So again, please, if you have an actual question about how to do something in MuseScore, can we focus on that?

Basically, all you should need to know is, if you type a chord symbol the way millions of musicians around the world would understand it, MuseScore will too. If you type something that musicians will not understand, neither will MuseScore. So if there is a particular chord you are having trouble getting to play the way you want, explain the chord, and we can tell you the standard way to notate that chord so that millions of musicians around the world will understand, and so will MuseScore.

In reply to by Maaattt

Cm-5/7 is not a chord symbol, it's a random string of letters and numbers.

Unfortunately, I still don't understand the question. I gather there is a particular chord you are trying to learn the standard name for, so that other musicians and MuseScore will play it the way you envision. maybe if you just tell us what notes are in the chord, we can more easily assist you by telling you the standard name for that combination of pitches, if there is one (not all combination of pitches have well-defined names).

In reply to by Maaattt

> "These categorizations might be useful for the player, but I cannot see why the software needs it?"
The software needs it exactly because that is how the thing works in real life for the players. It is extremely important for software to get programming concepts as close to the real world thing it is supposed to represent to ensure it behaves as much as expected when mimicking that real world thing.

In reply to by Maaattt

There is no one formal documented standard for chord symbols, no,. There are a number of very good references out there, though, all of which will be in agreement on basics like this.

In any case, MuseScore's job isn't to invent new symbols for things like arab minor chords or whatever, just to support the commonly used chord symbols that musicians all around the world use every day.

In reply to by Marc Sabatella

Hi! I've been following this thread, and have observed that not all Maaatt's questions were clear. And that recently, perhaps the underlying question was related to playback. However, given the breadth of questions, I'm guessing not all of it is related to playback.

If you may, here's my take. I'm understanding that a way of defining chords in a general way has been asked. And that by serving the way chords are usually applied, Musescore is already doing a good job. Here's where I'll add a question. I can understand that occasionally it might be advantageous to fully describe a chord in the way Maaatt's asking, and an example that seems clear to me would be on a pedagogical level - for example, having a score that names all the alterations of a chord, as only a teaching tool. Then later, in real practice a musician will write and perform chords in the way it was learned. So, on this premise - for the occasional use of a score writer to expressly break down the details of a chord - can Musescore currently do this? It could be useful.

In reply to by HotChocolateJazz

Hi, I'm not only talking about playback, it's for "realize chord symbols" too and for everything, you need the right notes from chord names. Again, the software recognizes the wrong notes:
Co plays no 7. If I want the triad, I write Cm-5
Co7 plays a diminished 7, but the 7 is normally used for a minor 7.
Cm-5/7 plays a major 7, should be a minor 7.
Cm-5/-7 plays a minor 7, should be a diminished 7.
The - sign is sometimes m and sometimes b.....

The software cannot do this, when you name apples sometimes bananas.
Just make unique symbols and everything is fine and a lot easier.

In reply to by Maaattt

Enclose all the -5's you use after the chord name in parentheses. Thus: no confusion about what the minus symbol means. (By both the software and the player.)
eg: C(-5) or C(b5) or better: Cdim

If the chord contains the seventh degree, use the degree containing "b" or "#" after the number 7. // with or without parentheses. ( I prefer the ones with parentheses in terms of reading clarity. )
eg: Cm7b5 or Cm7(b5) or Cm7-5 or Cm7(-5) // C7b9, C7(b9), CMaj7#11, CMaj7(#11)

About the dim chord:

the "dim" chord contains 3 notes.
Cdim or Co : c, eb, gb

In order for the dim chord to have four voices, it had to contain the 7th degree.
The seventh-degree of the dim chord has been decreased (diminished) twice.
Cdim7 : c, eb, gb, bbb // here bbb (b double flat) is the seventh degree of the Cdim chord.

And you can write it as Co7, C7o, C7dim, Cdim7. //The software will accept all of these.

In reply to by Ziya Mete Demircan

ok, parentheses work sometimes, but not for m-5(7). Slashes don't work for m-5/7 too.
In most sheet music books, the notation Cdim or Co denotes a diminished seventh chord with root C; but it may also happen, mostly in modern jazz books and some music theory literature, that Cdim or Co denotes a diminished triad (more commonly denoted Cm♭5), while Cdim7 or Co7 in these books denotes a diminished seventh chord (corresponding to Cm6♭5).
Same problem with Ø, so at the moment Ø and o have the same notes.

Suggestion again: This is a a bottomless pit. What speaks against defining a unique notation for every character? Then the user would not have 2000 possibilities any more, but only 1000. On the other side there would be clear and easy rules for the user and the software.

In reply to by Maaattt

Parentheses always work. Your problem is that as I said, m-5(7) is meaningless- it's just not a string of letters, numbers, and symbols that any musician would be able to understand.

Cdim and Co never denotes a seventh chord. It is a triad. it is true that musicians will often use their own judgment and choose to add a seventh, just as they might add ninths to dominant seventh chords, but the symbol itself is just a triad.

The half-diminished symbol technically means nothing without the 7. But here it is true, because it also dones't really mean anything different from diminished without a seventh, almost all musicians would figure that out and use their judgement to add the seventh. MuseScore should probably do the same, and I think there is an open feature request for it. Still, better to follow standard convention and include the 7.

Not sure what you mean about a bottomless pit. Chords symbols follow certain rules, MuseScore follows them the best it can. If you are proposing reinventing your own type of music notation and teaching the world to use it, then if it ever catches on, MuseScore will surely implement it. For now, though, we simply follow the standard practice used by millions of musicians around the world for over a century.

In reply to by Maaattt

Cm-5 is not how one denotes a triad. At least, not how musicians who have learned standard chord symbol notation do it. Co or Cdim is a triad. Cm-5 is a nonsense string. Cm5-/7 is a nonsense string but with a seventh in the bass, also nonsense. None of this is how chord symbols work. Musicians won't understand it, and neither will MuseScore.

In reply to by Maaattt

Yes, Cmb5 would at least be something people would figure out. The problem with "-" here is that this is also a symbol used for minor, so placing it right after the "m" makes it look like you are saying C minor minor 5. And placing a plain number 5 indicates a chord with no third. So it looks like you are saying this chord is doubly minor but has no third. Nonsense.

But, again, even if you change to "b", it's more understandable, but still non-standard. Why not simply use the standard, Cdim or Co? Makes life a lot easier to simply use the standard chord symbols.

But, as it happens, while very non-standard, MuseScore does manage to play either of these the way you seem to want - both Cm-5 and Cmb5 play as diminished triads, non-standard as the notation may be.

So I still don't understand your actual question here: what is it specifically you are having trouble figuring out how to do?

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