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