Allchordtypes#396
Conversation
|
@ejhumphrey can you take a look? I still know nothing about chords. |
|
Jumping in here, since I think @ejhumphrey may be permanently out of the game on this stuff, and I think that regex is my fault anyway. 🤣 High level, I don't think the proposed change is consistent with Harte's grammar, as described in https://qmro.qmul.ac.uk/xmlui/bitstream/handle/123456789/534/HARTETowardsAutomatic2010.pdf?sequence=1 chapter 4 (starting around page 86) and summarize in BNF form on page 105: In JAMS we extended the definition a little to fill in some obvious gaps in supported qualities(ie missing 11 and 13), but the basic structure of the grammar is unchanged. (Note: the grammar above can be standardized into a fully right-recursive form, and therefore collapses down to a regular expression, which is how I generated the monster regex in the first place.) As I understand it, the notation there allows accidentals on notes or intervals, but not qualities ("shorthand" in the above). If you want to raise or flatten a particular note within a chord, I suppose you would do it by something like This isn't to say we can't change how the grammar is defined, but at present we have a reasonably functional implementation that can parse strings that validate under the current grammar and do the "right" things with, eg, identifying pitch classes, roots, and bass notes. Changing the grammar would necessitate changing the downstream parsing as well, and I'd prefer to avoid that unless we have a strong reason to. "Strong reason" would be, eg, failing to handle existing and widely used annotations, or inability to represent certain common qualities. |
|
I was thinking on this a bit more, and I suppose the reasoning behind not allowing accidentals on chord qualities is that it could lead to some ambiguities. G#:9 and G:#9 would mean two entirely different things, and while the grammar we use requires a : to separate the root from the quality, it still seems brittle to me. (Especially if some datasets require automated reformatting to separate root from quality, eg they use G7 instead of G:7.) AFAIK, G:7(#9) is much clearer and more commonly used for exactly this reason. But if I have this wrong, someone who actually plays music should chime in. 😁 |
|
Hi! Thank you @bmcfee for the detailed explanations and ideas! This pull request simply aims to make use of all the qualities that are listed in So, for me and if I'm correct, the options are to either modify the regex or remove the I understand that I understand the broader scope though, and I will be happy to cancel the pull request or have it rejected - I don't know what is the preferable way - please let me know if I need to do something and I will be happy to do it :) |
Ah, that's an excellent point: you're correct that the validator blocks some of the qualities that are included in the QUALITIES dict. I suppose this came about because the qualities dict and the regex were developed independently and later merged. The merger happened because the old validator (originally developed with the QUALITIES dict, which I think can be traced back to Tae Min Cho's dissertation work circa 2012) was slow and not entirely correct. "Correct" is a little squishy here because I don't think there was a formally defined grammar in use at that point. We later brought in the regex as a way to codify what strings are and are not supported as chord labels.
Yeah, that's a good (if not exactly supported) use case. I've done similar things elsewhere.
In this case, I think I would opt for removing the unreachable qualities, given the potential ambiguity noted above. Since there are no reachable code paths that depend on them, I don't think this will result in any behavior change. This is not to say that we shouldn't ever expand the qualities and/or regex, in particular with extended chords. There is actually a separate issue #274 and PR #275 that has to do with improving support for above-octave extensions, and I think we can do a lot more with that, eg by allowing a two-octave bitmapping (so that 9 and 2 can be kept distinct if needed, etc). But that's getting a bit off topic. |
Hi! I've noticed that not all chord qualities in
mir_eval/chord.pyline 245were understood by
chord.encode.For example, there was an error when calling:
The fix was to add the missing chord qualities (I think they were 3) in the "monster" regext in line 347. So the change is only there.
I did some test on my own but couldn't properly integrate it in the official
test/test_chord.pyfile, so I simply left a comment on how I did my tests there.That's my first pull request on another repository on github so I'll be happy follow any instructions to make it more proper / professional. Thanks!