Fix file permissions.
[lilypond.git] / buildscripts / musicxml_generate_timesignatures.py
blob20e34cbf84f00c0651eb51a844b738135ed83a28
1 #!/usr/bin/env python
3 notes = "CDEFGAB"
4 alterations = [-1, 0, 1]
6 def print_measure (nr, beats, type, params = "", attr = "", barline = ""):
7 print """ <measure number="%s">
8 <attributes>
9 %s <time %s>
10 <beats>%s</beats>
11 <beat-type>%s</beat-type>
12 </time>
13 </attributes>
14 <note>
15 <pitch>
16 <step>C</step>
17 <octave>5</octave>
18 </pitch>
19 <duration>1</duration>
20 <voice>1</voice>
21 <type>quarter</type>
22 </note>
23 %s </measure>""" % (nr, attr, params, beats, type, barline)
25 first_atts = """ <divisions>1</divisions>
26 <key>
27 <fifths>0</fifths>
28 <mode>major</mode>
29 </key>
30 <time symbol="common">
31 <beats>2</beats>
32 <beat-type>4</beat-type>
33 </time>
34 <clef>
35 <sign>G</sign>
36 <line>2</line>
37 </clef>
38 """
40 final_barline = """ <barline location="right">
41 <bar-style>light-heavy</bar-style>
42 </barline>
43 """
45 print """<?xml version="1.0" encoding="UTF-8"?>
46 <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
47 "http://www.musicxml.org/dtds/partwise.dtd">
48 <score-partwise>
49 <movement-title>Different time signatures</movement-title>
50 <part-list>
51 <score-part id="P1">
52 <part-name>MusicXML Part</part-name>
53 </score-part>
54 </part-list>
55 <!--=========================================================-->
56 <part id="P1">
57 """
59 measure = 1
61 print_measure (measure, 2, 2, " symbol=\"common\"", first_atts)
62 measure += 1
64 print_measure (measure, 4, 4, " symbol=\"common\"")
65 measure += 1
67 print_measure (measure, 2, 2)
68 measure += 1
70 print_measure (measure, 3, 2)
71 measure += 1
73 print_measure (measure, 2, 4)
74 measure += 1
76 print_measure (measure, 3, 4)
77 measure += 1
79 print_measure (measure, 4, 4)
80 measure += 1
82 print_measure (measure, 5, 4)
83 measure += 1
85 print_measure (measure, 3, 8)
86 measure += 1
88 print_measure (measure, 6, 8)
89 measure += 1
91 print_measure (measure, 12, 8, "", "", final_barline)
92 measure += 1
94 print """ </part>
95 </score-partwise>
96 """