saebekassebil / teoria

Javascript taught Music Theory
http://saebekassebil.github.io/teoria
MIT License
1.31k stars 114 forks source link

Alternate Parsing Strategies #132

Open Quantalabs opened 3 months ago

Quantalabs commented 3 months ago

In addition to #129, any chord with a modified extension is generated incorrectly, not just #11 chords:

torqueville commented 3 months ago

♯13? Isn't ♯13 = ♭7?

saebekassebil commented 3 months ago

Hey @Quantalabs and thank you for your interest in an otherwise very old library :)

In general in music theory a chord will include all the tertian extensions up to the one written in the chord - not just the one added. I believe this is the "classical" understanding of chord notation. The "problem" is, that these chords rarely are used/seen in real life, and when we find them in (particular) jazz notations, many of the tertian extensions are omitted. Theoretically though they could be included. Otherwise they should have been notated as "add9" or "add11" chords.

To me it sames very hard if not impossible to make one set of rules as to how chords should be processed. I've chosen the "theoretical" one - although that will not give you the outcome you probably wanted, when inputting jazz chords.

If anything there should probably be two (or more) "modes" of parsing. One meant for parsing jazz notations and one for theoretical purposes.

So a D9 will include both 7 and 9, D11 will include both 7, 9 and 11 and D13, 7, 9, 11 and 13. While a Dadd9 is D, F#, A and E (no seventh)

I hope this clarifies why I've chosen this way of parsing chords.

saebekassebil commented 3 months ago

♯13? Isn't ♯13 = ♭7?

Well practically yes, but theoretically they will have different "meanings" in for example harmonic analysis.

EDIT: Also I should note, that the "Ab#5b9" does not add a "b7", but a minor 7th (the note gb)

torqueville commented 3 months ago

Well practically yes, but theoretically they will have different "meanings" in for example harmonic analysis.

I'm just a bedroom jazz guitarist, but I have never seen any chord ♯13 before, and it seems to defeat the purpose when combined with a major seventh. But I'm no expert.

EDIT: Also I should note, that the "Ab#5b9" does not add a "b7", but a minor 7th (the note gb)

To me, a minor 7 = ♭7 and gb is a diminished seventh (𝄫7).

saebekassebil commented 3 months ago

Well practically yes, but theoretically they will have different "meanings" in for example harmonic analysis.

I'm just a bedroom jazz guitarist, but I have never seen any chord ♯13 before, and it seems to defeat the purpose when combined with a major seventh. But I'm no expert.

EDIT: Also I should note, that the "Ab#5b9" does not add a "b7", but a minor 7th (the note gb)

To me, a minor 7 = ♭7 and gb is a diminished seventh (𝄫7).

its a question of notation. In chord notation a "7" added to the end of a chord (C7, E7), means adding the minor seventh, thus producing a "dominant chord", while specifically writing "maj7" means adding the major seventh.

The augmented sixth (#13) of C is A#, while the minor seventh is Bb. On a guitar (and piano) these two notes might result in the same key or fret pressed, but they are different for some other instruments and tuning - and also different in harmonic analysis.

I agree that it seems far-fetched to have that chord happen. Some (often american) jazz notation forms will sometimes write "maj" just meaning the major triad - but this is where I propose to have a different "parsing mode"

For those interested I believe Wikipedia and teoria pretty much agree on the "stacking of thirds" concept in music theory. See for example https://en.wikipedia.org/wiki/Thirteenth

Quantalabs commented 3 months ago

In general in music theory a chord will include all the tertian extensions up to the one written in the chord - not just the one added. I believe this is the "classical" understanding of chord notation.

Sorry for flagging this as incorrect, I need to brush up on my classical music theory. When I was playing with the demo it instantly jumped out at me as someone who works with a lot more jazz notation than classical.

I agree that it seems far-fetched to have that chord happen. Some (often american) jazz notation forms will sometimes write "maj" just meaning the major triad - but this is where I propose to have a different "parsing mode"

This reminds me of the option in MuseScore than lets the user choose between the "literal" and "jazz" interpretations of chord symbols. This could most definitely be extended as there are multiple different ways of parsing chord symbols.

I think, taking from MuseScore, we could extend this from not just a "mode" but to a new object: teoria.Interpretation which could let not only select a pre-defined interpretation, but perhaps create new ones?

My proposed structure is as follows:

  1. The constructor takes in 3 arguments:
    1. All defined chord symbols in the interpretation. The user could also specify whether or not to fallback to a pre-defined interpretation if the chord provided does not exist in the definition. This argument would put chord symbols in groups, so one can group "Maj", "M", and "ma" in group 1, for example.
    2. A generator function, that generates the chords. The library can do the heavy lifting, and provide the group and all the extensions/alterations etc.
    3. Optional parsing function, in case the user wants to alter the way chords are parsed
  2. When a user uses this new object to generate a chord, we first parse the chord, check if it exists in the interpretation, and then provide it to the correct generator, or throw an error.
  3. The constructor can also take in a single string as an argument for a pre-defined interpretation.

Should we implement this, or some variant, I think it might be best to drop daccord and integrate all this functionality into teoria, or rebuild dacccord from the ground up, as I don't think this will work well with the restructuring.

I think this structure provides significant advantages:

  1. Much easier to add other ways of notating chords (roman numerals or Nashville)
  2. Easier to have more versatile and accurate notation

Please let me know anything you'd like to add or if there are any faults in the structure (there probably are).