Repository navigation
[patch] Spell the raised seventh above a flat seventh as #7, not a lowered tonic - #406
Merged
Merged
Conversation
…wered tonic Scale.DegreeOf broke the chromatic tie toward the flat spelling even when the flat candidate only existed by wrapping round the octave, so G# in A aeolian came out as degree 1 lowered and Key.RomanNumeralOf labelled the minor-key leading-tone chord "bi°". When the flat would wrap, the tie now goes to the sharp spelling of the last degree; every other tie still prefers the flat. Fixes #304 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176ydtLncnCjKchHXEPCh7H
|
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #304
What changed
Scale.DegreeOfspells a chromatic pitch against its nearest scale neighbours and breaks a tie toward the flat. Above the last degree there is no upper neighbour, so the flat candidate wrapped round the octave to degree 1. In every flat-seventh mode, semitone 11 then came out as a lowered tonic: G# in A aeolian was(1, -1), andRomanNumeralOf(G#dim)returnedbi°.Now, when the flat spelling only exists by wrapping, the tie goes to the sharp spelling of the last degree. A strictly closer flat still wins, and every other tie still prefers the flat, so major-key bII, bIII, bVI and bVII don't change.
Tests
ScaleTests.DegreeOf_RaisedSeventhAboveAFlatSeventhIsSharpSeven: G# in A aeolian is(7, +1)KeyTests.RomanNumeral_MinorLeadingToneChordIsSharpSeven:G#dimin A aeolian andF#dimin G mixolydian both give#vii°KeyTests.RomanNumeral_MinorLeadingToneChordRoundTrips:RomanNumeralOf→ChordFromRomanNumeralgives backG#dimWith the
Scale.cschange reverted, the first two tests fail. The round-trip test passes either way and is there as a guard. The existingDegreeOf_ChromaticPrefersFlatOfUpperDegreestill passes. The fullSemantics.Testsuite passes on net10.0 (1483 passed, 8 skipped).🤖 Generated with Claude Code
https://claude.ai/code/session_0176ydtLncnCjKchHXEPCh7H
Generated by Claude Code