Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate Parsing Strategies #132

Open
Quantalabs opened this issue Apr 8, 2024 · 6 comments
Open

Alternate Parsing Strategies #132

Quantalabs opened this issue Apr 8, 2024 · 6 comments

Comments

@Quantalabs
Copy link

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

  • A C11#13 is different than a CMaj7#13, the latter does not contain the 9th or the 11th.
  • The problem is that teoria is adding all the chord tones below the specified extension to the chord. It should be adding first the base chord, eg. C, E, G, B for a CMaj7, and then adding the extension on top, in this case an F#.
  • Although the example was a Maj7#13, the problem applies to b13, b11, and of course #11 chords too.
  • This also is present in triads. When trying out examples on the README, I noticed the Ab#5b9 chord, adds a b7- not only is this incorrect since there shouldn't be a 7, but if this were a Maj7 chord, rather than a major triad, it would include the 7, not the b7.
@torqueville
Copy link

torqueville commented Apr 8, 2024

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

@saebekassebil
Copy link
Owner

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
Copy link
Owner

saebekassebil commented Apr 8, 2024

♯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
Copy link

torqueville commented Apr 8, 2024

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
Copy link
Owner

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
Copy link
Author

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).

@Quantalabs Quantalabs changed the title Incorrect chord generation Alternate Parsing Strategies Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants