Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <measure number='30' implicit='yes'>
- <print new-page='yes'/>
- <barline location='left'>
- <bar-style>heavy-light</bar-style>
- <repeat direction='forward'/>
- </barline>
- <attributes>
- <key>
- <fifths>-1</fifths>
- <mode>major</mode>
- </key>
- </attributes>
- <direction>
- <direction-type>
- <dynamics default-y='-82'>
- <p/>
- </dynamics>
- </direction-type>
- <staff>1</staff>
- </direction>
- <direction>
- <direction-type>
- <words default-y='15' relative-x='4'>
- </direction-type>
- <staff>1</staff>
- </direction>
- <note>
- <pitch>
- <step>F</step>
- <octave>5</octave>
- </pitch>
- <duration>768</duration>
- <voice>1</voice>
- <type>quarter</type>
- <stem>down</stem>
- <staff>1</staff>
- <notations>
- <ornaments>
- <trill-mark default-y='20'/>
- <wavy-line type='start' number='1'/>
- <wavy-line type='stop' number='1'/>
- </ornaments>
- </notations>
- </note>
- </measure>
- from music21 import *
- s = converter.parse(filepath)
- # assuming key changes are the same in all parts, just get the first part
- p = s.parts[0]
- pFlat = p.flat
- keySigs = pFlat.getElementsByClass('KeySignature')
- for k in keySigs:
- print k.measureNumber
- //measure[attributes/key]/@number
Add Comment
Please, Sign In to add comment