Repository navigation
Music: chord spellings, extended inversions, full roman numerals, and analysis fixes - #488
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kytFdmCCteiaenE8PdQDn
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kytFdmCCteiaenE8PdQDn
|
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.



Requested by Matt · project thread
Fixes #378, fixes #368, fixes #379, fixes #356, fixes #365, fixes #469, fixes #470, fixes #468, fixes #357, fixes #337, fixes #465, fixes #377.
Chord symbols
+at the start of the body is the augmented mark before a number too.C+7isCaug7,C+9isCaug9,Cm+7isCm7#5.C+5still reads as a raised fifth, andC7+9is stillC7#9.Cmaj7sus4,Cmaj9sus4andCM7sus2parse, and the writer no longer treats them as inexpressible, so the exhaustive round-trip test now covers them.9/11/13is an added tone (C7(13)isC7add13,C7(b9,13)isC7b9add13). A major-seventh mark supplies a missing seventh (Cm(maj7)isCmmaj7).C7(9,9),C9(9)andC7(maj7)are still refused. The README grammar is updated.Voice(octave, inversion)raises each tone below the target bass by as many octaves as it takes, so the 4th to 6th inversions ofC9/C13put the ninth, eleventh or thirteenth lowest. The root comes from MIDI arithmetic. A voicing outside MIDI 0..127 throws oneArgumentOutOfRangeException(octave).Roman numerals
Key.RomanNumeralOfdrops sixths and tensions: C6 → "I", G13 → "V7", C7b9 → "I7", even thoughChordFromRomanNumeralparses "I6", "V13" and "V7b9" #469:RomanNumeralOfwrites the chord's whole body, soC6→I6,G13→V13,C7b9→I7b9,Cmaj7sus4→Imaj7sus4. The slash bass is dropped (documented), becauseI6already means an added sixth.ChordFromRomanNumeralreads the suffix as a chord body against the root it has already resolved (a new internalChordSymbolReader.TryReadBody), soVb9is G with a flat nine rather than F#9, andIb5is C major-flat-five.ChordFromRomanNumeral(RomanNumeralOf(c)) == cfor 46 chord shapes on every degree of C major and C minor.Analysis
ChordFromRomanNumeral) are spelled against major or natural minor on the same tonic, chosen by the mode's third. G in C major pentatonic isV/Dominant and G → C is Authentic. C in A minor pentatonic isIII. Modes with more than seven degrees are unchanged.ChromaticChords. A key counts as minor when its scale has a minor third and a minor seventh.Fmin C is still borrowed, andD7is still V/V.V/vii°/V/ii°. The existing row that expectedV/III+in A harmonic minor was replaced withV/iv, as the issue asks.Progression.InferKeyignores sevenths and extensions: "C7 | Fmaj7 | C7" is inferred as C major, though C7's B♭ is not in C major #468:InferKeysmultiplies the root/triad score by the fraction of chord tones, slash bass included, that are in the scale. A minor key's dominant counts its leading tone as diatonic.C7 | Fmaj7 | C7andFmaj7 | C7now infer F major, andBbmaj7 | F7infers Bb major. The comment now matches the code for sus, power and altered-fifth chords (they score 1.0).ChromaticKind.AugmentedSixthis now produced. A chord holds pitch classes, not spellings, so the variants are read by shape on the lowered sixth degree.Ab7no5is It+6 andAb7b5is Fr+6.Ab7is Ger+6 only when it resolves to the dominant or to a cadential six-four (tonic over the dominant). Otherwise it stays chromatic. The rule is documented on the enum member and in the README.Testing
dotnet test Semantics.Test -c Release: 1836 total, 0 failed, 12 skipped. The new cases are inChordGrammarTests,ChordRoundTripTests,InversionTransposeTests,RomanNumeralParseTestsand the newAnalysisFixesTests.Generated by Claude Code