Skip to content

[patch] Spell fully and half-diminished sevenths as vii°7 and viiø7 - #395

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/289-diminished-seventh-numerals
Oct 8, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/289-diminished-seventh-numerals

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #289

What was wrong

Key.QualitySuffix had two problems:

  • It dropped the 7 from a fully diminished seventh, so Bdim7 became vii°, the same as the triad.
  • It spelled a half-diminished seventh (m7b5) as vii°7, which ChordFromRomanNumeral reads back as Bdim7. The chord changed identity on a round trip.

Change (Semantics.Music/Key.cs)

  • QualitySuffix:
    • A Diminished-quality chord with a Dominant (minor) seventh is now half-diminished: ø + 7.
    • A Diminished seventh always emits 7, so the fully diminished seventh becomes °7.
    • Triads (vii°), °maj7, and every non-diminished quality come out as before.
  • ChordFromRomanNumeral: a leading ø in the suffix now passes through to Chord.Parse, which already reads ø/ø7 as m7b5. °, dim, + and aug are unchanged.
  • Doc comment now lists viiø7 as an example.

Tests (RomanNumeralParseTests)

  • Parse_IsInverseOfRomanNumeralOf now also round-trips vii°7 and viiø7.
  • New tests:
    • Bdim gives vii° and Bdim7 gives vii°7.
    • Bm7b5 gives viiø7 and round-trips back to Bm7b5.
    • viiø7 parses to Bm7b5.
  • The existing Parse_LeadingToneDiminishedSeventh (vii°7 → dim7) still passes, unchanged.

With Key.cs reverted to main, 4 of these fail. With the fix, the full Semantics.Test suite passes: 1469 passed, 0 failed, 8 skipped.

The triage suggested pairing this with #281/#284 (Chord.Parse reading °7/b5/Maj7). This PR doesn't change Chord.Parse. It only makes the Roman-numeral path use the °/ø vocabulary Chord.Parse already accepts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRrKUmpjRrYrUchAi6wGqR


Generated by Claude Code

RomanNumeralOf gave a fully diminished seventh no suffix after °, so
Bdim7 read "vii°", the same as the triad. A half-diminished seventh read
"vii°7", which ChordFromRomanNumeral parses back as fully diminished.
QualitySuffix now emits "°7" for a diminished seventh and "ø7" for a
diminished triad under a minor seventh, and ChordFromRomanNumeral reads
ø as half-diminished.

Fixes #289

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRrKUmpjRrYrUchAi6wGqR
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Key.RomanNumeralOf drops the seventh from a fully diminished 7th ("Bdim7" → "vii°"), and a half-diminished 7th round-trips to fully diminished

2 participants