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}
17 \ifundefined{mudelacopyright}
18 \def\mudelacopyright{\copyright\ \number\year}
20 \ifundefined{LilyIdString}
21 \def\LilyIdString{Lily was here}
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 % macros to shorten other definitions
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 \def\musicdef#1#2{\def#1{\musicchar{#2}}}
28 \def\musicchar#1{\musicfnt\char#1}
29 \def\rationalmultiply#1*#2/#3{\multiply #1 by #2 \divide #1 by #3}
32 \def\maccentraise#1#2{\dimen0=\noteheight
33 \rationalmultiply\dimen0*#2%
34 \raise\dimen0\hbox{#1}}
35 \def\maccentdef#1#2#3{\def#1{\maccentraise{\musicchar{#2}}{#3}}}
36 \def\vertcenter#1{\vbox to 0pt{\vss #1\vss}}
38 \def\musicmathdef#1#2{\def#1{\musicmathchar{#2}}}
39 \def\musicmathchar#1{\musicmathfont\char#1}
41 \def\topalign#1{\vbox to 0pt{#1\vss}}
42 \def\botalign#1{\vbox to 0pt{\vss #1}}
44 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
45 \def\leftalign#1{\hbox to 0pt{#1\hss}}
46 \def\rightalign#1{\hbox to 0pt{\hss#1}}
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 \newdimen\interlinedist
58 \newdimen\staffrulethickness
59 \newdimen\interstaffrule
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 % set fonts and primary dimensions
67 \staffrulethickness=0.4pt
69 \font\textmusic=cmmi12
73 \def\musixsixteendefs{
75 \staffrulethickness=0.4pt
79 \font\textmusic=cmmi10
83 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
84 \def\textflat{\raise.4ex\hbox{\textmusic\char"5B}}
85 \def\flt{\raise.2ex\hbox{\mus\char"5B}}
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 \interlinedist=\fontdimen5\musicfnt
94 \smallspace=.3\interlinedist
95 \interstaffrule=\balkheight
96 \divide\interstaffrule by 4
100 \def\kdynf{{\dynfont \char0\kern-.2ex}}
101 \def\kdynm{{\dynfont \char1\kern-.18ex}}
102 \def\kdynp{{\dynfont \char2\kern-.08ex}}
103 \def\kdyns{{\dynfont \char3\kern-.22ex}}
104 \def\kdynz{{\dynfont \char4\kern-.2ex}}
107 \def\dynpp{\dynp\kdynp}
108 \def\dynppp{\dynpp\kdynp}
109 \def\dynmp{\kdynm\kdynp}
110 \def\dynmf{\kdynm\kdynf}
112 \def\dynff{\dynf\kdynf}
113 \def\dynfff{\dynff\kdynf}
115 \def\dynfp{\kdynf\kern.35ex\kdynp}
116 \def\dynsf{\kdyns\kdynf}
117 \def\dynsfz{\dynsf\kern.3ex\kdynz}
121 \musicmathdef\cup{91} % \cup
122 \musicmathdef\wedge{94} % \wedge
123 \musicmathdef\striepke{0} % heu?
125 %% custom characters --- this should go: add to (meta!) font
126 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
127 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
128 \def\myheel{\vbox{\cup}}
129 \def\mytoe{\vbox{\wedge}}
130 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
131 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
133 \def\heel{\vbox{\myheel}}
134 \def\toe{\vbox{\mytoe}}
135 \def\backorfront{\mystriepke}
137 \def\bheel{\vbox{\myheel\mystriepke}}
138 \def\btoe{\vbox{\mytoe\mystriepke}}
139 \def\fheel{\vbox{\mystriepke\myheel}}
140 \def\ftoe{\vbox{\mystriepke\mytoe}}
141 \def\heeltoe{\vbox{\myheel\mytoe}}
142 \def\toeheel{\vbox{\mytoe\myheel}}
147 \def\defaultthinbar{\thinbar{\balkheight}}
148 \def\defaultthickbar{\thickbar{\balkheight}}
149 %? what-s wrong with rightalign?
150 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
151 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
152 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
155 \def\repeatbar{\repeatstopbar}
156 \def\startrepeat{\repeatstartbar}
157 \def\repeatbarstartrepeat{\repeatstopstart}
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
166 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
167 \def\thickbar#1{\vrule height #1 width 2\smallspace}
168 \def\maatstreep#1{\thinbar{#1}}
169 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
170 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
172 \def\pianobrace#1{{\musicdraw\char#1}}
173 \def\slurcharh#1{{\slurhfont\char#1}}
174 \def\slurcharu#1{{\slurufont\char#1}}
175 \def\slurchard#1{{\slurdfont\char#1}}
176 \def\hslurcharh#1{{\hslurhfont\char#1}}
177 \def\hslurcharu#1{{\hslurufont\char#1}}
178 \def\hslurchard#1{{\hslurdfont\char#1}}
180 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
182 \vbox to 0.5\balkheight{\vss\meterfont #2}}}
184 % stacked horizontal lines
186 \vbox{\kern-\interstaffrule
187 \n=0\nointerlineskip%
188 \loop\ifnum\n<#1\advance\n by1%
191 \vbox to 0pt{\hrule height #3 width#2%
192 \vss}\nointerlineskip
197 % Ugh. Need to redo this. Wish we had PS.
199 \def\toplines#1{ % why space needed here?
200 \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
202 \def\botlines#1{ % idem ditto
203 \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
206 % a staffsymbol with #1 lines, width #2
208 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
210 \def\stem#1#2{\vrule height#2 depth-#1}
212 \def\placebox#1#2#3{%
213 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
217 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
218 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
219 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
220 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
221 \def\rulesym#1#2{\vrule height #1 width #2}
222 \def\settext#1{\normaltextfont #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 \def\interscoreline{\vskip 16pt}
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 % big fat marks, if errors are detected.
240 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
241 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
242 \def\errormark{{\bf E!}}
243 \def\unknown{{\bf u}}
246 \ifundefined{documentclass}
247 \footline={\ifnum\pageno=1
248 {\smalltextfont\mudelacopyright\hfil \LilyIdString
249 }\else{\hfil\the\pageno\hfil}\fi
253 \renewcommand{\@oddhead}{}%
254 \renewcommand{\@evenfoot}{}%
255 \renewcommand{\@evenhead}{}%
256 \renewcommand{\@oddfoot}{\ifnum\thepage=1
258 }\else{foo\hfil\the\pageno\hfil}\fi}}