1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
%
% This file is part of MusiXTeX
%
% MusiXTeX is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% MusiXTeX is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with MusiXTeX; see the file COPYING. If not, write to
% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
font_identifier := "music_special_symbols";
% Here are two types of pianobrackets available, they are absolute compatible,
% so choose this one you prefer (search for '%!!!')
% free pos: 196-255
mode_setup;
font_size 20pt#;
nhh#:=5pt#;
nhw#:=6pt#;
qqs#=.4pt#; %width of lines
qqw#=10pt#; %length of horizontal stroke.
med#:=1/33designsize;
thick#:=1/16designsize;
thinwidth:=0.125pt;
define_pixels(qqw,nhh,nhw);
define_blacker_pixels(med,thick);
qqs:=ceiling(qqs#*hppp); % the way rule widths are calculated
pair sw;
sw = down+left;
path p;
picture save_pic;
pen line_pen;
line_pen:= pencircle scaled qqs;
%%%%%%%
message ("<glissandi-elements>");
%%%%%%%
def glissando (expr theta)=
x1=-1; y1=0; z2=z1+(.5nhw,0); z3=z1+(nhw+1,0);
p:= z1{1.25up+right}..{1.25down+right}z2{1.25down+right}..{1.25up+right}z3;
pickup penrazor scaled (.075nhw+thick) rotated (theta+65);
draw p rotated theta;
labels (1,2,3);
enddef;
for slope=1 upto 8:
beginchar(slope-1, (cosd(10slope))*nhw#,(sind(10slope))*nhw#, 0);
" glissando element slope "&decimal (10slope)&" degree";
glissando (10slope);
save_pic:= currentpicture;
endchar;
beginchar(8+slope-1, (cosd(10slope))*nhw#, (sind(10slope))*nhw#, 0);
" glissando element slope "&decimal (-10slope)&" degree";
currentpicture:= save_pic reflectedabout (origin, right);
endchar;
endfor;
%%%%%%%
message ("<guitar chords>");
%%%%%%%
def tabulatur (expr nd)=
hwidth:=1/5w;
x1=x2=y2=y3=0; x3=w; y1=-nd;
fill unitsquare xscaled (w+2thinwidth) yscaled (med+.2pt)
shifted(-thinwidth,0);
pickup pencircle scaled max(1,.2pt+blacker);
for v=1 upto 5 :
draw (z2--z3) shifted (0,v*-hwidth);
endfor;
for v=0 upto 5 :
draw (z1--z2) shifted (v*hwidth,0);
endfor;
labels (1,2,3);
enddef;
shift:=.15nhh;
def Circle (expr nh)=
x1l=.1w; x2=x4=.5w; x3l=.9w;
y1=y3=.5nh+shift; y2=.1nh+shift; y4=.9nh+shift;
penpos1(med, 0);
penpos2(thinwidth,90);
penpos3(med,180);
penpos4(thinwidth, 270);
penstroke z1e..z2e..z3e..z4e..cycle;
pickup pencircle; draw z1..z2..z3..z4..cycle;
enddef;
def Cross (expr nh)=
x1=x3=.2w; x2=x4=.8w;
y1=y4=.2nh+shift; y2=y3=nh-.2nh+shift;
pickup pencircle scaled med;
draw z1--z2; draw z3--z4;
labels (1,2,3,4);
enddef;
beginchar(16, 3nhw#, 0, 0);" small grid";
tabulatur (108/25nhh);
endchar;
beginchar(17, 3/2nhw#, 0, 0); " small dot";
fill fullcircle scaled .54nhh shifted (w,-.36nhh);
endchar;
beginchar(18, 3nhw#, 0, 0); " small bar";
fill unitsquare xscaled w yscaled .24nhh shifted (0,-.48nhh);
endchar;
beginchar(19, 3/5nhw#, 0, 0); " small circle";
Circle (.72nhh);
endchar;
beginchar(20, 3/5nhw#, 0, 0); " small cross";
Cross (.72nhh);
endchar;
% the next seems to be senseless, but it isn't
beginchar(28, 3/5nhw#, 0, 0); " small blank";
endchar;
%%%%%%%
message ("<several lines>");
%%%%%%%
hooklength:=4.5pt;
beginchar(21, 0, 0, 0);" bracket hook up";
pickup line_pen;
draw origin--(0, hooklength);
endchar;
beginchar(22, 0, 0, 0);" bracket hook down";
pickup line_pen;
draw origin--(0, -hooklength);
endchar;
beginchar(23, nhw#, 0, 0);" upper octaveline";
pickup line_pen;
draw (.33w, 1.1nhw)--(.66w, 1.1nhw);
endchar;
beginchar(24, 0, 0, 0);" final hook for upper octaveline";
pickup line_pen;
draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
draw (.33nhw, 1.1nhw)--(1.1nhw, 1.1nhw);
endchar;
beginchar(25, nhw#, 0, 0);" lower octaveline";
pickup line_pen;
draw (.33w, 0)--(.66w, 0);
endchar;
beginchar(26, 0, 0, 0);" final hook for lower octaveline";
pickup line_pen;
draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
draw (.33nhw,0)--(1.1nhw, 0);
endchar;
beginchar(27, .75nhw#, 0, 0);" used for \bracket";
pickup line_pen;
draw origin--(.5nhw, 0);
endchar;
beginchar(29, qqw#, 0, 0);" line ydim 0pt";
pickup line_pen;
draw origin--(w,0);
endchar;
% lines length xdim 10pt, ydim (-).25 to (-)5pt
for j=1 upto 20:
beginchar(29+j, qqw#, 0, 0); " line ydim "&decimal .25j&"pt";
pickup line_pen;
draw origin--(w, .25pt*j);
save_pic:= currentpicture;
endchar;
beginchar(49+j, qqw#, 0, 0); " line ydim -"&decimal .25j&"pt";
currentpicture:= save_pic reflectedabout (origin, right);
endchar;
endfor;
%%%%%%%
message ("<circles>");
%%%%%%%
for n:=1 upto 14:
beginchar(70+n-1, 0, 0, 0);
" fullcircle diameter "&decimal ((n+2)*2)&" pt";
diameter:=(n+2)*2pt;
pickup line_pen;
draw fullcircle scaled diameter;
endchar;
endfor;
%%%%%%%
message ("<(de-)crescendi>");
%%%%%%%
widthstep:=nhw;
crescendowidth:=.5nhh; % \Internote
for n:=1 upto 32:
beginchar(84+n-1, 0, 3pt#, 3pt#);
" crescendo length "&decimal n&" noteheadwidths";
pickup line_pen;
draw (n*widthstep, crescendowidth+.0075n*crescendowidth)--(0,0);
addto currentpicture also currentpicture reflectedabout (origin,right);
save_pic:= currentpicture;
endchar;
beginchar(116+n-1, 0, 3pt#, 3pt#);
" decrescendo length "&decimal n&" noteheadwidths";
currentpicture:= save_pic reflectedabout(origin, up) shifted (n*widthstep,0);
endchar;
endfor;
%%%%%%%
message ("<piano brackets>");
%%%%%%%
% lastbrace is adjustable (originally 99)
firstbrace:=20; % smallest brace is 2*20 pt (\simeq 14mm)
lastbrace:=67; % largest brace is 2*67 pt (\simeq 47mm)
%%% from Stanislav Kneifl
def drawpianobracket (expr height) =
u# := 1nhh#/5pt# * 1pt#;
v# := (height/40) * 1pt#;
define_pixels (u, v);
% beginchar (height-firstbrace, 1.25nhh#, 0, 0);
beginchar (height-firstbrace+148, 0, 0, 0);
z1 = origin;
z2 = (4.7u, 7v);
z3 = (3.6u, 16.5v);
z4 = (1.9u, 25v);
z5 = (2.28u, 32v);
z6 = (w, 40v);
penpos1 (max(1,0.1u), 125);
penpos2 (1.2u, 180);
penpos3 (3.2u, 195);
penpos4 (2.5u, 180);
penpos5 (1.14u, 180);
penpos6 (max(2,0.3u), 150);
penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
currenttransform := identity reflectedabout ((0,0),(1,0));
penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
currenttransform := identity;
% inserted
currentpicture:=currentpicture shifted (round(-1.75nhh), 0);
%
endchar;
enddef;
def bigbrace(expr v) =
beginchar (v-firstbrace+148, 0, 0, 0);
" brace vsize "&decimal round(2v*pt#)&"pt";
vwidth:=v*pt;
hwidth:=max(.1vwidth,3.25pt);
hwidth:=min(hwidth,6.5pt);
actwidth:=.035vwidth;
x1=.25nhw; y1=vwidth;
x2l=-.8hwidth; y2=2/3vwidth;
x3r=.2hwidth; y3=1/3vwidth;
x4=-hwidth; y4=0;
penpos1(max(1,.25pt),-35);
penpos2(1.5med+actwidth,40);
penpos3(1.75med+actwidth,45);
penpos4(max(1,.2pt),-90);
penstroke z1e..z2e..z3e..{left+sw}z4e;
currentpen:= pencircle; draw z1..z2..z3..{left+sw}z4;
addto currentpicture also currentpicture reflectedabout (origin, right);
penlabels(1,2,3,4);
currentpicture:= currentpicture shifted (round(-.75nhh), 0);
endchar;
enddef;
%!!! comment the line 'bigbrace' and uncomment the line 'drawpianobracket'
for v=firstbrace upto lastbrace :
bigbrace (v);
% drawpianobracket (v);
endfor;
end
|