]> Git — Sourcephile - julm/violon-tex.git/blob - violon.sty
Ajout : tie.
[julm/violon-tex.git] / violon.sty
1 % This file is part of Violon, a violin score engine.
2 % Copyright (C) 2009-2012 Julien Moutinho
3 %
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published
6 % by the Free Software Foundation, either version 3 of the License,
7 % or any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty
11 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 % See the GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 % Any comment or contribution is welcome
18 % at julm&autogeree.net.
19
20 % Déclaration
21 \def\fileversion{1.0}%
22 \def\filedate{2009/10/11}%
23 \NeedsTeXFormat{LaTeX2e}%
24 \ProvidesPackage{violon}[\filedate\space\fileversion\space%
25 Violin score library (Julien Moutinho)]%
26 % Bibliothèques
27 \usepackage{ifthen}%
28 \usepackage{color}%
29 \usepackage{verbatim}%
30 % Polices
31 \gdef\ssssmall{%
32 \@setfontsize\sssmall{5pt}{5pt}}%
33 \gdef\sssmall{%
34 \@setfontsize\sssmall{6pt}{6pt}}%
35 \gdef\ssmall{%
36 \@setfontsize\ssmall\@viiipt\@ixpt}%
37 \gdef\vlnfingerfont{%
38 \expandafter\color{colVlnBowFingerCord\vlncurrcord}%
39 \fontfamily{pnc}\bfseries\sssmall}%
40 \gdef\vlncordfont{%
41 \color{colVlnBowCord}%
42 \fontfamily{pnc}\bfseries\sssmall}%
43 \gdef\vlnnamefont{%
44 \expandafter\color{colVlnBowNameOctave\the\vlncurroctave}%
45 \fontfamily{pnc}\scshape\ssssmall}%
46 \gdef\vlnpartfont{%
47 \color{colVlnPart}%
48 \fontfamily{pnc}\bfseries\sssmall}%
49 \gdef\vlntimefont{%
50 \fontfamily{pnc}\bfseries\ssssmall}%
51 % Algèbre
52 \newcount\@calc@mod@cnt%
53 \def\modulo#1#2{%
54 \@calc@mod@cnt=#1\relax%
55 \divide\@calc@mod@cnt by#2\relax%
56 \multiply\@calc@mod@cnt by#2\relax%
57 \advance#1 by-\@calc@mod@cnt%
58 }%
59 % Convertisseurs
60 \def\romannumeralz#1{%
61 \ifnum#1>\z@\romannumeral#1\else\number#1\fi%
62 }%
63 % Moteur
64 % Constantes
65 % Couleurs
66 %\definecolor{colVlnBowU}{rgb}{0.24,0.92,0.24}%
67 %\definecolor{colVlnBowD}{rgb}{0.80,0,0}%
68 %\definecolor{colVlnBowU}{rgb}{0.30,0.75,0.75}%
69 \definecolor{colVlnBowU}{gray}{0.50}%
70 \definecolor{colVlnBowD}{gray}{0}%
71 \definecolor{colVlnBowN}{gray}{1}%
72 \definecolor{colVlnBowCord}{rgb}{0,1,0}%
73 \definecolor{colVlnBowFinger}{rgb}{0,0,0}%
74 \definecolor{colVlnBowFingerCord0}{rgb}{0,0,0}%
75 \definecolor{colVlnBowFingerCord1}{rgb}{0,0.66,0}%
76 \definecolor{colVlnBowFingerCord2}{rgb}{0,0,1}%
77 \definecolor{colVlnBowFingerCord3}{rgb}{1,0,0}%
78 \definecolor{colVlnBowName}{rgb}{1,0,0}%
79 \definecolor{colVlnBowNameOctave0}{rgb}{0,0,0}%
80 \definecolor{colVlnBowNameOctave1}{rgb}{0,0.66,0}%
81 \definecolor{colVlnBowNameOctave2}{rgb}{0,0,1}%
82 \definecolor{colVlnBowNameOctave3}{rgb}{1,0,0}%
83 \definecolor{colVlnBowNameOctave4}{rgb}{1,1,0}%
84 \definecolor{colVlnLineHalfToneEven}{gray}{0.98}%
85 \definecolor{colVlnLineHalfToneOdd}{gray}{1}%
86 \definecolor{colVlnLineHalfToneFifth}{gray}{0.92}%
87 \definecolor{colVlnPart}{gray}{0}%
88 \definecolor{colVlnBar}{gray}{.85}%
89 \definecolor{colVlnCrescD}{rgb}{0,0.66,0}%
90 \definecolor{colVlnCrescU}{rgb}{1,0,0}%
91 % Portée
92 % Déclarations
93 \newdimen\vlnstaffhalftonelinevdim%
94 \newskip\vlnstaffvdim%
95 \def\vlnstaffvdimpre{0pt}%
96 \newskip\vlnstaffintervskip%
97 \newskip\vlnstaffvskip%
98 % Initialisations
99 \def\vlnstaffhsize{\hsize}%
100 \def\vlnstaffmaxvsize{\textheight}%
101 \vlnstaffhalftonelinevdim=3pt%
102 \vlnstaffvdim=0pt\relax%
103 \vlnstaffvskip=0pt\relax%
104 \vlnstaffintervskip=\vlnstaffhalftonelinevdim\relax%
105 \multiply\vlnstaffintervskip by 2\relax%
106 \def\vlnstaffhalftoneline#1{%
107 {\color{colVlnLineHalfTone#1}\hrule depth 0pt height \vlnstaffhalftonelinevdim width \vlnstaffhsize }}%
108 \def\vlnstafftoneskip{%
109 \advance\vlnstaffvdim by\vlnstaffhalftonelinevdim%
110 \nobreak%
111 }%
112 \def\vlnstafffivehalftonelines{%
113 \vlnstaffhalftoneline{Odd}\vlnstafftoneskip%
114 \vlnstaffhalftoneline{Even}\vlnstafftoneskip%
115 \vlnstaffhalftoneline{Odd}\vlnstafftoneskip%
116 \vlnstaffhalftoneline{Even}\vlnstafftoneskip%
117 \vlnstaffhalftoneline{Fifth}\vlnstafftoneskip%
118 }%
119 \def\vlnstaffallhalftonelines{%
120 \vlnstaffhalftoneline{Fifth}\vlnstafftoneskip%
121 \vlnstafffivehalftonelines%
122 \vlnstafffivehalftonelines%
123 \vlnstafffivehalftonelines%
124 \vlnstafffivehalftonelines%
125 \vlnstafffivehalftonelines%
126 }%
127 \def\vlnstaff{%
128 \nobreak\vskip\vlnstaffvdimpre%
129 \nobreak\vskip\vlnstaffvdim%
130 \advance\vlnstaffvskip by\vlnstaffvdim\relax%
131 \count@\vlnstaffvskip\relax%
132 \advance\count@ by\vlnstaffvdim\relax%
133 \ifnum\count@>\vlnstaffmaxvsize%
134 \vlnstaffvskip=0pt\relax%
135 \break%
136 \else%
137 \advance\vlnstaffvskip by\vlnstaffintervskip\relax%
138 \nobreak\vskip\vlnstaffintervskip%
139 \fi%
140 \vlnnotehskip=0pt\relax%
141 \vlnstaffvdim=0pt\relax%
142 \vlnstaffallhalftonelines%
143 \advance\vlnstaffvdim by\vlnstaffhalftonelinevdim%
144 \nobreak\vskip-\vlnstaffvdim%
145 }%
146 % Notes
147 % Déclarations
148 % Variables
149 \newskip\vlnnotevskip%
150 \newskip\vlnnotehskip%
151 \newdimen\dimen@%
152 \newdimen\dimen@@%
153 \newdimen\vlnnotevdim%
154 \newdimen\vlnnotevdimmore%
155 \newdimen\vlnnotehdim%
156 \newdimen\vlnnotehdimbase%
157 \newcount\vlncurrfinger%
158 \newcount\vlncurrposbase%
159 \newcount\vlncurrposunit%
160 \newcount\vlncurroctave%
161 \def\vlncurrletter{}%
162 \def\vlncurrshift{}%
163 \newcount\vlnnotepos%
164 \newcount\vlncurrpos%
165 \newcount\vlncurrpitch%
166 \newcount\vlnlastpitch%
167 \newcount\vlnnote%
168 \newcount\vlncurrtimes%
169 \newcount\vlnbow%
170 \gdef\vlncrescleft{}%
171 \gdef\vlncrescright{}%
172 % Initialisations
173 \vlnnotevskip=0pt\relax%
174 \vlnnotehskip=0pt\relax%
175 \vlnnotevdim=\vlnstaffhalftonelinevdim%
176 \vlnnotevdimmore=1pt\relax%
177 \vlnnotehdimbase=2cm\relax%
178 %\advance\vlnnotevdim by\vlnnotevdimmore%
179 %\advance\vlnnotevdim by\vlnnotevdimmore%
180 \def\vlncurrbow{}%
181 \def\vlncurrrealbow{}%
182 \def\vlncurrcord{}%
183 \def\vlncurrtimenum{}%
184 \def\vlncurrtimeden{}%
185 \def\vlncurrbowwithnext{no}%
186 \def\vlnnotehdimmodetim{yes}%
187 \def\vlnnotehdimmodetxt{}%
188 \parindent=0pt\relax%
189 \parskip=0pt\relax%
190 \parfillskip=0pt\relax%
191 \def\vlncurrposfinger{%
192 \csname vlncurrposfinger\romannumeralz\vlncurrfinger\endcsname%
193 }%
194 \def\vlncurrfingerpos{%
195 \csname vlncurrfingerpos\romannumeralz\vlncurrpos\endcsname%
196 }%
197 %\def\vlncurrposname{%
198 % \csname vlncurrposname\romannumeralz\vlncurrpos\endcsname%
199 % }%
200 \def\vlntimefrac#1/#2{%
201 \leavevmode%
202 \hbox{#1}%
203 \kern-.4ex\lower.3ex\hbox{\bfseries\tiny /}%
204 \kern-.3ex\lower.6ex\hbox{#2}%
205 }%
206 % Graveur
207 \def\vlndoatnote#1#2#3#4{%
208 \nointerlineskip%
209 \vlnnotevskip=0pt\relax%
210 \advance\vlnnotevskip by\vlnstaffhalftonelinevdim\relax%
211 \multiply\vlnnotevskip by#1\relax%
212 \advance\vlnnotevskip by\vlnstaffhalftonelinevdim\relax%
213 %\advance\vlnnotevskip by-\vlnnotevdimmore\relax%
214 \nobreak\vskip\vlnnotevskip\relax%
215 \vrule depth 0pt height 0pt width \vlnnotehskip\relax%
216 \setbox0=#3%
217 \advance\vlnnotevskip by \ht0\relax%
218 #2%
219 \box0%
220 #4%
221 \nobreak\vskip-\vlnnotevskip\relax%
222 \nointerlineskip%
223 }%
224 \def\vlnnotedraw{%
225 % Durée
226 \vlnnotehdim0pt%
227 \ifthenelse{\equal{\vlnnotehdimmodetim}{yes}}{%
228 \count@0%
229 \whiledo{\count@<\vlncurrtimes}{%
230 \dimen@\vlnnotehdimbase%
231 \multiply\dimen@ by\csname vlncurrtimenum\the\count@\endcsname\relax%
232 \divide\dimen@ by\csname vlncurrtimeden\the\count@\endcsname\relax%
233 \advance\vlnnotehdim by\dimen@\relax%
234 \advance\count@ by 1\relax%
235 }%
236 }{%
237 }%
238 % Automatic staff break
239 \count@\vlnnotehskip\relax%
240 \advance\count@ by\vlnnotehdim\relax%
241 \ifnum\count@>\vlnstaffhsize\vlnstaff\fi%
242 % Explicite
243 \def\vlnnotehdimmodetxtdo{%
244 % FIXME: handle \vlncurrtimes
245 \vbox to0pt{%
246 \setbox0=\hbox{%
247 \ifthenelse{\equal{\vlncurrtimeden}{1}}%
248 {{\vlntimefont{\vlncurrtimenum}}}%
249 {\vlntimefrac{\vlntimefont{\vlncurrtimenum}}/{\vlntimefont{\vlncurrtimeden}}}%
250 }%
251 \nobreak\vskip\vlnnotevdim\relax%
252 \nobreak\vskip0.2mm\relax%
253 \nobreak\hskip\vlnnotehdim\relax%
254 \nobreak\hskip-\wd0\relax%
255 \dp0=0pt\relax%
256 \box0%
257 }%
258 }%
259 \ifthenelse{\equal{}{\vlnnotehdimmodetxt}}%
260 {\null}%
261 {\vlndoatnote{\vlncurrpos}%
262 {}%
263 {\vlnnotehdimmodetxtdo}%
264 {}%
265 }%
266 % Archet
267 \vlndoatnote{\vlncurrpos}%
268 {\begingroup\expandafter\color{colVlnBow\vlncurrbow}}%
269 {%
270 \hbox{%
271 \ifthenelse{\equal{\vlncurrbow}{N}}
272 {}%
273 {%
274 \vrule depth 0pt height \vlnnotevdim width \vlnnotehdim\relax%
275 \nobreak\hskip-\vlnnotehdim\relax%
276 \dimen@\vlnnotevdim%
277 \divide\dimen@ by3\relax%
278 \dimen@@\vlnnotehdim%
279 \divide\dimen@@ by2\relax%
280 \ifthenelse{\equal{\vlncrescleft}{}}%
281 {%
282 \ifthenelse{\equal{\vlncrescright}{}}%
283 {%
284 }%
285 {%
286 \vrule depth 0pt height 0pt width \dimen@@\relax%
287 \color{colVlnCresc\vlncrescright}%
288 \vrule depth 0pt height \dimen@ width \dimen@@\relax%
289 }%
290 }%
291 {%
292 \ifthenelse{\equal{\vlncrescright}{}}%
293 {%
294 \color{colVlnCresc\vlncrescleft}%
295 \vrule depth 0pt height \dimen@ width \dimen@@\relax%
296 }%
297 {%
298 \color{colVlnCresc\vlncrescleft}%
299 \vrule depth 0pt height \dimen@ width \dimen@@\relax%
300 \color{colVlnCresc\vlncrescright}%
301 \vrule depth 0pt height \dimen@ width \dimen@@\relax%
302 }%
303 }%
304 \global\let\vlncrescleft\vlncrescright%
305 }%
306 }%
307 }%
308 {\endgroup}%
309 % Cordes
310 % Doigts
311 \ifthenelse{\equal{\vlncurrbow}{N}%
312 % \OR\equal{\the\vlncurrfinger}{\vlncurrfingerpos}%
313 % \AND\equal{\the\vlncurrpos}{\vlncurrposfinger}%
314 % \AND\equal{\the\vlncurrcord}{\thevlncurrlastcord}%
315 }%
316 {}%
317 {%
318 \expandafter\edef\csname vlncurrfingerpos\romannumeralz\vlncurrpos\endcsname{\the\vlncurrfinger}%
319 \expandafter\edef\csname vlncurrposfinger\romannumeralz\vlncurrfinger\endcsname{\the\vlncurrpos}%
320 \vlndoatnote{\vlncurrpos}%
321 {}%
322 {\vbox to0pt{%
323 \setbox0=\hbox{{\vlnfingerfont{\the\vlncurrfinger}}}%
324 \nobreak\vskip\vlnnotevdim\relax%
325 \nobreak\vskip0.2mm\relax%
326 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
327 \box0}}%
328 {}%
329 }%
330 % Nom
331 %\expandafter\edef\csname vlncurrposname\romannumeralz\vlncurrpos\endcsname{#5}%
332 \ifthenelse{\equal{\vlncurrbow}{N}}%
333 {}%
334 {%
335 \vlndoatnote{\vlncurrpos}%
336 {}%
337 {\vbox to0pt{%
338 \setbox0=\hbox{{\vlnnamefont{\vlncurrname}}}%
339 \nobreak\vskip-0.275mm\relax%
340 \nobreak\vskip-\ht0\relax%
341 %\vskip-\dp0\relax%
342 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
343 \box0}}%
344 {}%
345 }%
346 % Accord
347 \ifthenelse{\equal{\vlncurrbowwithnext}{yes}}%
348 {%
349 }%
350 {
351 \advance\vlnnotehskip by\vlnnotehdim\relax%
352 }%
353 \nointerlineskip%
354 }%
355 % Cordes
356 \def\vlncordposi{0}% G
357 \def\vlncordposii{7}% D
358 \def\vlncordposiii{14}% A
359 \def\vlncordposiv{21}% E
360 % Demi-tons alphabétiques sans modification
361 \expandafter\def\csname vlnnotetoneofnameG=\endcsname{0}%
362 \expandafter\def\csname vlnnotetoneofnameG+\endcsname{1}%
363 \expandafter\def\csname vlnnotetoneofnameA-\endcsname{1}%
364 \expandafter\def\csname vlnnotetoneofnameA=\endcsname{2}%
365 \expandafter\def\csname vlnnotetoneofnameA+\endcsname{3}%
366 \expandafter\def\csname vlnnotetoneofnameB-\endcsname{3}%
367 \expandafter\def\csname vlnnotetoneofnameB=\endcsname{4}%
368 \expandafter\def\csname vlnnotetoneofnameB+\endcsname{5}%
369 \expandafter\def\csname vlnnotetoneofnameC-\endcsname{4}%
370 \expandafter\def\csname vlnnotetoneofnameC=\endcsname{5}%
371 \expandafter\def\csname vlnnotetoneofnameC+\endcsname{6}%
372 \expandafter\def\csname vlnnotetoneofnameD-\endcsname{6}%
373 \expandafter\def\csname vlnnotetoneofnameD=\endcsname{7}%
374 \expandafter\def\csname vlnnotetoneofnameD+\endcsname{8}%
375 \expandafter\def\csname vlnnotetoneofnameE-\endcsname{8}%
376 \expandafter\def\csname vlnnotetoneofnameE=\endcsname{9}%
377 \expandafter\def\csname vlnnotetoneofnameE+\endcsname{10}%
378 \expandafter\def\csname vlnnotetoneofnameF-\endcsname{9}%
379 \expandafter\def\csname vlnnotetoneofnameF=\endcsname{10}%
380 \expandafter\def\csname vlnnotetoneofnameF+\endcsname{11}%
381 \expandafter\def\csname vlnnotetoneofnameG-\endcsname{11}%
382 % Modifications
383 \expandafter\def\csname vlnshiftsymbol-\endcsname{\kern-0.7pt$\flat$}%
384 \expandafter\def\csname vlnshiftsymbol=\endcsname{}%
385 \expandafter\def\csname vlnshiftsymbol+\endcsname{\kern-0.7pt$\sharp$}%
386 \def\vlnnotedrawtonebyname#1#2#3#4#5#6#7#8{%
387 % Octave
388 \ifthenelse{\equal{#1}{.}}%
389 {}%
390 {\vlncurroctave#1\relax}%
391 % Ton dans l'octave
392 \ifthenelse{\equal{#2}{.}}%
393 {}%
394 {\def\vlncurrletter{#2}}%
395 \ifthenelse{\equal{#3}{.}}%
396 {}%
397 {\def\vlncurrshift{#3}}%
398 \edef\vlncurrname{%
399 \vlncurrletter\csname vlnshiftsymbol\vlncurrshift\endcsname%
400 }%
401 % Position
402 \edef\vlncurroctavepitch{\csname vlnnotetoneofname\vlncurrletter\vlncurrshift\endcsname}%
403 \vlnlastpitch\vlncurrpitch%
404 \vlncurrpitch\vlncurroctavepitch%
405 \count@\vlncurroctave\relax%
406 \multiply\count@ by12\relax%
407 \advance\vlncurrpitch by\count@%
408 % Corde
409 \ifthenelse{\equal{#4}{.}}%
410 {}%
411 {\def\vlncurrcord{#4}%
412 }%
413 \count@\vlncurrcord%
414 \advance\count@ by1\relax%
415 \vlncurrpos\vlncurrpitch%
416 \advance\vlncurrpos by-\csname vlncordpos\romannumeralz\count@\endcsname%
417 % Doigt
418 \ifthenelse{\equal{#5}{.}}%
419 {}%
420 {\vlncurrfinger#5\relax}%
421 % Archet
422 \let\vlnlastlastrealbow\vlnlastrealbow%
423 \let\vlnlastrealbow\vlncurrrealbow%
424 \ifthenelse{\equal{#6}{C}}%
425 {\ifthenelse{\equal{U}{\vlncurrrealbow}}%
426 {\def\vlncurrbow{D}}%
427 {\def\vlncurrbow{U}}}%
428 {\ifthenelse{\equal{#6}{.}}%
429 {\def\vlncurrbow{\vlncurrrealbow}}%
430 {\def\vlncurrbow{#6}}}%
431 \ifthenelse{\equal{\vlncurrbow}{N}}%
432 {}%
433 {\edef\vlncurrrealbow{\vlncurrbow}}%
434 % Durée
435 \vlncurrtimes0\relax%
436 \def\@nexttime##1+##2##3{%
437 \ifthenelse{\equal{##2}{.}}%
438 {}%
439 {\def\vlncurrtimenum{##2}}%
440 \ifthenelse{\equal{##3}{.}}%
441 {}%
442 {\def\vlncurrtimeden{##3}}%
443 \expandafter\edef\csname vlncurrtimenum\the\vlncurrtimes\endcsname{\vlncurrtimenum}%
444 \expandafter\edef\csname vlncurrtimeden\the\vlncurrtimes\endcsname{\vlncurrtimeden}%
445 \advance\vlncurrtimes by 1\relax%
446 \@ifnextchar+{\@nexttime{##1}}{##1}%
447 }%
448 \def\@nextbow{%
449 \let\vlncurrbowwithlast\vlncurrbowwithnext%
450 \@ifnextchar&{%
451 \def\next&{%
452 \def\vlncurrbowwithnext{yes}%
453 \vlnnotelily%
454 \vlnnotedraw%
455 \advance\vlnnote by1\relax%
456 }%
457 \next%
458 }{%
459 \def\vlncurrbowwithnext{no}%
460 \advance\vlnbow by1\relax%
461 \vlnnotelily%
462 \vlnnotedraw%
463 \advance\vlnnote by1\relax%
464 }%
465 }%
466 \@nexttime\@nextbow+{#7}{#8}%
467 }%
468 \def\vlnpart#1{%
469 \vlndoatnote{0}%
470 {}%
471 {\vbox to0pt{%
472 \setbox0=\hbox{{\vlnpartfont{#1}}}%
473 \nobreak\vskip-0.3mm\relax%
474 \nobreak\vskip-\ht0\relax%
475 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
476 \box0}}%
477 {}%
478 }%
479 \def\vlnpartup#1{%
480 \vlndoatnote{0}%
481 {}%
482 {\vbox to0pt{%
483 \setbox0=\hbox{{\vlnpartfont{#1}}}%
484 \nobreak\vskip-0.3mm\relax%
485 \nobreak\vskip-\ht0\relax%
486 \nobreak\vskip-\ht0\relax%
487 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
488 \box0}}%
489 {}%
490 }%
491 \def\vlnbar{%
492 \vlndoatnote{0}%
493 {}%
494 {\vbox to0pt{%
495 \dimen@\vlnstaffvdim%
496 \advance\dimen@ by -\vlnnotevdim\relax%
497 \advance\dimen@ by -\vlnnotevdim\relax%
498 \setbox0=\hbox{{\color{colVlnBar}\vrule depth 0pt height \dimen@ width 0.1pt\relax}}%
499 \nobreak\vskip\vlnnotevdim\relax%
500 \dp0=0pt\relax%
501 \box0}}%
502 {}%
503 }%
504 \def\vlncresc#1{%
505 \global\let\vlncrescleft\vlncrescright%
506 \xdef\vlncrescright{#1}%
507 }%
508 % Lylipond
509 \def\lily{}%
510 % input time fraction -> Lilypond dotted duration
511 \expandafter\def\csname vlnnotelilyofduration1/2\endcsname{2}%
512 \expandafter\def\csname vlnnotelilyofduration2/2\endcsname{1}%
513 \expandafter\def\csname vlnnotelilyofduration3/2\endcsname{2.}%
514 \expandafter\def\csname vlnnotelilyofduration1/4\endcsname{4}%
515 \expandafter\def\csname vlnnotelilyofduration2/4\endcsname{2}%
516 \expandafter\def\csname vlnnotelilyofduration3/4\endcsname{???}%
517 \expandafter\def\csname vlnnotelilyofduration4/4\endcsname{1}%
518 \expandafter\def\csname vlnnotelilyofduration1/8\endcsname{8}%
519 \expandafter\def\csname vlnnotelilyofduration2/8\endcsname{4}%
520 \expandafter\def\csname vlnnotelilyofduration3/8\endcsname{4.}%
521 \expandafter\def\csname vlnnotelilyofduration4/8\endcsname{2}%
522 \expandafter\def\csname vlnnotelilyofduration5/8\endcsname{???}%
523 \expandafter\def\csname vlnnotelilyofduration6/8\endcsname{???}%
524 \expandafter\def\csname vlnnotelilyofduration7/8\endcsname{???}%
525 \expandafter\def\csname vlnnotelilyofduration8/8\endcsname{1}%
526 \expandafter\def\csname vlnnotelilyofduration1/12\endcsname{12}%
527 \expandafter\def\csname vlnnotelilyofduration2/12\endcsname{???}%
528 \expandafter\def\csname vlnnotelilyofduration3/12\endcsname{???}%
529 \expandafter\def\csname vlnnotelilyofduration4/12\endcsname{3}%
530 \expandafter\def\csname vlnnotelilyofduration5/12\endcsname{???}%
531 \expandafter\def\csname vlnnotelilyofduration6/12\endcsname{2}%
532 \expandafter\def\csname vlnnotelilyofduration7/12\endcsname{???}%
533 \expandafter\def\csname vlnnotelilyofduration8/12\endcsname{???}%
534 \expandafter\def\csname vlnnotelilyofduration9/12\endcsname{???}%
535 \expandafter\def\csname vlnnotelilyofduration10/12\endcsname{???}%
536 \expandafter\def\csname vlnnotelilyofduration11/12\endcsname{???}%
537 \expandafter\def\csname vlnnotelilyofduration12/12\endcsname{1}%
538 \expandafter\def\csname vlnnotelilyofduration1/16\endcsname{16}%
539 \expandafter\def\csname vlnnotelilyofduration2/16\endcsname{8}%
540 \expandafter\def\csname vlnnotelilyofduration3/16\endcsname{8.}%
541 \expandafter\def\csname vlnnotelilyofduration4/16\endcsname{4}%
542 \expandafter\def\csname vlnnotelilyofduration5/16\endcsname{???}%
543 \expandafter\def\csname vlnnotelilyofduration6/16\endcsname{???}%
544 \expandafter\def\csname vlnnotelilyofduration7/16\endcsname{???}%
545 \expandafter\def\csname vlnnotelilyofduration8/16\endcsname{2}%
546 \expandafter\def\csname vlnnotelilyofduration9/16\endcsname{???}%
547 \expandafter\def\csname vlnnotelilyofduration10/16\endcsname{???}%
548 \expandafter\def\csname vlnnotelilyofduration11/16\endcsname{???}%
549 \expandafter\def\csname vlnnotelilyofduration12/16\endcsname{???}%
550 \expandafter\def\csname vlnnotelilyofduration13/16\endcsname{???}%
551 \expandafter\def\csname vlnnotelilyofduration14/16\endcsname{???}%
552 \expandafter\def\csname vlnnotelilyofduration15/16\endcsname{???}%
553 \expandafter\def\csname vlnnotelilyofduration16/16\endcsname{1}%
554 \expandafter\def\csname vlnnotelilyofduration1/32\endcsname{32}%
555 \expandafter\def\csname vlnnotelilyofduration2/32\endcsname{16}%
556 \expandafter\def\csname vlnnotelilyofduration3/32\endcsname{???}%
557 \expandafter\def\csname vlnnotelilyofduration4/32\endcsname{8}%
558 \expandafter\def\csname vlnnotelilyofduration5/32\endcsname{???}%
559 \expandafter\def\csname vlnnotelilyofduration6/32\endcsname{???}%
560 \expandafter\def\csname vlnnotelilyofduration7/32\endcsname{???}%
561 \expandafter\def\csname vlnnotelilyofduration8/32\endcsname{4}%
562 \expandafter\def\csname vlnnotelilyofduration9/32\endcsname{???}%
563 \expandafter\def\csname vlnnotelilyofduration10/32\endcsname{???}%
564 \expandafter\def\csname vlnnotelilyofduration11/32\endcsname{???}%
565 \expandafter\def\csname vlnnotelilyofduration12/32\endcsname{???}%
566 \expandafter\def\csname vlnnotelilyofduration13/32\endcsname{???}%
567 \expandafter\def\csname vlnnotelilyofduration14/32\endcsname{???}%
568 \expandafter\def\csname vlnnotelilyofduration15/32\endcsname{???}%
569 \expandafter\def\csname vlnnotelilyofduration16/32\endcsname{2}%
570 \expandafter\def\csname vlnnotelilyofduration17/32\endcsname{???}%
571 \expandafter\def\csname vlnnotelilyofduration18/32\endcsname{???}%
572 \expandafter\def\csname vlnnotelilyofduration19/32\endcsname{???}%
573 \expandafter\def\csname vlnnotelilyofduration20/32\endcsname{???}%
574 \expandafter\def\csname vlnnotelilyofduration21/32\endcsname{???}%
575 \expandafter\def\csname vlnnotelilyofduration22/32\endcsname{???}%
576 \expandafter\def\csname vlnnotelilyofduration23/32\endcsname{???}%
577 \expandafter\def\csname vlnnotelilyofduration24/32\endcsname{???}%
578 \expandafter\def\csname vlnnotelilyofduration25/32\endcsname{???}%
579 \expandafter\def\csname vlnnotelilyofduration26/32\endcsname{???}%
580 \expandafter\def\csname vlnnotelilyofduration27/32\endcsname{???}%
581 \expandafter\def\csname vlnnotelilyofduration28/32\endcsname{???}%
582 \expandafter\def\csname vlnnotelilyofduration29/32\endcsname{???}%
583 \expandafter\def\csname vlnnotelilyofduration30/32\endcsname{???}%
584 \expandafter\def\csname vlnnotelilyofduration31/32\endcsname{???}%
585 \expandafter\def\csname vlnnotelilyofduration32/32\endcsname{1}%
586 % input octave -> Lilypond octave
587 \expandafter\def\csname vlnnotelilyofoctave0\endcsname{}%
588 \expandafter\def\csname vlnnotelilyofoctave1\endcsname{'}%
589 \expandafter\def\csname vlnnotelilyofoctave2\endcsname{''}%
590 \expandafter\def\csname vlnnotelilyofoctave3\endcsname{'''}%
591 % input name -> Lilypond name
592 \expandafter\def\csname vlnnotelilyofnameG=\endcsname{g}%
593 \expandafter\def\csname vlnnotelilyofnameG+\endcsname{gis}%
594 \expandafter\def\csname vlnnotelilyofnameA-\endcsname{aes}%
595 \expandafter\def\csname vlnnotelilyofnameA=\endcsname{a}%
596 \expandafter\def\csname vlnnotelilyofnameA+\endcsname{ais}%
597 \expandafter\def\csname vlnnotelilyofnameB-\endcsname{bes}%
598 \expandafter\def\csname vlnnotelilyofnameB=\endcsname{b}%
599 \expandafter\def\csname vlnnotelilyofnameB+\endcsname{bis}%
600 \expandafter\def\csname vlnnotelilyofnameC-\endcsname{ces}%
601 \expandafter\def\csname vlnnotelilyofnameC=\endcsname{c}%
602 \expandafter\def\csname vlnnotelilyofnameC+\endcsname{cis}%
603 \expandafter\def\csname vlnnotelilyofnameD-\endcsname{des}%
604 \expandafter\def\csname vlnnotelilyofnameD=\endcsname{d}%
605 \expandafter\def\csname vlnnotelilyofnameD+\endcsname{dis}%
606 \expandafter\def\csname vlnnotelilyofnameE-\endcsname{ees}%
607 \expandafter\def\csname vlnnotelilyofnameE=\endcsname{e}%
608 \expandafter\def\csname vlnnotelilyofnameE+\endcsname{eis}%
609 \expandafter\def\csname vlnnotelilyofnameF-\endcsname{fes}%
610 \expandafter\def\csname vlnnotelilyofnameF=\endcsname{f}%
611 \expandafter\def\csname vlnnotelilyofnameF+\endcsname{fis}%
612 \expandafter\def\csname vlnnotelilyofnameG-\endcsname{ges}%
613 \def\lilywrite{%
614 \newwrite\lilyfile%
615 \immediate\openout\lilyfile=out.ly%
616 \immediate\write\lilyfile{\lily}%
617 \immediate\closeout\lilyfile%
618 }%
619 \def\vlnlilyaddnote#1{%
620 \expandafter\xdef\csname lilynote\the\vlnnote\endcsname{#1}%
621 }
622 \def\vlnlilyflush{%
623 \count@0%
624 \ifthenelse{\equal{\the\vlnlilyslurbegin}{0}}%
625 {%
626 }%
627 {%
628 \advance\vlnlilyslurbegin by-1\relax%
629 \expandafter\xdef\csname lilynote\the\vlnlilyslurbegin\endcsname{\csname lilynote\the\vlnlilyslurbegin\endcsname(}%
630 \advance\vlnnote by-1\relax%
631 \expandafter\xdef\csname lilynote\the\vlnnote\endcsname{)\csname lilynote\the\vlnnote\endcsname}%
632 \advance\vlnnote by1\relax%
633 \vlnlilyslurbegin=0%
634 }%
635 \whiledo{\count@<\vlnnote}{%
636 \edef\lily{\lily\csname lilynote\the\count@\endcsname^^J}%
637 \advance\count@ by1\relax%
638 }%
639 }%
640 \def\vlnlilywriteverbatim{%
641 \@bsphack%
642 \let\do\@makeother\dospecials%
643 \catcode`\^^M\active \catcode`\^^I=12%
644 \def\verbatim@processline{%
645 \xdef\lily{\lily\the\verbatim@line^^J}%
646 }%
647 \verbatim@start%
648 }%
649 \def\endvlnlilywriteverbatim{%
650 \@esphack%
651 }%
652 \newcount\vlnlilyslurbegin%
653 \vlnlilyslurbegin=0%
654 \def\vlnlilyslurend{}%
655 \def\vlnnotelily{%
656 \count@=\vlncurrpitch\relax%
657 \advance\count@ by8%
658 \divide\count@ by12%
659 \edef\vlnlilyoctave{\csname vlnnotelilyofoctave\the\count@\endcsname}%
660 \ifthenelse{\equal{\vlncurrbow}{N}}%
661 {%
662 \edef\vlnlilyname{r}%
663 \edef\vlnlilyoctave{}%
664 }%
665 {%
666 \edef\vlnlilyname{\csname vlnnotelilyofname\vlncurrletter\vlncurrshift\endcsname}%
667 }%
668 \edef\text@{\csname vlncurrtimenum0\endcsname/\csname vlncurrtimeden0\endcsname}%
669 \edef\vlnlilyduration{\csname vlnnotelilyofduration\text@\endcsname}%
670 \count@1%
671 \whiledo{\count@<\vlncurrtimes}{%
672 \edef\text@{\csname vlncurrtimenum\the\count@\endcsname/\csname vlncurrtimeden\the\count@\endcsname}%
673 \edef\vlnlilyduration{%
674 \vlnlilyduration\string~\vlnlilyname\vlnlilyoctave\csname vlnnotelilyofduration\text@\endcsname%
675 }%
676 \advance\count@ by 1\relax%
677 }%
678 % Phrasé
679 \def\vlnlilytie{}%yes
680 \def\vlnlilyslurend{}%
681 \ifthenelse{\equal{\vlncurrrealbow}{\vlnlastrealbow}}%
682 {%
683 \ifthenelse{\equal{\vlncurrbowwithlast}{yes}}%
684 {%
685 }%
686 {%
687 \ifthenelse{\equal{\the\vlnlilyslurbegin}{0}}%
688 {%
689 \vlnlilyslurbegin\vlnnote%
690 }%
691 {%
692 }%
693 }%
694 }%
695 {%
696 \ifthenelse{\equal{\the\vlnlilyslurbegin}{0}}%
697 {%
698 }%
699 {%
700 \advance\vlnlilyslurbegin by-1\relax%
701 \expandafter\xdef\csname lilynote\the\vlnlilyslurbegin\endcsname{\csname lilynote\the\vlnlilyslurbegin\endcsname(}%
702 \vlnlilyslurbegin=0%
703 \def\vlnlilyslurend{)}%
704 }%
705 }%
706 %\ifthenelse{\equal{\the\vlncurrpitch}{\the\vlnlastpitch}}%
707 %\edef\vlnlilytie{\string~ }%
708 %\edef\vlnlilytie{}
709 %\csname lilynote\the\vlnlilyslurbegin\endcsname%
710 %\expandafter\def\csname lilynote\the\vlnlilyslurbegin\endcsname{#1}%
711 %\ifthenelse{\equal{\vlnlilyslurbegin}{}}%
712 % {\edef\vlnlilyslurend{}}%
713 % {\edef\vlnlilyslurend{)}}%
714 %\edef\vlnlilyslurbegin{}
715 % Accord
716 \ifthenelse{\equal{\vlncurrbowwithnext}{yes}}%
717 {%
718 \ifthenelse{\equal{\vlncurrbowwithlast}{yes}}%
719 {%
720 \vlnlilyaddnote{%
721 \space%
722 \vlnlilyname%
723 \vlnlilyoctave%
724 }%
725 }%
726 {%
727 \vlnlilyaddnote{%
728 \vlnlilytie%
729 \vlnlilyslurend%
730 <\vlnlilyname%
731 \vlnlilyoctave%
732 }%
733 }%
734 }%
735 {%
736 \ifthenelse{\equal{\vlncurrbowwithlast}{yes}}%
737 {%
738 \vlnlilyaddnote{%
739 \space%
740 \vlnlilyname%
741 \vlnlilyoctave%
742 >%
743 \vlnlilyduration%
744 }%
745 %\vlncurrtimeden*\vlncurrtimenum%
746 }%
747 {%
748 \vlnlilyaddnote{%
749 \vlnlilyslurend%
750 \vlnlilyname%
751 \vlnlilyoctave%
752 \vlnlilyduration%
753 }%
754 %\vlncurrtimeden*\vlncurrtimenum%
755 }%
756 }%
757 }%