Skip to content

Chord.Parse reads "Cm7#5", "Cm#5" and "Cm+" as augmented chords with a major third (Cm7#5 comes back as Caug7) #340

Description

@matt-edmondson

What's wrong

In Chord.DetermineQuality (Semantics.Music/Chord.cs:360-376), both the aug/+ branch and the fifthAlteration > 0 branch return ChordQuality.Augmented without looking at IsMinor(body). Augmented always has a major third, so the spelled minor third is dropped.

Commit fecd433 (#335) fixed exactly this for the lowered fifth at :365-369 (IsMinor(body) ? Diminished : MajorFlatFive), but the raised-fifth branch right below it was not changed.

Failure scenario

Run against HEAD with a small console probe:

Input Parsed as Tones Correct tones
Cm7#5 Augmented + dominant 7, prints Caug7 [0,4,8,10] [0,3,8,10]
Cm#5 Caug [0,4,8] [0,3,8]
Cm+ Caug [0,4,8] [0,3,8]

The parse succeeds and returns a different set of notes. m7#5 is a common lead-sheet symbol, so a chart containing it is silently voiced with E instead of Eb.

Suggested fix

Pick one:

  • Represent it: add a minor-sharp-five quality, mirroring MajorFlatFive (third = 3, fifth = 8), and return it from both branches when IsMinor(body) is true. It should print back as Cm#5 / Cm7#5.
  • Reject it: return false from TryParse for a minor third with a raised fifth, rather than returning a wrong chord.

Acceptance criteria

  • Chord.Parse("Cm7#5") has tones [0,3,8,10] and round-trips, or TryParse returns false.
  • The same holds for Cm#5, Cm+ and Cmaug7.
  • C7#5, Caug and C+ are unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions