Skip to content

Import better m21p Chord root() functions - #343

Merged
mscuthbert merged 2 commits into
masterfrom
chord-root-m21p
Oct 1, 2026
Merged

mscuthbert merged 2 commits into
masterfrom
chord-root-m21p

Conversation

@mscuthbert

@mscuthbert mscuthbert commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

music21p had a more sophisticated root() function -- use it here also. Now will find roots properly for missing thirds in 7th chords, etc.

AI-Assisted (Claude)

m21j's root search only checked the 3rd and 5th and fell back to the
lowest pitch, so e.g. G4 C5 had root G (m21p: C, 2nd inversion), and
the stacked-thirds result was never cached. Now uses m21p's stacked-
thirds fast path, rootness scoring, and bass-as-root for 13ths.

root() also takes a string or Note, snaps to a matching chord pitch,
and has m21p's `find` option. Empty chords throw "no pitches in chord".

AI-assisted (Claude)
@mscuthbert
mscuthbert merged commit c172250 into master Oct 1, 2026
4 checks passed
@mscuthbert
mscuthbert deleted the chord-root-m21p branch October 1, 2026 00:43
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