]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/tutorial.itely
Tutorial update seven; reorg tutorial into sections.
[lilypond.git] / Documentation / user / tutorial.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
9
10 @ignore
11 Tutorial guidelines:
12 - unless you have a really good reason, use either
13     @l ilypond[quote,ragged-right,verbatim]
14   or
15     @l ilypond[quote,ragged-right,verbatim,fragment,relative=2]
16   (without spaces)
17   Don't use any other relative=X commands (make it a non-fragment
18   example), and don't use fragment without relative=2.
19 - use "aes" and "ees" instead of "as" and "aes".  I know it's not
20   correct Dutch naming, but let's not confuse people with this until
21   we get to the Basic notation chapter.
22 @end ignore
23
24
25
26 @c   old info that will probably be removed.
27 @c TODO:
28 @c   * more details about running lilypond; error messages,
29 @c     compiling/viewing (emacs?)
30 @c   * where to go from First steps+More basics?
31
32 @c  wherever possible, do not include index entries here; the
33 @c  index should point to stuff in the reference manual.  -gp
34
35 @c Your first LilyPond score in 10 minutes?
36
37 @node Tutorial
38 @chapter Tutorial
39
40 This tutorial starts with an introduction to the LilyPond music
41 language and how to produce printed music.  After this first contact we
42 will explain how to create common musical notation.
43
44 @ifhtml
45 Many people learn programs by trying and fiddling around with the
46 program.  This is also possible with LilyPond.  If you click on a
47 picture in the HTML version of this manual, you will see the exact
48 LilyPond input that was used to generate that image.
49 Try it on this image
50
51 @lilypond[fragment,quote,ragged-right,relative=2]
52 c-\markup { \bold \huge { Click here.  } }
53 @end lilypond
54
55 By cutting and pasting everything from the @qq{Start cut-&-pastable-section}
56 to the end of the file, you have a
57 starting template for experiments.  If you like learning in this way,
58 you will probably want to print out or bookmark the
59 @ref{Cheat sheet}, which is a table listing of the most common
60 commands for quick reference.
61 @end ifhtml
62
63 @menu
64 * First steps::                 
65 * Notation for one note at once FIXME name::  
66 * Multiple notes at once::      
67 * Songs::                       
68 * Unsorted::                    
69 @end menu
70
71
72 @node First steps
73 @section First steps
74
75 This section gives a basic introduction to working with LilyPond.
76
77 @menu
78 * Compiling a file::            
79 * Simple notation::             
80 * Working on text files::       
81 * How to read the tutorial::    
82 @end menu
83
84
85 @node Compiling a file
86 @subsection Compiling a file
87
88 The first example demonstrates how to start working with LilyPond.  To
89 create sheet music, we write a text file that specifies the
90 notation.  For example, if we write
91
92 @example
93 @{
94   c' e' g' e'
95 @}
96 @end example
97
98 @noindent
99 the result looks like this
100
101 @lilypond[quote,ragged-right]
102 {
103   c' e' g' e'
104 }
105 @end lilypond
106
107 @strong{Warning:} Every piece of LilyPond input needs to have @strong{@{ curly
108 braces @}} placed around the input.  The braces should be also be
109 surrounded by a space unless they are at the beginning or end of a
110 line to avoid ambiguities.  These may be omitted in some examples in this
111 manual, but don't forget them in your own music!
112
113 @cindex Case sensitive
114 In addition, LilyPond input is @strong{case sensitive}.  @code{ @{ c d e @} }
115 is valid input; @code{ @{ C D E @} } will produce an error message.
116
117 @sp 1
118
119 @subheading Entering music and viewing output
120
121 In this section we will explain what commands to run
122 and how to view or print the output.
123
124 @subsubheading MacOS X
125
126 If you double click LilyPond.app, it will open with an example
127 file. Save it, for example, to @file{test.ly} on your Desktop, and
128 then process it with the menu command @samp{Compile > Typeset File}.
129 The resulting PDF file will be displayed on your screen.
130
131 Be warned that the first time you ever run lilypond will take a minute
132 or two because all of the system fonts have to be analyzed first.
133
134 For future use of LilyPond, you should begin by selecting "New"
135 or "Open".
136
137 @subsubheading Windows
138
139 On Windows, start up a text-editor@footnote{Any simple or
140 programmer-oriented editor with UTF-8 support will do, for example
141 Notepad.  Do not use a word processor, since these insert formatting
142 codes that will confuse LilyPond.} and enter
143
144 @verbatim
145 {
146   c' e' g' e'
147 }
148 @end verbatim
149
150 Save it on the desktop as @file{test.ly} and make sure that it is not
151 called @file{test.ly.TXT}.  Double clicking @file{test.ly} will process
152 the file and show the resulting PDF file.
153
154
155 @subsubheading Unix
156
157 Begin by opening a terminal window and starting a text editor.  For
158 example, you could open an xterm and execute
159 @code{joe}@footnote{There are macro files for VIM addicts, and there
160 is a @code{LilyPond-mode} for Emacs addicts.  If they have not been
161 installed already, refer to the file @file{INSTALL.txt}.  These
162 easiest editing environment is @file{LilyPondTool}.  See
163 @ref{Editor support} for more information.}.  In your
164 text editor, enter the following input and save the file as
165 @file{test.ly}
166
167 @verbatim
168 {
169   c' e' g' e'
170 }
171 @end verbatim
172
173 @noindent
174 To process @file{test.ly}, proceed as follows
175
176 @example
177 lilypond test.ly
178 @end example
179
180 @noindent
181 You will see something resembling
182
183 @example
184 lilypond test.ly
185 GNU LilyPond 2.10.0
186 Processing `test.ly'
187 Parsing...
188 Interpreting music... [1]
189 Preprocessing graphical objects...
190 Calculating line breaks... [2]
191 Layout output to `test.ps'...
192 Converting to `test.pdf'...
193 @end example
194
195 @cindex PDF file
196 @cindex Viewing music
197
198 @noindent
199 The result is the file @file{test.pdf} which you can print or view
200 with the standard facilities of your operating system.@footnote{If
201 your system does not have any tools installed, you can try
202 @uref{http://@/www@/.cs@/.wisc@/.edu/@/~ghost/,Ghostscript}, a freely
203 available package for viewing and printing PDF and PostScript files.}
204
205
206 @node Simple notation
207 @subsection Simple notation
208
209 LilyPond will add some notation elements automatically.  In the next
210 example, we have only specified four pitches, but LilyPond has
211 added a clef, time signature, and rhythms.
212
213 @lilypond[quote,ragged-right,verbatim]
214 {
215   c' e' g' e'
216 }
217 @end lilypond
218
219 @noindent
220 This behavior may be altered, but in most cases these automatic values
221 are useful.
222
223
224 @subheading Pitches
225
226 The easiest way to enter notes is by using @code{\relative} mode.  In
227 this mode, the @rglos{interval} between the previous note and the
228 current note is assumed to be within a @rglos{fourth}.  We begin by
229 entering the most elementary piece of music, a @rglos{scale}.
230
231 @lilypond[quote,ragged-right,verbatim]
232 \relative c' {
233   c d e f
234   g a b c
235 }
236 @end lilypond
237
238 The initial note is @rglos{middle C}.  Each successive note
239 is within a fourth of the previous note -- in other words, the first
240 @samp{c} is the closest C to middle C.  This is followed by the closest
241 D to the previous note.  We can create melodies which have larger intervals:
242
243 @lilypond[quote,ragged-right,verbatim]
244 \relative c' {
245   d f a g
246   c b f d
247 }
248 @end lilypond
249
250 @noindent
251 As you may notice, this example does not start on middle C.  The first
252 note -- the @samp{d} -- is the closest D to middle C.
253
254 To add intervals that are larger than a fourth, we can raise the octave
255 by adding a single quote @code{'} (or apostrophe) to the note name.  We can
256 lower the octave by adding a comma @code{,} to the note name.
257
258 @lilypond[quote,ragged-right,verbatim]
259 \relative c'' {
260   a a, c' f,
261   g g'' a,, f'
262 }
263 @end lilypond
264
265 @noindent
266 To change a note by two (or more!) octaves, we use multiple @code{''} or
267 @code{,,} -- but be careful that you use two single quotes @code{''} and
268 not one double quote @code{"}@tie{}!  The initial value in
269 @code{\relative c'} may also be modified like this.
270
271
272 @subheading Durations (rhythms)
273
274 The @rglos{duration} of a note is specified by a number after the note
275 name.  @samp{1} for a @rglos{whole note}, @samp{2} for a @rglos{half note},
276 @samp{4} for a @rglos{quarter note} and so on.  Beams are added
277 automatically.
278
279 @lilypond[quote,ragged-right,verbatim]
280 \relative c'' {
281   a1
282   a2 a4 a8 a
283   a16 a a a a32 a a a a64 a a a a a a a a2
284 }
285 @end lilypond
286
287 @noindent
288 If you do not specify a duration, the previous duration is used
289 for the next note.  The duration of the first note defaults to a quarter.
290
291 To create @rglos{dotted notes}, add a dot @samp{.} to the duration number.
292
293 @lilypond[quote,ragged-right,verbatim]
294 \relative c'' {
295   a a a4. a8
296   a8. a16 a a8. a8 a4.
297 }
298 @end lilypond
299
300
301 @subheading Rests
302
303 A @rglos{rest} is entered just like a note with the name @samp{r}:
304
305 @lilypond[quote,ragged-right,verbatim]
306 \relative c'' {
307   a r r2
308   r8 a r4 r4. r8
309 }
310 @end lilypond
311
312
313 @subheading Time signature
314
315 The @rglos{time signature}) can be set with the @code{\time} command:
316
317 @lilypond[quote,ragged-right,verbatim]
318 \relative c'' {
319   \time 3/4
320   a4 a a
321   \time 6/8
322   a4. a
323   \time 4/4
324   a4 a a a
325 }
326 @end lilypond
327
328
329 @subheading Clef
330
331 The @rglos{clef} can be set using the @code{\clef} command:
332
333 @lilypond[quote,ragged-right,verbatim]
334 \relative c' {
335   \clef treble
336   c1
337   \clef alto
338         c1
339   \clef tenor
340   c1
341   \clef bass
342   c1
343 }
344 @end lilypond
345
346
347 @subheading All together
348
349 Here is a small example showing all these elements together:
350
351 @lilypond[quote,ragged-right,verbatim]
352 \relative c, {
353   \time 3/4
354   \clef bass
355   c2 e8 c' g'2.
356   f4 e d c4 c, r4
357 }
358 @end lilypond
359
360 @moreinfo
361 @quotation
362 @table @asis
363 @item Entering pitches and durations
364 see @ref{Pitches} and @ref{Durations}.
365 @item Rests
366 see @ref{Rests}.
367 @item Time signatures and other timing commands
368 see @ref{Time signature}.
369 @item Clefs
370 see @ref{Clef}.
371 @end table
372 @end quotation
373
374
375 @node Working on text files
376 @subsection Working on text files
377
378 LilyPond input files are treated like files in most programming languages:
379 they are case sensitive, white-space insensitive, expressions are
380 formed with curly braces @{ @}, and comments are denoted with @code{%} or
381 @code{%@{ .. %@}}.
382
383 If the previous sentence sounds like nonsense, don't worry!  We'll explain
384 what all these terms mean:
385
386 @itemize
387
388 @cindex Case sensitive
389 @item @strong{Case sensitive}:
390 it matters whether you enter a letter
391 in lower case (i.e. @code{a, b, s, t}) or upper case (i.e.
392 @code{A, B, S, T}).  Notes are lower case: @code{ @{ c d e @} }
393 is valid input; @code{ @{ C D E @} } will produce an error message.
394
395 @item @strong{Whitespace insensitive}:
396 it does not matter how many
397 spaces (or new lines) you add.  @code{ @{ c d e @}} means the same thing
398 as @code{ @{ c @ @ @ @ @  d e @} } and
399 @example
400           @{
401 c                        d
402   e @}
403 @end example
404
405 @noindent
406 Of course, the previous example is hard to read.  A good rule of thumb
407 is to indent code blocks with either a tab or two spaces:
408 @example
409 @{
410   c d e
411 @}
412 @end example
413
414 @item @strong{Expressions:}
415 Every piece of LilyPond input needs to have
416 @strong{@{ curly braces @}} placed around the input.  These braces tell
417 LilyPond that the input is a single music expression, just like
418 parenthesis @samp{()} in mathematics.  The braces should
419 be surrounded by a space unless they are at the beginning or end of a
420 line to avoid ambiguities.
421
422 A function (such as @code{\relative @{ @}} ) also counts as a single
423 music expression.
424
425 @cindex comments
426 @cindex line comment
427 @cindex block comment
428 @item @strong{Comments}:
429 A comment is a remark for the human reader of the music input; it is
430 ignored while parsing, so it has no effect on the printed output.
431 There are two types of comments.  The percent symbol @samp{%}
432 introduces a line comment; anything after @samp{%} on that line is
433 ignored.  A block comment marks a whole section of music
434 input as a comment.  Anything that is enclosed in @code{%@{} and @code{%@}} is
435 ignored.  The following fragment shows possible uses for comments
436
437 @example
438 % notes for twinkle twinkle follow
439   c4 c g' g a a g2
440
441 %@{
442     This line, and the notes below
443     are ignored, since they are in a
444     block comment.
445
446     g g f f e e d d c2
447 %@}
448 @end example
449
450 @end itemize
451
452 There are more tips for constructing input files in
453 @ref{Suggestions for writing LilyPond files}.
454
455
456 @node How to read the tutorial
457 @subsection How to read the tutorial
458
459 As we saw in @ref{Working on text files}, LilyPond input must be
460 surrounded by @{ @} marks or a @code{\relative c'' @{ ... @}}.  For the
461 rest of this manual, most examples will omit this.
462
463 If you are reading the HTML documentation and wish to see the exact
464 exact LilyPond code that was used to create the example, simply click
465 on the picture.  If you are not reading the HTML version, you could
466 copy and paste the displayed input, but you @strong{must} add the
467 @code{\relative c'' @{ @}} like this:
468
469 @example
470 \relative c'' @{
471   ... example goes here...
472 @}
473 @end example
474
475 Why omit the braces?  Most examples
476 in this manual can be inserted into the middle of a longer piece of
477 music.  For these examples, it does not make sense to add
478 @code{\relative c'' @{ @}} -- you should not place a @code{\relative}
479 inside another @code{\relative}, so you would not be able to copy
480 a small documentation example and paste it inside a longer piece
481 of your own.
482
483
484 @node Notation for one note at once FIXME name
485 @section Notation for one note at once FIXME name
486
487 This section introduces common notation that is used for a single
488 staff.
489
490 @menu
491 * Accidentals and key signatures::  
492 * Ties and slurs::              
493 * Articulation and dynamics::   
494 * Automatic and manual beams::  
495 * Advanced rhythmic commands::  
496 @end menu
497
498
499 @node Accidentals and key signatures
500 @subsection Accidentals and key signatures
501
502 @subheading Accidentals
503
504 A @rglos{sharp} pitch is made by adding @samp{is} to
505 the name, and a @rglos{flat} pitch by adding @samp{es}.  As
506 you might expect, a @rglos{double sharp} or @rglos{double flat} is
507 made by adding @samp{isis} or @samp{eses}@footnote{This syntax
508 derived from note naming conventions in Nordic and Germanic languages,
509 like German and Dutch.  To use other names for accidentals, see
510 @ref{Note names in other languages}.}
511
512 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
513 cis1 ees fisis, aeses
514 @end lilypond
515
516 @cindex key signature, setting
517 @subheading Key signatures
518
519 The key signature is set with the command @code{\key} followed by
520 a pitch and @code{\major} or @code{\minor}.
521
522 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
523 \key d \major
524 a1
525 \key c \minor
526 a
527 @end lilypond
528
529 @sp 1
530
531 @subheading Warning: key signatures and pitches
532
533 To determine whether to print an accidental, LilyPond examines the
534 pitches and the key signature.  The key signature only effects
535 the @emph{printed} accidentals, not the actual pitches!  This is a
536 feature that often causes confusion to newcomers, so let us explain it
537 in more detail.
538
539 LilyPond makes a sharp distinction between musical content and
540 layout.  The alteration (flat, natural or sharp) of a note is part of
541 the pitch, and is therefore musical content.  Whether an accidental (a
542 @emph{printed} flat, natural or sharp sign) is printed in front of the
543 corresponding note is a question of layout.  Layout is something that
544 follows rules, so accidentals are printed automatically according to
545 those rules.  The pitches in your music are works of art, so they will
546 not be added automatically, and you must enter what you want to hear.
547
548 In this example
549
550 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
551 \key d \major
552 d cis fis
553 @end lilypond
554
555 @noindent
556 No note has a printed accidental, but you must still add the @samp{is} to
557 @code{cis} and @code{fis}.
558
559 The code @samp{e} does not mean @qq{print a black dot just below the
560 first line of the staff.}  Rather, it means: @qq{there is a note with
561 pitch E-natural.}  In the key of A-flat major, it @emph{does} get an
562 accidental:
563
564 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
565 \key aes \major
566 e
567 @end lilypond
568
569 Adding all alterations explicitly might require a little more effort
570 when typing, but the advantage is that transposing is easier, and
571 accidentals can be printed according to different conventions.  See
572 @ref{Automatic accidentals} for some examples how accidentals can be printed
573 according to different rules.
574
575 @moreinfo
576 @quotation
577 @table @asis
578 @item Accidentals
579 see @ref{Accidentals} and @ref{Automatic accidentals}.
580 @item Key signature
581 see @ref{Key signature}.
582 @end table
583 @end quotation
584
585
586 @node Ties and slurs
587 @subsection Ties and slurs
588
589 @cindex ties
590 @subheading Ties
591 A @rglos{tie} is created by appending a tilde @samp{~} to the first
592 note being tied
593
594 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
595 g4~ g c2~
596 c4 ~ c8 a8 ~ a2
597 @end lilypond
598
599 @cindex slurs
600 @subheading Slurs
601
602 A @rglos{slur} is a curve drawn across many notes.  The starting note
603 and ending note are marked with @samp{(} and @samp{)} respectively.
604
605 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
606 d4( c16) cis( d e c cis d) e( d4)
607 @end lilypond
608
609 @cindex slurs, phrasing
610 @cindex phrasing slurs
611 @subheading Phrasing slurs
612
613 @cindex phrasing slurs
614 Slurs to indicate longer phrasing can be entered with @code{\(} and
615 @code{\)}.  You can have both legato slurs and phrasing slurs at the
616 same time, but you cannot have simultaneous slurs or simultaneous
617 phrasing slurs.
618
619 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
620 a8(\( ais b c) cis2 b'2 a4 cis,\)
621 @end lilypond
622
623 @sp 1
624
625 @cindex slurs versus ties
626 @subheading Warnings: slurs vs. ties
627
628 A slur looks like a @rglos{tie}, but it has a different meaning.  A
629 tie simply makes the first note longer, and can only be used on
630 pairs of notes with the same pitch.  Slurs indicate the articulations
631 of notes, and can be used on larger groups of notes.  Slurs and ties
632 can be nested.
633
634 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
635 c2~( c8 fis fis4 ~ fis2 g2)
636 @end lilypond
637
638 @moreinfo
639 @quotation
640 @table @asis
641 @item Ties
642 see @ref{Ties}.
643 @item Slurs
644 see @ref{Slurs}.
645 @item Phrasing slurs
646 see @ref{Phrasing slurs}.
647 @end table
648 @end quotation
649
650
651 @node Articulation and dynamics
652 @subsection Articulation and dynamics
653
654 @cindex articulation
655 @cindex accents
656 @cindex staccato
657 @subheading Articulations
658
659 @c  FIXME: change to @rglos once the term is added  (articulations)
660 Common articulations can be added to a note using a dash (@samp{-}) and a
661 single character:
662
663 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
664 c-. c-- c-> c-^ c-+ c-_
665 @end lilypond
666
667 @cindex fingering
668 @subheading Fingerings
669 Similarly, fingering indications can be added to a note using a dash
670 (@samp{-}) and the digit to be printed:
671
672 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
673 c-3 e-5 b-2 a-1
674 @end lilypond
675
676 Articulations and fingerings are usually placed automatically, but you
677 can specify a direction using @samp{^} (up) or @samp{_} (down).  You can
678 also use multiple articulations on the same note.  However, in most cases
679 it is best to let LilyPond determine the articulation directions.
680
681 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
682 c_-^1 d^. f^4_2-> e^-_+
683 @end lilypond
684
685 @subheading Dynamics
686 Dynamic signs are made by adding the markings (with a backslash) to
687 the note
688
689 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
690 c\ff c\mf c\p c\pp
691 @end lilypond
692
693 @cindex dynamics
694 @cindex decrescendo
695 @cindex crescendo
696
697 Crescendi and decrescendi are started with the commands @code{\<} and
698 @code{\>}.  An ending dynamic, for example @code{\f}, will finish the
699 (de)crescendo, or the command @code{\!} can be used
700
701 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
702 c2\< c2\ff\> c2 c2\!
703 @end lilypond
704
705 @moreinfo
706 @quotation
707 @table @asis
708 @item Articulations
709 see @ref{Articulations}.
710 @item Fingering
711 see @ref{Fingering instructions}.
712 @item Dynamics
713 see @ref{Dynamics}.
714 @end table
715 @end quotation
716
717
718 @node Automatic and manual beams
719 @subsection Automatic and manual beams
720
721 @cindex beams, by hand
722 All @rglos{beam}s are drawn automatically:
723
724 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
725 a8 ais d ees r d c16 b a8
726 @end lilypond
727
728 @noindent
729 If you do not like the automatic beams, they may be overridden
730 manually.  Mark the first note to be beamed with @samp{[} and the last one
731 with @samp{]}.
732
733 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
734 a8[ ais] d[ ees r d] a b
735 @end lilypond
736
737 @moreinfo
738 @quotation
739 @table @asis
740 @item Automatic beams
741 see @ref{Automatic beams}.
742 @item Manual beams
743 see @ref{Manual beams}.
744 @end table
745 @end quotation
746
747
748 @node Advanced rhythmic commands
749 @subsection Advanced rhythmic commands
750
751 @cindex pickup
752 @cindex anacruse
753 @cindex partial measure
754 @subheading Partial measure
755
756 @c FIXME: glossary "anacrusis".
757 A pickup (or @q{anacrusis}) is entered with the keyword @code{\partial}.  It
758 is followed by a duration: @code{\partial 4} is a quarter note pickup
759 and @code{\partial 8} an eighth note.
760
761 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
762 \partial 8
763 f8 c2 d
764 @end lilypond
765
766 @cindex tuplets
767 @cindex triplets
768 @subheading Tuplets
769
770 Tuplets are made with the @code{\times} keyword.  It takes two
771 arguments: a fraction and a piece of music.  The duration of the piece
772 of music is multiplied by the fraction.  Triplets make notes occupy
773 2/3 of their notated duration, so a triplet has 2/3 as its fraction
774
775 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
776 \times 2/3 { f8 g a }
777 \times 2/3 { c r c }
778 \times 2/3 { f,8 g16 a g a }
779 \times 2/3 { d4 a8 }
780 @end lilypond
781
782 @cindex grace notes
783 @cindex acciaccatura
784 @cindex appoggiatura
785 @subheading Grace notes
786
787 Grace notes are created with the @code{\grace} command, although they
788 can also be created by prefixing a music expression with the
789 keyword @code{\appoggiatura} or @code{\acciaccatura}
790
791 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
792 c2 \grace { a32 b} c2
793 c2 \appoggiatura b16 c2
794 c2 \acciaccatura b16 c2
795 @end lilypond
796
797 @moreinfo
798 @quotation
799 @table @asis
800 @item Grace notes
801 see @ref{Grace notes},
802 @item Tuplets
803 see @ref{Tuplets},
804 @item Pickups
805 see @ref{Partial measures}.
806 @end table
807 @end quotation
808
809
810 @node Multiple notes at once
811 @section Multiple notes at once
812
813 This section introduces having more than one note at the same time:
814 multiple instruments, multiple staves for a single instrument (i.e. piano),
815 and chords.
816
817 Polyphony in music refers to having more than one voice occurring in
818 a piece of music.  Polyphony in LilyPond refers to having more than
819 one voice on the same staff.
820
821 @menu
822 * Music expressions explained::  
823 * Multiple staves::             
824 * Piano staves::                
825 * Single staff polyphony::      
826 * Combining notes into chords::  
827 @end menu
828
829
830 @node Music expressions explained
831 @subsection Music expressions explained
832
833 In LilyPond input files, music is represented by @emph{music
834 expressions}.  A single note is a music expression, although it is not
835 valid input all on its own.
836
837 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
838 a4
839 @end lilypond
840
841 Enclosing a group of notes in braces creates a new music expression:
842
843 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
844 { a4 g4 }
845 @end lilypond
846
847 Putting a group of music expressions (e.g. notes) in braces means that
848 are in sequence (i.e. each one follows the previous one).  The result
849 is another music expression:
850
851 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
852 { { a4 g } f g }
853 @end lilypond
854
855 @subheading Simultaneous music expressions: multiple staves
856
857 This technique is useful for polyphonic music.  To enter music
858 with more voices or more staves, we combine expressions in
859 parallel.  To indicate that two voices should play at the same time
860 simple enter a simultaneous combination of music expressions.  A
861 @q{simultaneous} music expression is formed by enclosing expressions inside
862 @code{<<} and @code{>>}.  In the following example, three sequences (all
863 containing two separate notes) are combined simultaneously:
864
865 @lilypond[quote,ragged-right,verbatim]
866 \relative c'' {
867   <<
868     { a4 g }
869     { f e }
870     { d b }
871   >>
872 }
873 @end lilypond
874
875 Note that we have indented each level of the input with a different
876 amount of space.  LilyPond does not care how much (or little) space there
877 is at the beginning of a line, but indenting LilyPond code like this makes
878 it much easier for humans to read.
879
880 @subheading Simultaneous music expressions: single staff
881
882 To determine the number of staves in a piece, LilyPond looks at the first
883 exression.  If it is a single note, there is one staff; if there is a
884 simultaneous expression, there is more than one staff.
885
886 @lilypond[quote,ragged-right,verbatim]
887 \relative c'' {
888   c2 <<c e>>
889   << { e f } { c <<b d>> } >>
890 }
891 @end lilypond
892
893 @cindex expression
894 @cindex music expression
895 @subheading Analogy: mathematical expressions
896
897 This mechanism is similar to mathematical
898 formulas: a big formula is created by composing small formulas.  Such
899 formulas are called expressions, and their definition is recursive so
900 you can make arbitrarily complex and large expressions.  For example,
901
902 @example
903 1
904
905 1 + 2
906
907 (1 + 2) * 3
908
909 ((1 + 2) * 3) / (4 * 5)
910 @end example
911
912 This is a sequence of expressions, where each expression is contained
913 in the next (larger) one.  The simplest expressions are numbers, and larger
914 ones are made by combining expressions with operators (like @samp{+},
915 @samp{*} and @samp{/}) and parentheses.  Like mathematical expressions,
916 music expressions can be nested arbitrarily deep, which is necessary
917 for complex music like polyphonic scores.
918
919
920 @node Multiple staves
921 @subsection Multiple staves
922
923 As we saw in @ref{Music expressions explained}, LilyPond input files
924 are constructed out of music expressions.  If the score begins with
925 simultaneous music expressions, LilyPond creates multiples staves.  However,
926 it is easier to see what happens if we create each staff explicitly.
927
928 To print more than one staff, each piece of music that makes up a
929 staff is marked by adding @code{\new Staff} before it.  These
930 @code{Staff} elements are then combined in parallel with @code{<<} and
931 @code{>>}:
932
933 @lilypond[quote,ragged-right,verbatim]
934 \relative c'' {
935   <<
936     \new Staff { \clef treble c }
937     \new Staff { \clef bass c,, }
938   >>
939 }
940 @end lilypond
941
942 The command @code{\new} introduces a @q{notation context.}  A notation
943 context is an environment in which musical events (like notes or
944 @code{\clef} commands) are interpreted.  For simple pieces, such
945 notation contexts are created automatically.  For more complex pieces, it
946 is best to mark contexts explicitly.
947
948 There are several types of contexts.  @code{Score}, @code{Staff},
949 and @code{Voice} handle melodic notation, while @code{Lyrics} sets lyric
950 texts and @code{ChordNames} prints chord names.
951
952 In terms of syntax, prepending @code{\new} to a music expression
953 creates a bigger music expression.  In this way it resembles the minus
954 sign in mathematics.  The formula @math{(4+5)} is an expression, so
955 @math{-(4+5)} is a bigger expression.
956
957
958 @node Piano staves
959 @subsection Piano staves
960
961 @cindex staff switch, manual
962 @cindex cross staff voice, manual
963 Piano music is typeset in two staves connected by a brace.  Printing
964 such a staff is similar to the polyphonic example in @ref{Multiple staves},
965 but now this entire expression is inserted inside a @code{PianoStaff}:
966
967 @example
968 \new PianoStaff <<
969   \new Staff @dots{}
970   \new Staff @dots{}
971 >>
972 @end example
973
974 Here is a small example
975
976 @lilypond[quote,ragged-right,verbatim]
977 \relative c'' {
978   \new PianoStaff <<
979     \new Staff { \time 2/4 c4 e g g, }
980     \new Staff { \clef bass c,, c' e c }
981   >>
982 }
983 @end lilypond
984
985 @moreinfo
986 See @ref{Piano music}.
987
988
989 @node Single staff polyphony
990 @subsection Single staff polyphony
991
992 @cindex polyphony
993 @cindex multiple voices
994 @cindex voices, more -- on a staff
995 When different melodic lines are combined on a single staff they are
996 printed as polyphonic voices; each voice has its own stems, slurs and
997 beams, and the top voice has the stems up, while the bottom voice has
998 them down.
999
1000 Entering such parts is done by entering each voice as a sequence (with
1001 @code{@{...@}}) and combining these simultaneously, separating the
1002 voices with @code{\\}
1003
1004 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
1005 <<
1006   { a4 g2 f4~ f4 } \\
1007   { r4 g4 f2 f4 }
1008 >>
1009 @end lilypond
1010
1011 For polyphonic music typesetting, spacer rests can also be convenient;
1012 these are rests that do not print.  They are useful for filling up
1013 voices that temporarily do not play.  Here is the same example with a
1014 spacer rest (@samp{s}) instead of a normal rest (@samp{r}),
1015
1016 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
1017 <<
1018   { a4 g2 f4~ f4 } \\
1019   { s4 g4 f2 f4 }
1020 >>
1021 @end lilypond
1022
1023 @noindent
1024 Again, these expressions can be nested arbitrarily.
1025
1026 @lilypond[quote,fragment,verbatim,relative=2,fragment]
1027 <<
1028   \new Staff <<
1029     { a4 g2 f4~ f4 } \\
1030     { s4 g4 f2 f4 }
1031   >>
1032   \new Staff <<
1033     \clef bass
1034     { <c g>1 ~ <c g>4 } \\
1035     { e,,4 d e2 ~ e4}
1036   >>
1037 >>
1038 @end lilypond
1039
1040 @moreinfo
1041 See @ref{Basic polyphony}.
1042
1043
1044 @node Combining notes into chords
1045 @subsection Combining notes into chords
1046
1047 @cindex chords
1048 Chords can be made by surrounding pitches with single angle brackets.  Angle
1049 brackets are the symbols @samp{<} and @samp{>}.
1050
1051 @lilypond[quote,fragment,verbatim,relative=2,fragment]
1052 r4 <c e g>4 <c f a>2
1053 @end lilypond
1054
1055 You can combine markings like beams and ties with chords.  They must
1056 be placed outside the angled brackets
1057
1058 @lilypond[quote,fragment,verbatim,relative=2,fragment]
1059 r4 <c e g>8[ <c f a>]~ <c f a>2
1060 @end lilypond
1061
1062 @lilypond[quote,fragment,verbatim,relative=2,fragment]
1063 r4 <c e g>8\>( <c e g> <c e g>4 <c f a>\!)
1064 @end lilypond
1065
1066
1067 @node Songs
1068 @section Songs
1069
1070 This section introduces vocal music and simple song sheets.
1071
1072 @menu
1073 * Printing lyrics::             
1074 * A lead sheet::                
1075 @end menu
1076
1077 @c zz
1078
1079 @node Printing lyrics
1080 @subsection Printing lyrics
1081 @cindex lyrics
1082
1083 @c TODO: (c) status of the Queen fragment.
1084
1085 @cindex Lyrics
1086 @cindex Songs
1087 Lyrics are entered by separating each syllable with a space
1088
1089 @example
1090 I want to break free
1091 @end example
1092
1093 Consider the melody
1094
1095 @lilypond[quote,verbatim,fragment,ragged-right]
1096 \relative {
1097   r4 c \times 2/3 { f g g }
1098   \times 2/3 { g4( a2) }
1099 }
1100 @end lilypond
1101
1102 The lyrics can be set to these notes, combining both with the
1103 @code{\addlyrics} keyword
1104
1105 @lilypond[quote,verbatim,fragment,ragged-right]
1106 <<
1107   \relative {
1108     r4 c \times 2/3 { f g g }
1109     \times 2/3 { g4( a2) }
1110   }
1111   \addlyrics { I want to break free }
1112 >>
1113 @end lilypond
1114
1115 @cindex melisma
1116 @cindex extender line
1117 @c synonyms?
1118 This melody ends on a @rglos{melisma}, a single syllable (@q{free})
1119 sung to more than one note.  This is indicated with an @emph{extender
1120 line}.  It is entered as two underscores, i.e.,
1121
1122 @example
1123 @{ I want to break free __ @}
1124 @end example
1125
1126 @lilypond[fragment,quote,ragged-right]
1127 <<
1128   \relative {
1129     r4 c \times 2/3 { f g g }
1130     \times 2/3 { g4( a2) }
1131   }
1132   \addlyrics { I want to break free __ }
1133 >>
1134 @end lilypond
1135
1136 Similarly, hyphens between words can be entered as two dashes,
1137 resulting in a centered hyphen between two syllables
1138
1139 @example
1140 A -- le gri -- a
1141 @end example
1142
1143 @c no ragged-right here, because otherwise the hypens get lost.
1144 @lilypond[fragment,quote]
1145 <<
1146   \relative {
1147     \time 2/4
1148     f4 f c' c
1149   }
1150   \addlyrics { A -- le gri -- a }
1151 >>
1152 @end lilypond
1153
1154 More options, like putting multiple lines of lyrics below a melody are
1155 discussed in @ref{Vocal music}.
1156
1157
1158 @node A lead sheet
1159 @subsection A lead sheet
1160
1161 @cindex Lead sheets
1162 @cindex chords
1163 @cindex chord names
1164
1165 @c TODO: revise this, \chords { } is shorter and more intuitive.
1166
1167 In popular music, it is common to denote accompaniment with chord names.
1168 Such chords can be entered like notes,
1169
1170 @lilypond[quote,verbatim,ragged-right]
1171 \chordmode { c2 f4. g8 }
1172 @end lilypond
1173
1174 @noindent
1175 Now each pitch is read as the root of a chord instead of a note.
1176 This mode is switched on with @code{\chordmode}
1177
1178 Other chords can be created by adding modifiers after a colon.  The
1179 following example shows a few common modifiers
1180
1181 @lilypond[quote,verbatim,ragged-right]
1182 \chordmode { c2 f4:m g4:maj7 gis1:dim7 }
1183 @end lilypond
1184
1185 For lead sheets, chords are not printed on staves, but as names on a
1186 line for themselves.  This is achieved by using @code{\chords} instead
1187 of @code{\chordmode}.  This uses the same syntax as @code{\chordmode},
1188 but renders the notes in a @code{ChordNames} context, with the
1189 following result.
1190
1191 @lilypond[quote,verbatim,ragged-right]
1192 \chords { c2 f4.:m g4.:maj7 gis8:dim7 }
1193 @end lilypond
1194
1195 @cindex lead sheet
1196 When put together, chord names, lyrics and a melody form
1197 a lead sheet, for example,
1198
1199 @example
1200 <<
1201   \chords @{ @emph{chords} @}
1202   @emph{the melody}
1203   \addlyrics @{ @emph{the text} @}
1204 >>
1205 @}
1206 @end example
1207
1208 @lilypond[quote,ragged-right]
1209 <<
1210   \chords { r2 c:sus4 f }
1211   \relative {
1212     r4 c' \times 2/3 { f g g }
1213     \times 2/3 { g4( a2) }
1214   }
1215   \addlyrics { I want to break free __ }
1216 >>
1217 @end lilypond
1218
1219 A complete list of modifiers and other options for layout can be found
1220 in @ref{Chords}.
1221
1222
1223 @node Unsorted
1224 @section Unsorted
1225
1226 @menu
1227 * Adding titles::               
1228 * Organizing larger pieces::    
1229 * An orchestral part::          
1230 * After the tutorial::          
1231 * Octave entry::                
1232 @end menu
1233
1234 @node Adding titles
1235 @subsection Adding titles
1236
1237 Bibliographic information is entered in a separate block, the
1238 @code{\header} block.  The name of the piece, its composer, etc., are
1239 entered as an assignment, within @code{\header
1240 @{@tie{}@dots{}@tie{}@}}.  The @code{\header} block is usually put at
1241 the top of the file.  For example,
1242
1243 @example
1244 \header @{
1245   title = "Miniature"
1246   composer = "Igor Stravinsky"
1247 @}
1248
1249 @{ @dots{} @}
1250 @end example
1251
1252
1253 When the file is processed, the title and composer are printed above
1254 the music.  More information on titling can be found in @ref{Creating
1255 titles}.
1256
1257
1258
1259
1260 @node Organizing larger pieces
1261 @subsection Organizing larger pieces
1262
1263 When all of the elements discussed earlier are combined to produce
1264 larger files, the @code{\score} blocks get a lot bigger because the
1265 music expressions are longer, and, in the case of polyphonic music,
1266 more deeply nested.  Such large expressions can become unwieldy.
1267
1268 By using variables, also known as identifiers, it is possible to break
1269 up complex music expressions.  An identifier is assigned as follows
1270
1271 @example
1272 namedMusic = @{ @dots{} @}
1273 @end example
1274
1275 @noindent
1276 The contents of the music expression @code{namedMusic}, can be used
1277 later by preceding the name with a backslash, i.e., @code{\namedMusic}.
1278 In the next example, a two-note motive is repeated two times by using
1279 variable substitution
1280
1281 @lilypond[quote,ragged-right,verbatim,nofragment]
1282 seufzer = {
1283   e'4( dis'4)
1284 }
1285 { \seufzer \seufzer }
1286 @end lilypond
1287
1288 The name of an identifier should have alphabetic characters only: no
1289 numbers, underscores, or dashes.  The assignment should be outside of
1290 running music.
1291
1292 It is possible to use variables for many other types of objects in the
1293 input.  For example,
1294
1295 @example
1296 width = 4.5\cm
1297 name = "Wendy"
1298 aFivePaper = \paper @{ paperheight = 21.0 \cm @}
1299 @end example
1300
1301 Depending on its contents, the identifier can be used in different
1302 places.  The following example uses the above variables
1303
1304 @example
1305 \paper @{
1306   \aFivePaper
1307   line-width = \width
1308 @}
1309 @{ c4^\name @}
1310 @end example
1311
1312 More information on the possible uses of identifiers is given in the
1313 technical manual, in @ref{Input variables and Scheme}.
1314 @c fixme: the ref is too technical.
1315
1316
1317 @node An orchestral part
1318 @subsection An orchestral part
1319
1320 In orchestral music, all notes are printed twice.  Once in a part for
1321 the musicians, and once in a full score for the conductor.  Identifiers can
1322 be used to avoid double work.  The music is entered once, and stored in
1323 a variable.  The contents of that variable is then used to generate
1324 both the part and the full score.
1325
1326 It is convenient to define the notes in a special file.  For example,
1327 suppose that the file @file{horn-music.ly} contains the following part
1328 of a horn/@/bassoon duo
1329
1330 @example
1331 hornNotes = \relative c @{
1332   \time 2/4
1333   r4 f8 a cis4 f e d
1334 @}
1335 @end example
1336
1337 @noindent
1338 Then, an individual part is made by putting the following in a file
1339
1340 @example
1341 \include "horn-music.ly"
1342 \header @{
1343   instrument = "Horn in F"
1344 @}
1345
1346 @{
1347  \transpose f c' \hornNotes
1348 @}
1349 @end example
1350
1351 The line
1352
1353 @example
1354 \include "horn-music.ly"
1355 @end example
1356
1357 @noindent
1358 substitutes the contents of @file{horn-music.ly} at this position in
1359 the file, so @code{hornNotes} is defined afterwards.  The command
1360 @code{\transpose f@tie{}c'} indicates that the argument, being
1361 @code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
1362 @samp{f} is denoted by notated @code{c'}, which corresponds with the
1363 tuning of a normal French Horn in@tie{}F.  The transposition can be seen
1364 in the following output
1365
1366 @lilypond[quote,ragged-right]
1367 \transpose f c' \relative c {
1368   \time 2/4
1369   r4 f8 a cis4 f e d
1370 }
1371 @end lilypond
1372
1373 In ensemble pieces, one of the voices often does not play for many
1374 measures.  This is denoted by a special rest, the multi-measure
1375 rest.  It is entered with a capital @samp{R} followed by a duration
1376 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
1377 etc.).  By multiplying the
1378 duration, longer rests can be constructed.  For example, this rest
1379 takes 3@tie{}measures in 2/4 time
1380
1381 @example
1382 R2*3
1383 @end example
1384
1385 When printing the part, multi-rests
1386 must be condensed.  This is done by setting a run-time variable
1387
1388 @example
1389 \set Score.skipBars = ##t
1390 @end example
1391
1392 @noindent
1393 This command sets the property @code{skipBars} in the
1394 @code{Score} context to true (@code{##t}).  Prepending the rest and
1395 this option to the music above, leads to the following result
1396
1397 @lilypond[quote,ragged-right]
1398 \transpose f c' \relative c {
1399   \time 2/4
1400   \set Score.skipBars = ##t
1401   R2*3
1402   r4 f8 a cis4 f e d
1403 }
1404 @end lilypond
1405
1406
1407 The score is made by combining all of the music together.  Assuming
1408 that the other voice is in @code{bassoonNotes} in the file
1409 @file{bassoon-music.ly}, a score is made with
1410
1411 @example
1412 \include "bassoon-music.ly"
1413 \include "horn-music.ly"
1414
1415 <<
1416   \new Staff \hornNotes
1417   \new Staff \bassoonNotes
1418 >>
1419 @end example
1420
1421 @noindent
1422 leading to
1423
1424 @lilypond[quote,ragged-right]
1425 \relative c <<
1426   \new Staff {
1427     \time 2/4 R2*3
1428     r4 f8 a cis4 f e d
1429   }
1430   \new Staff {
1431     \clef bass
1432     r4 d,8 f | gis4 c | b bes |
1433     a8 e f4 | g d | gis f
1434   }
1435 >>
1436 @end lilypond
1437
1438 More in-depth information on preparing parts and scores can be found
1439 in the notation manual; see @ref{Orchestral music}.
1440
1441 Setting run-time variables (@q{properties}) is discussed in
1442 @ref{Changing context properties on the fly}.
1443
1444
1445 @node After the tutorial
1446 @subsection After the tutorial
1447
1448 After finishing the tutorial, you should probably try writing a
1449 piece or two.  Start with one of the @ref{Example templates} and
1450 add notes.  If you need any notation that was not covered in the
1451 tutorial, look at the Notation Reference, starting with
1452 @ref{Basic notation}.  If you want to write for an instrument
1453 ensemble which is not covered in the @ref{Example templates},
1454 take a look at @ref{Extending the templates}.
1455
1456 Once you have written a few short pieces, read the rest of
1457 the Learning Manual (chapters 3-5).  There's nothing wrong
1458 with reading them now, of course!  However, the rest of the
1459 Learning Manual assumes that you are familiar with
1460 LilyPond input.  You may wish to skim these chapters right
1461 now, and come back to them after you have more experience.
1462
1463
1464
1465
1466
1467 @node Octave entry
1468 @subsection Octave entry
1469
1470 @c Tim wants to move this quotes example just before the: quotes-do not-work
1471 @c score, but we'd need to remove quotes from the other two (key and
1472 @c tie) examples...
1473
1474 @c better to have this just before the `octaves are bad' snipped
1475 @c but we'd need to remove the ', from \key and tie
1476 To raise a note by an octave, add a high quote @samp{'} (apostrophe) to
1477 the note name, to lower a note one octave, add a @q{low quote} @samp{,}
1478 (comma).  Middle C is @code{c'}
1479
1480 @lilypond[quote,notime,fragment,verbatim]
1481 c'4 c'' c''' \clef bass c c,
1482 @end lilypond
1483
1484 An example of the use of quotes is in the following Mozart fragment
1485
1486 @lilypond[quote,ragged-right,fragment,verbatim]
1487 \key a \major
1488 \time 6/8
1489 cis''8. d''16 cis''8 e''4 e''8
1490 b'8. cis''16 b'8 d''4 d''8
1491 @end lilypond
1492
1493 @noindent
1494 This example shows that music in a high register needs lots of quotes.
1495 This makes the input less readable, and it is a source of errors.  The
1496 solution is to use @q{relative octave} mode.   This is the
1497 most convenient way to copy existing music.
1498
1499 In relative mode, a note without octavation quotes (i.e., the @samp{'}
1500 or @samp{,} after a note) is chosen so that it is closest to the
1501 previous one.  For example, @samp{c f} goes up while @samp{c g} goes
1502 down.
1503
1504 To use relative mode, add @code{\relative} before the piece of
1505 music.  The first note is taken relative to the middle C
1506 @c no , for this sentence
1507 (i.e., @code{c'})
1508
1509
1510
1511 @lilypond[quote,notime,fragment,verbatim]
1512 \relative {
1513   c' f c g c
1514 }
1515 @end lilypond
1516
1517
1518 Since most music has small intervals, pieces can be written almost
1519 without octavation quotes in relative mode.  The previous example is
1520 entered as
1521
1522 @lilypond[quote,ragged-right,verbatim]
1523 \relative {
1524   \key a \major
1525   \time 6/8
1526   cis'8. d16 cis8 e4 e8
1527   b8. cis16 b8 d4 d8
1528 }
1529 @end lilypond
1530
1531 @c needed better, maybe even redundant explanation
1532 @c   added another example below.
1533 @c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
1534 @c in eerste instantie drong het `relative' niet door zonder extra uitleg.
1535 Larger intervals are made by adding octavation quotes.
1536
1537 @lilypond[quote,notime,verbatim,fragment]
1538 \relative c {
1539   c'' f, f c' c g' c,
1540 }
1541 @end lilypond
1542
1543 In summary, quotes or commas no longer determine the absolute height
1544 of a note in @code{\relative} mode.  Rather, the height of a note is
1545 relative to the previous one, and changing the octave of a single note
1546 shifts all following notes an octave up or down.
1547
1548 For more information on relative octaves see @ref{Relative octaves},
1549 and @ref{Octave check}.
1550
1551 @c  TODO   post-2.6 reorg
1552 @c   This is good info, but I wouldn't call it a comment.  IMO it should
1553 @c   be moved somewhere else.
1554
1555 @cindex versioning
1556
1557 There is a special statement that is a kind of comment.  The @code{\version}
1558 statement marks for which version of LilyPond the file was written.
1559 To mark a file for version 2.10.1, use
1560
1561 @example
1562 \version "2.10.1"
1563 @end example
1564
1565 @noindent
1566 These annotations make future upgrades of LilyPond go more
1567 smoothly.  Changes in the syntax are handled with a special program,
1568 @file{convert-ly} (see @ref{Updating files with convert-ly}), and it uses
1569 @code{\version} to determine what rules to apply.
1570
1571