mdanka / momo-chords

Chord parser and printer.
https://momo-chords.miklosdanka.com
Apache License 2.0
9 stars 1 forks source link

Impossible to parse C69 #29

Open no-chris opened 5 years ago

no-chris commented 5 years ago

Hello!

I've been working on separate stuff for a while, now ready to come back to your lib :)

So based on what I understand here: https://github.com/mdanka/momo-chords/blob/b22e162431a2c9bcb5d04b940d92157124863adb/src/chordSymbolParser.ts#L179 it seems that, by design, it is not possible to parse the chord C69, quite common in jazz/bossa, because intervals always come before addeds. That makes C96 parsable, but not C69. That also explains why I had trouble getting A7+, which can only be written A+7, when the former is a pretty common form as well.

Possible solution would be to change the parsing algorithm so the order of the different chords parts does not matter? Could be something like:

What do you think?

mdanka commented 5 years ago

Hi! Thanks for all the comments everywhere :) I'm quite busy right now, but I will read through these and have a think hopefully later this week!

On Mon, 13 May 2019 at 17:52, Christophe Noël notifications@github.com wrote:

Hello!

I've been working on separate stuff for a while, now ready to come back to your lib :)

So based on what I understand here: https://github.com/mdanka/momo-chords/blob/b22e162431a2c9bcb5d04b940d92157124863adb/src/chordSymbolParser.ts#L179 it seems that, by design, it is not possible to parse the chord C69, quite common in jazz/bossa, because intervals always come before addeds. That makes C96 parsable, but not C69. That also explains why I had trouble getting A7+, which can only be written A+7, when the former is a pretty common form as well.

Possible solution would be to change the parsing algorithm so the order of the different chords parts does not matter? Could be something like:

  • parse the root note, the quality, then the bass note, and isolate the rest. That seems to be pretty stable and being opinionated here should not remove any flexibility from the user.
  • from here the "rest" is a bit more blurry and if I agree that most cases respect the order you have defined, this might not always be the case. So we instead of parsing everything "at once", we could loop on the different regexp, removing the matches as we find them. For ex: get the intervals take what's left. Get the added, take what's left. Etc. until we have no more characters in the input string?

What do you think?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mdanka/momo-chords/issues/29?email_source=notifications&email_token=AB5SG37O3C3GXUQMM5TCQM3PVGFCBA5CNFSM4HMRFOKKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GTO4THQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5SG32VEGFVVHMDNKOOB4LPVGFCBANCNFSM4HMRFOKA .

no-chris commented 5 years ago

I took a different approach, nevermind ! :) https://github.com/no-chris/chord-symbol

mdanka commented 5 years ago

Ah nice :) Looks good - I will check it out. Sorry for not following up on these in a timely way.

On Sat, 8 Jun 2019 at 21:26, Christophe Noël notifications@github.com wrote:

I took a different approach, nevermind ! :) https://github.com/no-chris/chord-symbol

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mdanka/momo-chords/issues/29?email_source=notifications&email_token=AB5SG32RNTV7NVEZBQPDDCLPZQBWPA5CNFSM4HMRFOKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXH34WQ#issuecomment-500153946, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5SG3YXDUAB5D5WAOGOSTDPZQBWPANCNFSM4HMRFOKA .

no-chris commented 5 years ago

no pb, still think my PRs add some value here, though ;)