Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Recognize and Count Chord Symbols Imported as Lyrics in MusicXML Using Music21? #1727

Open
XuhongQiu opened this issue Aug 26, 2024 · 1 comment

Comments

@XuhongQiu
Copy link

Hi, I'm looking to understand how to use Music21 to identify chord symbols that have already been imported as lyrics in a MusicXML file. I used MuseScore to create a monophonic melody along with corresponding chords and now hope to use Music21 to recognize these chord symbols (especially non-harmonic chords) and tally them. Unfortunately, I've only found methods for analyzing and importing Roman numeral annotations and analyzing lyrics in the user manual. Is there anyone who could offer me some inspiration?

@mscuthbert
Copy link
Member

are you thinking of something like?

for el in s[note.GeneralNote]:
    if el.lyric:
        # probably do a try/except here
        cs = harmony.ChordSymbol(el.lyric)
        m = el.activeSite
        m.insert(el.offset, cs)

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

No branches or pull requests

2 participants