]> git.donarmstrong.com Git - lilypond.git/blob - input/mutopia/claop.py
* input/regression/font-name.ly: don't use PS fonts for
[lilypond.git] / input / mutopia / claop.py
1 import sys
2
3
4 copyright = """copyright 1992. Peter Wallin. Verbatim redistribution
5 permitted """
6
7
8
9 """
10
11 This file produces the Score for CLA(O)P II  -- a piece by
12 Peter Wallin (pwallin@post8.tele.dk).
13
14 The score produced by this file is
15 copyright 1992. Peter
16 Wallin. Verbatim redistribution permitted
17
18
19
20
21 From: Rune Zedeler <rune@zedeler.dk>
22 Sender: lilypond-devel-admin@gnu.org
23 To: LilyPond Devel <lilypond-devel@gnu.org>
24 Subject: CLA(O)P II
25 Date: Wed, 12 Jun 2002 02:14:05 +0200
26
27 The concert went well.
28 I talked to the composer and he agreed to include the score in lilypond 
29 as long as his name was maintained and as long as he kept the copyrights 
30 - that is people are not allowed to make changes to the score.
31
32 I think including CLA(O)P II is a Good Thing because it stress tests 
33 lilypond very well. This is also why I think that including only an 
34 excerpt from it is stupid.
35 I am not sure how the inclusion should be.
36 The raw lilypond file is 750k; gzip'ed 40k.
37 Alternatively one could include the generating c-file into lilypond.
38 Or perhaps we should just wait till I manage to redo it in scheme... :-)
39
40 -Rune
41
42 """
43
44
45
46 #//set to 1, 385 to typeset the whole score
47 start_measure =1
48 no_measures = 385
49 voices = 48
50
51 durs = ["16","8","8.","4"]
52 grund = [
53   "x x x x xx x",
54   "x x xx xx x xx x",
55   "xx xx x xx xx x xx xx x ",
56   
57   "x x x xx xx ",
58   "x xx xx x xx xx ",
59   "x xx x xx xx x xx xx x x",
60   
61   "x x xx xx x ",
62   "xx xx x xx xx x ",
63   "xx x xx xx x xx xx x xx ",
64   
65   "x xx xx x x ",
66   "x xx x xx xx x x",
67   "x x xx xx x xx xx x xx x",
68   
69   "xx xx x x x ",
70   "xx x xx xx x xx ",
71   "x xx xx x xx xx x xx xx ",
72   
73   "x xx x x x x",
74   "x x xx xx x xx x",
75   "xx xx x xx xx x xx xx x ",
76   
77   "xx x x x xx ",
78   "x xx xx x xx xx ",
79   "x xx x xx xx x xx xx x x",
80   
81   
82   "x x x x xx x",
83   "xx xx x xx xx x ",
84   "xx x xx xx x xx xx x xx ",
85   
86   "x x x xx xx ",
87   "x xx x xx xx x x",
88   "x x xx xx x xx xx x xx x",
89   
90   "x x xx xx x ",
91   "xx x xx xx x xx ",
92   "x xx xx x xx xx x xx xx ",
93   
94   "x xx xx x x ",
95   "x x xx xx x xx x",
96   "xx xx x xx xx x xx xx x ",
97   
98   "xx xx x x x ",
99   "x xx xx x xx xx ",
100   "x xx x xx xx x xx xx x x",
101   
102   "x xx x x x x",
103   "xx xx x xx xx x ",
104   "xx x xx xx x xx xx x xx ",
105   
106   "xx x x x xx ",
107   "x xx x xx xx x x",
108   "x x xx xx x xx xx x xx x",
109   
110   "x x x x xx x",
111   "xx x xx xx x xx ",
112   "x xx xx x xx xx x xx xx ",
113   
114   "x x x xx xx ",
115   "x x xx xx x xx x",
116   "xx xx x xx xx x xx xx x " 
117 ]
118
119 accents = ''
120 accstr = '' 
121
122
123 def stemme(st) :
124   adr = [0] * (385*16)
125   pos = st*48+44
126
127   for i in range(0,100):
128     adr[384*16-i*28] = ord ('X')
129
130   for k in range(0,48):
131     if k: 
132       for j in range(0,8):
133         adr[pos] = 0
134         pos += 1
135         
136     for j in range(0,4):
137       for c in grund[k]:
138           if c ==' ' :
139               adr[pos] = 0
140           else:
141               adr[pos] = 3-j+ord ('a')
142           pos += 1
143           
144   for i in range(0,385*16):
145     ac = accents[48*4+i-((48+24-st)%48)*4]
146     if ac:
147       adr[i]=ac
148   
149   return adr
150
151
152 def print1(ch) :
153   accstr=""
154   if ch >= ord('A') and ch <=ord('D'):
155     ch += ord('a')-ord('A')
156     accstr="->"
157
158   namestr = ''
159   cr = chr (ch)
160   
161   if cr=='a':
162       namestr="a"
163   elif cr=='b':
164       namestr="b"
165   elif cr=='c':
166       namestr="d'"
167   elif cr=='d':
168       namestr="e'"
169   elif cr=='X':
170       namestr="\\property Staff.NoteHead \\override #'style = #'cross c'"
171       accstr="-^ \\property Staff.NoteHead \\revert #'style"
172   else:
173       print 'foo', cr, chr(ch), ch == 'd', "A%sA" % cr
174       raise 'foo'
175
176   return (namestr,accstr)
177
178
179 namestr = ''
180 accstr = ''
181
182 def print4(ptr):
183     val = reduce (lambda x,y : x|y,  ptr)
184 #    sys.stderr.write ('%d ' % val)
185     if not val:
186         sys.stdout.write ("r4 ")
187     else:
188         dur=-1
189
190         global namestr
191         global accstr
192         if ptr[0]==0:
193             sys.stdout.write ("~")
194             (namestr, accstr) = print1(val)
195
196         for c in ptr:
197             if c==0:
198                 dur += 1
199             else:
200                 if dur>=0:
201                     sys.stdout.write( "%s%s%s " % (namestr,durs[dur],accstr))
202                 (namestr, accstr)  = print1(c)
203                 dur=0
204       
205         sys.stdout.write( "%s%s%s "% (namestr,durs[dur],accstr))
206   
207
208
209 def print8(ptr) :
210     val = reduce (lambda x,y : x|y,  ptr)
211     if val:
212         print4(ptr[0:4])
213         print4(ptr[4:8])
214     else:
215         sys.stdout.write ("r2 ")
216
217
218 def print16(ptr):
219     val = reduce (lambda x,y : x|y,  ptr)
220     if val:
221         print8(ptr[0:8])
222         print8(ptr[8:16])
223     else:
224         sys.stdout.write("R1 ")  
225
226 accents = [0] *(500*16)
227 for i in range(0,32):
228     pos=i*12*16+4*48
229     accents[pos]=ord('D')
230     if(i<31) :
231         if(i>0):
232             accents[pos+4*12]=ord('A')
233         accents[pos+4*23]=ord('C')
234         accents[pos+4*35]=ord('B' )
235
236
237 sys.stdout.write ('%%{\n %s \n %%}' % copyright)
238 sys.stdout.write (r"""
239 \include "paper11.ly"
240
241 \header {
242     title = "CLA(O)P II"
243     composer = "Peter Wallin (1992-93)"
244     copyright = "Copyright  (1992-93) Peter Wallin, verbatim redistribution permitted"
245 }
246
247
248 """)
249
250
251
252
253
254 for st in range(1,voices+1):
255     str=stemme(st)
256     ststr=chr((st-1)/24+ord('A')) + chr ((st-1)%24+ord('A'))
257     sys.stdout.write( """
258
259 stemme%s = \\notes {\n\\clef percussion
260 \\property Staff.instrument = \"%d\"\n
261 \\property Staff.instr = \"%d\"\n
262 \\property Score.currentBarNumber = #%d\n""" % (ststr,st,st,start_measure))
263     
264     for i in range(start_measure-1, start_measure-1+no_measures):
265       print16(str[i*16:i*16+16])
266       sys.stdout.write (" |\n")
267     
268     sys.stdout.write ("\\bar\"|.\" }\n")
269     
270
271 sys.stdout.write (r"""
272 \score {
273     \notes <
274         \property Score.BarNumber \override #'padding = #2.5
275         \property Score.autoBeamSettings \override
276           #'(end * * * *) = #(ly:make-moment 1 4)
277         \property Score.skipBars = ##t
278         \context StaffGroup <
279             \property StaffGroup.Stem \override #'direction = #1
280 """)
281
282
283 for   st in range(1,voices+1):
284   ststr=chr((st-1)/24+ord('A')) + chr ((st-1)%24+ord('A'))
285   ststr = 'stemme' + ststr
286   sys.stdout.write (r"""\context Staff="%s" \%s
287 """ % (ststr,ststr))
288
289 sys.stdout.write (r""">
290     >
291     \paper {
292         linewidth = 26.0\cm
293         indent = 0
294         textheight = 38.0\cm
295         %hsize = 30.0 \cm
296         %vsize = 42.0 \cm
297
298         \translator {
299             \StaffContext 
300             StaffSymbol \override #'line-count  = #3
301             minimumVerticalExtent = #'(-3 . 3)
302         }
303     }
304     
305 }
306 """)