]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/musicxml_generate_keys.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / auxiliar / musicxml_generate_keys.py
1 #!/usr/bin/env python
2
3 notes = "CDEFGAB"
4 alterations = [-1, 0, 1]
5
6 def print_measure (nr, fifth, mode, atts1 = "", atts = "", final = ""):
7     print """    <measure number="%s">
8       <attributes>
9 %s        <key>
10           <fifths>%s</fifths>
11           <mode>%s</mode>
12         </key>
13 %s      </attributes>
14       <note>
15         <pitch>
16           <step>C</step>
17           <octave>4</octave>
18         </pitch>
19         <duration>2</duration>
20         <voice>1</voice>
21         <type>half</type>
22       </note>
23 %s    </measure>""" % (nr, atts1, fifth, mode, atts, final)
24
25 first_div = """        <divisions>1</divisions>
26 """
27 first_atts = """        <time symbol="common">
28           <beats>2</beats>
29           <beat-type>4</beat-type>
30         </time>
31         <clef>
32           <sign>G</sign>
33           <line>2</line>
34         </clef>
35 """
36
37 final_barline = """      <barline location="right">
38         <bar-style>light-heavy</bar-style>
39       </barline>
40 """
41
42 print """<?xml version="1.0" encoding="UTF-8"?>
43 <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
44                                 "http://www.musicxml.org/dtds/partwise.dtd">
45 <score-partwise>
46   <movement-title>Different Key signatures</movement-title>
47   <identification>
48     <miscellaneous>
49       <miscellaneous-field name="description">Various key signature: from 11
50             flats to 11 sharps (each one first one measure in major, then one
51             measure in minor)</miscellaneous-field>
52     </miscellaneous>
53   </identification>
54   <part-list>
55     <score-part id="P1">
56       <part-name>MusicXML Part</part-name>
57     </score-part>
58   </part-list>
59   <!--=========================================================-->
60   <part id="P1">"""
61
62 max_range = 11
63 measure = 0
64 for fifth in range(-max_range, max_range+1):
65     measure += 1
66     if fifth == -max_range:
67         print_measure (measure, fifth, "major", first_div, first_atts)
68     else:
69         print_measure (measure, fifth, "major")
70     measure += 1
71     if fifth == max_range:
72         print_measure (measure, fifth, "minor", "", "", final_barline)
73     else:
74         print_measure (measure, fifth, "minor")
75     
76
77 print """  </part>
78 </score-partwise>"""