2 %% include file for LilyPond
4 %% this file defines various macros to accomodate lilypond output
7 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
9 % skip if included already
10 \def\SkipLilydefs{\endinput}
11 \ifundefined{EndLilyPondOutput}
12 \def\EndLilyPondOutput{\csname bye\endcsname}
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 % macros to shorten other definitions
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 \def\mdef#1#2{\def#1{\mchar{#2}}}
22 \def\mchar#1{\musicfnt\char#1}
23 \def\rationalmultiply#1*#2/#3{\multiply #1 by #2 \divide #1 by #3}
24 \def\maccentraise#1#2{\dimen0=\noteheight
25 \rationalmultiply\dimen0*#2%
26 \raise\dimen0\hbox{#1}}
27 \def\maccentdef#1#2#3{\def#1{\maccentraise{\mchar{#2}}{#3}}}
28 \def\vertcenter#1{\vbox to 0pt{\vss #1\vss}}
30 \def\mathdef#1#2{\def#1{\mathchar{#2}}}
31 \def\mathchar#1{\mathfont\char#1}
33 \def\topalign#1{\vbox to 0pt{#1\vss}}
34 \def\botalign#1{\vbox to 0pt{\vss #1}}
36 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
37 \def\leftalign#1{\hbox to 0pt{#1\hss}}
38 \def\rightalign#1{\hbox to 0pt{\hss#1}}
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 \newdimen\interlinedist
50 \newdimen\staffrulethickness
51 \newdimen\interstaffrule
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 % set fonts and primary dimensions
57 \font\meterfont=cmbx12
58 \font\slurufont=xslu20
59 \font\slurdfont=xsld20
60 \font\slurhfont=xslz20
61 \font\hslurufont=xslhu20
62 \font\hslurdfont=xslhd20
63 \font\hslurhfont=xslhz20
64 \font\musicfnt=musix20
65 \font\musicdraw=musixsps
66 \font\italicfont=cmti10
67 \font\dynfont=cmbxti10 scaled \magstep1
72 \staffrulethickness=0.4pt
77 \def\musixsixteendefs{
79 \font\meterfont=cmbx12
80 \font\italicfont=cmti8
81 \font\slurufont=xslu16
82 \font\slurdfont=xsld16
83 \font\slurhfont=xslz20 % sigh
84 \font\hslurufont=xslhu16
85 \font\hslurdfont=xslhd16
86 \font\hslurhfont=xslhz20
87 \font\musicfnt=musix16
88 \font\dynfont=cmbxti12
89 \font\musicdraw=musixsps
92 \staffrulethickness=0.4pt
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
102 \interlinedist=\fontdimen5\musicfnt
103 \smallspace=.3\interlinedist
104 \interstaffrule=\balkheight
105 \divide\interstaffrule by 4
108 % dynamics take extra kerning
110 \def\kdynf{\dynfont f\kern-.1ex}
111 \def\kdynm{\dynfont m\kern-.15ex}
112 \def\kdynp{\dynfont p\kern-.15ex}
115 \def\dynp{\dynfont p}
116 \def\dynpp{\dynp\kdynp}
117 \def\dynppp{\dynpp\kdynp}
118 \def\dynmp{\dynfont m\kdynp}
119 \def\dynmf{\dynfont m\kdynf}
120 \def\dynf{\dynfont f}
121 \def\dynff{\dynf\kdynf}
122 \def\dynfff{\dynff\kdynf}
127 \mathdef\cup{91} % \cup
128 \mathdef\wedge{94} % \wedge
129 \mathdef\striepke{0} % heu?
131 %% custom characters --- this should go: add to (meta!) font
132 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
133 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
134 \def\myheel{\vbox{\cup}}
135 \def\mytoe{\vbox{\wedge}}
136 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
137 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
139 \def\heel{\vbox{\myheel}}
140 \def\toe{\vbox{\mytoe}}
141 \def\backorfront{\mystriepke}
143 \def\bheel{\vbox{\myheel\mystriepke}}
144 \def\btoe{\vbox{\mytoe\mystriepke}}
145 \def\fheel{\vbox{\mystriepke\myheel}}
146 \def\ftoe{\vbox{\mystriepke\mytoe}}
147 \def\heeltoe{\vbox{\myheel\mytoe}}
148 \def\toeheel{\vbox{\mytoe\myheel}}
153 \def\thinbar{\vrule height\balkheight width 1.6\staffrulethickness} % TODO parametric.
154 \def\thickbar{\vrule height\balkheight width 2\smallspace}
155 \def\maatstreep{\thinbar}
157 %? what-s wrong with rightalign?
158 \def\finishbar{\rightalign{\thinbar\kern\smallspace\thickbar}}
160 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}}
161 \def\repeatstartbar{\hbox{\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}}
162 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar\kern\smallspace\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}}
163 \def\doublebar{\hbox{\thinbar\hskip\smallspace\thinbar}}
166 \def\repeatbar{\repeatstopbar}
167 \def\startrepeat{\repeatstartbar}
168 \def\repeatbarstartrepeat{\repeatstopstart}
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174 \def\slurcharh#1{{\slurhfont\char#1}}
175 \def\slurcharu#1{{\slurufont\char#1}}
176 \def\slurchard#1{{\slurdfont\char#1}}
177 \def\hslurcharh#1{{\hslurhfont\char#1}}
178 \def\hslurcharu#1{{\hslurufont\char#1}}
179 \def\hslurchard#1{{\hslurdfont\char#1}}
181 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
183 \vbox to 0.5\balkheight{\vss\meterfont #2}}}
185 % stacked horizontal lines
187 \vbox{\kern-\interstaffrule
188 \n=0\nointerlineskip%
189 \loop\ifnum\n<#1\advance\n by1%
192 \vbox to 0pt{\hrule height #3 width#2%
193 \vss}\nointerlineskip
198 % Ugh. Need to redo this. Wish we had PS.
200 \def\toplines#1{ % why space needed here?
201 \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
203 \def\botlines#1{ % idem ditto
204 \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
207 % a staffsymbol with #1 lines, width #2
209 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
211 \def\stem#1#2{\vrule height#2 depth-#1}
213 \def\placebox#1#2#3{%
214 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
218 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
219 \def\rulesym#1#2{\vrule height #1 width #2}
220 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
221 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
222 \def\settext#1{\textfont #1}
223 \def\setitalic#1{\italicfont #1}
224 \def\setdynamic#1{\dynfont #1}
226 % the interline symbol. Redefine to remove it.
227 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
228 \def\lineseparator{\defaultlineseparator}
230 \par\vskip 10pt plus 30pt minus 10pt\par
231 \hskip -5pt\lineseparator
232 \par\vskip 10pt plus 30pt minus 10pt\par
236 % redefine if not happy with interline spacing
238 \def\interstaffline{%
241 \def\interscoreline{\beauty}
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244 % big fat marks, if errors are detected.
245 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
246 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}