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