daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <measure number='30' implicit='yes'>
  2.     <print new-page='yes'/>
  3.     <barline location='left'>
  4.         <bar-style>heavy-light</bar-style>
  5.         <repeat direction='forward'/>
  6.     </barline>
  7.     <attributes>
  8.         <key>
  9.             <fifths>-1</fifths>
  10.             <mode>major</mode>
  11.         </key>
  12.     </attributes>
  13.     <direction>
  14.         <direction-type>
  15.             <dynamics  default-y='-82'>
  16.                 <p/>
  17.             </dynamics>
  18.         </direction-type>
  19.         <staff>1</staff>
  20.     </direction>
  21.     <direction>
  22.         <direction-type>
  23.             <words default-y='15' relative-x='4'>
  24.         </direction-type>
  25.         <staff>1</staff>
  26.     </direction>
  27.     <note>
  28.         <pitch>
  29.             <step>F</step>
  30.             <octave>5</octave>
  31.         </pitch>
  32.         <duration>768</duration>
  33.         <voice>1</voice>
  34.         <type>quarter</type>
  35.         <stem>down</stem>
  36.         <staff>1</staff>
  37.         <notations>
  38.             <ornaments>
  39.                 <trill-mark default-y='20'/>
  40.                 <wavy-line type='start' number='1'/>
  41.                 <wavy-line type='stop' number='1'/>
  42.             </ornaments>
  43.         </notations>
  44.     </note>
  45. </measure>
  46.    
  47. from music21 import *
  48. s = converter.parse(filepath)
  49. # assuming key changes are the same in all parts, just get the first part
  50. p = s.parts[0]
  51. pFlat = p.flat
  52. keySigs = pFlat.getElementsByClass('KeySignature')
  53. for k in keySigs:
  54.     print k.measureNumber
  55.    
  56. //measure[attributes/key]/@number
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top