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}
26 \def\maccentraise#1#2{\dimen0=\noteheight
27 \rationalmultiply\dimen0*#2%
28 \raise\dimen0\hbox{#1}}
29 \def\maccentdef#1#2#3{\def#1{\maccentraise{\mchar{#2}}{#3}}}
30 \def\vertcenter#1{\vbox to 0pt{\vss #1\vss}}
32 \def\mathdef#1#2{\def#1{\mathchar{#2}}}
33 \def\mathchar#1{\mathfont\char#1}
35 \def\topalign#1{\vbox to 0pt{#1\vss}}
36 \def\botalign#1{\vbox to 0pt{\vss #1}}
38 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
39 \def\leftalign#1{\hbox to 0pt{#1\hss}}
40 \def\rightalign#1{\hbox to 0pt{\hss#1}}
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 \newdimen\interlinedist
52 \newdimen\staffrulethickness
53 \newdimen\interstaffrule
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 % set fonts and primary dimensions
61 \staffrulethickness=0.4pt
66 \def\musixsixteendefs{
68 \staffrulethickness=0.4pt
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 \interlinedist=\fontdimen5\musicfnt
80 \smallspace=.3\interlinedist
81 \interstaffrule=\balkheight
82 \divide\interstaffrule by 4
85 % dynamics take extra kerning
87 \def\kdynf{\dynfont f\kern-.1ex}
88 \def\kdynm{\dynfont m\kern-.15ex}
89 \def\kdynp{\dynfont p\kern-.15ex}
93 \def\dynpp{\dynp\kdynp}
94 \def\dynppp{\dynpp\kdynp}
95 \def\dynmp{\dynfont m\kdynp}
96 \def\dynmf{\dynfont m\kdynf}
98 \def\dynff{\dynf\kdynf}
99 \def\dynfff{\dynff\kdynf}
104 \mathdef\cup{91} % \cup
105 \mathdef\wedge{94} % \wedge
106 \mathdef\striepke{0} % heu?
108 %% custom characters --- this should go: add to (meta!) font
109 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
110 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
111 \def\myheel{\vbox{\cup}}
112 \def\mytoe{\vbox{\wedge}}
113 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
114 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
116 \def\heel{\vbox{\myheel}}
117 \def\toe{\vbox{\mytoe}}
118 \def\backorfront{\mystriepke}
120 \def\bheel{\vbox{\myheel\mystriepke}}
121 \def\btoe{\vbox{\mytoe\mystriepke}}
122 \def\fheel{\vbox{\mystriepke\myheel}}
123 \def\ftoe{\vbox{\mystriepke\mytoe}}
124 \def\heeltoe{\vbox{\myheel\mytoe}}
125 \def\toeheel{\vbox{\mytoe\myheel}}
130 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
131 \def\thickbar#1{\vrule height #1 width 2\smallspace}
132 \def\maatstreep#1{\thinbar{#1}}
133 \def\defaultthinbar{\thinbar{\balkheight}}
134 \def\defaultthickbar{\thickbar{\balkheight}}
135 %? what-s wrong with rightalign?
136 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
138 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
139 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
140 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
141 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
144 \def\repeatbar{\repeatstopbar}
145 \def\startrepeat{\repeatstartbar}
146 \def\repeatbarstartrepeat{\repeatstopstart}
148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 \def\slurcharh#1{{\slurhfont\char#1}}
153 \def\slurcharu#1{{\slurufont\char#1}}
154 \def\slurchard#1{{\slurdfont\char#1}}
155 \def\hslurcharh#1{{\hslurhfont\char#1}}
156 \def\hslurcharu#1{{\hslurufont\char#1}}
157 \def\hslurchard#1{{\hslurdfont\char#1}}
159 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
161 \vbox to 0.5\balkheight{\vss\meterfont #2}}}
163 % stacked horizontal lines
165 \vbox{\kern-\interstaffrule
166 \n=0\nointerlineskip%
167 \loop\ifnum\n<#1\advance\n by1%
170 \vbox to 0pt{\hrule height #3 width#2%
171 \vss}\nointerlineskip
176 % Ugh. Need to redo this. Wish we had PS.
178 \def\toplines#1{ % why space needed here?
179 \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
181 \def\botlines#1{ % idem ditto
182 \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
185 % a staffsymbol with #1 lines, width #2
187 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
189 \def\stem#1#2{\vrule height#2 depth-#1}
191 \def\placebox#1#2#3{%
192 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
196 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
197 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
198 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
199 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
200 \def\rulesym#1#2{\vrule height #1 width #2}
201 \def\settext#1{\textfont #1}
202 \def\setitalic#1{\italicfont #1}
203 \def\setdynamic#1{\dynfont #1}
205 % the interline symbol. Redefine to remove it.
206 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
207 \def\lineseparator{\defaultlineseparator}
209 \par\vskip 10pt plus 30pt minus 10pt\par
210 \hskip -5pt\lineseparator
211 \par\vskip 10pt plus 30pt minus 10pt\par
215 \def\interscoreline{\vskip 16pt}
217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 % big fat marks, if errors are detected.
219 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
220 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
221 \def\unknown{{\bf u}}