Created
April 8, 2020 21:06
-
-
Save codingsnap/b7d66284bcfc665f41882827304ae7c4 to your computer and use it in GitHub Desktop.
This file contains 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
notes_demo = [] | |
for ele in elements_to_parse: | |
# If the element is a Note, then store it's pitch | |
if isinstance(ele, note.Note): | |
notes_demo.append(str(ele.pitch)) | |
# If the element is a Chord, split each note of chord and join them with + | |
elif isinstance(ele, chord.Chord): | |
notes_demo.append("+".join(str(n) for n in ele.normalOrder)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment