]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/tutorial.itely
man fixes
[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 @html
9 <!--- @@WEB-TITLE@@=Tutorial --->
10 @end html
11
12 @menu
13 * First steps::                 Music language of LilyPond
14 * Cheat sheet::                 
15 * Running LilyPond::            Printing music
16 * The first real tune::         The first real tune
17 * Lyrics and chords::           Lyrics and chords
18 * More movements ::             Joining separate pieces of music
19 * A piano excerpt::             Piano music
20 * Fine tuning a piece::         
21 * An orchestral score::         Conductor's score and individual parts
22 * Integrating text and music::  Integrating text and music
23 * End of tutorial::             The end
24 @end menu
25
26 Operating lilypond is done through text files: to print a piece of
27 music, you enter the music in a file.  When you run lilypond, that
28 file is read, and after some computations, the program produces a file
29 containing the sheet music that you can print or view.
30
31 This tutorial starts with a small introduction to the LilyPond music
32 language.  After this first contact, we will show you how to run
33 LilyPond to produce printed output; you should then be able to create
34 your first sheets of music. The tutorial continues with more and more
35 complex examples.
36
37
38 @c title?
39
40 @node First steps
41 @section First steps
42
43 @c @node Music language of LilyPond
44 @c @section Music language of LilyPond
45
46 In this section, we show how to make small, very simple pieces of
47 music in LilyPond.  If you have not seen LilyPond input files before,
48 this section is for you. The contents of this section are summarized
49 in the Cheat Sheet (See @ref{Cheat sheet}).
50
51 You get a simple note by typing its note name, from @code{a} through
52 @code{g}. So if you enter
53 @quotation
54 @example
55 c d e f g a b
56 @end example
57 @end quotation
58 then the result looks like this:
59 @quotation
60 @lilypond[fragment]
61 \property Score.timing = ##f
62 \property Staff.TimeSignature = \turnOff
63 \transpose c'' { c d e f g a b }
64 @end lilypond
65 @end quotation
66 @separate
67
68 We continue showing  LilyPond input like we did previously: first a
69 snippet of input, then the resulting output.
70
71 The length of a note is specified by adding a number, ``@code{1}'' for a
72 whole note, ``@code{2}'' for a half note, and so on:
73
74 @quotation
75 @example
76 a1 a2 a4 a16 a32
77 @end example
78
79 @c missing clef seems to raise more questions than actual pitch of notes,
80 @c as these are snippets anyway
81 @lilypond[fragment]
82 \property Score.timing = ##f
83 \property Staff.TimeSignature = \turnOff
84 \property Staff.autoBeaming = ##f
85 %\property Staff.Clef = \turnOff
86 \transpose c'' { a1 a2 a4 a16 a32 }
87 s16_" "
88 @end lilypond
89 @end quotation
90 @separate
91
92 If you don't specify a duration, the previous one is used: 
93 @quotation
94 @example
95 a a a2 a
96 @end example
97
98 @c missing clef seems to raise more questions than actual pitch of notes,
99 @c as these are snippets anyway
100 @lilypond[fragment]
101 \property Score.timing = ##f
102 \property Staff.TimeSignature = \turnOff
103 %\property Staff.Clef = \turnOff
104 \transpose c'' { a a a2 a }
105 s16_" "
106 @end lilypond
107 @end quotation
108 @separate
109
110 A sharp (@texisharp{}) is made by adding ``@code{is}'', a flat
111 (@texiflat{}) by adding ``@code{es}'':
112
113 @quotation
114 @example
115 cis1 ees fisis aeses
116 @end example
117
118 @lilypond[fragment]
119 \property Score.timing = ##f
120 \property Staff.TimeSignature = \turnOff
121 \transpose c'' { cis1 ees fisis aeses }
122 s16_" "
123 @end lilypond
124 @end quotation
125 @separate
126
127 Add a dot ``@code{.}'' after the duration to get a dotted note:
128 @quotation
129 @example
130 a2. a4 a8. a16
131 @end example
132
133 @c missing clef seems to raise more questions than actual pitch of notes,
134 @c as these are snippets anyway
135 @lilypond[fragment]
136 \property Score.timing = ##f
137 \property Staff.TimeSignature \set #'transparent = ##t
138 %\property Staff.Clef = \turnOff
139 \transpose c'' { a2. a4 a8. a16 }
140 s16_" "
141 @end lilypond
142 @end quotation
143 @separate
144
145 The meter (or time signature) can be set with the @code{\time} command:
146
147 @quotation
148 @example
149 \time 3/4
150 \time 6/8
151 \time 4/4
152 @end example
153
154 @c a clef here may lead to confusion
155 @lilypond[fragment]
156 \property Staff.Clef \set #'transparent = ##t 
157 \time 3/4
158 s4_" "
159 \time 6/8
160 s4_" "
161 \time 4/4
162 s16_" "
163 @end lilypond
164 @end quotation
165 @separate
166
167 The clef can be set using the ``@code{\clef}'' command:
168
169 @c what is more common name treble or violin?
170 @c in Dutch, its violin.
171 @quotation
172 @example
173 \clef violin
174 \clef bass
175 \clef alto
176 \clef tenor
177 @end example
178
179 @lilypond[fragment]
180 \property Score.timing = ##f
181 \property Staff.TimeSignature = \turnOff
182 \clef violin
183 s4_" "
184 \clef bass
185 s4_" "
186 \clef alto
187 s4_" "
188 \clef tenor
189 s16_" "
190 @end lilypond
191 @end quotation
192 @separate
193
194 From these commands and notes, a piece of music can be formed.  A piece
195 of music is made by enclosing it in ``@code{\notes @{ ... @}}''.
196 LilyPond then knows that music follows (and not lyrics, for example):
197
198 @quotation
199 @example
200 \notes @{
201    \time 3/4
202    \clef bass
203    c2 e4 g2.
204    f4 e d c2.
205 @}
206 @end example
207 @end quotation
208 @separate
209
210 At this point, the piece of music is ready to be printed.  This is done
211 by combining the music with a printing command.
212
213 The printing command is the so-called ``@code{\paper}'' block.  You
214 will see later that the \paper block is necessary to customize all
215 kinds of printing specifics.  The music and the \paper block are
216 combined by enclosing them in ``@code{\score @{ ... @}}''.  This is
217 what a full LilyPond source file looks like:
218
219 @quotation
220 @example
221 \score @{
222   \notes @{
223      \time 3/4
224      \clef bass
225      c2 e4 g2.
226      f4 e d c2.
227   @}
228   \paper @{ @}
229 @}
230 @end example
231
232 @lilypond
233 \score {
234   \notes {
235      \time 3/4
236      \clef bass
237      c2 e4 g2.
238      f4 e d c2.
239   }
240   \paper { linewidth = 60 * \staffspace }
241 }
242 @end lilypond
243 @end quotation
244 @separate
245
246
247 We continue with the introduction of the remaining musical constructs.
248
249 @c maybe legend here?
250
251 Normal rests are entered just like notes with the name ``@code{r}'':
252
253 @quotation
254 @example
255 r2 r4 r8 r16
256 @end example
257
258 @lilypond[fragment]
259 \property Score.timing = ##f
260 \property Staff.Clef = \turnOff
261 \property Staff.TimeSignature = \turnOff
262 r2 r4 r8 r16
263 s16_" "
264 @end lilypond
265 @end quotation
266 @separate
267
268 @c Tim wants to move this quotes example just before the: quotes-don't-work
269 @c score, but we'd need to remove quotes from the other two (key and
270 @c tie) examples...
271
272 @c better to have this just before the `octaves are bad' snipped
273 @c but we'd need to remove the ', from \key and tie 
274 To raise a note by an octave, add a high quote @code{'} (apostrophe) to
275 the note name, to lower a note one octave, add a ``low quote'' @code{,}
276 (a comma).  The central C is @code{c'}:
277
278 @quotation
279 @example
280 c'4 c'' c''' \clef bass c c,
281 @end example
282
283 @lilypond[fragment]
284 \property Score.timing = ##f
285 \property Staff.TimeSignature = \turnOff
286 c'4 c'' c''' \clef bass c c,
287 @end lilypond
288 @end quotation
289 @separate
290
291 A tie is created by entering a tilde ``@code{~}'' between the notes to
292 be tied.  A tie between two notes means that the second note must not be
293 played separately, but just makes the first note sound longer:
294
295 @quotation
296 @lilypond[fragment,verbatim]
297 g'4 ~ g' a'2 ~ a'4
298 @end lilypond
299 @end quotation
300 @separate
301
302 The key signature is set with the command ``@code{\key}'':
303 @quotation
304 @example
305 \key d \major
306 g'1
307 \key c \minor
308 g'
309 @end example
310
311 @lilypond[fragment]
312 \property Staff.TimeSignature = \turnOff
313 \key d \major
314 g'1
315 \key c \minor
316 g'
317 @end lilypond
318 @end quotation
319
320
321 @c bit on the long/complex/scary taste
322 @c cheating a bit: two lines makes for a friendlier look
323 This example shows notes, ties, octave marks, and rests in action.
324 Don't worry about all the quotes.
325
326 @quotation
327 @example
328 \score @{
329   \notes @{
330     \time 4/4
331     \clef violin
332     \key d \minor
333     r4 r8 d''8 cis''4 e''
334     d''8 a'4. ~ a' b'8
335     cis''4 cis''8 cis'' bis'4 d''8 cis'' ~
336     cis''2 r2
337   @}
338   \paper @{ @}
339 @}
340 @end example
341
342 @lilypond
343 \score {
344   \notes {
345     \time 4/4
346     \clef violin
347     \key d \minor
348     r4 r8 d''8 cis''4 e''
349     d''8 a'4. ~ a' b'8
350     cis''4 cis''8 cis'' bis'4 d''8 cis'' ~
351     cis''2 r2
352   }
353   \paper { linewidth = 50*\staffspace }
354 }
355 @end lilypond
356 @end quotation
357
358 @c accidentals...
359 There are some interesting points to note in this example.  Firstly,
360 accidentals (sharps and flats) don't have to be marked explicitly: you
361 just enter the note name, and LilyPond determines whether or not to
362 print an accidental.  Secondly, bar lines and beams are drawn
363 automatically.  Thirdly, LilyPond calculates line breaks for you; it
364 doesn't matter where you make new lines in the source file.
365
366 The example also indicates that a piece of music written in a high
367 register needs lots of quotes.  This makes the input less readable,
368 and is therefore also a potential source of errors.
369
370 @separate
371
372 The solution is to use ``relative octave'' mode.  In practice, most
373 music is entered using this mode.
374
375 To use relative mode, add @code{\relative} before the piece of music.
376 You must also give a note from which relative starts, in this case
377 @code{c''}.
378
379 @c In relative octave mode, quotes are used to mark large jumps in the
380 @c melody.  Without any quotes or commas, the interval between a note and
381 @c its predecessor is assumed to be a fourth or less.  Quotes and commas
382 @c add octaves in up and down direction.
383
384 If you type no octaviation quotes, relative mode chooses the note that
385 is closest to the previous one, which is often just the one you need.
386 @c don't use commas or quotes in this sentence
387 For example: @code{c f} goes up; @code{c g} goes down:
388
389 @quotation
390 @example
391 \relative c'' @{
392   c f c g c
393 @}
394 @end example
395
396 @lilypond[fragment]
397 \property Score.timing = ##f
398 \property Staff.TimeSignature = \turnOff
399 \relative c'' {
400   c f c g c
401 }
402 @end lilypond
403 @end quotation
404 @separate
405
406 @c needed better, maybe even redundant explanation
407 @c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
408 @c in eerste instantie drong het `relative' niet door zonder extra uitleg.
409 You can make a large interval by adding octaviation quotes.  Note that
410 quotes or commas do not determine the absolute height of a note;
411 the height of a note is relative to the previous one.
412 @c don't use commas or quotes in this sentence
413 For example: @code{c f,} goes down; @code{f, f} are both the same;
414 @code{c c'} are the same; and @code{c g'} goes up:
415
416 @quotation
417 @example
418 \relative c'' @{
419   c f, f c' c g' c,
420 @}
421 @end example
422
423 @lilypond[fragment]
424 \property Score.timing = ##f
425 \property Staff.TimeSignature = \turnOff
426 \relative c'' {
427   c f, f c' c g' c,
428 }
429 @end lilypond
430 @end quotation
431 @separate
432
433 A slur is drawn across many notes, and indicates bound articulation
434 (legato).  The starting note and ending note are marked with a
435 ``@code{(}'' and a ``@code{)}'' respectively:
436
437 @quotation
438 @lilypond[fragment,relative 1, verbatim]
439 d4( )c16( cis d e c cis d )e( )d4
440 @end lilypond
441 @end quotation
442 @separate
443
444 If you need two slurs at the same time (one for articulation, one for
445 phrasing), you can also make a phrasing slur with @code{\(} and
446 @code{\)}.
447
448 @c lousy example
449 @quotation
450 @lilypond[fragment,relative 1, verbatim]
451 a8(\( ais b ) c cis2 b'2 a4 cis, \) c
452 @end lilypond
453 @end quotation
454 @separate
455
456 Beams are drawn automatically, but if you don't like the choices, you
457 can enter beams by hand. Surround the notes to be grouped with @code{[}
458 and @code{]}:
459 @quotation
460 @lilypond[fragment,relative 1, verbatim]
461 [a8 ais] [d es r d]
462 @end lilypond
463 @end quotation
464 @separate
465
466 To print more than one staff, each piece of music that makes up a staff
467 is marked by adding @code{\context Staff} before it.  These
468 @code{Staff}'s can be grouped inside @code{<} and @code{>}, as is
469 demonstrated here:
470
471 @quotation
472 @lilypond[fragment,verbatim]
473 <
474   \context Staff = staffA { \clef violin c'' }
475   \context Staff = staffB { \clef bass c }
476 >
477 @end lilypond
478 @end quotation
479
480 In this example, @code{staffA} and @code{staffB} are names that are
481 given to the staves.  For now, it doesn't matter what names you give, as
482 long as each staff has a unique name.
483
484 @separate
485
486 We can typeset a melody with two staves now:
487
488 @quotation
489 @lilypond[verbatim]
490 \score {
491   \notes 
492   < \context Staff = staffA {
493       \time 3/4
494       \clef violin
495       \relative c'' { e2 ( d4 c2 b4 [a8 a] [b b] [g g] )a2. }  
496     }
497     \context Staff = staffB {
498        \clef bass
499        c2 e4  g2.
500        f4 e d c2.
501     }
502   >
503   \paper {} 
504 }
505 @end lilypond
506 @end quotation
507
508 Notice that the time signature is specified in one melody staff only
509 (the top staff), but is printed on both.  LilyPond knows that the time
510 signature should be the same for all staves.
511
512 @separate
513
514 Common accents can be added to a note using @code{-.}, @code{--}, @code{->}:
515 @quotation
516 @lilypond[verbatim,relative 1]
517 c-. c-- c->
518 @end lilypond
519 @end quotation
520 @separate
521
522 Dynamic signs are made by adding the markings to the note:
523 @quotation
524 @lilypond[verbatim,relative 1]
525 c-\ff c-\mf
526 @end lilypond
527 @end quotation
528 @separate
529
530 Crescendi are started with the commands @code{\<}  and @code{\>}. The
531 command @code{\!} finishes a crescendo on the following note.
532 @quotation
533 @lilypond[verbatim,relative 1]
534 c2\<  \!c2-\ff  \>c2  \!c2
535 @end lilypond
536 @end quotation
537 @separate
538
539 Chords can be made by surrounding notes with @code{<} and @code{>}:
540 @quotation
541 @lilypond[relative 0, fragment,verbatim]
542 r4 <c e g> <c f a> 
543 @end lilypond
544 @end quotation
545 @separate
546
547 @ignore
548 @c te diepzinnig?
549 @c hmm, te losjes, iig
550 In general, @code{ < @var{stuff} > } is used when @var{stuff} all
551 happens at the same time, like in chords, or (like in the two-staff
552 example above) in a bunch of stacked staves.
553 @end ignore
554
555 Of course, you can combine beams and ties with chords.  Notice that
556 beam and tie markings must be placed outside the chord markers:
557 @quotation
558 @lilypond[relative 0, fragment,verbatim]
559 r4 [<c8 e g> <c8 f a>] ~ <c8 f a>
560 @end lilypond
561 @end quotation
562
563 When you want to combine chords with slurs and dynamics, technical
564 detail crops up: you have type these commands next to the notes, which
565 means that they have to be inside the @code{< >}:
566
567 @quotation
568 @lilypond[relative 0, fragment,verbatim]
569 r4 <c8 e g \> ( > <c e g> <c e g>  < ) \! c8 f a>
570 @end lilypond
571 @end quotation
572 @separate
573
574 There is one golden rule that you should keep in mind when writing
575 LilyPond input:
576 @quotation
577 @strong{DO NOT START A PIECE WITH A CHORD}
578 @end quotation
579 Of course, it is a allowed, but the result might not be what you expect:
580 @quotation
581 @lilypond[verbatim,singleline]
582 \score { \notes <c'2 e'2> }
583 @end lilypond
584 @end quotation
585 @separate
586
587 Of course, it is possible to typeset pieces that start with a chord,
588 but you must make explicit that the notes of chord are to be put on
589 the same staff, in the same voice.  This is done by specifying
590 @code{\context Staff} for the notes:
591
592 @quotation
593 @lilypond[verbatim,singleline]
594 \score { \notes \context Voice <c'2 e'2> }
595 @end lilypond
596 @end quotation
597 @separate
598
599
600
601
602 @ignore
603 [TODO add some more here
604
605 * lyrics, chords (?)
606
607 * \header
608
609 * identifiers?
610
611 ]
612 @end ignore
613
614 This is the end of the simple tutorial. You know the basic ingredients
615 of a music file, so this is the right moment to try your at hand at
616 doing it yourself: try to type some simple examples, and experiment a
617 little.
618
619 When you're comfortable with the basics, then you might want to read the
620 rest of this chapter. It also a manual in tutorial-style, but it is much
621 more in-depth. It will also be very intimidating if you're not familiar
622 with the basics.  It deals with some of the more advanced features of
623 LilyPond. Topics include lyrics, chords, orchestral scores and parts,
624 fine tuning output, polyphonic music, and integrating text and music.
625
626
627 @c refer to this section
628 @node Cheat sheet
629 @section Cheat sheet
630
631
632 @c need texinfo-4.0a or later for this
633
634
635 @c both Tim and my father came independently with a request for a
636 @c `legend' like this.
637
638 @c what should be in it?
639
640
641
642 @multitable @columnfractions .20 .20 .30  .20
643
644 @item @b{Syntax}
645 @tab @b{Description}
646 @tab @b{Example}
647 @tab @b{Grob name}
648
649 @item @code{1 2 8 16}
650 @tab durations 
651 @tab
652 @lilypond[fragment, relative 1]
653 \property Staff.TimeSignature = \turnOff
654 \property Staff.autoBeaming = ##f
655 \property Staff.Clef = \turnOff
656 c1 c2 c8 c16
657 @end lilypond
658
659 @item @code{. ..}
660 @tab augmentation dots
661 @tab
662 @lilypond[fragment, relative 1]
663 \property Staff.TimeSignature = \turnOff
664 \property Staff.Clef = \turnOff
665 c4. c4..  
666 @end lilypond
667 @tab @internalsref{Dot}, @internalsref{DotColumn}
668
669 @item @code{c d e f g a b }
670 @tab scale 
671 @tab
672 @lilypond[fragment, relative 1]
673 \property Staff.TimeSignature = \turnOff
674 \property Staff.Clef = \turnOff
675 c d e f g a b
676 @end lilypond
677 @tab @internalsref{NoteHead}
678
679 @item @code{es is}
680 @tab flat/sharp
681 @tab
682 @lilypond[fragment, relative 2]
683 \property Staff.TimeSignature = \turnOff
684 \property Staff.Clef = \turnOff
685 bes4 cis4  
686 @end lilypond
687 @tab @internalsref{Accidental}
688
689 @item @code{-. -^ ->}
690 @tab articulations (1)
691 @tab
692 @lilypond[fragment, relative 1]
693 \property Staff.TimeSignature = \turnOff
694 \property Staff.Clef = \turnOff
695 c-. c-^ c->
696 @end lilypond
697 @tab @internalsref{Script}
698
699 @item @code{-\trill -\fermata}
700 @tab articulations (2)
701 @tab
702 @lilypond[fragment, relative 1]
703 \property Staff.TimeSignature = \turnOff
704 \property Staff.Clef = \turnOff
705 c-\trill c-\fermata 
706 @end lilypond
707 @tab @internalsref{Script}
708
709 @item @code{\time 3/4 \time 4/4 }
710 @tab time signature
711 @tab
712 @lilypond[fragment]
713 \property Staff.Clef \set #'transparent = ##t 
714 \time 3/4
715 s4_" "
716 \time 4/4
717 s16_" "
718 @end lilypond
719 @tab @internalsref{TimeSignature}
720
721 @item @code{\clef treble \clef bass }
722 @tab clefs
723 @tab
724 @lilypond[fragment]
725 \property Staff.TimeSignature \set #'transparent = ##t 
726 \clef treble
727 s4_" "
728 \clef bass
729 s4_" "
730 @end lilypond
731 @tab @internalsref{Clef}
732
733 @item @code{\sfz \mf }
734 @tab dynamics
735 @tab
736 @lilypond[fragment,relative 1]
737 \property Staff.TimeSignature = \turnOff
738 \property Staff.Clef = \turnOff
739 c\sfz c\mf
740 @end lilypond
741 @tab @internalsref{DynamicText}
742
743 @item @code{[ ]}
744 @tab beam
745 @tab
746 @lilypond[fragment, relative 1]
747 \property Score.timing = ##f
748 \property Staff.TimeSignature = \turnOff
749 \property Staff.autoBeaming = ##f
750 \property Staff.Clef = \turnOff
751 [a8 b]
752 @end lilypond
753 @tab @internalsref{Beam}
754
755 @item @code{~}
756 @tab tie
757 @tab
758 @lilypond[fragment, relative 1]
759 \property Score.timing = ##f
760 \property Staff.TimeSignature = \turnOff
761 \property Staff.autoBeaming = ##f
762 \property Staff.Clef = \turnOff
763 d ~ d
764 @end lilypond
765 @tab @internalsref{Tie} 
766
767 @item @code{( )}
768 @tab slur
769 @tab
770 @lilypond[fragment, relative 1]
771 \property Score.timing = ##f
772 \property Staff.TimeSignature = \turnOff
773 \property Staff.autoBeaming = ##f
774 \property Staff.Clef = \turnOff
775 c( d )e
776 @end lilypond
777 @tab @internalsref{Slur}
778
779 @item @code{'}
780 @tab raise octave
781 @tab
782 @lilypond[fragment, relative 1]
783 \property Score.timing = ##f
784 \property Staff.TimeSignature = \turnOff
785 \property Staff.autoBeaming = ##f
786 \property Staff.Clef = \turnOff
787 a a'
788 @end lilypond
789 @tab
790
791 @item @code{,}
792 @tab lower octave
793 @tab
794 @lilypond[fragment, relative 1]
795 \property Score.timing = ##f
796 \property Staff.TimeSignature = \turnOff
797 \property Staff.autoBeaming = ##f
798 \property Staff.Clef = \turnOff
799 c c,
800 @end lilypond
801 @tab
802
803 @item @code{< >}
804 @tab chord
805 @tab
806 @lilypond[fragment, relative 1]
807 \property Score.timing = ##f
808 \property Staff.TimeSignature = \turnOff
809 \property Staff.autoBeaming = ##f
810 \property Staff.Clef = \turnOff
811 \context Voice { <a c> }
812 @end lilypond
813 @tab 
814
815 @item @code{\< \!}
816 @tab crescendo
817 @tab
818 @lilypond[fragment, relative 1]
819 \property Score.timing = ##f
820 \property Staff.TimeSignature = \turnOff
821 \property Staff.autoBeaming = ##f
822 \property Staff.Clef = \turnOff
823 a\< a \!a
824 @end lilypond
825 @tab @internalsref{Hairpin}
826
827 @item @code{\> \!}
828 @tab decrescendo
829 @tab
830 @lilypond[fragment, relative 1]
831 \property Score.timing = ##f
832 \property Staff.TimeSignature = \turnOff
833 \property Staff.autoBeaming = ##f
834 \property Staff.Clef = \turnOff
835 a\> a \!a
836 @end lilypond
837 @tab @internalsref{Hairpin}
838
839 @end multitable
840
841
842
843
844 @node Running LilyPond
845 @section Running LilyPond
846
847 In the last section, we explained what kind of things you could enter
848 in a lilypond file.  In this section we explain how to run LilyPond,
849 and how view or print the output.  If you have not used LilyPond
850 before, want to test your setup of LilyPond, or try to run an example
851 file yourself, then read this section.  The instructions that follow
852 are for running LilyPond on Unix-like systems.  Some additional
853 instructions for running LilyPond on Windows are given at the end of
854 this section.
855
856 You begin with opening a terminal window, and start up a text editor.
857 For example, open an xterm and execute @code{joe}.  In your text editor,
858 enter the following input, and save the file as @file{test.ly}:
859
860 @quotation
861 @example
862 \score @{
863   \notes @{ c'4 e' g' @}
864 @} 
865 @end example
866 @end quotation
867
868 @cindex ly2dvi
869
870 @c now this is weird, running ly2dvi to run LilyPond
871 @c (therefore name change proposal) 
872
873 LilyPond is the program that computes the sheet music. All other
874 things, such as adding titles, page breaking and other page layout,
875 are done by a small wrapper program called
876 @code{ly2dvi}. @code{ly2dvi} calls lilypond to render the music, and
877 then adds the titling and page layout instructions.  To process
878 @file{test.ly} with ly2dvi, proceed as follows:
879
880 @quotation
881 @example
882 ly2dvi -P test.ly
883 @end example
884 @end quotation
885
886 You will see the following on your screen:
887
888 @quotation
889 @example
890 GNU LilyPond 1.4.0
891 Now processing: `/home/fred/ly/test.ly'
892 Parsing...
893 Interpreting music...[1]
894  @emph{ ... more interesting stuff ... }
895 PS output to `test.ps'...
896 DVI output to `test.dvi'...
897 @end example
898 @end quotation
899 @cindex DVI file
900 @cindex Viewing music
901 @cindex xdvi
902
903 The results of the ly2dvi run are two files, @file{test.dvi} and
904 @file{test.ps}.  The PS file (@file{test.ps}) is the one you can print.
905 You can view the PS file using the program ghostview.  If a version of
906 ghostview is installed on your system, one of these commands will
907 produce a window with some music notation on your screen:
908 @c eeek
909 @quotation
910 @example
911   gv test.ps
912   ghostview test.ps
913   ggv test.ps
914   kghostview test.ps
915 @end example
916 @end quotation
917 If you are satisfied with the looks of the music displayed on your
918 screen, you can print the PS file by clicking File/Print inside
919 ghostview.
920
921 The DVI file (@file{test.dvi}) contains the same sheet music in a
922 different format. DVI files are more easily processed by the computer,
923 so viewing them usually is quicker.  Execute @code{xdvi test.dvi}
924 to view the DVI file.
925
926 If your DVI viewer does not have a "Print" button, you can print the
927 file by executing @code{lpr test.ps}.
928
929 @c volgende alinea schrappen?  
930
931 If you can't get the examples to print, then you should look into
932 installing and configuring ghostscript.  Refer to GhostScript's website
933 at @uref{http://www.ghostscript.com}.
934
935 @cindex GhostScript
936 @cindex @code{lpr}
937 @cindex Printing output
938 @cindex PostScript
939
940 @unnumberedsubsec Windows users
941 Windows users start the terminal by clicking on the LilyPond or Cygwin
942 icon.  Notepad is sufficient for editing the LilyPond file.  Viewing
943 the PS file can be done with:
944 @quotation
945 @example
946 @code{gsview32 test.ps}
947 @end example
948 @end quotation
949 You can also print from the command line by executing:
950 @quotation
951 @example
952 @code{gsview32 /s test.ps}
953 @end example
954 @end quotation
955
956
957 @node The first real tune
958 @section The first real tune
959
960
961 The rest of this tutorial will demonstrate how to use Lilypond by
962 presenting examples of input along with resulting output.  We will use
963 English terms for notation.  In case you are not familiar with those,
964 you may consult the glossary that is distributed with LilyPond.
965
966 The examples discussed are included in the distribution, in the
967 subdirectory @file{input/tutorial/}@footnote{When we refer to filenames,
968 they are relative to the top directory of the source package. }
969
970 To demonstrate what LilyPond input looks like, we start off with a
971 full-fledged, yet simple example. It is a convoluted version
972 of the famous minuet in J. S. Bach's @emph{Klavierb@"uchlein}. The file
973 is included in the distribution as  @file{minuet.ly}.
974 @cindex Bach, Johann Sebastian 
975
976 @lilypond[verbatim]
977 % all text after a percent sign is a comment
978 % and is ignored by LilyPond
979 \include "paper16.ly"
980 \score {
981     \notes                        
982     \relative c'' \sequential {
983             \time 3/4                
984             \key g \major
985
986         \repeat "volta" 2 {
987             d4 g,8 a b c d4 g, g |
988             e'4 c8 d e fis g4 g, g |
989             c4 d8( )c b a( )b4 c8 b a g |
990             a4 [b8 a] [g fis] g2.  |
991         }
992
993         b'4 g8 a b g
994         a4 d,8 e fis d |
995         g4 e8 fis g d cis4 b8 cis a4 |
996         a8-. b-. cis-. d-. e-. fis-.
997         g4 fis e |
998         fis a,  r8 cis8
999         d2.-\fermata
1000         \bar "|."
1001     }
1002     \paper {
1003        % standard settings are too big and wide for a book
1004        indent = 1.0 \cm
1005        linewidth = 15.0 \cm
1006    }
1007 }
1008 @end lilypond
1009
1010 We will analyse the input, line by line.
1011 @separate
1012 @example
1013         % all text after a percent sign is a comment
1014         % and is ignored by LilyPond
1015 @end example 
1016 Percent signs introduce comments: everything after a percent sign is
1017 ignored. You can use this If you want to write down mental notes to
1018 yourself in a file, then you can enter preceded with a @code{%} sign.
1019 These lines are called comments. If you have long winded mental notes,
1020 you can make comments that span several lines by enclosing text in
1021 @code{%@{} and @code{%@}}.
1022 @cindex comment
1023 @cindex block comment
1024 @cindex line comment
1025 @separate
1026 @example 
1027
1028         \include "paper16.ly"
1029  
1030 @end example
1031 @cindex @code{\include}
1032 @cindex point, printer's
1033 @cindex staff size, setting
1034 @cindex font size, setting
1035
1036 By default, LilyPond will typeset the music in a size such that each
1037 staff is 20 point (0.7 cm, or 0.27 inch) high.  We want smaller output
1038 (16 point staff height), so we must import the settings for that size,
1039 which is done here.
1040 @separate
1041 @example 
1042
1043         \score @{
1044  
1045 @end example 
1046 Music is printed by combining a piece of music with directions for
1047 outputting it.  This combination is formed in the @code{\score} block.
1048 @separate
1049 @example 
1050
1051         \notes                
1052  
1053 @end example 
1054 Prepare LilyPond for accepting notes.
1055 @cindex octaves, choosing
1056 @cindex pitch
1057 @separate
1058 @example 
1059
1060         \relative c''
1061  
1062 @end example
1063 @cindex relative
1064 @c removed duplicate introduction to octave marks /MB
1065 @c Shorten even more?
1066
1067 @c As we will see, each note is described by its note name, duration,
1068 @c octave and possibly a chromatic alteration.  In this setup, the octave
1069 @c is indicated by using high quotes (@code{'}) and ``lowered quotes''
1070 @c (commas: @code{,}).  The central C is denoted by @code{c'}.  The C one
1071 @c octave higher is @code{c''}.  One and two octaves below the central C is
1072 @c denoted by @code{c} and @code{c,} respectively.
1073
1074 Even though a piece of music often spans a range of several octaves,
1075 often melodies move in small intervals. Such melodies can be entered
1076 easily using @code{\relative}.  In this ``relative octave mode'',
1077 octaves of notes without quotes are chosen such that a note is as
1078 close as possible (graphically, on the staff) to the preceding note.
1079 If you add a high-quote an extra octave is added.  A lowered quote (a
1080 comma) will subtract an extra octave.
1081
1082 Absolute starting pitch for this relative mode is given as the
1083 argument to @code{\relative}. In this case it is the @code{c''}, one
1084 octave above central C.
1085  
1086 @separate
1087 @example 
1088
1089         \sequential @{
1090  
1091 @end example 
1092 What follows is sequential music, i.e.,
1093 @cindex sequential music
1094 notes that are to be played and printed after each other.
1095 @separate
1096 @example 
1097
1098         \time 3/4
1099  
1100 @end example
1101 @cindex time signature, setting
1102 @cindex @code{\time}
1103 The @code{\time} command sets (or changes) the time signature of the
1104 current piece: a 3/4 sign is printed.  This setting is also used to
1105 generate bar lines at the right spots.
1106 @separate
1107 @example 
1108
1109         \key g \major
1110  
1111 @end example
1112 @cindex key signature, setting
1113 @cindex @code{\key}
1114 Set (or change) the current key signature to G-major.  Although in this
1115 example, the @code{\key} command happened to be entered after the
1116 @code{\time} command, in the output the time signature will be printed
1117 after the key signature; LilyPond knows about music typesetting
1118 conventions.
1119 @separate
1120 @example 
1121
1122         \repeat "volta" 2
1123  
1124 @end example 
1125 The following piece of music is played twice.  The first argument
1126 indicates the type of repeat.  In this case, @code{"volta"} means that
1127 prima volta/secunda volta brackets are used for the alternative
1128 endings---if there were any.
1129
1130 A special notation for repeats allows you to get correct repeats in
1131 MIDI output. However, some extra trickery is needed to get this
1132 working, See @ref{Repeats and MIDI}.  
1133 @separate
1134 @example 
1135
1136         @{
1137  
1138 @end example 
1139 The subject of the repeat is again sequential music.  Since
1140 @code{\sequential} is such a common construct, a shorthand is provided:
1141 just leave off @code{\sequential}, and the result is the same.
1142 @separate
1143 @example 
1144
1145         d4 g,8
1146  
1147 @end example 
1148 Two notes.  The first note is a quarter note with relative pitch
1149 @code{d}.  The relative music was started with a @code{c''}, so the real
1150 pitch of this note is @code{d''}.  The duration of a note is designated
1151 by a number; the @code{4} here represents a quarter note.
1152
1153 The second note is an eight note with relative pitch @code{g,}.  The
1154 pitch is taken relative to the previous @code{d''}, making this
1155 note have real pitch @code{g'}.  The @code{8} represents an eight note.
1156 @separate
1157 @example 
1158
1159         a b
1160  
1161 @end example 
1162 Two more notes, with pitch @code{a} and @code{b}.  Because their
1163 duration is the same as the @code{g,8}, there is no need to enter the
1164 duration, but you may enter it anyway, i.e., @code{a8 b8}
1165 @separate
1166 @example 
1167
1168         d4 g, g |
1169  
1170 @end example
1171 @cindex bar check
1172 @cindex @code{|}
1173 @cindex errors, finding 
1174 Three more notes.  The @code{|} character is a ``bar check''.  LilyPond
1175 will verify that bar checks are found at the start of a measure.  This can
1176 help you track down typing errors.
1177
1178 @cindex alteration, chromatic
1179 @cindex chromatic alteration
1180 @separate
1181 @example 
1182
1183         c8 d e fis
1184
1185 @end example 
1186 So far, no notes were chromatically altered.  Here is the first one
1187 that is: @code{fis}.  LilyPond uses Dutch note names, and ``Fis'' is
1188 the name for ``F sharp''.  There is no sharp sign in the output. The
1189 program keeps track of key signatures, and will only print accidentals
1190 if they are needed.  If you can not get used to Dutch names, then
1191 there also are names available in several other languages.
1192
1193
1194 For groups of eighth notes and shorter, LilyPond can determine how the
1195 notes should form a beam.  In this case, the 4 eights are automatically
1196 printed as a beam.
1197 @separate
1198 @example 
1199
1200         c4 d8( )c b a( )b4 c8 b a g |
1201  
1202 @end example 
1203 The beginning and ending notes of a slur are marked with parentheses,
1204 @code{(} and @code{)} for start and end respectively.  The line above
1205 indicates two slurs.  These slur markers (parentheses) are entered
1206 between the slurred notes.
1207 @separate
1208 @example 
1209
1210         a4 [b8 a] [g fis] 
1211  
1212 @end example 
1213 Automatic beaming can be overridden by inserting beam marks, @code{[}
1214 and @code{]}.  These beam markers (brackets) are put around the notes
1215 you want beamed.
1216 @separate
1217 @example 
1218
1219         g2.  |
1220  
1221 @end example
1222 @cindex augmentation dot
1223 @cindex dotted note
1224 A period adds a dot to the note.
1225 @separate
1226 @example 
1227
1228         @}
1229  
1230 @end example 
1231 The end of the sequential music to be repeated.  LilyPond will typeset a
1232 repeat bar.
1233 @separate
1234 @example 
1235
1236         cis'4 b8 cis a4 |
1237  
1238 @end example 
1239 Accidentals are printed whenever necessary: the first C sharp of the bar
1240 will be printed with an accidental, the second one without.
1241 @separate
1242 @example 
1243
1244         a8-. b-. cis-. d-. e-. fis-.
1245  
1246 @end example
1247 @cindex articulation
1248 Staccato signs are entered as a dash and a period. Some other
1249 articulations may also be entered in this short form.
1250 @separate
1251 @example 
1252
1253         fis a, r8 cis8
1254  
1255 @end example 
1256  
1257 Rests are denoted by the special note name @code{r}.  
1258 @separate
1259 @example 
1260
1261         d2.-\fermata
1262  
1263 @end example 
1264 All articulations have a verbose form, like @code{\fermata}.  The
1265 command @code{\fermata} is not part of the core of the language, but it
1266 is a shorthand for a more complicated description of a fermata symbol.
1267 @code{\fermata} names that description and is therefore called an
1268 identifier.
1269 @cindex identifier
1270 @cindex @code{\fermata}
1271 @separate
1272 @example
1273         \bar "|."
1274         @}
1275 @end example 
1276 Here the music ends.  LilyPond does not automatically typeset an end
1277 bar, we must explicitly request one, using @code{"|."}.
1278
1279 @separate
1280 @example 
1281
1282         \paper @{
1283                 % standard settings are too big and wide for a book
1284                 indent = 1.0\cm
1285                 linewidth = 15.0\cm
1286         @}
1287  
1288 @end example 
1289 The @code{\paper} block specifies how entered music should be converted
1290 to notation output.  Most of the details of the conversion (font sizes,
1291 dimensions, etc.) have been taken care of, but to fit the output in this
1292 document, it has to be narrower.  We do this by setting the line width
1293 to 14 centimeters (approximately 5.5 inches).
1294 @separate
1295 @example 
1296
1297         @}
1298  
1299 @end example 
1300 The last brace ends the @code{\score} block.
1301
1302
1303
1304
1305 @node Lyrics and chords
1306 @section Lyrics and chords
1307
1308 In this section we show how to typeset a song. This file is
1309 included as @file{flowing.ly}.
1310
1311 @example 
1312 \header @{
1313         title = "The river is flowing"
1314         composer = "Traditional"
1315 @}
1316 \include "paper16.ly"
1317 melody = \notes \relative c' @{
1318         \partial 8
1319         \key c \minor
1320         g8 |
1321         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
1322         c4 c8 d [es () d] c4 | d4 es8 d c4.
1323         \bar "|."
1324 @}
1325
1326 text = \lyrics @{
1327         The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
1328         ri -- ver is flo -- wing down to the sea.
1329 @}
1330
1331 accompaniment =\chords @{
1332         r8
1333         c2:3- f:3-.7 d:min es4 c8:min r8
1334         c2:min f:min7 g:7^3.5 c:min @}
1335
1336 \score @{
1337         \simultaneous @{
1338           %\accompaniment
1339           \context ChordNames \accompaniment
1340
1341           \addlyrics
1342             \context Staff = mel @{        
1343               \property Staff.autoBeaming = ##f
1344               \property Staff.automaticMelismata = ##t
1345               \melody 
1346             @}
1347             \context Lyrics \text
1348         @}
1349         \midi  @{ \tempo 4=72 @}
1350         \paper @{ linewidth = 10.0\cm @}
1351 @} 
1352 @end example 
1353
1354
1355 The result would look this.@footnote{The titling and font size shown
1356 may differ, since the titling in this document is not generated by
1357 @code{ly2dvi}.}
1358
1359 @center @strong{The river is flowing}
1360 @center Traditional 
1361
1362 @lilypond[center]
1363 \header {
1364         title = "The river is flowing"
1365         composer = "Traditional"
1366 }
1367 \include "paper16.ly"
1368 melody = \notes \relative c' {
1369         \partial 8
1370         \key c \minor
1371         g8 |
1372         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
1373         c4 c8 d [es () d] c4 | d4 es8 d c4.
1374         \bar "|."
1375 }
1376
1377 text = \lyrics {
1378         The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
1379         ri -- ver is flo -- wing down to the sea.
1380 }
1381
1382 accompaniment =\chords {
1383         r8
1384         c2:3- f:3-.7 d:min es4 c8:min r8
1385         c2:min f:min7 g:7^3.5 c:min }
1386
1387 \score {
1388         \simultaneous {
1389           %\accompaniment
1390           \context ChordNames \accompaniment
1391
1392           \addlyrics
1393             \context Staff = mel {
1394               \property Staff.autoBeaming = ##f
1395               \property Staff.automaticMelismata = ##t
1396               \melody 
1397             }
1398             \context Lyrics \text
1399         }
1400         \midi  { \tempo 4=72 }
1401         \paper { linewidth = 10.0\cm }
1402 }
1403 @end lilypond
1404
1405 Again, we will dissect the file line by line.
1406 @separate
1407 @example 
1408
1409         \header @{
1410  
1411 @end example
1412 @cindex @code{\header}
1413 Information about the music you are about to typeset goes into a
1414 @code{\header} block.  The information in this block is not used by
1415 LilyPond, but it is passed into the output.  @file{ly2dvi} uses this
1416 information to print titles above the music.
1417 @separate
1418 @example 
1419
1420         title = "The river is flowing"
1421         composer = "Traditional (?)"
1422 @end example
1423 @cindex assignments
1424 @cindex identifier assignment
1425 the @code{\header} block contains assignments.  In each assignment, a
1426 variable is set to a value. 
1427 @separate
1428 @example 
1429
1430         \include "paper16.ly"
1431  
1432 @end example
1433 Smaller size for inclusion in a book.
1434 @separate
1435 @example 
1436
1437         melody = \notes \relative c' @{
1438  
1439 @end example 
1440 The structure of the file will be the same as the previous one, a
1441 @code{\score} block with music in it.  To keep things readable, we will
1442 give names to the different parts of music, and use the names to
1443 construct the music within the score block.
1444
1445 @separate
1446 @example 
1447         \partial 8
1448 @end example 
1449
1450 @cindex @code{\partial}
1451 @cindex anacrusis
1452 The piece starts with an anacrusis of one eighth.
1453 @separate
1454 @example
1455         \key c \minor
1456 @end example
1457 The key is C minor: we have three flats.
1458
1459 @separate
1460 @example 
1461
1462         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
1463         c4 c8 d [es () d] c4 | d4 es8 d c4.
1464         \bar "|."
1465  
1466 @end example 
1467
1468 @cindex manual beaming
1469 @cindex automatic beaming, turning off
1470 We use explicit beaming.  Since this is a song,  we turn automatic
1471 beams off, and use explicit beaming where needed.
1472 @separate
1473 @example 
1474
1475         @}
1476  
1477 @end example 
1478 This ends the definition of @code{melody}.  
1479
1480 @separate
1481 @example 
1482
1483         text = \lyrics @{
1484  
1485 @end example
1486 @cindex lyrics
1487 @cindex identifier assignment
1488 @cindex syllables, entering
1489 Another identifier assignment.  This one is for the lyrics. 
1490 Lyrics are formed by syllables that have duration, and not by
1491 notes. To make LilyPond parse words as syllables,  switch it  into
1492 lyrics mode with @code{\lyrics}.  Again, the brace after @code{\lyrics}
1493 is a shorthand for @code{\sequential @{}.
1494 @separate
1495 @example 
1496
1497   The ri -- ver is flo- __ wing,  flo -- wing and gro -- wing, the
1498   ri- ver is flo- __ wing down to the sea.
1499 @}
1500  
1501 @end example
1502 @cindex extenders, lyric
1503 @cindex hyphens, lyric 
1504 The syllables  themselves are  separated by spaces.  You can get syllable
1505 extenders by entering @code{__}, and centered hyphens with
1506 @code{-}@code{-}.  We don't enter durations for  the syllables. They
1507 are  aligned with the melody later.
1508 @separate
1509 @example 
1510
1511         accompaniment =\chords @{
1512  
1513 @end example
1514 @cindex chords
1515 @cindex mode, chords
1516 We'll put chords over the music. To enter them, there is a special mode
1517 analogous to @code{\lyrics} and @code{\notes} mode, where you can give
1518 the names of the chords you want, instead of listing the notes
1519 comprising the chord.
1520 @separate
1521 @example 
1522
1523         r8
1524  
1525 @end example 
1526 There is no accompaniment during the anacrusis.
1527 @separate
1528 @example 
1529
1530         c2:3- 
1531  
1532 @end example
1533
1534 @cindex tonic
1535 @cindex chord modifier
1536 @cindex modifier, chord 
1537 This is a c minor chord, lasting half a note.  Chord are entered by
1538 entering the tonic. Then notes can be changed. In this case, a small third
1539 is used. The cod for this is @code{3-}. 
1540
1541 @separate
1542 @example
1543 f:3-.7
1544 @end example
1545 Similarly, @code{7} modifies (adds) a seventh, which is small by
1546 default to create the @code{f a c es} chord.  Multiple modifiers must be
1547 separated by dots.
1548 @separate
1549 @example 
1550
1551         d:min es4 c8:min r8
1552  
1553 @end example
1554 Some modifiers have predefined names, e.g. @code{min} is  the same as
1555 @code{3-}, so @code{d-min} is a minor @code{d} chord.
1556 @separate
1557 @example 
1558
1559         c2:min f:min7 g:7^3.5 c:min @}
1560  
1561 @end example
1562 @cindex named modifier
1563
1564 A named modifier @code{min} and a normal modifier @code{7} do not have
1565 to be separated by a dot.  Tones from a chord are removed with chord
1566 subtractions.  Subtractions are started with a caret, and they are
1567 also separated by dots.  In this example, @code{g:7^3.5} produces a
1568 minor seventh.  The brace ends the sequential music.
1569 @separate
1570 @example 
1571
1572         \score @{
1573                 \simultaneous @{
1574  
1575 @end example 
1576 We assemble the music in the @code{\score} block.  Melody, lyrics and
1577 accompaniment have to sound at the same time, so they should be
1578 @code{\simultaneous}.
1579 @cindex @code{\simultaneous}
1580 @separate
1581 @example 
1582
1583         %\accompaniment
1584  
1585 @end example 
1586 Chord mode generates notes grouped in @code{\simultaneous} music.  If
1587 you remove the comment sign, you can see the chords in normal
1588 notation: they will be printed as note heads on a separate
1589 staff. To print them as chords names, they have to be interpreted as
1590 being chords, not notes. This is done with the following command:  
1591 @separate
1592 @example 
1593
1594         \context ChordNames \accompaniment
1595  
1596 @end example
1597 @cindex context
1598 @cindex interpretation context
1599 @cindex notation context
1600
1601
1602 Normally, the notes that you enter are transformed into note heads.
1603 Note heads alone make no sense, they need surrounding information: a key
1604 signature, a clef, staff lines, etc.  They need @emph{context}.  In
1605 LilyPond, these symbols are created by objects called `interpretation
1606 contexts'.  Interpretation contexts exist for generating notation
1607 (`notation context') and for generating sound (`performance
1608 context'). These objects only exist during a run of LilyPond.
1609
1610 When LilyPond interprets music, it will create a Staff context.  If
1611 the @code{%} sign in the previous line were removed, you could see
1612 that mechanism in action.
1613
1614 We don't want that default here, because we want chord names.  The
1615 command above explicitly creates an interpretation context of 
1616 @code{ChordNames} type to interpret the music @code{\accompaniment}. 
1617 @separate
1618 @example 
1619
1620         \addlyrics
1621  
1622 @end example
1623 @cindex @code{\addlyrics}
1624 @cindex lyrics and melody, combining
1625 @cindex combining lyrics and melody
1626
1627 The lyrics should be aligned with the melody.  This is done by
1628 combining both with @code{\addlyrics}.  @code{\addlyrics} takes two
1629 pieces of music (usually a melody and lyrics, in that order) and
1630 aligns the syllables of the second piece under the notes of the
1631 first piece.
1632 @separate
1633 @example 
1634
1635         \context Staff = mel @{
1636  
1637 @end example
1638
1639 We place the melody on a staff called @code{mel}. We give it a name to
1640 differentiate it from the one that would contain note heads for the
1641 chords, if you would remove the comment before the ``note heads''
1642 version of the accompaniment. By giving this staff a name, it is
1643 forced to be different.
1644 @separate
1645 @example 
1646
1647         \property Staff.autoBeaming = ##f
1648  
1649 @end example
1650 @cindex \property
1651 @cindex context variables
1652 @cindex setting context variables
1653 An interpretation context has variables, called properties, that tune
1654 its behavior.  One of the variables is @code{autoBeaming}.  Setting
1655 this @code{Staff}'s property to @code{##f}, which is the boolean value
1656 @var{false}, turns the automatic beaming mechanism off for the current
1657 staff.
1658
1659 @ignore
1660 @cindex GUILE
1661 @cindex Scheme
1662 @cindex accessing Scheme
1663 @cindex evaluating Scheme
1664 @cindex LISP
1665
1666 LilyPond internally uses GUILE, a Scheme-interpreter. Scheme is a
1667 language from the LISP family. You can learn more about Scheme at
1668 @uref{http://www.scheme.org}. It is used to represent data throughout
1669 the whole program. The hash-sign (@code{#}) accesses GUILE directly: the
1670 code following the hash-sign is evaluated as Scheme.  The boolean value
1671 @var{true} is @code{#t} in Scheme, so for LilyPond @var{true} looks like
1672 @code{##t}.
1673
1674 If Scheme scares you, don't worry. You don't need to know Scheme to
1675 create beautiful sheet music.
1676 @end ignore
1677
1678
1679 @separate
1680 @example 
1681
1682         \property Staff.automaticMelismata = ##t
1683  
1684 @end example
1685 @cindex automaticMelismata
1686 @cindex melismata
1687 @cindex @code{\addlyrics} and slurs
1688 Similarly, we  don't want to print a  syllable when there is
1689 a slur. This sets up @code{\addlyrics} to not put lyrics under each
1690 separate note while there is a slur.
1691 @separate
1692 @example 
1693
1694           \melody
1695         @}
1696  
1697 @end example 
1698 Finally, we put the melody on the current staff.  Note that the
1699 @code{\property} directives and @code{\melody} are grouped in sequential
1700 music,  so the property settings are done before the melody is
1701 processed.
1702 @separate
1703 @example 
1704
1705         \context Lyrics \text
1706  
1707 @end example 
1708 The second argument of @code{\addlyrics} is the text. The text also
1709 should not land on a Staff, but on a interpretation context for
1710 syllables, extenders, hyphens etc.  This context is called
1711 Lyrics.
1712 @separate
1713 @example 
1714
1715         \midi  @{ \tempo 4=72@}
1716  
1717 @end example 
1718 MIDI (Musical Instrument Digital Interface) is a standard for
1719 connecting and recording digital instruments. So a MIDI file is like a
1720 tape recording of an instrument. The @code{\midi} block makes the
1721 music go to a MIDI file, so you can listen to the music you entered.  It
1722 is great for checking the music.  Whenever you hear something weird, you
1723 probably hear a typing error.
1724
1725 Syntactically, @code{\midi} is similar to @code{\paper @{ @}}, since it
1726 also specifies an output method. You can specify the tempo using the
1727 @code{\tempo} command, in this case the tempo of quarter notes is set to
1728 72 beats per minute.
1729 @separate
1730 @example 
1731
1732         \paper @{ linewidth = 10.0\cm @}
1733  
1734 @end example 
1735 We also want notation output.  The linewidth is short so the piece
1736 will be set in two lines.
1737
1738 @node More movements 
1739 @section More movements
1740
1741 [FIXME: merge here with, or move this to: Other ways to run LilyPond]
1742
1743 You probably ran @file{ly2dvi} on the last example, and ended up with a
1744 viewable @file{.dvi} file.  However, between there are a few steps of
1745 which LilyPond is only one. To enhance your understanding of what's
1746 happening under the hood when you run @code{ly2dvi}, we explain what
1747 programs are run.
1748
1749 @code{ly2dvi} is a program that calls a number of programs  in sequence.
1750 The first thing it does, is running LilyPond on the input file. After
1751 some calculations, a @file{.tex} is produced. The contents
1752 of this file are very  low-level instructions.
1753
1754 For example, consider the following file (@file{miniatures.ly}) 
1755
1756 @example
1757 \version "1.5.60"
1758 \header @{
1759   title = "Two miniatures"
1760   tagline = "small is beautiful"
1761 @}
1762
1763 #(set! point-and-click line-column-location)
1764
1765 \paper @{ linewidth = -1.0 @}
1766
1767 \score @{
1768     \notes @{ c'4 d'4 @}
1769     \header @{
1770         opus = "Opus 1."
1771         piece = "Up" @}
1772 @}
1773 \score @{
1774     \notes @{ d'4 c'4 @}
1775     \header @{
1776         opus = "Opus 2."
1777         piece = "Down" @}
1778 @}
1779 @end example
1780
1781 The titling in this manual was not generated by ly2dvi, so we can't
1782 exactly show what it would look like, but the result should resemble this:
1783
1784 @center @strong{Two miniatures}
1785 @flushright
1786 Opus 1.
1787 @end flushright
1788 @flushleft
1789 @var{Up}
1790 @end flushleft
1791 @lilypond
1792   \score {
1793     \notes { c'4 d'4 }
1794     \paper { linewidth = -1.0 }
1795   }
1796 @end lilypond
1797 @flushright
1798 Opus 2.
1799 @end flushright
1800 @flushleft
1801 @var{Down}
1802 @end flushleft
1803 @lilypond
1804   \score {
1805     \notes { d'4 c'4 }
1806     \paper { linewidth = -1.0 }
1807   }
1808 @end lilypond
1809
1810 This file is produced by ly2dvi in a few stages, with the help of text
1811 formatting tools. LilyPond produces two output files,
1812 @file{miniatures.tex} and @file{miniatures-1.tex}.  Both files contain
1813 only graphical music notation. @file{ly2dvi} looks at what output
1814 LilyPond produces, and adds page layout and titling to those files.  The
1815 result is a DVI file called @file{miniatures.dvi}.
1816
1817 Next, now we'll look at the example line by line to explain new things.
1818
1819 @separate
1820 @example 
1821 \version "1.4.0"
1822 @end example 
1823 Lilypond and its language are still under development, and occasionally,
1824 details of the syntax are changed. This fragment indicates for which
1825 version the input file was written. When you compile this file, the
1826 version number will be checked, and you will get a warning when the file
1827 is too old.
1828
1829 This version number is also used by the @code{convert-ly} program (See
1830 @ref{Upgrading from older LilyPond versions}), which is used to update
1831 the file to the latest lily version.
1832
1833 @separate
1834 @example
1835   \header @{
1836     title = "Two miniatures"  @}
1837 @end example
1838 This sets the titling information for the entire file.
1839 @separate
1840 @example
1841     tagline = "small is beautiful" 
1842 @end example
1843 A signature line is printed at the bottom of the last page.
1844  This signature is produced from the @code{tagline} field of
1845 @code{\header}.  Many people find the default "Lily was here,
1846 @var{version number}" too droll. If that is the case,  assign
1847 something else to @code{tagline}, as shown above.
1848 @separate
1849 @example
1850         #(set! point-and-click line-column-location)
1851 @end example
1852
1853 This piece of Scheme code sets the Scheme variable
1854 @code{point-and-click} to the value @var{line-column-location} (which
1855 itself is a Scheme procedure).
1856
1857 Editing input files can be complicated if you're working with
1858 large files: if you're digitizing existing music, you have to
1859 synchronize the .ly file, the sheet music on your lap and the sheet
1860 music on the screen.  The point-and-click mechanism makes it easy to
1861 find the origin of an error in the LY file: when you view the file with
1862 Xdvi and click on a note, your editor will jump to the spot where that
1863 note was entered.  For more information, see @ref{Point and click}.
1864
1865 @separate
1866 @example
1867   \paper @{ 
1868 @end example
1869
1870 The @code{\score} blocks that follow in the file don't have
1871 @code{\paper} sections, so the settings of this block are substituted: A
1872 paper block at top level, i.e. not in a @code{\score} block sets the
1873 default page layout.
1874
1875 @separate
1876 @example
1877   linewidth = -1.0 @}
1878 @end example
1879
1880
1881
1882 The variable @code{linewidth} normally sets the length of the systems on
1883 the page. However, a negative value has a special meaning. If
1884 @code{linewidth} is less than 0, no line breaks are inserted into the
1885 score, and the spacing is set to natural length: a short phrase takes up
1886 little space, a longer phrase more space.
1887
1888 @separate
1889 @example
1890   \score @{
1891     \notes @{ c'4 d'4 @}
1892 @end example
1893
1894 In previous examples, notes were specified in relative octaves,
1895 i.e. each note was put in the octave that is closest to its
1896 predecessor. Besides relative, there is also absolute octave
1897 specification, which you get when you don't specify @code{\relative}. In
1898 this input mode, the central C is denoted by @code{c'}. Going down, you
1899 get @code{c} @code{c,} @code{c,,} etc.  Going up, you get @code{c''}
1900 @code{c'''} etc.
1901
1902 When you're copying music from existing sheet music, relative octaves
1903 are probably the easiest to use: it's less typing work and errors are
1904 easily spotted. However, if you write LilyPond input directly, either by
1905 hand (i.e. composing) or by computer, absolute octaves may be easier to use.
1906
1907
1908 @separate
1909 @example
1910     \header @{
1911 @end example
1912
1913 The @code{\header} is normally at the top of the file, where it sets
1914 values for the rest of the file. If you want to typeset different pieces
1915 from one file (for example, if there are multiple movements, or if
1916 you're making an exercise book), you can put different @code{\score}
1917 blocks into the input file. ly2dvi will assemble all LilyPond output
1918 files into a big document. The contents of \header blocks specified
1919 within each score, are used for the titling of each movement.
1920 @separate
1921 @example
1922         opus = "Opus 1."
1923         piece = "Up" @}
1924 @end example
1925 For example, the Opus number is put at the right, and the piece string
1926 will be at the left.
1927
1928
1929
1930 @node A piano excerpt
1931 @section A piano excerpt
1932
1933 Our fourth subject is a piece of piano music.  The fragment in the
1934 input file is a piano reduction of the G major Sinfonia by Giovanni
1935 Battista Sammartini.  It was composed around 1740.  It's in the source
1936 package under the name @file{sammartini.ly}.
1937
1938 @lilypondfile[verbatim]{sammartini.ly}
1939
1940 As you can see, this example features multiple voices on one staff.  To
1941 make room for those voices, their notes have to be stemmed in opposite
1942 directions.
1943
1944 LilyPond includes the identifiers @code{\stemUp}, @code{\stemDown} along
1945 with some other commonly used formatting instructions, but to explain how
1946 it works, we wrote our own here.  Of course, you should use predefined
1947 identifiers like these if possible: then you will be affected less by
1948 the implementation changes we occasionally make.
1949
1950 @separate
1951 @example 
1952 viola = \notes \relative c'  \context Voice = viola @{ 
1953 @end example 
1954 In this example, you can see multiple parts on a staff.  Each part is
1955 associated with one notation context.  This notation context handles
1956 stems and dynamics (among others).  The type name of this context is
1957 @code{Voice}.  For each part we have to make sure that there is
1958 precisely one @code{Voice} context, so we give it a unique name
1959 (`@code{viola}').
1960
1961 @separate
1962 @example 
1963 <c4-\arpeggio g' c>
1964 @end example 
1965 The delimiters @code{<} and @code{>} are shorthands for
1966 @code{\simultaneous @{} and @code{@}}. The expression enclosed in
1967 @code{<} and @code{>} is a chord.
1968
1969 @cindex arpeggio
1970
1971 @code{\arpeggio} typesets an arpeggio sign (a wavy vertical line) before
1972 the chord.
1973
1974 @separate
1975 @example 
1976    \voiceTwo
1977 @end example 
1978
1979 We want the viola to have stems down, and have all the other
1980 characteristics of a second voice. This is enforced using the
1981 @code{\voiceTwo} command:  it inserts instructions that makes stem,
1982 ties, slurs, etc. go down.
1983
1984
1985
1986 @separate
1987 @example 
1988         g'8. b,16 
1989 @end example 
1990 Relative octaves work a little differently with chords.  The starting
1991 point for the note following a chord is the first note of the chord.  So
1992 the @code{g} gets an octave up quote: it is a fifth above the starting
1993 note of the previous chord (the central C).
1994
1995 @separate
1996 @example 
1997 s1 s2. r4 
1998 @end example 
1999 @code{s} is a spacer rest.  It does not print anything, but it does have
2000 the duration of a rest. It is useful for filling up voices that
2001 temporarily don't play. In this case, the viola doesn't come until one
2002 and a half measure later.
2003
2004 @separate
2005 @example 
2006 oboes = \notes \relative c'' \context Voice = oboe @{ 
2007 @end example 
2008 Now comes a part for two oboes.  They play homophonically, so we
2009 print the notes as one voice that makes chords. Again, we insure that
2010 these notes are indeed processed by precisely one context with
2011 @code{\context}.
2012 @separate
2013 @example 
2014 \voiceOne s4  g8. b,16 c8 r <e'8. g> <f16 a> 
2015 @end example
2016
2017 The oboes should have stems up, so they should have stems up, to keep
2018 them from interfering with the staff-jumping bass figure.
2019
2020 @separate
2021 @example 
2022 \grace <e8( g> < d4 )f> <c2 e> 
2023 @end example
2024 @cindex @code{\grace}
2025 @cindex ornaments
2026 @cindex grace notes
2027 @code{\grace} introduces grace notes.  It takes one argument, in this
2028 case a chord. A slur is introduced starting from the @code{\grace}
2029 ending on the following chord.
2030
2031 @separate
2032 @example 
2033 \times 2/3 
2034 @end example
2035 @cindex tuplet
2036 @cindex triplets
2037 Tuplets are made with the @code{\times} keyword.  It takes two
2038 arguments: a fraction and a piece of music.  The duration of the piece
2039 of music is multiplied by the fraction.  Triplets make notes occupy 2/3
2040 of their notated duration, so in this case the fraction is 2/3.
2041 @separate
2042 @example 
2043 @{ <d8 f> <e g> <f a> @} 
2044 @end example 
2045 The piece of music to be `tripletted' is sequential music containing
2046 three chords.
2047
2048 @separate
2049 @example 
2050
2051 @end example 
2052 At this point, the homophonic music splits into two rhythmically
2053 different parts.  We can't use a sequence of chords to enter this, so
2054 we make a `chord' of sequences to do it.  We start with the upper
2055 voice, which continues with upward stems:
2056 @separate
2057 @example 
2058  @{ \times 2/3 @{ a8 g c @} c2 @} 
2059 @end example
2060
2061 @separate
2062 @example
2063 \\
2064 @end example
2065 The easiest way to enter multiple voices is demonstrated
2066 here. Separate the components of the voice (single notes or entire
2067 sequences) with @code{\\} in a simultaneous music expression. The
2068 @code{\\} separators split first voice, second voice, third voice, and
2069 so on.
2070
2071 As far as relative mode is concerned, the previous note is the
2072 @code{c'''2} of the upper voice, so we have to go an octave down for
2073 the @code{f}.
2074 @separate
2075 @example 
2076
2077   f,8 e e2
2078 @} > 
2079 @end example 
2080 This ends the two-part section.
2081 @separate
2082 @example 
2083 \stemBoth
2084 \grace <c,8( e> <)b8. d8.-\trill> <c16 e> |  
2085 @end example
2086 @cindex trill
2087 @cindex stemBoth
2088
2089 @code{\stemBoth} ends the forced stem directions. From here, stems are
2090 positioned as if it were single part music.
2091
2092 The bass has a little hoom-pah melody to demonstrate parts switching
2093 between staves.  Since it is repetitive, we use repeats:
2094 @separate
2095 @example 
2096 hoomPah  =  \repeat unfold 8
2097 @end example
2098 @cindex unfolded @code{\repeat}
2099 The unfolded repeat prints the notes in its argument as if they were
2100 written out in full eight times.
2101 @separate
2102 @example
2103 \notes \transpose c' @{
2104 @end example
2105 @cindex transposing
2106 @cindex relative mode and transposing
2107
2108 Transposing can be done with @code{\transpose}, which takes two arguments.
2109 The first specifies what central C should be transposed to.  The second
2110 is the to-be-transposed music.  As you can see, in this case, the
2111 transposition has no effect, as central C stays at central C.
2112
2113 The purpose of this no-op is to protect it from being interpreted as
2114 relative notes.  Relative mode can not be used together with
2115 transposition, so @code{\relative} will leave the contents of
2116 @code{\hoomPah} alone.  We can use it without having to worry about
2117 getting the motive in a wrong octave.
2118 @separate
2119 @cindex staff switch, manual
2120 @cindex cross staff voice, manual
2121 @cindex @code{\translator}
2122
2123 @example
2124         \translator Staff = down
2125         \stemUp
2126         c8
2127         \translator Staff = up
2128         \stemDown
2129         c'8 @}
2130 @end example
2131 Voices can switch between staves. Here you see two staff switching
2132 commands. The first one moves to the lower staff, the second one to
2133 the lower one. If you set stem directions explicitly (using the
2134 identifiers @code{\stemUp} and @code{\stemDown}. 
2135
2136 @separate
2137 @example 
2138 bassvoices = \notes \relative c' @{
2139 c4 g8. b,16
2140 \autochange Staff \hoomPah \context Voice
2141 @end example
2142
2143 @separate
2144 @example
2145         \translator Staff = down
2146 @end example
2147 @cindex staff switch
2148 @cindex cross staff voice
2149 We want the remaining part of this melody on the lower staff, so we do a
2150 manual staff switch here.
2151
2152
2153 @separate
2154 @example 
2155 \context Voice = reallyLow  @{\stemDown g2 ~ | g4 c8 @} > 
2156 @end example
2157 @cindex tie
2158 @cindex @code{~}
2159 After skipping some lines, we see @code{~}.  This mark makes ties.  Note
2160 that ties and slurs are different things.  A tie can only connect two
2161 note heads of the same pitch, whereas a slur can connect many chords
2162 with one curve.
2163
2164 @separate
2165 @example 
2166 \context PianoStaff 
2167 @end example 
2168  A special context is needed to get cross staff beaming right.  This
2169 context is called @code{PianoStaff}.
2170 @separate
2171 @example 
2172 \context Staff = bottom < \time 2/2 \clef bass 
2173 @end example 
2174 The bottom staff must have a different clef.
2175 @separate
2176 @example 
2177 indent = 0.0 
2178 @end example 
2179 To make some more room on the line, the first (in this case the only)
2180 line is not indented.  The line still looks very cramped, but that is due
2181 to the page layout of this document.
2182
2183
2184 @ignore
2185 [TODO:
2186
2187 * font-size, multi-stanza.
2188
2189 * Simple part combining in a Hymn
2190 @end ignore
2191
2192
2193 @node Fine tuning a piece
2194 @section  Fine tuning a piece
2195
2196 In this section, we show some ways to fine tune the final output of a
2197 piece. We do so using a single measure of a moderately complex piano
2198 piece: a Brahms intermezzo (opus 119, no. 1).
2199 @cindex Brahms, Johannes
2200
2201 The code for the untuned example shows us some new things.
2202
2203 @lilypondfile[verbatim]{brahms-original.ly}
2204
2205
2206 @cindex dynamics
2207 @cindex loudness
2208 @cindex forte
2209 @cindex crescendo
2210 @cindex @code{\<}
2211 @cindex @code{\!}
2212
2213 The crescendo is ended at the half note by the escaped exclamation
2214 mark @code{\!}.
2215
2216 Hairpin dynamics can be indicated using @code{\>} to start a
2217 decrescendo, and @code{\!} to end one. The crescendo is started using
2218 @code{\<} and also ended using @code{\!}. Absolute dynamics can be
2219 entered using @code{\p}, @code{\mf}, etc. All these commands apply to
2220 the complete chord where they are entered, but for syntactical
2221 reasons, they must be attached to one of the notes of  the chord.
2222
2223 @cindex fingering instructions
2224
2225 Fingering indications are entered simply using @code{-@var{N}}, where
2226 @var{N} is a digit.
2227
2228 Now that we have the basic piece of music entered, we want to fine
2229 tune it, so we get something that resembles the original printed
2230 edition by Schott/Universal Edition:
2231
2232 @lilypondfile{brahms-tweaked.ly}
2233
2234 @cindex tuning grob behavior
2235
2236 The basic process that we follow is that we override defaults in the
2237 printing system. We do this by setting variables in so-called grobs.
2238 Printed symbols are internally represented by Graphical Objects
2239 (Grobs).  Each grob is described by a bunch of settings. These setting
2240 determine the fonts, offsets, sub-routines to be called on the grob,
2241 etc.  The initial values of these settings are set in the Scheme file
2242 @file{scm/grob-description.scm}.
2243
2244 @cindex slur attachments
2245
2246 We start with the slur: the slur in the upper part, running from the F
2247 sharp to the A, runs from stem to stem in the printed edition, while
2248 ours starts from the note head at the left. The following property
2249 setting forces all slurs to run from stem to stem (and not from or to
2250 note head)
2251
2252 @example
2253   \property Voice.Slur \set #'attachment = #'(stem . stem)
2254 @end example
2255
2256 More precisely, this command extends the definition of the @code{Slur}
2257 object in the current @code{Voice}.  The variable @code{attachment} is
2258 set to the pair of symbols @code{'(stem . stem)}. 
2259
2260 Although this is useful information, it is not very helpful: the
2261 lilypond backend supports approximately 240 variables like
2262 @code{attachment}, each with their own meaning and own type
2263 (eg. number, symbol, list, etc). Besides slur, LilyPond has 80
2264 different types of Grobs, that may be created in 14 different context
2265 types besides Voice.
2266
2267 @cindex internal documentation
2268 @cindex finding grobs
2269 @cindex grob descriptiosn 
2270
2271 The interesting information is how you can figure out which properties
2272 to tune for your own scores. To discover this, you must have a copy of
2273 the internals document. This is a set of HTML pages, which should be
2274 included if you run a binary distribution@footnote{You can also
2275 compile them by executing @code{make -C Documentation/user/
2276 out/lilypond-internals.html} in the source package.}. This document is
2277 also available on the web: go to the lilypond website, click
2278 ``Documentation: other'' on the side bar, click
2279 ``lilypond-internals'', under information for users.
2280
2281 You might want to bookmark either the HTML files on disk, or the one
2282 on the web. One word of caution is in place here: the internals
2283 documentation is generated from the definitions that lily uses. For
2284 that reason, it is strongly tied to the version of LilyPond that you
2285 use. Before you proceed, please make sure that you are using the
2286 documentation that corresponds to the LilyPond version that you use.
2287
2288 Suppose that you wanted to tune the behavior of the slur. The first
2289 step is to get some general info on slurs in lilypond. Turn to the
2290 index, and look up slur. The section on slurs says
2291 @quotation
2292 The grob for this object is @internalsref{Slur}, generally in
2293 @internalsref{Voice} context.
2294 @end quotation
2295
2296 So the grob for this object is called @code{Slur}, and slurs are
2297 created in the @code{Voice} context.  If you are reading this tutorial
2298 in the HTML version, then you can simply click Slur, otherwise, you
2299 must look it up the internal documentation: click ``grob overview'' ,
2300 and select ``slur'' (the list is alphabetical.)
2301
2302 Now you get a list of all the properties that the slur object
2303 supports, along with their default values. Among the properties we
2304 find the @code{attachment} property, leading to 
2305 @example 
2306  \property Voice.Slur \set #'attachment = #'(stem . stem)
2307 @end example
2308
2309 If you ran the previous example, you have unknowingly already used
2310 this kind of command.  The @file{ly/property-init.ly} contains the
2311 definition of @code{\stemUp}
2312 @example
2313   stemUp = \property Voice.Stem \set #'direction = #1
2314 @end example  
2315
2316
2317 We also want to move around the fingering `3'.  In the printed edition
2318 it is not above the stem, but a little lower, slightly left of the
2319 stem. From the user manual, we find that the associated grob is called
2320 @code{Fingering}, but how do we know if we should use @code{Voice} or
2321 @code{Staff}. In many cases, @code{Voice} is a safe bet, but you can
2322 also deduce this information from the internals documentation: if you
2323 visit the documentation of @code{Fingering}, you will notice
2324 @example
2325 Fingering grobs are created by: Fingering_engraver
2326 @end example
2327
2328
2329
2330 Clicking @code{Fingering_engraver} will show you the documentation of
2331 the module responsible for interpreting the fingering instructions and
2332 translating them to a @code{Fingering} grob. Such a module is called
2333 an @emph{engraver}. The documentation of the @code{Fingering_engraver}
2334 says,
2335 @example
2336 Fingering_engraver is part of contexts: Voice and TabVoice
2337 @end example
2338 so tuning the settings for Fingering should be done using either
2339 @example
2340   \property Voice.Fingering \set @dots{}
2341 @end example
2342 or
2343 @example
2344   \property TabVoice.Fingering \set @dots{}
2345 @end example
2346
2347 Since the @code{TabVoice} is only used for tab notation, we see that
2348 the first guess @code{Voice} was indeed correct.
2349
2350 @cindex setting grob properties
2351 @cindex @code{extra-offset}
2352
2353 For shifting the fingering, we use the grob property
2354 @code{extra-offset}.  The following command manually adds an offset to
2355 the object. We move it a little to the left, and 1.8 staff space
2356 downwards.
2357 @example
2358  \property Voice.Fingering \set #'extra-offset = #'(-0.3 . -1.8) 
2359 @end example       
2360 The @code{extra-offset} is a low-level feature: it moves around
2361 objects in the printout; the formatting engine is completely oblivious
2362 to these offsets.
2363
2364 @cindex reverting grob properties
2365 @cindex undoing grob properties
2366
2367 We only want to offset a single grob, so after the F-sharp, we must
2368 undo the setting. The technical term is to revert the grob property.
2369 @example
2370   \property Voice.Fingering \revert #'extra-offset
2371 @end example
2372
2373 @cindex property types
2374 @cindex translator properties
2375 @cindex grob properties
2376 @cindex music properties
2377
2378
2379 There is three different types of variables in LilyPond, something
2380 which is confusing at first (and for some, it stays like that).
2381 Variables such as @code{extra-offset} and @code{attachment} are called
2382 grob properties. They are something different from the translator
2383 properties, like @code{autoBeaming} and
2384 @code{automaticMelismata}. Finally, music expressions are internally
2385 also stored using properties, so-called music properties. You will
2386 encounter the latter type if you run Scheme functions on music using
2387 @code{\apply}.
2388
2389 The second fingering instruction should be moved up a little, to avoid
2390 a collision with the slur. This could be achieved with
2391 @code{extra-offset}, but in this case, a simpler mechanism also
2392 works. We insert an empty text between the 5 and the note. The empty
2393 text pushes the fingering instruction away:
2394 @example
2395   a^" "^#'(finger "5")
2396 @end example
2397
2398 Lilypond tries to put fingering instructions closer to the notes as
2399 text instructions. To insert an empty text (@code{^" "}) between the
2400 finger and the note, we have disguised the fingering instruction as a
2401 text: @code{(finger "5")}.
2402
2403 Normally, one would specify dynamics in a single voice, and start and
2404 end dynamics (such as @b{f} and @b{p}) will be aligned with
2405 hairpins. In this case, we want the decrescendo to be in a different
2406 place from the piano sign. We achieve this by putting the dynamic
2407 markings in different voices. The crescendo should be above the upper
2408 staff. This can be forced by the precooked command 
2409 @example
2410   \dynamicsUp
2411 @end example
2412
2413 However, if you do that, the decrescendo will be too close to the
2414 upper voice, and collide with the stems. Looking at the manual for
2415 dynamics, we notice that ``Vertical positioning of these symbols is
2416 handled by the @internalsref{DynamicLineSpanner} grob.''. If we turn
2417 to the documentation of @code{DynamicLineSpanner}, we find that the
2418 @code{DynamicLineSpanner} supports several so-called
2419 `interfaces'. This grob not only puts dynamic objects next to the
2420 staff (@code{side-position-interface}), but it also groups dynamic
2421 objects (@code{axis-group-interface}), is considered a dynamic sign
2422 itself (@code{dynamic-interface}) and is a grob: it has the
2423 @code{grob-interface}, with all the variables that come with it.
2424
2425 For the moment, we are interested in the side positioning:
2426 @quotation
2427  side-position-interface
2428
2429   Position a victim object (this one) next to other objects (the
2430   support).  In this case, the direction signifies where to put the
2431   victim object relative to the support (left or right, up or down?)
2432 @end quotation
2433 Between the grob and its support (in this case: the notes in the voice
2434 going down), there should be more space. This space is controlled by
2435 @code{padding}, so we increase it.
2436 @example
2437             \property Voice.DynamicLineSpanner \override #'padding = #5.0
2438 @end example
2439
2440 This command is almost like the command for setting slur attachments,
2441 but subtly different in its details.  Grob properties can be
2442 manipulated with two commands: @code{\override} extends the grob
2443 variables with a setting, and @code{\revert} releases this
2444 setting. This has a certain theoretical appeal: the operations are
2445 simple and symmetric. For practical use, it can be cumbersome.  Both
2446 commands act like parentheses: you should carefully balance the use of
2447 @code{\override} and @code{\revert}. The @code{\set} command is more
2448 friendly: it first does a @code{\revert} followed by @code{\override}.
2449
2450 Finally, Brahms uses music notation is a slightly unorthodox way. Ties
2451 usually happen only within one voice. In this piece, the composer
2452 gladly produces ties that jump voices. We deal with this by faking
2453 these ties: whenever we need such a tie, we insert a notehead in a
2454 different voice, and blank the stem. This is done in the following
2455 snippet of code.
2456
2457 @example
2458           \property Voice.Stem \set #'transparent = ##t
2459           d'
2460           \property Voice.Stem \revert #'transparent
2461 @end example
2462
2463 Finally, the last tie is forced up using @code{\tieUp}.
2464
2465
2466 @node An orchestral score
2467 @section An orchestral score
2468
2469 @menu
2470 * The full score::              
2471 * Extracting an individual part::  
2472 @end menu
2473
2474
2475 Our last two examples show a way to setup the music for an orchestral
2476 score.  When typesetting a piece for several instruments, you'll want to
2477 create a conductor's full score, alongside several individual parts.
2478
2479 LilyPond is well suited for this task.  We will declare the music for
2480 each instrument individually, giving the music of each instrument its
2481 own name.  These pieces of music are then combined in different
2482 @code{\score} blocks to produce different combinations of the score.
2483
2484 This orchestral score example consists of three input files.  In the
2485 first file, @file{os-music.ly}, we define the music for all instruments.
2486 This file will be used both for producing the score and the separate
2487 parts.
2488
2489 If you were to run LilyPond on this file, no printable output would be
2490 produced.
2491
2492 @example
2493 % os-music.ly
2494 \header @{
2495   title = "Zo, goed lieverd?"
2496   subtitle = "How's, this babe?"
2497   composer = "JCN"
2498   opus = "1"
2499   piece = "Laid back"
2500 @}
2501 global = @{
2502   \time 2/4
2503   \skip 2*4 \bar "|."
2504 @}
2505 Key = \notes \key as \major
2506 flautoI = \notes\relative c'' @{
2507   f8 g f g f g f g
2508   bes as bes as bes as bes as
2509 @}
2510 flautoII = \notes\relative c'' @{
2511   as8 bes as bes R1 d4 ~ d
2512 @}
2513 tromboI = \notes\relative c'' @{
2514   c4. c8 c8 c4. es4 r as, r
2515 @}
2516 tromboII = \notes\relative c'' @{
2517   as4. as8 as8 as4. R1*1/2 as4 es'
2518 @}
2519 timpani = \notes\relative c, @{
2520   \times 2/3 @{ f4 f f @}
2521   \times 4/5 @{ as8 as as as as @}
2522   R1
2523 @}
2524 corno = \notes\relative c' @{
2525    bes4 d f, bes d f, bes d
2526 @}
2527 @end example
2528
2529 We will not go through the input line by line, but only indicate and
2530 explain the new elements.
2531
2532
2533 @separate
2534 @example
2535 global = @{
2536   \time 2/4
2537   \skip 2*4 \bar "|.";
2538 @}
2539 @end example
2540
2541 Declare setting to be used globally.  The @code{\skip} command produces
2542 no output, but moves forward in time: in this case, the duration of a
2543 half note (@code{2}), and that four times (@code{*4}).  This brings us
2544 to the end of the piece, and we can set the end bar.
2545
2546 @separate
2547 @example
2548 Key = \notes \key as \major
2549 @end example
2550 Declare the key signature of the piece and assign it to the identifier
2551 @var{Key}.  Later on, we'll use @code{\Key} for all staves except those
2552 for transposing instruments.
2553
2554 @node The full score
2555 @subsection The full score
2556
2557
2558 The second file, @file{os-score.ly} reads the definitions of the first
2559 (@file{os-music.ly}), and defines the @code{\score} block for the full
2560 conductor's score.
2561
2562
2563 @example
2564 % os-score.ly
2565 \include "os-music.ly"
2566 \include "paper13.ly"
2567
2568 #(set! point-and-click line-column-location)
2569 #(define text-flat '((font-relative-size . -2)
2570          (music "accidentals--1")))
2571
2572 \score @{
2573   <
2574     \global
2575     \property Score.BarNumber \override #'padding = #3
2576     \context StaffGroup = woodwind <
2577       \context Staff = flauti <
2578         \property Staff.midiInstrument = #"flute"
2579         \property Staff.instrument = "2 Flauti"
2580         \property Staff.instr = "Fl."
2581         \Key
2582         \context Voice=one @{ \voiceOne \flautoI @}
2583         \context Voice=two @{ \voiceTwo \flautoII @}
2584       >
2585     >
2586     \context StaffGroup = timpani <
2587       \context Staff = timpani <
2588         \property Staff.midiInstrument = #"timpani"
2589         \property Staff.instrument = #'(lines "Timpani" "(C-G)")
2590         \property Staff.instr = #"Timp."
2591         \clef bass
2592         \Key
2593         \timpani
2594       >
2595     >
2596     \context StaffGroup = brass <
2597       \context Staff = trombe <
2598         \property Staff.midiInstrument = #"trumpet"
2599         \property Staff.instrument = #`(lines "2 Trombe" "(C)")
2600         \property Staff.instr = #`(lines "Tbe." "(C)")
2601         \Key
2602         \context Voice=one \partcombine Voice
2603           \context Thread=one \tromboI
2604           \context Thread=two \tromboII
2605       >
2606       \context Staff = corni <
2607         \property Staff.midiInstrument = #"french horn"
2608         \property Staff.instrument = #`(lines "Corno"
2609           (columns "(E" ,text-flat ")"))
2610         \property Staff.instr = #`(lines "Cor."
2611           (columns "(E" ,text-flat ")"))
2612         \property Staff.transposing = #3
2613         \notes \key bes \major
2614         \context Voice=one \corno
2615       >
2616     >
2617   >
2618   \paper @{
2619     indent = 15 * \staffspace
2620     linewidth = 60 * \staffspace
2621     textheight = 90 * \staffspace
2622     \translator@{
2623       \HaraKiriStaffContext
2624     @}
2625   @}
2626   \midi @{
2627     \tempo 4 = 75
2628   @}
2629 @}
2630 @end example
2631
2632 @center @strong{Zo, goed lieverd?}
2633 @sp 1
2634 @center How's, this babe?
2635 @flushright
2636 Opus 1.
2637 @end flushright
2638 @flushleft
2639 @sc{Laid back}
2640 @end flushleft
2641
2642 @lilypondfile{os-score.ly}
2643
2644 @separate
2645 @example
2646 \include "os-music.ly"
2647 @end example
2648 First, we need to include the music definitions we made in
2649 @file{os-music.ly}.
2650
2651 @separate
2652 @example
2653 #(set! point-and-click line-column-location)
2654 @end example
2655 In a large orchestral score like this you're bound to make some small
2656 mistakes, so we enable point and click (See @ref{Point and click})
2657 editing.
2658
2659 @separate
2660 @example
2661 #(define text-flat '((font-relative-size . -2)
2662          (music "accidentals--1")))
2663 @end example
2664
2665 When naming the tuning of the french horn, we'll need a piece of text
2666 with a flat sign.  LilyPond has a mechanism for font selection and
2667 kerning called Scheme markup text (See @ref{Text markup}).  The flat
2668 sign is taken from the music font, and its name is @code{accidentals--1}
2669 (The natural sign is called @code{accidentals-0}).  The default font is
2670 too big for text, so we select a relative size of @code{-2}.
2671
2672 @separate
2673 @example
2674   <
2675     \global
2676 @end example
2677 Of course, all staves are simultaneous and use the same global settings.
2678
2679 @separate
2680 @example
2681     \property Score.BarNumber \override #'padding = #3
2682 @end example
2683 LilyPond prints bar numbers at the start of each line, but
2684 unfortunately, they end up a bit too close to the staff in this
2685 example.  A bar number internally is a Grob called @var{BarNumber}.
2686 BarNumber Grobs can be manipulated through their
2687 @var{side-position-interface}.  One of the properties of a
2688 @var{side-position-interface} that can be tweaked is the
2689 @var{padding}: the amount of extra space that is put between this Grob
2690 and other Grobs.  We set the padding to three staff spaces.
2691
2692 You can find information on all these kind of properties in LilyPond's
2693 automatically generated documentation in
2694 @ifnottex
2695 @ref{ (lilypond-internals)lilypond-internals, LilyPond Internals}.
2696 @end ifnottex
2697 @iftex
2698 the online documentation.
2699 @end iftex
2700
2701 @separate
2702 @example
2703     \context StaffGroup = woodwind <
2704       \context Staff = flauti <
2705 @end example
2706 A new notation context: the @code{StaffGroup}.  @code{StaffGroup} can
2707 hold one or more @code{Staff}'s, and will print a big bracket at the
2708 left of the score.  Start a new staff group for the woodwind section
2709 (just the flutes in this case).  Immediately after that, we start the
2710 staff for the two flutes, that also play simultaneously.
2711
2712 @separate
2713 @example
2714         \property Staff.midiInstrument = #"flute"
2715 @end example
2716 Specify the instrument for MIDI output (see @ref{MIDI instrument
2717 names}).
2718
2719 @separate
2720 @example
2721         \property Staff.instrument = "2 Flauti"
2722         \property Staff.instr = "Fl."
2723 @end example
2724 And define the instrument names to be printed in the margin,
2725 @code{instrument} for the first line of the score, @code{instr} for the
2726 rest of the score.
2727
2728 @separate
2729 @example
2730         \Key
2731 @end example
2732 The flutes play in the default key.
2733
2734 @separate
2735 @example
2736         \context Voice=one @{ \voiceOne \flautoI @}
2737         \context Voice=two @{ \voiceTwo \flautoII @}
2738 @end example
2739 Last come the actual flute parts.  Remember that we're still in
2740 simultaneous mode.  We name both voices differently, so that LilyPond
2741 will actually create two Voice contexts.  The flute parts are simple, so
2742 we specify manually which voice is which: @code{\voiceOne} forces the
2743 direction of stems, beams, slurs and ties up, @code{\voiceTwo} sets
2744 directions down.
2745
2746 @separate
2747 @example
2748       >
2749     >
2750 @end example
2751 Close the flutes staff and woodwind staff group.
2752
2753 @separate
2754 @example
2755         \property Staff.instrument = #'(lines "Timpani" "(C-G)")
2756 @end example
2757 The timpani staff only shows a new piece of scheme markup, it sets two
2758 lines of text.
2759
2760 @separate
2761 @example
2762         \context Voice=one \partcombine Voice
2763           \context Thread=one \tromboI
2764           \context Thread=two \tromboII
2765 @end example
2766 You have seen the notation contexts Staff and Voice, but here's a new
2767 one: Thread.  One or more Threads can be part of a Voice.  The Thread
2768 takes care of note heads and rests, the Voice combine note heads onto a
2769 stem.
2770
2771 For the trumpets we use the automatic part combiner (see @ref{Automatic
2772 part combining}) to combine the two simultaneous trumpet parts onto the
2773 trumpet staff.  Each trumpet gets its own Thread context, which must be
2774 named @code{one} and @code{two}).  The part combiner makes these two
2775 threads share a Voice when they're similar, and splits the threads up
2776 when they're different.
2777
2778 @separate
2779 @example
2780         \property Staff.instrument = #`(lines "Corno"
2781           (columns "(E" ,text-flat ")"))
2782 @end example
2783 The french horn has the most complex scheme markup name, made up of two
2784 lines of text.  The second line has three elements (columns), the @code{(E},
2785 the flat sign @code{text-flat} that we defined before and a final @code{")"}.
2786 Note that we use a backquote instead of an ordinary quote at the
2787 beginning of the Scheme expression to be able to access the
2788 @code{text-flat} identifier, `unquoting' it with a @code{,}.
2789
2790 @separate
2791 @example
2792         \property Staff.transposing = #3
2793 @end example
2794 The french horn is to be tuned in E-flat, so we tell the MIDI backend to
2795 transpose this staff by three steps.
2796
2797 Note how we can choose different tuning for entering, printing and
2798 playing, using @code{\transpose} and the MIDI Staff property
2799 @var{transposing}.
2800
2801 @separate
2802 @example
2803         \notes \key bes \major
2804 @end example
2805 Therefore, it has a different key.
2806
2807 @separate
2808 @example
2809     indent = 15 * \staffspace
2810     linewidth = 60 * \staffspace
2811 @end example
2812 We specify a big indent for the first line and a small linewidth for this
2813 tutorial.
2814
2815 @separate
2816
2817 Usually, LilyPond's predefined setup of notation contexts (Thread,
2818 Voice, Staff, Staffgroup, Score) is just fine.  But in this case, we
2819 want a different type of Staff context.
2820
2821 @example
2822     \translator@{
2823       \HaraKiriStaffContext
2824     @}
2825 @end example
2826
2827 In orchestral scores, it often happens that one instrument has only
2828 rests during one line of the score.  The @code{HaraKiriStaffContext} can
2829 be used as a regular @code{StaffContext} drop-in and will take care of
2830 the automatic removing of empty staves.
2831
2832 @node Extracting an individual part
2833 @subsection Extracting an individual part
2834
2835 The third file, @file{os-flute-2.ly} also reads the definitions of the
2836 first (@file{os-music.ly}), and defines the @code{\score} block for the
2837 second flute part.
2838
2839 @example
2840 \include "os-music.ly"
2841 \include "paper16.ly"
2842
2843 \score @{
2844   \context Staff <
2845     \property Score.skipBars = ##t
2846     \property Staff.midiInstrument = #"flute"
2847     \global
2848     \Key
2849     \flautoII
2850   >
2851   \header @{
2852     instrument = "Flauto II"
2853   @}
2854   \paper @{
2855     linewidth = 80 * \staffspace
2856     textheight = 200 * \staffspace
2857   @}
2858   \midi @{
2859     \tempo 4 = 75
2860   @}
2861 @}
2862 @end example
2863
2864 @center @strong{Zo, goed lieverd?}
2865 @sp 1
2866 @center How's, this babe?
2867 @center @emph{Flauto II}
2868 @flushright
2869 Opus 1.
2870 @end flushright
2871 @flushleft
2872 @sc{Laid back}
2873 @end flushleft
2874 @lilypondfile{os-flute-2.ly}
2875
2876
2877 Because we separated the music definitions from the @code{\score}
2878 instantiations, we can easily define a second score with the music of
2879 the second flute.  This then is the part for the second flute player.
2880 Of course, we make separate parts for all individual instruments.
2881
2882 @separate
2883 @example
2884     \flautoII
2885 @end example
2886 In this individual part the second flute has a whole staff for itself,
2887 so we don't want to force stem or tie directions.
2888
2889 @separate
2890 @example
2891   \header @{
2892     instrument = "Flauto II"
2893   @}
2894 @end example
2895 The @code{\header} definitions were also read from @file{os-music.ly},
2896 but we need to set the instrument for this particular score.
2897
2898 @separate
2899 @example
2900     \property Score.skipBars = ##t
2901 @end example
2902 In the conductor's full score, all bars with rests are printed, but for
2903 the individual parts, we want to contract pieces of consecutive empty
2904 bars.  LilyPond will do this if Score's @var{skipBars} property to
2905 true. 
2906
2907
2908 @node Integrating text and music
2909 @section Integrating text and music
2910
2911 Sometimes, you might want to use music examples in a text that you are
2912 writing. For example, if you are writing a musicological treatise, a
2913 songbook, or (like us) the LilyPond manual.  You can make such texts by
2914 hand, simply by importing a PostScript figure into your wordprocessor.
2915 However, there is a also an automated procedure:
2916
2917 If you use HTML, La@TeX{} or texinfo, you can mix text and LilyPond
2918 code. A script called @code{lilypond-book} will extract the music
2919 fragments, run LilyPond on them, and put back the resulting notation.
2920 This utility program is described fully in the chapter @ref{Merging text
2921 and music with lilypond-book}. Here we show a small example. Since the
2922 example also contains explanatory text, we won't comment on the
2923 contents.
2924
2925 @example
2926 \documentclass[a4paper]@{article@}
2927 \begin@{document@}
2928
2929 In a lilypond-book document, you can freely mix music and text. For
2930 example:
2931 \begin@{lilypond@}
2932   \score @{ \notes \relative c' @{
2933      c2 g'2 \times 2/3 @{ f8 e d @} c'2 g4
2934   @} @}
2935 \end@{lilypond@}
2936 Notice that the music line length matches the margin settings of the
2937 document.
2938
2939 If you have no \verb+\score+ block in the fragment,
2940 \texttt@{lilypond-book@} will supply one:
2941
2942 \begin@{lilypond@}
2943   c'4
2944 \end@{lilypond@}
2945
2946 In the example you see here, a number of things happened: a
2947 \verb+\score+ block was added, and the line width was set to natural
2948 length. You can specify many more options using  \LaTeX style options
2949 in brackets:
2950
2951 \begin[verbatim,11pt,singleline,
2952   fragment,relative,intertext="hi there!"]@{lilypond@}
2953   c'4 f bes es
2954 \end@{lilypond@}
2955
2956 \texttt@{verbatim@} also shows the LilyPond code, \texttt@{11pt@} selects
2957 the default music size, \texttt@{fragment@} adds a score block,
2958 \texttt@{relative@} uses relative mode for the fragment, and
2959 \texttt@{intertext@} specifies what to print between the
2960 \texttt@{verbatim@} code and the music.
2961
2962 If you include large examples into the text, it may be more convenient
2963 to put the example in a separate file:
2964
2965 \lilypondfile[printfilename]@{sammartini.ly@}
2966
2967 The \texttt@{printfilename@} option adds the file name to the output.
2968
2969 \end@{document@}
2970 @end example
2971
2972 Under Unix, you can view the results as follows.
2973 @example
2974 $ cd input/tutorial
2975 $ lilypond-book --outdir=out/ lilbook.tex
2976 lilypond-book (GNU LilyPond) 1.3.146
2977 Reading `input/tutorial/lilbook.tex'
2978 Reading `input/tutorial/sammartini.ly'
2979 @var{lots of stuff deleted}
2980 Writing `out/lilbook.latex'
2981 $ cd out
2982 $ latex lilbook.latex
2983 @var{lots of stuff deleted}
2984 $ xdvi lilbook 
2985 @end example
2986
2987 Notice the @code{outdir} option to lilypond-book. Running lilypond-book
2988 and running latex creates a lot of temporary files, and you wouldn't want
2989 those to clutter up your working directory. Hence, we have them created
2990 in a separate subdirectory.
2991
2992 The result more or less looks like this: 
2993
2994 @separate
2995
2996 In a lilypond-book document, you can freely mix music and text. For
2997 example:
2998 @lilypond
2999   \score { \notes \relative c' {
3000      c2 g'2 \times 2/3 { f8 e d } c'2 g4
3001   } }
3002 @end lilypond
3003 Notice that the music line length matches the margin settings of the
3004 document.
3005
3006 If you have no @code{\score} block in the fragment,
3007 @code{lilypond-book} will supply one:
3008
3009 @lilypond
3010   c'4
3011 @end lilypond
3012
3013 In the example you see here, a number of things happened: a
3014 @code{\score} block was added, and the line width was set to natural
3015 length. You can specify many more options using  La@TeX{} style options
3016 in brackets:
3017
3018 @lilypond[verbatim,11pt,singleline,
3019   fragment,relative,intertext="hi there!"]
3020   c'4 f bes es
3021 @end lilypond
3022
3023 @code{verbatim} also shows the LilyPond code, @code{11pt} selects
3024 the default music size, @code{fragment} adds a score block,
3025 @code{relative} uses relative mode for the fragment, and
3026 @code{intertext} specifies what to print between the
3027 @code{verbatim} code and the music.
3028
3029 If you include large examples into the text, it may be more convenient
3030 to put the example in a separate file:
3031
3032 @lilypondfile[printfilename]{sammartini.ly}
3033
3034 The @code{printfilename} option adds the file name to the output.
3035 @node  End of tutorial
3036 @section End of tutorial
3037          
3038 That's all folks.  From here, you can either try fiddling with input
3039 files, or you can read the reference manual.  You can find more example
3040 files in @file{input} and @file{input/test}.  You can also look at some
3041 real music.  The website @uref{http://www.mutopiaproject.org} has many
3042 examples of real music typeset by LilyPond.
3043
3044
3045
3046 @ignore
3047
3048 [TODO
3049
3050 this should be on mutopia website.
3051
3052 ]
3053
3054
3055 @c waar deze info?  is uiteindelijk wel handig, schat ik.
3056 [TODO: cut blabla]
3057
3058 If you have a big music project, or just a lot of LilyPond input files,
3059 all generated output from LilyPond, @TeX{} and metafont will clutter
3060 your working directory.  LilyPond comes with a one-size-fits-all
3061 pre-cooked makefile that helps you manage producing output.  It will
3062 produce all output in the directory @file{out} , generate and track
3063 dependencies. Also, it helps in preparing your submission to @ref{Mutopia
3064 project}.
3065
3066 @file{make/ly.make}
3067 @example
3068 mkdir my-project
3069 cd my-project
3070 cp /usr/share/lilypond/make/ly.make GNUmakefile
3071 cp /usr/share/doc/lilypond/examples/input/tutorial/minuet.ly .
3072 make minuet
3073 [..]
3074 Generated out/minuet.ps for target minuet.
3075 @end example
3076
3077 Type @samp{make help} to see possible targets.
3078
3079 [TODO]
3080 @file{/usr/share/lilypond/doc/lilypond/examples/input/mutopia-header.ly}
3081
3082
3083
3084
3085
3086 [TODO: rewrite completely.]
3087
3088 @menu
3089 * Songs with additional verses::  
3090 @end menu
3091
3092 @end ignore
3093