]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/introduction.doc
05fdfff7160d9cf9706312fb94c4803f61b7a516
[lilypond.git] / Documentation / introduction.doc
1 % -*-latex-*-
2
3 % this document should be run through the mudela-book script after lilypond
4 % has been installed.  The rules have been precooked into the
5 % Documentation/Rules.make file; do 
6 %
7 %   make out/introduction.dvi
8 %
9 % or
10 %
11 %   mudela-book --outdir=out/ --outname=introduction.mudtex introduction.doc
12 %   latex '\nonstopmode \input out/introduction.mudtex'
13
14
15 \documentclass{article}
16 \usepackage{a4wide}
17 \title{Introduction to GNU LilyPond}
18 \author{Jan Nieuwenhuizen}
19 \date{March 2, 1998}
20
21 \def\file#1{\verb+#1+}
22
23 % ugh: trick to get examples not generate par
24 % these are for 16pt
25 \def\mudelapaperlinewidth{-28.452756}%
26 \def\mudelapaperindent{28.452756}%
27 \def\mudelapaperrulethickness{0.400000}%
28 \def\mudelapaperbarsize{16.000000}%
29 \def\mudelapaperinterline{4.000000}%
30 \def\mudelapapernotewidth{5.930000}%
31 \def\mudelapaperwholewidth{8.640000}%
32 \def\mudelapaperunitspace{22.000000}%
33 \def\mudelapaperbasicspace{4.000000}%
34 \def\mudelapapergeometric{0.000000}%
35 \def\mudelapaperarithmetic_basicspace{2.000000}%
36 \def\mudelapaperarithmetic_multiplier{4.800000}%
37 \def\mudelapaperinterbeam{3.140000}%
38 \def\mudelapapergourlay_energybound{100000.000000}%
39 \def\mudelapapergourlay_maxmeasures{14.000000}%
40 % huh?
41 % \def\exampleheight{2\mudelapaperbarsize pt}
42 \def\exampleheight{2cm}
43
44 % ful of pars, needs the above
45 \input lilyponddefs
46 % generates par
47 \musixsixteendefs
48 \def\musixsixteendefs{}
49 % generates par
50 \turnOnPostScript%
51 \def\turnOnPostScript{}
52 % generates par
53 \def\interscoreline{}
54
55
56 \begin{document}
57 \maketitle
58
59 %\def\interexample{\hskip15mm$\Longrightarrow$\hskip15mm}
60 %\def\interexample{\hbox to10mm{\hfill\hbox to0pt{\hss\vbox to\exampleheight{\vss$\Longrightarrow$\vss}\hss}\hfill}}
61 \def\interexample{}
62 \def\preexample{\par}
63 \def\postexample{\par\medskip}
64
65 \def\file#1{{\texttt{#1}}}
66 \setcounter{secnumdepth}{-1}
67
68 \emph{\Large ***Under construction***}
69
70 \section{Introduction}
71 This document should provide a gentle introduction to 
72 LilyPond's input language, Mudela.
73 For completeness and nifty features see 
74 \file{input/*.ly}
75 and
76 \file{lily/parser.y}, \file{lily/lexer.l}.
77 By tradition, Mudela files have the extension \file{.ly}.
78
79 Mudela is an ascii script language 
80 that is especially designed 
81 to be easy to read and write.
82 In the following sections 
83 the basic elements of Mudela are presented
84 in a series of simple examples.
85 Each example has
86 a verbatim snippet of Mudela%
87 % a snippet of Mudela as it's typed-in%
88 \footnote{ 
89 In an effort not to bore you too much with details,
90 we leave-out some red tape
91 that's needed for a valid piece of Mudela.
92 Therefore, before you try-out any of the examples,
93 be sure to read the section `A complete example'.}
94 on the left
95 and the resulting fragment of music on the right
96 as it was produced by LilyPond.
97
98 \section{Notes}
99
100 Let's start with a single note, a quarter C
101
102 \begin[fragment,verbatim,center]{mudela}
103 c
104 \end{mudela}
105
106 Now that was easy and entering a scale is not much harder
107
108 %\subsection{Pitches}
109
110 \begin[fragment,verbatim,center]{mudela}
111 c d e f g a b
112 \end{mudela}
113
114 % \subsection{Durations}
115
116 However, having only quarter notes may get a bit dull.
117 Durations are entered as their reciproce values
118 % a1 a2 a4 a a8 a a16 a a32 a a64 a a a a
119 \begin[fragment,verbatim,center]{mudela}
120 a1 a2 a4 a a8 a a16 a32 a64
121 \end{mudela}
122 note that you only have to specify
123 the duration when it changes:
124 Lily assumes a note has the same duration as the previous one.
125
126 Now we can already write a little tune
127 \begin[fragment,verbatim,center]{mudela}
128 c d e c | c d e c | e f g2
129 \end{mudela}
130 As you'll probably have guessed,
131 the vertical bar (pipe) \verb+|+ may be used to mark
132 measures.
133
134 In the scale shown above
135 we left-out the last c note of the next octave.
136 Postfixing the pitch with a quote \verb+'+
137 produces a note by one octave higher
138 \begin[fragment,verbatim,center]{mudela}
139 c c' c''
140 \end{mudela}
141
142 Prefixing the pitch with a quote \verb+'+
143 produces a note by one octave lower
144 \begin[fragment,verbatim,center]{mudela}
145 a 'a ''a
146 \end{mudela}
147
148 \section{Slurs and Ties}
149
150 A tie connects two adjacent noteheads
151
152 \begin[fragment,verbatim,center]{mudela}
153 e' ~ e
154 \end{mudela}
155
156 Whereas a slur rather connects `chords', 
157 and tries to avoid crossing stems
158
159 \begin[fragment,verbatim,center]{mudela}
160 e'( )e
161 \end{mudela}
162
163 And of course, such a (legato) slur can span several notes
164 \begin[fragment,verbatim,center]{mudela}
165 c( d e )f
166 \end{mudela}
167
168 \section{Beams and Plets}
169
170 A beam is 
171 \begin[fragment,verbatim,center]{mudela}
172 [a8 a] [a16 a a a]
173 \end{mudela}
174
175 Here's a beamed triplet
176 \begin[fragment,verbatim,center]{mudela}
177 [/3 a8 a a]/1
178 \end{mudela}
179
180 a triplet without a beam
181 \begin[fragment,verbatim,center]{mudela}
182 \[/3 a4 a8\]
183 \end{mudela}
184
185 and a combination
186 \begin[fragment,verbatim,center]{mudela}
187 [/3 a8 a16 a] a8 \]
188 \end{mudela}
189
190 Abbreviations
191 \begin[fragment,verbatim,center]{mudela}
192 c1:16 [:16 e1 g]
193 \end{mudela}
194
195 \begin[fragment,verbatim,center]{mudela}
196 c4:32 [:16 c8 d8]
197 \end{mudela}
198
199 \section{Notenames}
200
201 Lily has predefined sets of notenames
202 for various languages%
203 \footnote{These are Dutch, English, German, Italian and Swedish.
204 Simply include the language specific init file \file{<language.ly>}.}.
205 The default set are the ones we like best are the Dutch notenames.
206
207 A sharp is formed by adding \verb+is+
208 \begin[fragment,verbatim,center]{mudela}
209 cis dis eis fis gis ais bis
210 \end{mudela}
211
212 and a flat is formed by adding \verb+es+%
213 %\footnote{Exceptions: \verb+es+ and \verb+as+.}
214 \footnote{Exceptions: {\tt es} and {\tt as}.}
215 \begin[fragment,verbatim,center]{mudela}
216 ces des es fes ges as bes
217 \end{mudela}
218
219 With the obvious names for double sharps
220 \begin[fragment,verbatim,center]{mudela}
221 cisis disis eisis fisis gisis aisis bisis
222 \end{mudela}
223
224 and double flats
225 \begin[fragment,verbatim,center]{mudela}
226 ceses deses eses feses geses ases beses
227 \end{mudela}
228 See why we like-em?
229
230 There are two special `notenames', the rest
231 \begin[fragment,verbatim,center]{mudela}
232 r16 [a a a]
233 \end{mudela}
234
235 and the space
236 \begin[fragment,verbatim,center]{mudela}
237 a2 s-"diminuendo" | a
238 \end{mudela}
239
240
241 \section{Commands}
242
243 \begin[fragment,verbatim,center]{mudela}
244 \clef "bass"; 'c
245 \end{mudela}
246
247 and a clef-change
248 \begin[fragment,verbatim,center]{mudela}
249 \clef "violin"; f' e' \clef "alto"; d' c'
250 \end{mudela}
251
252 \begin[fragment,verbatim,center]{mudela}
253 \meter 3/4; c g g |
254 \end{mudela}
255
256 \begin[fragment,verbatim,center]{mudela}
257 \key fis cis;
258 'g 'a 'b cis d e fis g'
259 \end{mudela}
260 Note how Mudela allows you to 
261 convey a musical message
262 rather than forces you to produce a list of typesetting commands.
263 If the music a \verb+cis+, you type a \verb+cis+.
264 Depending on the key and context of the note
265 Lily will determine what accidentals to typeset.
266
267 A reminder accidental can be forced by
268 using an exclamation mark \verb+!+
269 on a pitch a reminder accidental
270 \begin[fragment,verbatim,center]{mudela}
271 cis d e cis | c! d e c |
272 \end{mudela}
273
274 \begin[fragment,verbatim,center]{mudela}
275 \meter 2/4;
276 \bar "|:"; c c \bar ":|:"; c c \bar ":|"; c c \bar "|."; 
277 \end{mudela}
278
279 \section{Scripts}
280
281 Staccato may be abbreviated
282 \begin[fragment,verbatim,center]{mudela}
283 a-\staccato a-.
284 \end{mudela}
285
286 Marcato
287 \begin[fragment,verbatim,center]{mudela}
288 a-\marcato a-|
289 \end{mudela}
290
291 Staccatissimo
292 \begin[fragment,verbatim,center]{mudela}
293 a-\staccatissimo a-^
294 \end{mudela}
295
296 Sforzato
297 % duh?
298 % a-\sforzato a->
299 \begin[fragment,verbatim,center]{mudela}
300 a-\accent a->
301 \end{mudela}
302
303 \begin[fragment,verbatim,center]{mudela}
304 a-\fermata
305 \end{mudela}
306
307 \begin[fragment,verbatim,center]{mudela}
308 a-\fermata
309 \end{mudela}
310
311 Dynamics from pianississimo upto mezzopiano
312 \begin[fragment,verbatim,center]{mudela}
313 a\ppp a\pp a\p a\mp
314 \end{mudela}
315
316 from fortississimo downto mezzoforte
317 \begin[fragment,verbatim,center]{mudela}
318 a\fff a\ff a\f a\mf
319 \end{mudela}
320
321 sforzando, sforzato and rinforzato
322 % huh?
323 % a\sfz a\sf a\rf
324 \begin[fragment,verbatim,center]{mudela}
325 a\sfz a\sf
326 \end{mudela}
327
328 Fingering
329 \begin[fragment,verbatim,center]{mudela}
330 [e8-1 c'-5 g-3 f-2] a''-\flageolet
331 \end{mudela}
332
333 Bowing
334 \begin[fragment,verbatim,center]{mudela}
335 c-\upbow d-\downbow
336 \end{mudela}
337
338 Footwork
339 \begin[fragment,verbatim,center]{mudela}
340 \clef "bass"; \octave c;
341   'b4.-\lheel [cis8-\ltoe dis8-\rtoe e8-\rheel]
342 \end{mudela}
343
344 \section{Chords and Voices}
345
346 Here's a simple chord
347 \begin[fragment,verbatim,center]{mudela}
348 <c e g>
349 \end{mudela}
350
351 here are a few
352 \begin[fragment,verbatim,center]{mudela}
353 <
354         { c()d()c }
355         { e()f()e }
356         { g()a()g }
357 >
358 \end{mudela}
359
360 and similarly voices
361 \begin[fragment,verbatim,center]{mudela}
362 <
363         { \voiceone c g c g }
364         { \voicetwo 'c2 'g2 }
365 >
366 \end{mudela}
367
368
369 \section{A complete example}
370 %\label{se:complete}
371
372 A Mudela file needs some red tape
373
374 \begin[verbatim,center]{mudela}
375 \score{
376         \melodic {
377                 \octave c';
378                 c d e c |
379                 c d e c |
380                 e f g2 |
381         }
382 }
383 \end{mudela}
384
385 \section{Lyrics}
386
387 \begin[verbatim,center]{mudela}
388 \score{
389         < 
390                 \melodic{ 
391                         \octave c'; 
392                         c d e c | c d e c |
393                         e f g2 | e4 f g2
394                         \bar "|.";
395                 }
396                 \type Lyrics \lyric{ 
397                         Fr\`e-4 re Ja- que
398                         Fr\`e- re Ja- que
399                         Dor- mez vous?2
400                         Dor-4 mez vous?2
401                 }
402         >
403 }
404 \end{mudela}
405
406 \section{Variables}
407
408
409 \section{Ly2dvi}
410 Check-out this handy little script 
411 that not only may save you quite some keystrokes,
412 but produces titles and takes care of
413 margins and (hopefully) papersizes.
414 See \file{ly2dvi (1)}.
415
416 \end{document}
417