Skip to content

Chord.Parse stacks the natural 9th/11th under an altered one: "C13#11" sounds both F and F#, "C13b9" both Db and D #341

Description

@matt-edmondson

What's wrong

In Chord.ApplyExtensions (Semantics.Music/Chord.cs:437-444), the 13 branch always adds Nine | Eleven | Thirteen and the 11 branch always adds Nine | Eleven. Only the bare 9 branch (:445-451) skips Nine when FlatNine or SharpNine is already set. So an altered tension is added next to its natural version instead of replacing it.

Failure scenario

Probe output against HEAD:

Input Tensions Tones Problem
C13b9 FlatNine, Nine, Eleven, Thirteen [0,4,7,10,13,14,17,21] Db and D
C13#11 … […,17,18,…] F and F#
C13#9 … […,14,15,…] D and D#
C11b9 … […,13,14,…] Db and D

Anything built on ChordTones inherits the extra notes, Voice() included, so a voicing plays a minor second cluster the symbol never asked for.

The round-trip corpus doesn't catch this because the wrong chord round-trips: C13b9 prints C713b9, which reparses to the same wrong set.

Suggested fix

Apply the rule the 9 branch already uses:

  • In the 13 and 11 branches, add Nine only when neither FlatNine nor SharpNine is set.
  • Add Eleven only when SharpEleven is not set.

Acceptance criteria

  • Tone assertions for C13b9, C13#9, C13#11, C11b9 and a combined one such as C13b9#11 contain the altered tension and not the natural one.
  • Existing C13, C11 and C9 tone assertions 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