Skip to content

Refactor/harmony - #547

Merged
azfoo merged 9 commits into
TimeLineAnnotator:devfrom
azfoo:refactor/harmony
Jul 28, 2026
Merged

Refactor/harmony#547
azfoo merged 9 commits into
TimeLineAnnotator:devfrom
azfoo:refactor/harmony

Conversation

@azfoo

@azfoo azfoo commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator
  • Roman numeral figured bass — dynamically computes MusAnalysis figured-bass suffixes for all chord qualities and inversions using music21's chord structure, replacing the previous hard-coded triad/seventh table. Handles triads, seventh, ninth, eleventh, and thirteenth chords at any inversion; extended chords drop implied intermediates (e.g. the 7th in a 9th chord). Augmented-sixth, suspended, and other bespoke qualities keep a static table.
  • Modal scale types — mode labels now display the mode name in a readable font alongside the tonic (e.g. "C Dorian", "B♭ Phrygian") rather than rendering the mode name through the MusAnalysis glyph font.
  • Quality-aware inversion clamping — when changing a chord's quality in the inspector or the add-harmony dialog, the inversion is clamped to the maximum valid for the new quality. Closes Crash when switching to chord that has no 3rd inversion #468.
  • Chord symbol fallback for uninvertible qualitiesletter_symbol now catches ChordException and falls back to root position when music21 cannot construct the requested inversion (e.g. minor-sixth at inversion 3). Closes 3rd Inversion of Minor 6th chord crashes the app #376.
  • Add-harmony dialog sync — selecting a note/quality/accidental from the combo boxes now writes the chord symbol back into the text field, so the two entry methods stay in sync.
  • Refactor — harmony constants (NOTE_NAME_TO_INT, INT_TO_NOTE_NAME, etc.) are now derived from music21 at import time rather than duplicated by hand; _INV_TO_STRING is the single source of truth for inversion labels across the dialog and inspector.

@azfoo
azfoo force-pushed the refactor/harmony branch 2 times, most recently from 3a3b7a0 to de6557a Compare June 2, 2026 10:18
@azfoo
azfoo requested a review from FelipeDefensor June 23, 2026 12:45
@azfoo
azfoo force-pushed the refactor/harmony branch 2 times, most recently from 3a4e416 to b4ee754 Compare July 21, 2026 11:34
azfoo added 9 commits July 27, 2026 16:58
the if block prevented applied_to from clearing once it was set through the text box.
The test was silently never receiving the qtui fixture (its first
parameter was bound to self instead), so it only passed by riding on
Get.MAIN_WINDOW state left over from earlier tests in the same session.
It failed outright when run in isolation.
Deriving inversion counts purely from music21's CHORD_TYPES tone counts let the Inspector and Add Harmony dialog offer non-root inversions for Italian/French/German sixths, the Neapolitan, the Tristan chord, and power chords, even though to_roman_numeral/letter_symbol_label render a fixed string for these regardless of bass note, making the control a silent no-op.

Document per-quality why each is locked to root position and, for Neapolitan and power (the two that do have real inversions in principle), what's actually blocking support: Neapolitan's "N6" abbreviation in music21 isn't the classical triad at all but an unrelated 4-note all-interval tetrachord, and power chords can't be inverted through music21's normal API and have no established figured-bass notation.
@azfoo
azfoo force-pushed the refactor/harmony branch from b4ee754 to 614a065 Compare July 27, 2026 14:58
@azfoo
azfoo merged commit a400113 into TimeLineAnnotator:dev Jul 28, 2026
11 checks passed
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.

1 participant