]> git.donarmstrong.com Git - lilypond.git/blob - mf/musexgen.mf
release: 0.0.54
[lilypond.git] / mf / musexgen.mf
1 %  this is musexgen.mf
2
3 % Here are two types of pianobrackets available, they are absolute compatible,
4 % so choose this one you prefer (search for '%!!!')
5
6 path p;
7 picture save_pic;
8
9 pen thin_pen, med_pen;
10 thin_pen:= pencircle scaled max(1,.2pt+blacker);
11 med_pen:= pencircle scaled med;
12
13 %%%%%%%
14 message ("<big braces>");
15 %%%%%%%
16
17 firstbrace:=20;  % smallest brace is 2*20 pt (\simeq 14mm)
18 lastbrace:=67;   % largest brace is 2*67 pt (\simeq 47mm)
19
20 %%% from Stanislav Kneifl
21
22 def drawpianobracket (expr height) =
23   u# := 1nhh#/5pt# * 1pt#;
24   v# := (height/40) * 1pt#;
25   define_pixels (u, v);
26 %  beginchar (height-firstbrace, 1.25nhh#, 0, 0);
27   beginchar (height-firstbrace, 0, 0, 0);
28     z1 = origin;
29     z2 = (4.7u, 7v);
30     z3 = (3.6u, 16.5v);
31     z4 = (1.9u, 25v);
32     z5 = (2.28u, 32v);
33     z6 = (w, 40v);
34     penpos1 (max(1,0.1u), 125);
35     penpos2 (1.2u, 180);
36     penpos3 (3.2u, 195);
37     penpos4 (2.5u, 180);
38     penpos5 (1.14u, 180);
39     penpos6 (max(2,0.3u), 150);
40     penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
41     currenttransform := identity reflectedabout ((0,0),(1,0));
42     penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
43     currenttransform := identity;
44 % inserted
45     currentpicture:=currentpicture shifted (round(-1.75nhh), 0);
46 %
47   endchar;
48 enddef;
49
50 def bigbrace(expr v) =
51   beginchar (v-firstbrace, 0, 0, 0);
52   " brace vsize "&decimal round(2v*pt#)&"pt";
53     vwidth:=v*pt;
54     hwidth:=max(.1vwidth,3.25pt);
55     hwidth:=min(hwidth,6.5pt);
56     actwidth:=.035vwidth;
57     x1=.25nhw;  y1=vwidth;
58     x2l=-.8hwidth; y2=2/3vwidth;
59     x3r=.2hwidth; y3=1/3vwidth;
60     x4=-hwidth; y4=0;
61     penpos1(max(1,.25pt),-35);
62     penpos2(1.5med+actwidth,40);
63     penpos3(1.75med+actwidth,45);
64     penpos4(max(1,.2pt),-90);
65     penstroke z1e..z2e..z3e..{left+sw}z4e;
66     currentpen:= pencircle; draw z1..z2..z3..{left+sw}z4;
67     addto currentpicture also currentpicture reflectedabout (origin, right);
68     penlabels(1,2,3,4);
69     currentpicture:= currentpicture shifted (round(-.75nhh), 0);
70   endchar;
71 enddef;
72
73 %!!! comment the line 'bigbrace' and uncomment the line 'drawpianobracket'
74 %    or leave it like it is !!!
75
76 for v=firstbrace upto lastbrace :
77     bigbrace (v);
78 %    drawpianobracket (v);
79 endfor;
80
81 %%%%%%%
82 message ("<glissandi-elements>");
83 %%%%%%%
84 %  glissando{slide} (slope [degree])
85
86 def glissando (expr theta)=
87   x1=-1; y1=0; z2=z1+(.5nhw,0); z3=z1+(nhw+1,0);
88   p:= z1{1.25up+right}..{1.25down+right}z2{1.25down+right}..{1.25up+right}z3;
89   pickup penrazor scaled (.075nhw+thick) rotated (theta+65);
90   draw p rotated theta;
91   labels (1,2,3);
92 enddef;
93
94 for slope=1 upto 8:
95
96   beginchar(56+slope-1, (cosd(10slope))*nhw#,(sind(10slope))*nhw#, 0);
97   " glissando element slope "&decimal (10slope)&" degree";
98     glissando (10slope);
99     save_pic:= currentpicture;
100   endchar;
101
102   beginchar(64+slope-1, (cosd(10slope))*nhw#, (sind(10slope))*nhw#, 0);
103   " glissando element slope "&decimal (-10slope)&" degree";
104     currentpicture:= save_pic reflectedabout (origin, right);
105   endchar;
106
107 endfor;
108
109 %%%%%%%
110 message ("<guitar chords>");
111 %%%%%%%
112 def tabulatur (expr nd)=
113   hwidth:=1/5w;
114   x1=x2=y2=y3=0; x3=w; y1=-nd;
115   fill unitsquare xscaled (w+2thinwidth) yscaled (med+.2pt)
116        shifted(-thinwidth,0);
117   pickup thin_pen;
118   for v=1 upto 5 :
119     draw (z2--z3) shifted (0,v*-hwidth);
120   endfor;
121
122   for v=0 upto 5 :
123     draw (z1--z2) shifted (v*hwidth,0);
124   endfor;
125   labels (1,2,3);
126 enddef;
127
128 %beginchar(72, 15/4nhw#, 0, 0);" grid";
129 %  tabulatur (54/10nhh);
130 %endchar;
131
132 %beginchar(73, 15/8nhw#, 0, 0); " dot";
133 %  fill fullcircle scaled .675nhh shifted (w,-.45nhh);
134 %endchar;
135
136 %beginchar(74, 15/4nhw#, 0, 0); " bar";
137 %  fill unitsquare xscaled w yscaled .3nhh shifted (0,-.6nhh);
138 %endchar;
139
140 shift:=.15nhh;
141 def Circle (expr nh)=
142   x1l=.1w; x2=x4=.5w; x3l=.9w;
143   y1=y3=.5nh+shift; y2=.1nh+shift; y4=.9nh+shift;
144   penpos1(med, 0);
145   penpos2(thinwidth,90);
146   penpos3(med,180);
147   penpos4(thinwidth, 270);
148   penstroke z1e..z2e..z3e..z4e..cycle;
149   pickup pencircle; draw z1..z2..z3..z4..cycle;
150 enddef;
151
152 %beginchar(75, 3/4nhw#, 0, 0); " circle";
153 %  Circle (.9nhh);
154 %endchar;
155
156 def Cross (expr nh)=
157   x1=x3=.2w; x2=x4=.8w;
158   y1=y4=.2nh+shift; y2=y3=nh-.2nh+shift;
159   pickup med_pen;
160   draw z1--z2; draw z3--z4;
161 % labels (1,2,3,4);
162 enddef;
163
164 %beginchar(76, 3/4nhw#, 0, 0); " cross";
165 %  Cross (.9nhh);
166 %endchar;
167
168 %beginchar(77, 3/4nhw#, 0, 0); " blank";
169 %endchar;
170
171 beginchar(72, 3nhw#, 0, 0);" small grid";
172   tabulatur (108/25nhh);
173 endchar;
174
175 beginchar(73, 3/2nhw#, 0, 0); " small dot";
176   fill fullcircle scaled .54nhh shifted (w,-.36nhh);
177 endchar;
178
179 beginchar(74, 3nhw#, 0, 0); " small bar";
180   fill unitsquare xscaled w yscaled .24nhh shifted (0,-.48nhh);
181 endchar;
182
183 beginchar(75, 3/5nhw#, 0, 0); " small circle";
184   Circle (.72nhh);
185 endchar;
186
187 beginchar(76, 3/5nhw#, 0, 0); " small cross";
188   Cross (.72nhh);
189 endchar;
190
191 % the next seems to be senseless, but it isn't
192
193 beginchar(77, 3/5nhw#, 0, 0); " small blank";
194 endchar;