]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/tutorial.itely
482d1b0b356bb0a5befc43e9022c753584707b7d
[lilypond.git] / Documentation / user / tutorial.itely
1 @c -*-texinfo-*-
2
3 @c TODO: LilyPond Lilypond lilypond
4
5 @node Tutorial
6 @chapter Tutorial
7   
8 LilyPond prints music from a specification that you, the user, supply.
9 You have to give that specification using a textual @emph{language}.  
10 This chapter is a gentle introduction to that language.
11
12 [rewrite]
13 @c gentle?
14 @c the first section is gentle
15 @c the later sections get rather high-brow, deep, detailed, thorough
16
17
18 This tutorial will demonstrate how to use Lilypond by presenting
19 examples of input along with resulting output.  We will use English
20 terms for notation.  In case you are not familiar with those, you may
21 consult the glossary that is distributed with LilyPond.
22
23 @menu
24 * Music language of LilyPond::  
25 * Running LilyPond::            Getting started
26 * The first tune::              The first tune
27 * Lyrics and chords::           Lyrics and chords
28 * More movements ::             
29 * A piano excerpt::             Piano music
30 * An orchestral score::         
31 * Other ways to run LilyPond::  
32 * Integrating text and music::  
33 * end of tutorial::             The end
34 @end menu
35
36 @node Music language of LilyPond
37 @section Music language of LilyPond
38
39
40 simple notes
41 @lilypond[verbatim, relative 1]
42 a b c
43 @end lilypond
44
45 alterations
46 @lilypond[verbatim, relative 0]
47 fis as cisis beses
48 @end lilypond
49
50 durations
51 @lilypond[verbatim, relative 1]
52 a1 a2 a8 a4 a16 a8. a16
53 @end lilypond
54
55 octaves: high quote, low quote (comma)
56 @lilypond[verbatim, relative 1]
57 c c, c''
58 @end lilypond
59
60 @c normal use of LilyPond is \relative note entry
61 @c so let's just show/explain that and make smart
62 @c people look for non-\relative
63
64 lilypond chooses nearest note
65 @lilypond[verbatim, relative 1]
66 c f c g c
67 @end lilypond
68
69 to go other way: add octaviation quote
70 @lilypond[verbatim, relative 1]
71 c f, c' g, c' 
72 @end lilypond
73
74 rests and skips
75 @lilypond[verbatim, relative 1]
76 r2 s4 r4
77 @end lilypond
78
79
80 meter
81 @c \time -> \meter ?
82 @lilypond[verbatim, relative 1]
83 \time 3/4 c c c | R1 * 3/4
84 @end lilypond
85
86 key
87 @lilypond[verbatim, relative 0]
88 \key f \major es as bes
89 @end lilypond
90
91 slur, tie, phrasing slur
92 @lilypond[verbatim, relative 1]
93 c\( ( ) d  ~ d \) c
94 @end lilypond
95
96 simple chords
97 @lilypond[verbatim, relative 1]
98 <a c> <b d> <c e>
99 @end lilypond
100
101 suddenly lilypond gets really difficult:
102 [explain about score -> \score and \notes]
103
104 long chords; simultaneous music
105 @lilypond[verbatim]
106 % huh?
107 % \singleLine
108 % \paper { \singleLine }
109 \paper { linewidth = -1.0 }
110 \score {
111   \context Staff \notes \relative c'' <
112     { a b c }
113     { c d e }
114   >
115 }
116 @end lilypond
117
118 @lilypond[verbatim]
119 \paper { linewidth = -1.0 }
120 \score {
121   \context GrandStaff \notes \relative c' <
122     { a' b c }
123     { \clef bass c d e }
124   >
125 }
126 @end lilypond
127
128
129 @node Running LilyPond
130 @section Running LilyPond
131
132 Before we dive into describing the input language of LilyPond, we first
133 show you through the procedure for getting notes on your screen and out
134 of your printer.
135
136 The first step is creating an input file.  Using your favorite
137 text-editor, create @file{test.ly} containing
138
139 @ignore
140
141 NOTE: if you're reading this, ie, the Texinfo source itself, test.ly
142 should of course contain:
143
144    \score{
145      \notes { c'4 e' g' }
146    }
147
148 @end ignore
149
150 @example
151 \score @{
152   \notes @{ c'4 e' g' @}
153 @} 
154 @end example
155
156 @unnumberedsubsec Unix
157 @cindex Unix, Running lilypond on
158 @cindex ly2dvi
159
160 On unix, you invoke ly2dvi to compile your lilypond source file (you can
161 omit the @code{.ly}):
162
163 @example
164 ly2dvi -P test
165 @end example
166
167 You will see the following on your screen:
168
169 @example
170 GNU LilyPond 1.3.145
171 Now processing: `/home/fred/ly/test.ly'
172 Parsing...
173 Interpreting music...[1]
174 Preprocessing elements... 
175 Calculating column positions... [2]
176 paper output to test.tex...
177
178 Analyzing test.tex...
179 Running LaTeX...
180 Running dvips...
181 PS output to test.ps...
182 DVI output to test.dvi...
183 @end example
184
185 The results of the ly2dvi run are a ``DeVice Independent'' file
186 (@file{test.dvi}) and a PostScript file (@file{test.ps}).
187
188 @cindex DVI file
189
190 @cindex Viewing music
191 @cindex xdvi
192 @cindex .dvi
193
194 To view the @code{test.dvi} output, run Xdvi (you may omit the
195 @code{.dvi}):
196
197 @example
198 xdvi test
199 @end example
200
201 @c FIXME: should we say anything on xdvi-gs interaction?
202
203 You should see the following in  a window next to some buttons.
204 @lilypond
205 \score {
206   \notes { c'4 e' g' }
207
208 @end lilypond
209
210 When you're satisfied with the result, you can print the
211 PostScript file:
212
213 @example
214 lpr test.ps
215 @end example
216 If this does not make your printer produce a page of music, you should
217 look into installing and configuring ghostscript.  Refer to
218 GhostScript's website at @uref{http://www.ghostscript.com}.
219 @cindex GhostScript
220 @cindex @code{lpr}
221 @cindex Printing output
222
223 @cindex PostScript
224 @cindex .ps
225
226
227 @unnumberedsubsec Windows
228
229
230 On windows, you open a LilyPond shell, and then you invoke ly2dvi
231 compile your lilypond source file, just like on Unix:
232
233 @example
234 ly2dvi -P test
235 @end example
236
237 You will see the following on your screen:
238
239 @c FIXME: leave this out, just refer to unix section?
240 @c FIXME: commands run in dos shell: we can't redirect output
241 @example
242 GNU LilyPond 1.3.150
243 Now processing: `/home/tim/ly/test.ly'
244 Parsing...
245 Interpreting music...[1]
246 Preprocessing elements... 
247 Calculating column positions... [2]
248 paper output to test.tex...
249
250 This is TeX, Version 3.14159 (MiKTeX 2)
251 LaTeX2e <2000/06/01>
252 Babel <v3.6Z> and hyphenation patterns for english, french, german, ngerman, du
253 mylang, nohyphenation, loaded.
254
255 (test.latex (C:\cygwin\usr\windows\MiKTeX\tex\latex\base\article.cls
256 Document Class: article 2000/05/19 v1.4b Standard LaTeX document class
257 (C:\cygwin\usr\windows\MiKTeX\tex\latex\base\size10.clo))
258 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\geometry.sty
259 (C:\cygwin\usr\windows\MiKTeX\tex\latex\graphics\keyval.sty))
260 (C:\cygwin\usr\windows\MiKTeX\tex\latex\base\inputenc.sty
261 (C:\cygwin\usr\windows\MiKTeX\tex\latex\base\latin1.def))
262 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\titledefs.tex)
263 No file test.aux.
264 (test.tex
265 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\lilyponddefs.tex
266 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\lilypond-latex.tex
267 LaTeX definitions)
268 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\feta20.tex)
269 (C:\cygwin\usr\lilypond-1.3.150.jcn2\share\lilypond\tex\lily-ps-defs.tex)
270 [footer empty]))
271 Overfull \hbox (15.0pt too wide) in paragraph at lines 20--24
272 [] $[]$ 
273
274 Overfull \vbox (0.7539pt too high) has occurred while \output is active
275 [1] (test.aux) )
276 (see the transcript file for additional information)
277 Output written on test.dvi (1 page, 4292 bytes).
278 Transcript written on test.log.
279 This is dvips(k) 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com)
280 ' TeX output 2001.04.25:0015' -> test.ps
281 <texc.pro><special.pro>. [1] 
282 Running LilyPond...
283 Analyzing test.tex...
284 PS output to test.ps...
285 DVI output to test.dvi...
286 @end example
287
288 To view the @code{test.dvi} output, run Yap
289
290 @example
291 yap test
292 @end example
293
294 You should see the following in a window
295 @lilypond
296 \score {
297   \notes { c'4 e' g' }
298
299 @end lilypond
300
301 @c FIXME: talk about newer Yap versions, proper gs installation?
302 When you're satisfied with the result, you can print from within Yap
303 (File/Print).  Note that Yap may not display embedded PostScript symbols
304 such as beams and slurs.  Don't worry, they'll be printed anyway.
305
306 You can also print the PostScript file directly from the
307 command line using GSview:
308
309 @example
310 gsview32 /s test.ps
311 @end example
312
313
314
315 @node The first tune
316 @section The first tune
317
318
319 @cindex examples, tutorial
320
321 The examples discussed are included in the distribution, in the
322 subdirectory @file{input/tutorial/}@footnote{When we refer
323 to filenames, they are relative to the top directory of the source
324 package.  In binary installations you should look in your doc section,
325 eg, @code{/usr/share/doc/lilypond1.3/examples/input/tutorial}
326 @cindex file names
327 }. We recommend that you experiment with writing Lilypond input
328 yourself, to get a feel for how the program behaves.
329
330
331
332 To demonstrate what LilyPond input looks like, we start off with a
333 full-fledged, yet simple example. It is a convoluted version
334 of the famous minuet in J. S. Bach's @emph{Klavierb@"uchlein}. The file
335 is included in the distribution as  @file{minuet.ly}.
336 @cindex Bach, Johann Sebastian 
337
338 @lilypond[verbatim]
339 % all text after a percent sign is a comment
340 % and is ignored by Lilypond
341 \include "paper16.ly"
342 \score {
343     \notes                        
344     \relative c'' \sequential {
345             \time 3/4                
346             \key g \major
347
348         \repeat "volta" 2 {
349             d4 g,8 a b c d4 g, g |
350             e'4 c8 d e fis g4 g, g |
351             c4 d8( )c b a( )b4 c8 b a g |
352             a4 [b8 a] [g fis] g2.  |
353         }
354
355         b'4 g8 a b g
356         a4 d,8 e fis d |
357         g4 e8 fis g d cis4 b8 cis a4 |
358         a8-. b-. cis-. d-. e-. fis-.
359         g4 fis e |
360         fis a,  r8 cis8
361         d2.-\fermata
362         \bar "|."
363     }
364     \paper {
365        % standard settings are too wide for a book
366        linewidth = 14.0 \cm
367    }
368 }
369 @end lilypond
370
371 We will analyse the input, line by line.
372 @separate
373 @example
374         % all text after a percent sign is a comment
375         % and is ignored by Lilypond
376 @end example 
377 The percent sign, @code{%}, introduces a line comment.  You can also
378 comment out a block of several lines, by enclosing them in
379 @code{%@{} and @code{%@}}.
380 @cindex comment
381 @cindex block comment
382 @cindex line comment
383 @separate
384 @example 
385
386         \include "paper16.ly"
387  
388 @end example
389 @cindex @code{\include}
390 @cindex point, printer's
391 @cindex staff size setting 
392 By default, LilyPond will typeset the music in a size such that each 
393 staff is 20 point@footnote{A point is the standard measure of length for
394 printing; one point is 1/72.27 inch.} high.  We want smaller
395 output (16 point staff height), so we must import the settings for that
396 size, which is done here.
397 @separate
398 @example 
399
400         \score @{
401  
402 @end example 
403 Music is printed by combining a piece of music with directions for
404 outputting it.  This combination is formed in the @code{\score} block.
405 @separate
406 @example 
407
408         \notes                
409  
410 @end example 
411 Prepare LilyPond for accepting notes.
412 @cindex octaves, choosing
413 @cindex pitch
414 @separate
415 @example 
416
417         \relative c''
418  
419 @end example
420 @cindex relative
421 As we will see, each note is described by its note name, duration,
422 octave and possibly a chromatic alteration.  In this setup, the octave
423 is indicated by using high quotes (@code{'}) and ``lowered quotes''
424 (commas: @code{,}).  The central C is denoted by @code{c'}.  The C one
425 octave higher is @code{c''}.  One and two octaves below the central C is
426 denoted by @code{c} and @code{c,} respectively.
427
428 Even though a piece of music often spans a range of several octaves, it
429 mostly moves in small intervals.  LilyPond has a special entry mode to
430 save typing in this situation.  In this ``relative'' octave mode,
431 octaves of notes without quotes are chosen such that a note is as close
432 as possible (graphically, on the staff) to the preceding note.  If you
433 add a high-quote an extra octave is added.  A lowered quote (a comma)
434 will subtract an extra octave.
435
436 Because the first note has no predecessor,
437 you have to give the (absolute) pitch of the note to start with.
438 @separate
439 @example 
440
441         \sequential @{
442  
443 @end example 
444 What follows is sequential music, i.e.,
445 @cindex sequential music
446 notes that are to be played and printed after each other.
447 @separate
448 @example 
449
450         \time 3/4
451  
452 @end example
453 @cindex time signature, setting
454 @cindex @code{\time}
455 Set (or change) the time signature of the current piece: a 3/4 sign is
456 printed.  The time signature setting is also used to generate bar lines
457 at the right spots.
458 @separate
459 @example 
460
461         \key g \major
462  
463 @end example
464 @cindex key signature, setting
465 @cindex @code{\key}
466 Set (or change) the current key signature to G-major.  Although in this
467 example, the @code{\key} command happened to be entered after the
468 @code{\time} command, in the output the time signature will be printed
469 after the key signature; LilyPond knows about music typesetting
470 conventions.
471 @separate
472 @example 
473
474         \repeat "volta" 2
475  
476 @end example 
477 The following piece of music is played twice.  The first argument
478 indicates the type of repeat.  In this case, @code{"volta"} means that
479 prima volta/secunda volta brackets are used for the alternative
480 endings---if there were any.
481 @separate
482 @example 
483
484         @{
485  
486 @end example 
487 The subject of the repeat is again sequential music.  Since
488 @code{\sequential} is such a common construct, a shorthand is provided:
489 just leave off @code{\sequential}, and the result is the same.
490 @separate
491 @example 
492
493         d4 g,8
494  
495 @end example 
496 Two notes.  The first note is a quarter note with relative pitch
497 @code{d}.  The relative music was started with a @code{c''}, so the real
498 pitch of this note is @code{d''}.  The duration of a note is designated
499 by a number; the @code{4} here represents a quarter note.
500
501 The second note is an eight note with relative pitch @code{g,}.  The
502 pitch is taken relative to the previous @code{d''}, making this
503 note have real pitch @code{g'}.  The @code{8} represents an eight note.
504 @separate
505 @example 
506
507         a b
508  
509 @end example 
510 Two more notes, with pitch @code{a} and @code{b}.  Because their
511 duration is the same as the @code{g,8}, there is no need to enter the
512 duration, but you may enter it anyway, i.e., @code{a4 b4}
513 @separate
514 @example 
515
516         d4 g, g |
517  
518 @end example
519 @cindex bar check
520 @cindex @code{|}
521 @cindex errors, finding 
522 Three more notes.  The @code{|} character is a ``bar check''.  LilyPond
523 will verify that bar checks are found at the start of a measure.  This can
524 help you track down typing errors.
525
526 @cindex alteration, chromatic
527 @cindex chromatic alteration
528 @separate
529 @example 
530
531         c8 d e fis
532
533 @end example 
534 So far, no notes were chromatically altered.  Here is the first one that
535 is: @code{fis}.  Lilypond by default uses Dutch@footnote{Note names are
536 available in several languages, but we find the Dutch names quite
537 convenient.} note names, and ``Fis'' is the Dutch note name for ``F
538 sharp''.  However, there is no sharp sign in the output. The program
539 keeps track of key signatures, and will only print accidentals if they
540 are needed.
541
542 For groups of eighth notes and shorter, LilyPond can determine how the
543 notes should form a beam.  In this case, the 4 eights are automatically
544 printed as a beam.
545 @separate
546 @example 
547
548         c4 d8( )c b a( )b4 c8 b a g |
549  
550 @end example 
551 The beginning and ending notes of a slur are marked with parentheses,
552 @code{(} and @code{)} for start and end respectively.  The line above
553 indicates two slurs.  These slur markers (parentheses) are entered
554 between the slurred notes.
555 @separate
556 @example 
557
558         a4 [b8 a] [g fis] 
559  
560 @end example 
561 Automatic beaming can be overridden by inserting beam marks, @code{[}
562 and @code{]}.  These beam markers (brackets) are put around the notes
563 you want beamed.
564 @separate
565 @example 
566
567         g2.  |
568  
569 @end example
570 @cindex augmentation dot
571 @cindex dot
572 A period adds an augmentation dot to the note.
573 @separate
574 @example 
575
576         @}
577  
578 @end example 
579 The end of the sequential music to be repeated.  LilyPond will typeset a
580 repeat bar.
581 @separate
582 @example 
583
584         cis'4 b8 cis a4 |
585  
586 @end example 
587 Accidentals are printed whenever necessary: the first C sharp of the bar
588 will be printed with an accidental, the second one without.
589 @separate
590 @example 
591
592         a8-. b-. cis-. d-. e-. fis-.
593  
594 @end example
595 @cindex articulation
596 You can enter articulation signs either in a verbose form or using a
597 shorthand.  Here we demonstrate the shorthand: it is formed by a dash
598 and the character for the articulation to use, e.g. @code{-.} for
599 staccato as shown above.
600 @separate
601 @example 
602
603         fis a, r8 cis8
604  
605 @end example 
606  
607 Rests are denoted by the special notename @code{r}.  
608 @separate
609 @example 
610
611         d2.-\fermata
612  
613 @end example 
614 All articulations have a verbose form, like @code{\fermata}.  The
615 command @code{\fermata} is not part of the core of the language, but it
616 is a shorthand for a more complicated description of a fermata symbol.
617 @code{\fermata} names that description and is therefore called an
618 identifier.
619 @cindex identifier
620 @cindex @code{\fermata}
621 @separate
622 @example
623         \bar "|."
624         @}
625 @end example 
626 Here the music ends.  LilyPond does not automatically typeset and end
627 bar, we must explicitely request one, using @code{"|."}.
628
629 @separate
630 @example 
631
632         \paper @{
633                 linewidth = 14.0\cm
634         @}
635  
636 @end example 
637 The @code{\paper} block specifies how entered music should be converted
638 to notation output.  Most of the details of the conversion (font sizes,
639 dimensions, etc.) have been taken care of, but to fit the output in this
640 document, it has to be narrower.  We do this by setting the line width
641 to 14 centimeters (approximately 5.5 inches).
642 @separate
643 @example 
644
645         @}
646  
647 @end example 
648 The last brace ends the @code{\score} block.
649
650
651
652
653 @node Lyrics and chords
654 @section Lyrics and chords
655
656 In this section we show how to typeset a song. This file is
657 included as @file{flowing.ly}.
658
659 @example 
660 \header @{
661         title = "The river is flowing"
662         composer = "Traditional"
663 @}
664 \include "paper16.ly"
665 melody = \notes \relative c' @{
666         \partial 8
667         \key c \minor
668         g8 |
669         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
670         c4 c8 d [es () d] c4 | d4 es8 d c4.
671         \bar "|."
672 @}
673
674 text = \lyrics @{
675         The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
676         ri -- ver is flo -- wing down to the sea.
677 @}
678
679 accompaniment =\chords @{
680         r8
681         c2:3- f:3-.7 d:min es4 c8:min r8
682         c2:min f:min7 g:7^3.5 c:min @}
683
684 \score @{
685         \simultaneous @{
686           %\accompaniment
687           \context ChordNames \accompaniment
688
689           \addlyrics
690             \context Staff = mel @{        
691               \property Staff.noAutoBeaming = ##t
692               \property Staff.automaticMelismata = ##t
693               \melody 
694             @}
695             \context Lyrics \text
696         @}
697         \midi  @{ \tempo 4=72 @}
698         \paper @{ linewidth = 10.0\cm @}
699 @} 
700 @end example 
701
702
703 The result would look this.@footnote{The titling and font size shown
704 may differ, since the titling in this document is not generated by
705 @code{ly2dvi}.}
706
707 @center @strong{The river is flowing}
708 @center Traditional 
709
710 @lilypond[center]
711 \header {
712         title = "The river is flowing"
713         composer = "Traditional"
714 }
715 \include "paper16.ly"
716 melody = \notes \relative c' {
717         \partial 8
718         \key c \minor
719         g8 |
720         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
721         c4 c8 d [es () d] c4 | d4 es8 d c4.
722         \bar "|."
723 }
724
725 text = \lyrics {
726         The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
727         ri -- ver is flo -- wing down to the sea.
728 }
729
730 accompaniment =\chords {
731         r8
732         c2:3- f:3-.7 d:min es4 c8:min r8
733         c2:min f:min7 g:7^3.5 c:min }
734
735 \score {
736         \simultaneous {
737           %\accompaniment
738           \context ChordNames \accompaniment
739
740           \addlyrics
741             \context Staff = mel {
742               \property Staff.noAutoBeaming = ##t
743               \property Staff.automaticMelismata = ##t
744               \melody 
745             }
746             \context Lyrics \text
747         }
748         \midi  { \tempo 4=72 }
749         \paper { linewidth = 10.0\cm }
750 }
751 @end lilypond
752
753 Again, we will dissect the file line by line.
754 @separate
755 @example 
756
757         \header @{
758  
759 @end example
760 @cindex @code{\header}
761 Information about the music you are about to typeset goes into a
762 @code{\header} block.  The information in this block is not used by
763 LilyPond, but it is passed into the output.  @file{ly2dvi} uses this
764 information to print titles above the music.
765 @separate
766 @example 
767
768         title = "The river is flowing"
769         composer = "Traditional (?)"
770 @end example
771 @cindex assignments
772 @cindex identifier assignment
773 the @code{\header} block contains assignments.  In each assignment, a
774 variable is set to a value. Lexically, both the variable name and the
775 assigned value are strings. The values have to be quoted here, because
776 they contain spaces, the variable names could also be put within quotes
777 but it is not necessary. 
778 @separate
779 @example 
780
781         \include "paper16.ly"
782  
783 @end example
784 Smaller size for inclusion in a book.
785 @separate
786 @example 
787
788         melody = \notes \relative c' @{
789  
790 @end example 
791 The structure of the file will be the same as the previous one, a
792 @code{\score} block with music in it.  To keep things readable, we will
793 give names to the different parts of music, and use the names to
794 construct the music within the score block.
795
796 @separate
797 @example 
798         \partial 8
799 @end example 
800
801 @cindex @code{\partial}
802 @cindex anacrusis
803 The piece starts with an anacrusis of one eighth.
804 @separate
805 @example
806         \key c \minor
807 @end example
808 The key is C minor: we have three flats.
809
810 @separate
811 @example 
812
813         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
814         c4 c8 d [es () d] c4 | d4 es8 d c4.
815         \bar "|."
816  
817 @end example 
818
819 @cindex manual beaming
820 @cindex automatic beaming, turning off
821 We use explicit beaming.  Since this is a song,  we turn automatic
822 beams off, and use explicit beaming where needed.
823 @separate
824 @example 
825
826         @}
827  
828 @end example 
829 This ends the definition of @code{melody}.  
830
831 @separate
832 @example 
833
834         text = \lyrics @{
835  
836 @end example
837 @cindex lyrics
838 @cindex identifier assignment
839 @cindex syllables, entering
840 Another identifier assignment.  This one is for the lyrics. 
841 Lyrics are formed by syllables that have duration, and not by
842 notes. To make LilyPond parse words as syllables,  switch it  into
843 lyrics mode with @code{\lyrics}.  Again, the brace after @code{\lyrics}
844 is a shorthand for @code{\sequential @{}.
845 @separate
846 @example 
847
848   The4 ri -- ver is flo- __ wing,  flo -- wing and gro -- wing, the
849   ri- ver is flo- __ wing down to the sea.
850 @}
851  
852 @end example
853 @cindex extenders, lyric
854 @cindex hyphens, lyric 
855 The syllables  themselves are  separated by spaces.  You can get syllable
856 extenders by entering @code{__}, and centered hyphens with
857 @code{-}@code{-}.  We enter the syllables as if they are all quarter notes
858 in length (hence the @code{4}), and use a feature to align the
859 syllables to the music, which obviously isn't all quarter notes.
860 @separate
861 @example 
862
863         accompaniment =\chords @{
864  
865 @end example
866 @cindex chords
867 @cindex mode, chords
868 We'll put chords over the music. To enter them, there is a special mode
869 analogous to @code{\lyrics} and @code{\notes} mode, where you can give
870 the names of the chords you want, instead of listing the notes
871 comprising the chord.
872 @separate
873 @example 
874
875         r8
876  
877 @end example 
878 There is no accompaniment during the anacrusis.
879 @separate
880 @example 
881
882         c2:3- f:3-.7
883  
884 @end example
885
886 @cindex tonic
887 @cindex chord modifier
888 @cindex modifier, chord 
889 A chord is started by  the tonic of the chord. The
890 first one lasts a half note.  An unadorned note creates a major
891 triad. Since a minor triad is wanted, @code{3-} is added to modify the
892 third to be small. @code{7} modifies (adds) a seventh, which is small by
893 default to create the @code{f a c es} chord.  Multiple modifiers must be
894 separated by dots.
895 @separate
896 @example 
897
898         d:min es4 c8:min r8
899  
900 @end example
901
902 Some modifiers have predefined names, eg. @code{min} is  the same as
903 @code{3-}, so @code{d-min} is a minor @code{d} chord.
904 @separate
905 @example 
906
907         c2:min f:min7 g:7^3.5 c:min @}
908  
909 @end example
910 @cindex named modifier
911
912 A named modifier @code{min} and a normal modifier @code{7} do not have
913 to be separated by a dot.  Tones from a chord are removed with chord
914 subtractions.  Subtractions are started with a caret, and they are
915 also separated by dots.  In this example, @code{g:7^3.5} produces a
916 minor seventh.  The brace ends the sequential music.
917 @separate
918 @example 
919
920         \score @{
921                 \simultaneous @{
922  
923 @end example 
924 We assemble the music in the @code{\score} block.  Melody, lyrics and
925 accompaniment have to sound at the same time, so they should be
926 @code{\simultaneous}.
927 @cindex @code{\simultaneous}
928 @separate
929 @example 
930
931         %\accompaniment
932  
933 @end example 
934 Chord mode generates notes grouped in @code{\simultaneous} music.  If
935 you remove the comment sign, you can see the chords in normal
936 notation: they will be printed as note heads on a separate
937 staff. To print them as chords names, they have to be interpreted as
938 being chords, not notes. This is done with the following command:  
939 @separate
940 @example 
941
942         \context ChordNames \accompaniment
943  
944 @end example
945 @cindex context
946 @cindex interpretation context
947 @cindex notation context
948
949
950 Normally, the notes that you enter are transformed into note heads.
951 Note heads alone make no sense, they need surrounding information: a key
952 signature, a clef, staff lines, etc.  They need @emph{context}.  In
953 LilyPond, these symbols are created by objects called `interpretation
954 contexts'.  Interpretation contexts exist for generating notation
955 (`notation context') and for generating sound (`performance
956 context'). These objects only exist during a run of LilyPond.
957
958 By default, LilyPond will create a Staff context for you.  If you would
959 remove the @code{%} sign in the previous line, you would see that
960 mechanism in action.
961
962 We don't want that default here, because we want chord names.  The
963 command above explicitly creates an interpretation context of 
964 @code{ChordNames} type to interpret the music @code{\accompaniment}. 
965 @separate
966 @example 
967
968         \addlyrics
969  
970 @end example
971 @cindex @code{\addlyrics}
972 @cindex lyrics and melody, combining
973 @cindex combining lyrics and melody
974
975 The lyrics should be aligned with the melody.  This is done by
976 combining both with @code{\addlyrics}.  @code{\addlyrics} takes two
977 pieces of music (usually a melody and lyrics, in that order) and
978 aligns the syllables of the second piece under the notes of the
979 first piece.  If you would reverse the order, the notes would be
980 aligned on the lyrics, which is not very useful, and looks
981 silly.
982 @separate
983 @example 
984
985         \context Staff = mel @{
986  
987 @end example
988
989 The second argument of @code{\addlyrics} is the melody.  We instantiate
990 a @code{Staff} context explicitly: should you choose to remove the
991 comment before the ``note heads'' version of the accompaniment, the
992 accompaniment will be on a nameless staff.  The melody has to be on
993 staff different from the accompaniment.  This is accomplished by giving
994 the melody and accompaniment staffs different names.
995 @separate
996 @example 
997
998         \property Staff.noAutoBeaming = ##t
999  
1000 @end example
1001 @cindex \property
1002 @cindex context variables
1003 @cindex setting context variables
1004 An interpretation context has variables, called properties, that tune
1005 its behaviour.  One of the variables is @code{noAutoBeaming}.  Setting
1006 this Staff's property to @code{##t}, which is the boolean value @var{true},
1007 turns the automatic beaming mechanism off for the current staff.
1008 @cindex GUILE
1009 @cindex Scheme
1010 @cindex accessing Scheme
1011 @cindex evaluating Scheme
1012 @cindex LISP
1013
1014 LilyPond internally uses GUILE, a Scheme-interpreter. Scheme is a
1015 language from the LISP family. You can learn more about Scheme at
1016 @uref{http://www.scheme.org}. It is used to represent data throughout
1017 the whole program. The hash-sign (@code{#}) accesses GUILE directly: the
1018 code following the hash-sign is evaluated as Scheme.  The boolean value
1019 @var{true} is @code{#t} in Scheme, so for LilyPond @var{true} looks like
1020 @code{##t}.
1021
1022 If Scheme scares you, don't worry. You don't need to know Scheme to
1023 create beautiful sheet music.
1024
1025
1026
1027 @separate
1028 @example 
1029
1030         \property Staff.automaticMelismata = ##t
1031  
1032 @end example
1033 @cindex automaticMelismata
1034 @cindex melismata
1035 @cindex @code{\addlyrics} and slurs
1036 Similarly, we  don't want to print a  syllable when there is
1037 a slur. This sets up @code{\addlyrics} to not put lyrics under each
1038 separate note while there is a slur.
1039 @separate
1040 @example 
1041
1042           \melody
1043         @}
1044  
1045 @end example 
1046 Finally, we put the melody on the current staff.  Note that the
1047 @code{\property} directives and @code{\melody} are grouped in sequential
1048 music,  so the property settings are done before the melody is
1049 processed.
1050 @separate
1051 @example 
1052
1053         \context Lyrics \text
1054  
1055 @end example 
1056 The second argument of @code{\addlyrics} is the text. The text also
1057 should not land on a Staff, but on a interpretation context for
1058 syllables, extenders, hyphens etc.  This context is called
1059 Lyrics.
1060 @separate
1061 @example 
1062
1063         \midi  @{ \tempo 4=72@}
1064  
1065 @end example 
1066 MIDI (Musical Instrument Digital Interface) is a standard for
1067 connecting and recording digital instruments. So a MIDI file is like a
1068 tape recording of an instrument. The @code{\midi} block causes makes the
1069 music go to a MIDI file, so you can listen to the music you entered.  It
1070 is great for checking the music.  Whenever you hear something weird, you
1071 probably hear a typing error.
1072
1073 Syntactically, @code{\midi} is similar to @code{\paper @{ @}}, since it
1074 also specifies an output method. You can specify the tempo using the
1075 @code{\tempo} command, in this case the tempo of quarter notes is set to
1076 72 beats per minute.
1077 @separate
1078 @example 
1079
1080         \paper @{ linewidth = 10.0\cm @}
1081  
1082 @end example 
1083 We also want notation output.  The linewidth is short so the piece
1084 will be set in two lines.
1085
1086 @node More movements 
1087 @section More movements
1088
1089 [FIXME: merge here with, or move this to: Other ways to run LilyPond]
1090
1091 You probably ran @file{ly2dvi} on the last example, and ended up with a
1092 viewable @file{.dvi} file.  However, between there are a few steps of
1093 which LilyPond is only one. To enhance your understanding of what's
1094 happening under the hood when you run @code{ly2dvi}, we explain what
1095 programs are run.
1096
1097 @code{ly2dvi} is a program that calls a number of programs  in sequence.
1098 The first thing it does, is running LilyPond on the input file. After
1099 some calculations, a @file{.tex} is produced. The contents
1100 of this file are very  low-level instructions.
1101
1102 For example,  the following file (@file{miniatures.ly}) 
1103
1104 @example
1105 \version "1.3.124"
1106 \header @{ title = "Two miniatures"  @}
1107
1108 #(set! point-and-click line-column-location)
1109
1110 \paper @{ linewidth = -1.0 @}
1111
1112 \score @{
1113     \notes @{ c'4 d'4 @}
1114     \header @{
1115         opus = "Opus 1."
1116         piece = "Up" @}
1117 @}
1118 \score @{
1119     \notes @{ d'4 c'4 @}
1120     \header @{
1121         opus = "Opus 2."
1122         piece = "Down" @}
1123 @}
1124 @end example
1125
1126 The titling in this manual was not generated by ly2dvi, so we can't
1127 exactly show it would look, but the result should resemble this:
1128
1129 @center @strong{Two miniatures}
1130 @flushright
1131 Opus 1.
1132 @end flushright
1133 @flushleft
1134 @var{Up}
1135 @end flushleft
1136 @lilypond
1137   \score {
1138     \notes { c'4 d'4 }
1139     \paper { linewidth = -1.0 }
1140   }
1141 @end lilypond
1142 @flushright
1143 Opus 2.
1144 @end flushright
1145 @flushleft
1146 @var{Down}
1147 @end flushleft
1148 @lilypond
1149   \score {
1150     \notes { d'4 c'4 }
1151     \paper { linewidth = -1.0 }
1152   }
1153 @end lilypond
1154
1155 This file is produced by ly2dvi in a few stages, with the help of text
1156 formatting tools. LilyPond produces two output files, @file{miniatures.tex}
1157 and @file{miniatures-1.tex}.  They both look like this:
1158
1159 @example
1160         ...
1161   \placebox@{-5  \outputscale @}%
1162   @{  8.7229  \outputscale @}%
1163   @{\magfontWXGEomMMBo\char90 @}%
1164   
1165   \placebox@{-4  \outputscale @}%
1166   @{ 81.0647  \outputscale @}%
1167         ...
1168 @end example
1169
1170 @file{ly2dvi} looks at what output LilyPond produces, and generates a
1171 file called @file{ly2dvi.out.tex}. This file contains formatting
1172 instructions for the title and page layout.  A fragment might look like
1173
1174 @example
1175
1176         \def\lilypondopus@{Opus 1.@}
1177         \def\lilypondpiece@{Up@}
1178         \def\mustmakelilypondtitle@{@}
1179         \input miniatures.tex
1180         \def\lilypondtitle@{Two miniatures@}
1181
1182 @end example
1183
1184 @file{ly2dvi} runs it through LaTeX. LaTeX is a text-formatting system
1185 built on top of @TeX{}. It's very popular in the academic world. If LaTeX
1186 is successful, this will produce a @file{.dvi} file, containing both the
1187 titling and the actual music.  @code{ly2dvi} completes its task by
1188 deleting the two temporary files, leaving only @file{miniatures.dvi}.
1189
1190 Next, now we'll look at the example line by line to explain new things.
1191
1192 @separate
1193 @example 
1194 \version "1.3.124"
1195 @end example 
1196 Lilypond and its language are still under development, and occasionally,
1197 details of the syntax are changed. This fragment indicates for which
1198 version the input file was written. When you compile this file, the
1199 version number will be checked, and you will get a warning when the file
1200 is too old.
1201
1202 This version number is also used by the @code{convert-ly} program (See
1203 @ref{convert-ly}), which uses it to update the file to the latest lily
1204 version.
1205
1206 @separate
1207 @example
1208   \header @{ title = "Two miniatures"  @}
1209 @end example
1210 This sets the titling information for the entire file.
1211
1212 @separate
1213 @example
1214         #(set! point-and-click line-column-location)
1215 @end example
1216
1217 This piece of Scheme code sets the Scheme variable
1218 @code{point-and-click} to the value @var{line-column-location} (which
1219 itself is a Scheme procedure).
1220
1221 Editing input files can be quite complicated if you're working with
1222 large files: if you're digitizing existing music, you have to
1223 synchronize the .ly file, the sheet music on your lap and the sheet
1224 music on the screen.  The point-and-click mechanism makes it easy to
1225 find the origin of an error in the .ly file: when you view the file with
1226 Xdvi and click on a note, your editor will jump to the spot where that
1227 note was entered.  For more information, see @ref{Point and click}.
1228
1229 @separate
1230 @example
1231   \paper @{ 
1232 @end example
1233
1234 The @code{\score} blocks that follow in the file don't have
1235 @code{\paper} sections, so the settings of this block are substituted: A
1236 paper block, at top-level, i.e. not in a @code{\score} block sets the
1237 default page layout.
1238
1239 @separate
1240 @example
1241   linewidth = -1.0 @}
1242 @end example
1243
1244
1245
1246 The variable @code{linewidth} normally sets the length of the systems on
1247 the page. However, a negative value has a special meaning. If
1248 @code{linewidth} is less than 0, no line breaks are inserted into the
1249 score, and the spacing is set to natural length: a short phrase takes up
1250 little space, a longer phrase more space.
1251
1252 @separate
1253 @example
1254   \score @{
1255     \notes @{ c'4 d'4 @}
1256 @end example
1257
1258 In previous examples, notes were specified in relative octaves,
1259 i.e. each note was put in the octave that would put it closest to its
1260 predecessor. Besides relative, there is also absolute octave
1261 specification, which you get when you don't specify @code{\relative}. In
1262 this input mode, the central C is denoted by @code{c'}. Going down, you
1263 get @code{c} @code{c,} @code{c,,} etc.  Going up, you get @code{c''}
1264 @code{c'''} etc.
1265
1266 When you're copying music from existing sheet music, relative octaves
1267 are probably the easiest to use: it's less typing work and errors are
1268 easily spotted. However, if you write LilyPond input, either by hand
1269 (ie. composing) or by computer, absolute octaves are probably less work.
1270
1271
1272 @separate
1273 @example
1274     \header @{
1275 @end example
1276
1277 The @code{\header} is normally at the top of the file, where it sets
1278 values for the rest of the file. If you want to typeset different pieces
1279 from one file (for example, if there are multiple movements, or if
1280 you're making an exercise book), you can put different @code{\score}
1281 blocks into the input file. ly2dvi will assemble all LilyPond output
1282 files into a big document. The contents of \header blocks specified
1283 within each score, are used for the titling of each movement.
1284 @separate
1285 @example
1286         opus = "Opus 1."
1287         piece = "Up" @}
1288 @end example
1289 For example, the Opus number is put at the right, and the piece string
1290 will be at the left.
1291
1292
1293
1294 @node A piano excerpt
1295 @section A piano excerpt
1296
1297 Our fourth subject is a piece of piano music.  The fragment in the input
1298 file is a piano reduction of the G major Sinfonia by Giovanni Battista
1299 Sammartini.  It was composed around 1740.  It's in the source package
1300 under  the name @file{sammartini.ly}.
1301
1302 @lilypond[verbatim]
1303 \include "paper16.ly"
1304
1305 stemDown = \property Voice.Stem \override #'direction = #-1
1306 stemUp = \property Voice.Stem \override #'direction = #1
1307 stemBoth = \property Voice.Stem \revert #'direction  
1308
1309 viola = \notes \relative c' \context Voice = viola {
1310     <c4-\f-\arpeggio g' c>
1311     \stemDown g'8. b,16
1312     s1 s2. r4
1313     g
1314 }
1315
1316 oboes = \notes \relative c'' \context Voice = oboe {
1317     \stemUp s4  g8. b,16 c8 r <e'8.^\p g> <f16 a>
1318     \grace <e8( g> <d4 )f> <c2 e>
1319     \times 2/3 { <d8 \< f> <e g> <f a> }
1320     <
1321         { \times 2/3 { a8 g c } \! c2 }
1322         \context Voice = oboeTwo {
1323             \stemDown
1324             \grace {
1325                 \property Grace.Stem \override #'direction = #-1
1326                 [f,16 g] }
1327             f8 e e2
1328         }
1329     >
1330     \stemBoth
1331     \grace <c,8( e> <)b8. d8.-\trill> <c16 e> | 
1332     [<d ( f> < )f8. a>] <)b,8 d> r [<d16( f> <f8. )a>] <b,8 d> r  |
1333     [<c16( e>  < )e8. g>] <c8 e,>
1334 }
1335
1336 hoomPah = \repeat unfold 8 \notes
1337     \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
1338
1339 bassvoices = \notes \relative c' {
1340     c4 g8. b,16
1341     \autochange Staff \hoomPah
1342     \translator Staff = down
1343     \stemDown [c8 c'8] r4
1344     <g d'> r4
1345     < {\stemUp r2 <e4 c'> <c8 g'> }
1346         \context Voice = reallyLow  {\stemDown g2 ~ | g4 c8 } >
1347 }
1348
1349 \score {
1350     \context PianoStaff \notes <
1351         \context Staff = up < \time 2/2
1352             \viola
1353             \oboes
1354         >
1355         \context Staff = down < \time 2/2 \clef bass
1356             \bassvoices
1357         >
1358     >
1359     \midi { }
1360     \paper {
1361         indent = 0.0
1362         linewidth = 15.0 \cm }
1363 }
1364 @end lilypond
1365
1366 If this looks like incomprehensible gibberish to you, you are right.
1367 This example has been doctored to have as many quirks as possible.
1368
1369 As you can see, this example features multiple voices on one staff.  To
1370 make room for those voices, their notes have to be stemmed in opposite
1371 directions.
1372
1373 Printed symbols are internally represented by so-called Graphical
1374 Objects (more colloquially: Grobs).  These statements concern the
1375 grob called `Stem'. Each grob is described by a bunch of settings. These
1376 setting determine the fonts, offsets, sub-routines to be called on the
1377 grob, etc.  The initial values of these settings are set in the Scheme
1378 file @file{scm/grob-description.scm}.
1379
1380 @separate
1381 @example
1382   stemDown = \property Voice.Stem \override #'direction = #-1
1383 @end example
1384
1385 Set a proprerty for all Stem grobs in the current Voice:
1386 @code{direction} is set to @code{-1}, which encodes down.  The setting
1387 remains in effect until it is reverted.
1388
1389 @separate
1390 @example
1391  \property Voice.Stem \revert #'direction  
1392 @end example
1393
1394 Revert the to the previous setting.  The effect of precisely one
1395 @code{\stemDown} or @code{\stemUp} is neutralised.
1396
1397
1398 LilyPond includes the identifiers @code{\stemUp}, @code{\stemDown} along
1399 with some other commonly used formatting instructions, but to explain how
1400 it works, we wrote our own here.  Of course, you should use predefined
1401 identifiers like these if possible: then you will be affected less by
1402 the implementation changes we occasionally make.
1403
1404 @separate
1405 @example 
1406 viola = \notes \relative c'  \context Voice = viola @{ 
1407 @end example 
1408 In this example, you can see multiple parts on a staff.  Each part is
1409 associated with one notation context.  This notation context handles
1410 stems and dynamics (among others).  The name of this context is
1411 @code{Voice}.  For each part we have to make sure that there is
1412 precisely one @code{Voice} context, so we give it an unique name
1413 (`@code{viola}').
1414
1415 @separate
1416 @example 
1417 <c4-\f-\arpeggio g' c>
1418 @end example 
1419 The delimiters @code{<} and @code{>} are shorthands for
1420 @code{\simultaneous @{} and @code{@}}. The expression enclosed in
1421 @code{<} and @code{>} is a chord.
1422
1423 @cindex dynamics
1424 @cindex loudness
1425 @cindex forte
1426 @cindex arpeggio
1427
1428 @code{\f} places a forte symbol under the chord. The forte applies to
1429 the whole chord, but the syntax requires that commands like forte and
1430 arpeggio are attached to a note, so here we attach them to the first
1431 note.
1432
1433 @code{\arpeggio} typesets an arpeggio sign (a wavy vertical line) before
1434 the chord.
1435
1436 @separate
1437 @example 
1438    \stemDown
1439 @end example 
1440
1441
1442 @separate
1443 @example 
1444         g'8. b,16 
1445 @end example 
1446 Relative octaves work a little differently with chords.  The starting
1447 point for the note following a chord is the first note of the chord.  So
1448 the @code{g} gets an octave up quote: it is a fifth above the starting
1449 note of the previous chord (the central C).
1450
1451 @separate
1452 @example 
1453 s1 s2. r4 
1454 @end example 
1455 @code{s} is a spacer rest.  It does not print anything, but it does have
1456 the duration of a rest. It is useful for filling up voices that
1457 temporarily don't play. In this case, the viola doesn't come until one
1458 and a half measure later.
1459
1460 @separate
1461 @example 
1462 oboes = \notes \relative c'' \context Voice = oboe @{ 
1463 @end example 
1464 Now comes a part for two oboes.  They play homophonically, so we
1465 print the notes as one voice that makes chords. Again, we insure that
1466 these notes are indeed processed by precisely one context with
1467 @code{\context}.
1468 @separate
1469 @example 
1470 \stemUp s4  g8. b,16 c8 r <e'8.-\p g> <f16 a> 
1471 @end example 
1472 @code{\stemUp} is a reference to the @code{\property \override} command
1473 defined above. 
1474 @separate
1475 @example 
1476 \grace <e8 g> < d4 f> <c2 e> 
1477 @end example
1478 @cindex @code{\grace}
1479 @cindex ornaments
1480 @cindex grace notes
1481
1482 @code{\grace} introduces grace notes.  It takes one argument, in this
1483 case a chord.
1484
1485 @ignore
1486 The slur started on the @code{e} of the chord
1487 will be attached to the next note.@footnote{LilyPond will squirm
1488 about unended Slurs.  In this case, you can ignore the warning}.
1489 @end ignore
1490 @separate
1491 @example 
1492 \times 2/3 
1493 @end example
1494 @cindex tuplet
1495 @cindex triplets
1496 Tuplets are made with the @code{\times} keyword.  It takes two
1497 arguments: a fraction and a piece of music.  The duration of the piece
1498 of music is multiplied by the fraction.  Triplets make notes occupy 2/3
1499 of their notated duration, so in this case the fraction is 2/3.
1500 @separate
1501 @example 
1502 @{ <d8 \< f> <e g> <f a> @} 
1503 @end example 
1504 The piece of music to be `tripletted' is sequential music containing
1505 three notes.  On the first chord, a crescendo is started with
1506 @code{\<}. To be precise, the crescendo start is syntactically attached
1507 to the preceding note, the @code{d}.
1508
1509 @cindex dynamics
1510 @cindex crescendo
1511 @cindex @code{\<}
1512
1513 @separate
1514 @example 
1515
1516 @end example 
1517 At this point, the homophonic music splits into two rhythmically
1518 different parts.  We can't use a sequence of chords to enter this, so
1519 we make a `chord' of sequences to do it.  We start with the upper
1520 voice, which continues with upward stems:
1521 @separate
1522 @example 
1523  @{ \times 2/3 @{ a8 g c @} \! c2 @} 
1524 @end example
1525
1526 @cindex @code{\!}
1527
1528 The crescendo is ended at the half note by the escaped exclamation
1529 mark @code{\!}.
1530 @separate
1531 @example 
1532 \context Voice = oboeTwo @{
1533 \stemDown 
1534 @end example 
1535 We can't share stems with the other voice, so we have to create a new
1536 @code{Voice} context.  We give it the name @code{oboeTwo} to distinguish
1537 it from the other context.  Stems go down in this voice.
1538 @separate
1539 @example 
1540 \grace @{  
1541 @end example
1542 @cindex Grace context
1543 When a grace section is processed, a @code{Grace} context is
1544 created. This context acts like a miniature score of its own.  It has
1545 its own time bookkeeping, and you can make notes, beams, slurs
1546 etc. Here we fiddle with a property and make a beam.  The argument of
1547 @code{\grace} is sequential music.
1548
1549 @separate
1550 @example 
1551 \property Grace.Stem \override #'direction = #-1
1552 [f,16 g] @}
1553 @end example 
1554
1555 Normally, grace notes are always stem up, but in this case, the upper
1556 voice interferes. We set the stems down here.
1557
1558 As far as relative mode is concerned, the previous note is the
1559 @code{c'''2} of the upper voice, so we have to go an octave down for
1560 the @code{f}.
1561 @separate
1562 @example 
1563
1564   f8 e e2
1565 @} > 
1566 @end example 
1567 This ends the two-part section.
1568 @separate
1569 @example 
1570 \stemBoth
1571 \grace <c,8( e> <)b8. d8.-\trill> <c16 e> |  
1572 @end example
1573 @cindex trill
1574 @cindex stemBoth
1575
1576 @code{\stemBoth} ends the forced stem directions. From here, stems are
1577 positioned as if it were single part music.
1578
1579 The bass has a little hoom-pah melody to demonstrate parts switching
1580 between staffs.  Since it is repetitive, we use repeats:
1581 @separate
1582 @example 
1583 hoomPah  =  \repeat unfold 8
1584 @end example
1585 @cindex unfolded @code{\repeat}
1586 The unfolded repeat prints the notes in its argument as if they were
1587 written out in full eight times.
1588 @separate
1589 @example
1590 \notes \transpose c' @{
1591 @end example
1592 @cindex transposing
1593 @cindex relative mode and transposing
1594
1595 Transposing can be done with @code{\transpose}.  It takes two arguments
1596 the first specifies what central C should be transposed to.  The second
1597 is the to-be-transposed music.  As you can see, in this case, the
1598 transposition has no effect, as central C stays at central C.
1599
1600 The purpose of this no-op is circumventing relative mode.  Relative mode
1601 can not be used together with transposition, so @code{\relative} will
1602 leave the contents of @code{\hoomPah} alone.  We can use it without
1603 having to worry about getting the motive in a wrong octave.
1604 @separate
1605 @example 
1606 bassvoices = \notes \relative c' @{
1607 c4 g8. b,16
1608 \autochange Staff \hoomPah 
1609 @end example
1610 @cindex staff switch, automatic
1611 @cindex cross staff voice, automatic
1612 @cindex @code{\autochange}
1613
1614 Voices can switch between staffs. The easiest way to get this, is to use
1615 @code{\autochange}. This command looks at the pitch of each note, and if
1616 necessary, will cross to the other staff. For this to work, the two
1617 staffs must be called @code{"up"} and @code{"down"}.
1618 @separate
1619 @example
1620         \translator Staff = down
1621 @end example
1622 @cindex staff switch
1623 @cindex cross staff voice
1624 We want the remaining part of this melody on the lower staff, so we do a
1625 manual staff switch here.
1626
1627
1628 @separate
1629 @example 
1630 \context Voice = reallyLow  @{\stemDown g2 ~ | g4 c8 @} > 
1631 @end example
1632 @cindex tie
1633 @cindex @code{~}
1634 After skipping some lines, we see @code{~}.  This mark makes ties.  Note
1635 that ties and slurs are different things.  A tie can only connect two
1636 note heads of the same pitch, whereas a slur can connect many chords
1637 with one curve.
1638
1639 @separate
1640 @example 
1641 \context PianoStaff 
1642 @end example 
1643  A special context is needed to get cross staff beaming right.  This
1644 context is called @code{PianoStaff}.
1645 @separate
1646 @example 
1647 \context Staff = bottom < \time 2/2 \clef bass 
1648 @end example 
1649 The bottom staff must have a different clef.
1650 @separate
1651 @example 
1652 indent = 0.0 
1653 @end example 
1654 To make some more room on the line, the first (in this case the only)
1655 line is not indented.  The line still looks very cramped, but that is due
1656 to the page layout of this document.
1657
1658
1659 @ignore
1660 [TODO:
1661
1662 * font-size, multi-stanza.
1663
1664 * Simple part combining in a Hymn
1665 @end ignore
1666
1667
1668 @node An orchestral score
1669 @section An orchestral score
1670
1671 @menu
1672 * The full score::              
1673 * Extracting an individual part::  
1674 @end menu
1675
1676
1677 Our last two examples show a way to setup the music for an orchestral
1678 score.  When typesetting a piece for several instruments, you'll want to
1679 create a conductor's full score, alongside several individual parts.
1680
1681 LilyPond is well suited for this task.  We will declare the music for
1682 each instrument individually, giving the music of each instrument its
1683 own name.  These pieces of music are then combined in different
1684 @code{\score} blocks to produce different combinations of the score.
1685
1686 This orchestral score example consists of three input files.  In the
1687 first file, @file{os-music.ly}, we define the music for all instruments.
1688 This file will be used both for producing the score and the separate
1689 parts.
1690
1691 If you were to run lilypond on this file, no printable output would be
1692 produced.
1693
1694 @example
1695 % os-music.ly
1696 \header @{
1697   title = "Zo, goed lieverd?"
1698   subtitle = "How's, this babe?"
1699   composer = "JCN"
1700   opus = "1"
1701   piece = "Laid back"
1702 @}
1703 global = @{
1704   \time 2/4
1705   \skip 2*4 \bar "|."
1706 @}
1707 Key = \notes \key as \major
1708 flautoI = \notes\relative c'' @{
1709   f8 g f g f g f g
1710   bes as bes as bes as bes as
1711 @}
1712 flautoII = \notes\relative c'' @{
1713   as8 bes as bes R1 d4 ~ d
1714 @}
1715 tromboI = \notes\relative c'' @{
1716   c4. c8 c8 c4. es4 r as, r
1717 @}
1718 tromboII = \notes\relative c'' @{
1719   as4. as8 as8 as4. R1*1/2 as4 es'
1720 @}
1721 timpani = \notes\relative c, @{
1722   \times 2/3 @{ f4 f f @}
1723   \times 4/5 @{ as8 as as as as @}
1724   R1
1725 @}
1726 corno = \notes\relative c' @{
1727    bes4 d f, bes d f, bes d
1728 @}
1729 @end example
1730
1731 We will not go through the input line by line, but only indicate and
1732 explain the new elements.
1733
1734
1735 @separate
1736 @example
1737 global = @{
1738   \time 2/4
1739   \skip 2*4 \bar "|.";
1740 @}
1741 @end example
1742
1743 Declare setting to be used globally.  The @code{\skip} command produces
1744 no output, but moves forward in time: in this case, the duration of a
1745 half note (@code{2}), and that four times (@code{*4}).  This brings us
1746 to the end of the piece, and we can set the end bar.
1747
1748 @separate
1749 @example
1750 Key = \notes \key as \major
1751 @end example
1752 Declare the key signature of the piece and assign it to the identifier
1753 @var{Key}.  Lateron, we'll use @code{\Key} for all staffs except those
1754 for transposing instruments.
1755
1756 @node The full score
1757 @subsection The full score
1758
1759
1760 The second file, @file{os-score.ly} reads the definitions of the first
1761 (@file{os-music.ly}), and defines the @code{\score} block for the full
1762 conductor's score.
1763
1764
1765 @example
1766 % os-score.ly
1767 \include "os-music.ly"
1768 \include "paper13.ly"
1769
1770 #(set! point-and-click line-column-location)
1771 #(define text-flat '((font-relative-size . -2)
1772          (music "accidentals--1")))
1773
1774 \score @{
1775   <
1776     \global
1777     \property Score.BarNumber \override #'padding = #3
1778     \context StaffGroup = woodwind <
1779       \context Staff = flauti <
1780         \property Staff.midiInstrument = #"flute"
1781         \property Staff.instrument = "2 Flauti"
1782         \property Staff.instr = "Fl."
1783         \Key
1784         \context Voice=one @{ \voiceOne \flautoI @}
1785         \context Voice=two @{ \voiceTwo \flautoII @}
1786       >
1787     >
1788     \context StaffGroup = timpani <
1789       \context Staff = timpani <
1790         \property Staff.midiInstrument = #"timpani"
1791         \property Staff.instrument = #'(lines "Timpani" "(C-G)")
1792         \property Staff.instr = #"Timp."
1793         \clef bass
1794         \Key
1795         \timpani
1796       >
1797     >
1798     \context StaffGroup = brass <
1799       \context Staff = trombe <
1800         \property Staff.midiInstrument = #"trumpet"
1801         \property Staff.instrument = #`(lines "2 Trombe" "(C)")
1802         \property Staff.instr = #`(lines "Tbe." "(C)")
1803         \Key
1804         \context Voice=one \partcombine Voice
1805           \context Thread=one \tromboI
1806           \context Thread=two \tromboII
1807       >
1808       \context Staff = corni <
1809         \property Staff.midiInstrument = #"french horn"
1810         \property Staff.instrument = #`(lines "Corno"
1811           (columns "(E" ,text-flat ")"))
1812         \property Staff.instr = #`(lines "Cor."
1813           (columns "(E" ,text-flat ")"))
1814         \property Staff.transposing = #3
1815         \notes \key bes \major
1816         \context Voice=one \corno
1817       >
1818     >
1819   >
1820   \paper @{
1821     indent = 15 * \staffspace
1822     linewidth = 60 * \staffspace
1823     textheight = 90 * \staffspace
1824     \translator@{
1825       \VoiceContext
1826       \consists "Multi_measure_rest_engraver"
1827     @}
1828     \translator@{
1829       \HaraKiriStaffContext
1830       \remove "Multi_measure_rest_engraver"
1831     @}
1832   @}
1833   \midi @{
1834     \tempo 4 = 75
1835   @}
1836 @}
1837 @end example
1838
1839 @center @strong{Zo, goed lieverd?}
1840 @sp 1
1841 @center How's, this babe?
1842 @flushright
1843 Opus 1.
1844 @end flushright
1845 @flushleft
1846 @sc{Laid back}
1847 @end flushleft
1848
1849 @lilypondfile{os-score.ly}
1850
1851 @separate
1852 @example
1853 \include "os-music.ly"
1854 @end example
1855 First, we need to include the music definitions we made in
1856 @file{os-music.ly}.
1857
1858 @separate
1859 @example
1860 #(set! point-and-click line-column-location)
1861 @end example
1862 In a large orchestral score like this you're bound to make some small
1863 mistakes, so we enable point and click (See @ref{Point and click})
1864 editing.
1865
1866 @separate
1867 @example
1868 #(define text-flat '((font-relative-size . -2)
1869          (music "accidentals--1")))
1870 @end example
1871
1872 When naming the tuning of the french horn, we'll need a piece of text
1873 with a flat sign.  LilyPond has a mechanism for font selection and
1874 kerning called Scheme markup text (See @ref{Text markup}).  The flat
1875 sign is taken from the music font, and its name is @code{accidentals--1}
1876 (The sharp sign is called @code{accidentals-+1}).  The default font is
1877 too big for text, so we select a relative size of @code{-2}.
1878
1879 @separate
1880 @example
1881   <
1882     \global
1883 @end example
1884 Of course, all staffs are simultaneous and use the same global settings.
1885
1886 @separate
1887 @example
1888     \property Score.BarNumber \override #'padding = #3
1889 @end example
1890 LilyPond prints bar numbers at the start of each line, but
1891 unfortunately, they end up a bit too close to the staff in this example.
1892 A bar number internally is a Grob called @var{BarNumber}.  BarNumber
1893 Grobs can be manipulated through their @var{side-position-interface}.  One
1894 of the properties of a @var{side-position-interface} that can be tweaked
1895 is the @var{padding}: the amount of extra space that is put between this
1896 Grob and other Grobs.  We set the padding to three staff spaces.
1897
1898 You can find all this kind of information in LilyPond's automatically
1899 generated documentation in
1900 @ifnottex
1901 @ref{ (lilypond-internals)lilypond-internals, LilyPond Internals}.
1902 @end ifnottex
1903 @iftex
1904 the online documentation.
1905 @end iftex
1906
1907 @separate
1908 @example
1909     \context StaffGroup = woodwind <
1910       \context Staff = flauti <
1911 @end example
1912 A new notation context: the StaffGroup.  StaffGroup can hold one or more
1913 Staffs, and will print a big bracket at the left of the score.  Start a
1914 new staff group for the woodwind section (just the flutes in this case).
1915 Immediately after that, we start the staff for the two flutes, that also
1916 play simultaneously.
1917
1918 @separate
1919 @example
1920         \property Staff.midiInstrument = #"flute"
1921 @end example
1922 Specify the instrument for MIDI output (see @ref{MIDI instrument
1923 names}).
1924
1925 @separate
1926 @example
1927         \property Staff.instrument = "2 Flauti"
1928         \property Staff.instr = "Fl."
1929 @end example
1930 And define the instrument names to be printed in the margin,
1931 @code{instrument} for the first line of the score, @code{instr} for the
1932 rest of the score.
1933
1934 @separate
1935 @example
1936         \Key
1937 @end example
1938 The flutes play in the default key.
1939
1940 @separate
1941 @example
1942         \context Voice=one @{ \voiceOne \flautoI @}
1943         \context Voice=two @{ \voiceTwo \flautoII @}
1944 @end example
1945 Last come the actual flute parts.  Remember that we're still in
1946 simultaneous mode.  We name both voices differently, so that LilyPond
1947 will actually create two Voice contexts.  The flute parts are simple, so
1948 we specify manually which voice is which: @code{\voiceOne} forces the
1949 direction of stems, beams, slurs and ties up, @code{\voiceTwo} sets
1950 directions down.
1951
1952 @separate
1953 @example
1954       >
1955     >
1956 @end example
1957 Close the flutes staff and woodwind staff group.
1958
1959 @separate
1960 @example
1961         \property Staff.instrument = #'(lines "Timpani" "(C-G)")
1962 @end example
1963 The timpani staff only shows a new piece of scheme markup, it sets two
1964 lines of text.
1965
1966 @separate
1967 @example
1968         \context Voice=one \partcombine Voice
1969           \context Thread=one \tromboI
1970           \context Thread=two \tromboII
1971 @end example
1972 You have seen the notation contexts Staff and Voice, but here's a new
1973 one: Thread.  One or more Threads can be part of a Voice.  The Thread
1974 takes care of note heads and rests, the Voice combine note heads onto a
1975 stem.
1976
1977 For the trumpets we use the automatic part combiner (see @ref{Automatic
1978 part combining}) to combine the two simultaneous trumpet parts onto the
1979 trumpet staff.  Each trumpet gets its own Thread context, which must be
1980 named @code{one} and @code{two}).  The part combiner makes these two
1981 threads share a Voice when they're similar, and splits the threads up
1982 when they're different.
1983
1984 @separate
1985 @example
1986         \property Staff.instrument = #`(lines "Corno"
1987           (columns "(E" ,text-flat ")"))
1988 @end example
1989 The french horn has the most complex scheme markup name, made up of two
1990 lines of text.  The second line has two elements (columns), the @code{E}
1991 and the flat sign @code{text-flat} that we defined before.
1992
1993 @separate
1994 @example
1995         \property Staff.transposing = #3
1996 @end example
1997 The french horn is to be tuned in E-flat, so we tell the MIDI backend to
1998 transpose this staff by three steps.
1999
2000 Note how we can choose different tuning for entering, printing and
2001 playing, using @code{\transpose} and the MIDI Staff proprerty
2002 @var{transposing}.
2003
2004 @separate
2005 @example
2006         \notes \key bes \major
2007 @end example
2008 Therefore, it has a different key.
2009
2010 @separate
2011 @example
2012     indent = 15 * \staffspace
2013     linewidth = 60 * \staffspace
2014 @end example
2015 We specify a big indent for the first line and a small linewidth for this
2016 tutorial.
2017
2018 @separate
2019
2020 Usually, LilyPond's predefined setup of notation contexts (Thread,
2021 Voice, Staff, Staffgroup, Score) is just fine.  But in this case, we
2022 want a different type of Staff context.
2023
2024 In orchestral scores, it often happens that one instrument has only
2025 rests during one line of the score.  The @code{HaraKiriStaffContext} can
2026 be used as a regular @code{StaffContext} drop-in and will take care of
2027 the automatic removing of empty staffs.
2028
2029 @node Extracting an individual part
2030 @subsection Extracting an individual part
2031
2032 The third file, @file{os-flute-2.ly} also reads the definitions of the
2033 first (@file{os-music.ly}), and defines the @code{\score} block for the
2034 second flute part.
2035
2036 @example
2037 \include "os-music.ly"
2038 \include "paper16.ly"
2039
2040 \score @{
2041   \context Staff <
2042     \property Score.skipBars = ##t
2043     \property Staff.midiInstrument = #"flute"
2044     \global
2045     \Key
2046     \flautoII
2047   >
2048   \header @{
2049     instrument = "Flauto II"
2050   @}
2051   \paper @{
2052     linewidth = 80 * \staffspace
2053     textheight = 200 * \staffspace
2054   @}
2055   \midi @{
2056     \tempo 4 = 75
2057   @}
2058 @}
2059 @end example
2060
2061 @center @strong{Zo, goed lieverd?}
2062 @sp 1
2063 @center How's, this babe?
2064 @center @emph{Flauto II}
2065 @flushright
2066 Opus 1.
2067 @end flushright
2068 @flushleft
2069 @sc{Laid back}
2070 @end flushleft
2071 @lilypondfile{os-flute-2.ly}
2072
2073
2074 Because we separated the music definitions from the @code{\score}
2075 instantiations, we can easily define a second score from the music of
2076 the second flute.  This then is the part for the second flute player.
2077 Of course, we make separate parts for all individual instruments.
2078
2079 @separate
2080 @example
2081     \flautoII
2082 @end example
2083 In this individual part the second flute has a whole staff for itself,
2084 so we don't want to force stem or tie directions.
2085
2086 @separate
2087 @example
2088   \header @{
2089     instrument = "Flauto II"
2090   @}
2091 @end example
2092 The @code{\header} definitions were also read from @file{os-music.ly},
2093 but we need to set the instrument for this particular score.
2094
2095 @separate
2096 @example
2097     \property Score.skipBars = ##t
2098 @end example
2099 In the conductor's full score, all bars with rests are printed, but for
2100 the individual parts, we want to contract pieces of consecutive empty
2101 bars.  LilyPond will do this if Score's @var{skipBars} property to
2102 true. 
2103
2104
2105 @node Other ways to run LilyPond
2106 @section Other ways to run LilyPond
2107
2108 Until now, you have been using @file{ly2dvi} to invoke LilyPond.
2109 There are three other routes.  Firstly, there is a script called
2110 @code{lilypond-book}, that allows you to freely mix LilyPond input with
2111 Texinfo or LaTeX input. For example, this manual was written using
2112 @code{lilypond-book}. It is discussed in @ref{lilypond-book}.
2113
2114
2115 Secondly, you can generate PostScript directly. This is useful if you
2116 can not or do not want to run @TeX{} on your system.  To obtain direct
2117 PostScript output, invoke LilyPond as follows:
2118 @cindex PostScript output
2119 @example
2120 lilypond -f ps test.ly
2121 @end example
2122 You have to set some environment variables to view or print this
2123 output. More information can be found in @ref{Invoking
2124 LilyPond}.
2125
2126
2127 Thirdly, if you want to do special things with your output, you can run
2128 invoke lilypond directly:
2129 @example
2130 lilypond test.ly
2131 @end example
2132 to produce plain @TeX{} output.  Note that La@TeX{} will not work on the
2133 resulting @file{test.tex}.  You must run plain @TeX{} on it.
2134
2135 @cindex @TeX{}
2136
2137
2138
2139
2140
2141 @node Integrating text and music
2142 @section Integrating text and music
2143
2144 Sometimes, you might want to use music examples in a text that you are
2145 writing. For example, if you are writing a musicological treatise, a
2146 songbook, or (like us) the LilyPond manual.  You can make such texts by
2147 hand, simply by importing a PostScript figure into your wordprocessor.
2148 However, there is a also an automated procedure:
2149
2150 If you use La@TeX{} or texinfo, you can mix text and lilypond code. A
2151 script called @code{lilypond-book} will extract the music fragments, run
2152 lilypond on them, and put back the resulting notation.  lilypond-book is
2153 described fully in @ref{lilypond-book}, but here we show a small
2154 example. Since the example also contains explanatory text, we won't
2155 comment on the contents.
2156
2157 @example
2158 \documentclass[a4paper]@{article@}
2159 \begin@{document@}
2160
2161 In a lilypond-book document, you can freely mix music and text. For
2162 example:
2163 \begin@{lilypond@}
2164   \score @{ \notes \relative c' @{
2165      c2 g'2 \times 2/3 @{ f8 e d @} c'2 g4
2166   @} @}
2167 \end@{lilypond@}
2168 Notice that the music line length matches the margin settings of the
2169 document.
2170
2171 If you have no \verb+\score+ block in the fragment,
2172 \texttt@{lilypond-book@} will supply one:
2173
2174 \begin@{lilypond@}
2175   c'4
2176 \end@{lilypond@}
2177
2178 In the example you see here, a number of things happened: a
2179 \verb+\score+ block was added, and the line width was set to natural
2180 length. You can specify many more options using  \LaTeX style options
2181 in brackets:
2182
2183 \begin[verbatim,11pt,singleline,
2184   fragment,relative,intertext="hi there!"]@{lilypond@}
2185   c'4 f bes es
2186 \end@{lilypond@}
2187
2188 \texttt@{verbatim@} also shows the lilypond code, \texttt@{11pt@} selects
2189 the default music size, \texttt@{fragment@} adds a score block,
2190 \texttt@{relative@} uses relative mode for the fragment, and
2191 \texttt@{intertext@} specifies what to print between the
2192 \texttt@{verbatim@} code and the music.
2193
2194 If you include large examples into the text, it may be more convenient
2195 to put the example in a separate file:
2196
2197 \lilypondfile[printfilename]@{sammartini.ly@}
2198
2199 The \texttt@{printfilename@} option adds the file name to the output.
2200
2201 \end@{document@}
2202 @end example
2203
2204 Under Unix, you can view the results as follows.
2205 @example
2206 $ cd input/tutorial
2207 $ lilypond-book --outdir=out/ lilbook.tex
2208 lilypond-book (GNU LilyPond) 1.3.146
2209 Reading `/home/hanwen/usr/src/lilypond-1.3.146/input/tutorial/lilbook.tex'
2210 Reading
2211 `/home/hanwen/usr/src/lilypond-1.3.146/input/tutorial/sammartini.ly'
2212 @var{lots of stuff deleted}
2213 Writing `out/lilbook.latex'
2214 $ cd out
2215 $ latex lilbook.latex
2216 @var{lots of stuff deleted}
2217 $ xdvi lilbook 
2218 @end example
2219
2220 Notice the @code{outdir} option to lilypond-book. Running lilypond-book
2221 and running latex creates a lot of temporary files, and you wouldn't
2222 those to clutter up your working directory. Hence, we have them created
2223 in a separate subdirectory.
2224
2225 The result more or less looks like this: 
2226
2227 @separate
2228
2229 In a lilypond-book document, you can freely mix music and text. For
2230 example:
2231 @lilypond
2232   \score { \notes \relative c' {
2233      c2 g'2 \times 2/3 { f8 e d } c'2 g4
2234   } }
2235 @end lilypond
2236 Notice that the music line length matches the margin settings of the
2237 document.
2238
2239 If you have no @code{\score} block in the fragment,
2240 @code{lilypond-book} will supply one:
2241
2242 @lilypond
2243   c'4
2244 @end lilypond
2245
2246 In the example you see here, a number of things happened: a
2247 @code{\score} block was added, and the line width was set to natural
2248 length. You can specify many more options using  La@TeX{} style options
2249 in brackets:
2250
2251 @lilypond[verbatim,11pt,singleline,
2252   fragment,relative,intertext="hi there!"]
2253   c'4 f bes es
2254 @end lilypond
2255
2256 @code{verbatim} also shows the lilypond code, @code{11pt} selects
2257 the default music size, @code{fragment} adds a score block,
2258 @code{relative} uses relative mode for the fragment, and
2259 @code{intertext} specifies what to print between the
2260 @code{verbatim} code and the music.
2261
2262 If you include large examples into the text, it may be more convenient
2263 to put the example in a separate file:
2264
2265 @lilypondfile[printfilename]{sammartini.ly}
2266
2267 The @code{printfilename} option adds the file name to the output.
2268 @node  end of tutorial
2269 @section The end        
2270          
2271 That's all folks.  From here, you can either try fiddling with input
2272 files, or you can read the reference manual.  You can find more example
2273 files in @file{input} and @file{input/test}.  You can also look at some
2274 real music.  Have a look at the @uref{Mutopia project,
2275 http://www.mutopiaproject.org}.
2276
2277
2278
2279 @ignore
2280
2281 [TODO
2282
2283 this should be on mutopia website.
2284
2285 ]
2286
2287
2288 @c waar deze info?  is uiteindelijk wel handig, schat ik.
2289 [TODO: cut blabla]
2290
2291 If you have a big music project, or just a lot of LilyPond input files,
2292 all generated output from LilyPond, @TeX{} and metafont will clutter
2293 your working directory.  LilyPond comes with a one-size-fits-all
2294 pre-cooked makefile that helps you manage producing output.  It will
2295 produce all output in the directory @file{out} , generate and track
2296 dependencies. Also, it helps in preparing your submission to @ref{Mutopia
2297 project}.
2298
2299 @file{make/ly.make}
2300 @example
2301 mkdir my-project
2302 cd my-project
2303 cp /usr/share/lilypond/make/ly.make GNUmakefile
2304 cp /usr/share/doc/lilypond/examples/input/tutorial/minuet.ly .
2305 make minuet
2306 [..]
2307 Generated out/minuet.ps for target minuet.
2308 @end example
2309
2310 Type @samp{make help} to see possible targets.
2311
2312 [TODO]
2313 @file{/usr/share/lilypond/doc/lilypond/examples/input/mutopia-header.ly}
2314
2315
2316
2317
2318
2319 [TODO: rewrite completely.]
2320
2321 @menu
2322 * Songs with additional verses::  
2323 @end menu
2324
2325 @end ignore
2326