]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/musicxml_generate_intervals.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / auxiliar / musicxml_generate_intervals.py
1 #!/usr/bin/env python
2
3 notes = "CDEFGAB"
4 alterations = [-1, 0, 1]
5
6 def print_note (octave, note, alteration):
7     print "      <note>\n        <pitch>\n          <step>%s</step>" % notes[note]
8     if alteration <> 0:
9         print "          <alter>%s</alter>" % alteration
10     print "          <octave>%s</octave>\n        </pitch>\n        <duration>1</duration>\n        <voice>1</voice>\n        <type>quarter</type>\n      </note>" % octave
11
12
13 print """<?xml version="1.0" encoding="UTF-8"?>
14 <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
15                                 "http://www.musicxml.org/dtds/partwise.dtd">
16 <score-partwise>
17   <movement-title>Various piches and interval sizes</movement-title>
18   <part-list>
19     <score-part id="P1">
20       <part-name>MusicXML Part</part-name>
21     </score-part>
22   </part-list>
23   <!--=========================================================-->
24   <part id="P1">
25     <measure number="1">
26       <attributes>
27         <divisions>1</divisions>
28         <key>
29           <fifths>0</fifths>
30           <mode>major</mode>
31         </key>
32         <time symbol="common">
33           <beats>2</beats>
34           <beat-type>4</beat-type>
35         </time>
36         <clef>
37           <sign>G</sign>
38           <line>2</line>
39         </clef>
40       </attributes>
41 """
42
43 start_octave = 5
44
45 for octave in (start_octave, start_octave+1):
46     for note in (0,1,2,3,4,5,6):
47         for alteration in alterations:
48             if octave == start_octave and note == 0 and alteration == -1:
49                 continue
50             print_note (octave, note, alteration)
51 #             if octave == start_octave and note == 0 and alteration == 0:
52 #                 continue
53             print_note (start_octave-(octave-start_octave)-(1-(7-note)/7), (7-note)%7, -alteration)
54
55 print """    </measure>
56   </part>
57 </score-partwise>
58 """