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