Desbeers / Chord-Provider

A ChordPro file parser and editor for macOS Sonoma. Show the song with the chords for guitar, guitalele or ukulele and export them to PDF.
https://desbeers.github.io/Chord-Provider/
GNU General Public License v3.0
68 stars 9 forks source link

Show unrecognized chord name instead of mangling the name with '?' #15

Closed karlding closed 6 months ago

karlding commented 6 months ago

(I'm not sure if this is more of an issue with the SwiftlyChordUtilities dependency or Chord Provider itself, so feel free to move the issue)

I have a chordpro file which contains a Gadd4 chord (also known as Gadd11).

Since Chord Provider doesn't recognize this chord, I defined a chord chart + fingering for it:

{define: Gadd4 base-fret 1 frets 3 2 0 0 1 3 fingers 3 2 0 0 1 4}

Some [Gadd4]lyrics here

This rendered as:

G?*

in both the display and PDF output which was a surprise, since I expected this to display the chord name I wrote.

A quick fix might be just to add support for add4 chords. Looking at the way add9 is supported in SwiftlyChordUtilities, it appears like you explicitly added a case for Chord.Quality to cover addNine. Should there also be an addFour/addEleven?

Although thinking about this some more, add chords are just the major triad with an "added" interval above the root, so theoretically it would be possible to construct arbitrary add chords with intervals over the entire octave. However, the number of such chords is bounded if we assume we’re naming chords by “normalizing” the added interval within the octave (so add11 would be written as add4). So perhaps the path forward is to generalize add to allow for arbitrary intervals?

It seems reasonable that the chord database may not be exhaustive, but my main issue is that the name gets mangled in the display (and also PDF output). For chords that aren't recognized, could the original name be kept as-is instead of mangling the name?

Desbeers commented 6 months ago

Hello Karl,

Thanks for reporting this issue.

Your are correct, the name of a chord should not be mangled if unknown. Fixed.

Generalising the add chords needs a rewrite of the chord-parsing so for now I just added the add4 and add11 qualities.

The fixes are in the SwiftlyChordUtilities package and I’ve updated Chord Provider to use this new version.

If any other issues, just let me know!