Skip to content

Instantly share code, notes, and snippets.

@codingsnap
Created April 8, 2020 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingsnap/b7d66284bcfc665f41882827304ae7c4 to your computer and use it in GitHub Desktop.
Save codingsnap/b7d66284bcfc665f41882827304ae7c4 to your computer and use it in GitHub Desktop.
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