3 @c A menu is needed before every deeper *section nesting of @nodes
4 @c Run M-x texinfo-all-menus-update
5 @c to automagically fill in these menus
6 @c before saving changes
14 Rhythm staff (clef, x-notehead)
16 \addlyrics, \autochange, \partcombine: music (re)grouping
18 postscript, scheme output?
19 (links to?) using/existance of ly2dvi, lilypond-book
25 @node Reference Manual
26 @chapter Reference Manual
32 * Note specification::
49 describes the the GNU LilyPond input format This format represents a
50 piece of music in an elegant way, but contains enough information for
51 both automatic typesetting and automatic performances.
53 This document has been revised for LilyPond 1.3.125
57 There are two things to note here. The format contains musical
58 concepts like pitches and durations, instead of symbols and positions:
59 the input format tries to capture the meaning of @emph{music}, and not
60 notation. Second, the format tries to be @emph{context-free}:
61 a note will sound the same regardless of the current time signature,
64 The purpose of LilyPond is explained informally by the term `music
65 typesetter'. This is not a fully correct name: not only does the
66 program print musical symbols, it also makes esthetic decisions. All
67 symbols and their placement is @emph{generated} from a high-level musical
68 description. In other words, LilyPond would be best
69 described by `music compiler' or `music to notation compiler'.
71 LilyPond input can be classified into three types:
73 @item musical expressions: a musical expression is some combination of
75 @item output definitions: recipes for translating those musical
76 expressions into performances (MIDI) or graphics (eg. PostScript).
78 @item declarations: by declaring and naming musical expressions, you
79 can enter and edit them in manageable chunks.
83 @c. {Music constructs}
84 @node Music constructs
85 @section Music constructs
86 @cindex Music constructs
90 * Simultanious music::
91 * Compound music expressions::
93 * Explicit atomic music::
96 @c. {Music expressions}
97 @node Music expressions
98 @subsection Music expressions
100 @cindex music expressions
102 Music in LilyPond is entered as a music expression. Notes, rests,
103 lyric syllables are music expressions (the atomic
105 @cindex atomic music expressions
106 and you can combine music expressions to form new ones. This example
107 forms a compound expressions out of the quarter @code{c} note and a
111 \sequential @{ c4 d4 @}
114 The meaning of this compound expression is to play the @code{c}
115 first, and then the @code{d} (as opposed to playing them
116 simultaneously, for instance).
118 Atomic music expression are discussed in
119 subsection @ref{Atomic music expressions}. Compound music expressions are
120 discussed in subsection @ref{Compound music expressions}.
123 @c. {Sequential music}
124 @node Sequential music
125 @subsection Sequential music
126 @cindex Sequential music
127 @cindex @code{\sequential}
128 @cindex sequential music
131 \sequential @code{@{} @var{musicexprlist} @code{@}}
134 This means that list should be played or written in sequence, i.e.,
135 the second after the first, the third after the second. The duration
136 of sequential music is the the sum of the durations of the elements.
137 There is a shorthand, which leaves out the keyword:
143 @code{@{} @var{musicexprlist} @code{@}}
146 @c. {Simultanious music}
147 @node Simultanious music
148 @subsection Simultanious music
149 @cindex Simultanious music
150 @cindex @code{\simultaneous}
153 \simultaneous @code{@{} @var{musicexprlist} @code{@}}
156 It constructs a music expression where all of its arguments start at
157 the same moment. The duration is the maximum of the durations of the
158 elements. The following shorthand is a common idiom:
161 @code{<} @var{musicexprlist} @code{>}
164 If you try to use a chord as the first thing in your score, you might
165 get multiple staffs instead of a chord.
167 @lilypond[verbatim,center]
176 This happens because the chord is interpreted by a score context.
177 Each time a note is encountered a default Voice context (along with a
178 Staff context) is created. The solution is to explicitly instantiate
181 @lilypond[verbatim,center]
183 \notes\context Voice <c''4 e''>
190 @c. {Compound music expressions}
191 @node Compound music expressions
192 @subsection Compound music expressions
194 @cindex Compound music expressions
196 Music expressions are compound data structures. You can nest music
197 expressions any way you like. This simple example shows how three
198 chords can be expressed in two different ways:
200 @lilypond[fragment,verbatim,center]
201 \notes \context Staff {
202 <a c'> <b d' > <c' e'>
203 < { a b c' } { c' d' e' } >
208 @cindex @code{\context}
209 @cindex context selection
212 \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
215 Interpret @var{musicexpr} within a context of type @var{contexttype}.
216 If the context does not exist, it will be created. The new context
217 can optionally be given a name.
220 @c. {Grace music} <-> Grace notes
222 @subsection Grace music
224 @cindex @code{\grace}
227 @cindex @code{graceAlignPosition}
230 \grace @var{musicexpr}
233 A grace note expression has duration 0; the next real note is
234 assumed to be the main note.
236 You cannot have the grace note after the main note, in terms of
237 duration, and main notes, but you can typeset the grace notes to the
238 right of the main note using the property
239 @code{graceAlignPosition}.
240 @cindex @code{flagStyle}
242 When grace music is interpreted, a score-within-a-score is set up:
243 @var{musicexpr} has its own time bookkeeping, and you could (for
244 example) have a separate time signature within grace notes. While in
245 this score-within-a-score, you can create notes, beams, slurs, etc.
246 Unbeamed eighth notes and shorter by default have a slash through the
247 stem. This behavior can be controlled with the
248 @code{flagStyle} property.
251 @lilypond[fragment,verbatim]
253 \grace c8 c4 \grace { [c16 c16] } c4
254 \grace { \property Grace.flagStyle = "" c16 } c4
259 @cindex @code{\grace}
261 At present, nesting @code{\grace} notes is not supported. The following
262 may cause run-time errors:
264 @code{\grace @{ \grace c32 c16 @} c4}
266 Since the meaning of such a construct is unclear, we don't consider
267 this a loss. Similarly, juxtaposing two @code{\grace} sections is
268 syntactically valid, but makes no sense and may cause runtime errors.
270 Ending a staff or score with grace notes may also generate a run-time
271 error, since there will be no main note to attach the grace notes to.
273 The present implementation is not robust and generally kludgy. We expect
274 it to change after LilyPond 1.4
277 @c. {Explicit atomic music}
278 @node Explicit atomic music
279 @subsection Explicit atomic music
280 @cindex Explicit atomic music
285 The syntax for pitch specification is
287 @cindex @code{\pitch}
289 \pitch @var{scmpitch}
292 @var{scmpitch} is a pitch scheme object, see @ref{Pitch}.
294 In Note and Chord mode, pitches may be designated by names. See
295 section @ref{Other languages} for pitch names in different languages.
298 @cindex @code{\duration}
300 The syntax for duration specification is
302 \duration @var{scmduration}
305 In Note, Chord, and Lyrics mode, durations may be designated by
311 @c. {Modifying music}
312 @node Modifying music
313 @section Modifying music
314 @cindex Modifying music
316 FIXME: more verbose titling:
320 Repeating music expressions?
335 @cindex relative octave specification
337 It is easy to get confused by octave changing marks and accidentally
338 putting a pitch in the wrong octave. A much better way of entering a
339 note's octave is `the relative octave' mode.
341 @cindex @code{\relative}
343 \relative @var{startpitch} @var{musicexpr}
346 The octave of notes that appear in @var{musicexpr} are calculated as
347 follows: If no octave changing marks are used, the basic interval
348 between this and the last note is always taken to be a fourth or
349 less.@footnote{The interval is determined without regarding
350 accidentals. A @code{fisis} following a @code{ceses} will be put above
351 the @code{ceses}.} The octave changing marks @code{'} and @code{,}
352 can then be added to raise or lower the pitch by an extra octave.
353 Upon entering relative mode, an absolute starting pitch must be
354 specified that will act as the predecessor of the first note of
357 Entering scales is straightforward in relative mode.
359 @lilypond[fragment,verbatim,center]
365 And octave changing marks are used for intervals greater than a fourth.
367 @lilypond[fragment,verbatim,center]
372 If the preceding item is a chord, the first note of the chord is used
373 to determine the first note of the next chord. But other notes
374 within the second chord are determined by looking at the immediately
377 @lilypond[fragment,verbatim,center]
384 @cindex @code{\notes}
386 The pitch after the @code{\relative} contains a notename. To parse
387 the pitch as a notename, you have to be in note mode, so there must
388 be a surrounding @code{\notes} keyword (which is not
391 The relative conversion will not affect @code{\transpose} or
392 @code{\relative} sections in its argument. If you want to use
393 relative within transposed music, you must place an additional
394 @code{\relative} inside the @code{\transpose}.
396 It is strongly recommended to use relative pitch mode: less work,
397 less error-prone, and more readable.
401 @subsection Transpose
403 @cindex transposition of pitches
404 @cindex @code{\transpose}
406 A music expression can be transposed with @code{\transpose}. The syntax
409 \transpose @var{pitch} @var{musicexpr}
412 This means that middle C in @var{musicexpr} is transposed to
415 @code{\transpose} distinguishes between enharmonic pitches: both
416 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
417 a tone. The first version will print sharps and the second version
421 @lilypond[fragment,verbatim]
424 { \key e \major; c d e f }
426 \transpose des'' { \key e \major; c d e f }
427 \transpose cis'' { \key e \major; c d e f }
433 If you want to use both @code{\transpose} and @code{\relative}, then
434 you must use @code{\transpose} first. @code{\relative} will have no
435 effect music that appears inside a @code{\transpose}.
444 [TODO: document #'repeatCommands.]
446 @cindex @code{\repeat}
448 In order to specify repeats, use the @code{\repeat}
449 keyword. Since repeats look and sound differently when played or
450 printed, there are a few different variants of repeats.
454 Repeated music is fully written (played) out. Useful for MIDI
458 This is the normal notation: Repeats are not written out, but
459 alternative endings (voltas) are printed, left to right.
462 Alternative endings are written stacked. Which is unfortunately not
463 practical for anything right now.
469 The syntax for repeats is
472 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
475 If you have alternative endings, you may add
477 @cindex @code{\alternative}
479 \alternative @code{@{} @var{alternative1}
481 @var{alternative3} @dots{} @code{@}}
484 where each @var{alternative} is a Music expression.
486 Normal notation repeats are used like this:
490 @lilypond[fragment,verbatim]
492 \repeat volta 2 { c'4 d' e' f' }
493 \repeat volta 2 { f' e' d' c' }
498 With alternative endings:
502 @lilypond[fragment,verbatim]
504 \repeat volta 2 {c'4 d' e' f'}
505 \alternative { {d'2 d'} {f' f} }
510 Folded repeats look like this:@footnote{Folded repeats offer little
511 more over simultaneous music. However, it is to be expected that
512 more functionality -- especially for the MIDI backend -- will be
517 @lilypond[fragment,verbatim]
519 \repeat fold 2 {c'4 d' e' f'}
520 \alternative { {d'2 d'} {f' f} }
527 @lilypond[fragment,verbatim]
531 \repeat volta 2 { e | c2 d2 | e2 f2 | }
532 \alternative { { g4 g g } { a | a a a a | b1 } }
539 If you don't give enough alternatives for all of the repeats, then
540 the first alternative is assumed to be repeated often enough to equal
541 the specified number of repeats.
544 @lilypond[fragment,verbatim]
547 \repeat volta 3 { \partial 4; e | c2 d2 | e2 f2 | }
548 \alternative { { g4 g g }
549 {\partial 1; e4 e e }
550 {\partial 1; a a a a | b1 } }
556 As you can see, LilyPond doesn't remember the timing information, nor
557 are slurs or ties repeated. We hope to fix this after 1.4.
559 It is possible to nest @code{\repeat}. This is not entirely
560 supported: the notes will come be in the right places, but the repeat
563 To place tremolo marks between notes, use @code{\repeat} with tremolo
565 @cindex tremolo beams
566 To create tremolo beams on a single note, simply attach
567 `@code{:}@var{length}' to the note itself.
569 @lilypond[verbatim,center]
571 \context Voice \notes\relative c' {
572 \repeat "tremolo" 8 { c16 d16 }
573 \repeat "tremolo" 4 { c16 d16 }
574 \repeat "tremolo" 2 { c16 d16 }
577 linewidth = 40*\staffspace;
583 @lilypond[fragment,verbatim,center]
593 Tuplets are made out of a music expression by multiplying their
594 duration with a fraction.
596 @cindex @code{\times}
598 \times @var{fraction} @var{musicexpr}
601 The duration of @var{musicexpr} will be multiplied by the fraction.
602 In print, the fraction's denominator will be printed over the notes,
603 optionally with a bracket. The most common tuplet is the triplet in
604 which 3 notes have the length of 2, so the notes are 2/3 of
605 their written length:
607 @lilypond[fragment,verbatim,center]
608 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
616 Apply allows a Scheme-function to operate directly on the internal
617 representation of music.
619 \apply #@var{func} @var{music}
621 The function takes two arguments, being a function and an musical
622 argument for that function. The function should return a music
625 This example replaces the text string of a script. It also shows a dump
626 of the music it processes.
628 #(define (testfunc x)
629 (if (eq? (ly-get-mus-property x 'text) "foo")
630 (ly-set-mus-property x 'text "bar"))
632 (ly-set-mus-property x 'elements
633 (map testfunc (ly-get-mus-property x 'elements)))
638 \apply #testfunc { c4_"foo" }
642 For more information on what is possible, see the @ref{Tricks} and the
643 automatically generated documentation.
647 @subsection Transform
663 @subsection Notes mode
667 @cindex @code{\notes}
668 Note mode is introduced by the keyword
669 @code{\notes}. In Note mode, words can only
670 contain alphabetic characters. If @code{word} is encountered,
671 LilyPond first checks for a notename of @code{word}. If no
672 notename is found, then @code{word} is treated as a string.
674 Since combinations of numbers and dots are used for indicating
675 durations, it is not possible to enter real numbers in this mode.
682 @subsection Pitch names
684 @node Note specification
685 @section Note specification
686 @cindex Note specification
689 @cindex entering notes
691 A note specification has the form
694 @var{pitch}[@var{octavespec}][!][?][@var{duration}]
697 The pitch of the note is specified by the note's name.
700 The default names are the Dutch note names. The notes are specified
701 by the letters @code{c} through @code{b}, where @code{c} is an
702 octave below middle C and the letters span the octave above that C.
704 @cindex note names, Dutch
705 a sharp is formed by adding @code{-is} to the end of a pitch name. A
706 flat is formed by adding @code{-es}. Double sharps and double flats are
707 obtained by adding @code{-isis} or @code{-eses}. @code{aes} and
708 @code{ees} are contracted to @code{as} and @code{es} in Dutch, but both
709 forms will be accepted.
711 LilyPond has predefined sets of notenames for various other languages.
712 To use them, simply include the language specific init file. For
713 example: @code{\include "english.ly"}. The available language files and
714 the names they define are:
717 Note Names sharp flat
718 nederlands.ly c d e f g a bes b -is -es
719 english.ly c d e f g a bf b -s/-sharp -f/-flat
720 deutsch.ly c d e f g a b h -is -es
721 norsk.ly c d e f g a b h -iss/-is -ess/-es
722 svenska.ly c d e f g a b h -iss -ess
723 italiano.ly do re mi fa sol la sib si -d -b
724 catalan.ly do re mi fa sol la sib si -d/-s -b
729 Pitch names can be redefined using the @code{\pitchnames} command, see
735 The optional octave specification takes the form of a series of
736 single quote (`@code{'}') characters or a series of comma
737 (`@code{,}') characters. Each @code{'} raises the pitch by one
738 octave; each @code{,} lowers the pitch by an octave.
740 @lilypond[fragment,verbatim,center]
741 c' d' e' f' g' a' b' c''
744 @lilypond[fragment,verbatim,center]
745 cis' dis' eis' fis' gis' ais' bis'
748 @lilypond[fragment,verbatim,center]
749 ces' des' es' fes' ges' as' bes'
752 @lilypond[fragment,verbatim,center]
753 cisis' eisis' gisis' aisis' beses'
756 @lilypond[fragment,verbatim,center]
757 ceses' eses' geses' ases' beses'
760 LilyPond will determine what accidentals to typeset depending on the key
761 and context, so alteration refer to what note is heard, not to whether
762 accidentals are printed. A reminder accidental
763 @cindex reminder accidental
765 can be forced by adding an exclamation mark @code{!} after the pitch.
766 A cautionary accidental,
767 @cindex cautionary accidental
769 i.e., an accidental within parentheses can be obtained by adding the
770 question mark `@code{?}' after the pitch.
772 @lilypond[fragment,verbatim,center]
773 cis' d' e' cis' c'? d' e' c'!
781 * Multi measure rests::
789 Rests are entered like notes, with note name `@code{r}'.
790 There is also a note name
791 `@code{s}', which produces a space of the specified
797 @subsection Durations
800 Durations are entered as their reciprocal values. For notes longer
801 than a whole note, use identifiers.
807 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
809 r1 r2 r4 r8 r16 r32 r64 r64
815 \notes \relative c'' {
816 a\longa a\breve \autoBeamOff
817 a1 a2 a4 a8 a16 a32 a64 a64
819 r1 r2 r4 r8 r16 r32 r64 r64
824 \remove "Clef_engraver";
825 \remove "Staff_symbol_engraver";
826 \remove "Time_signature_engraver";
827 \consists "Pitch_squash_engraver";
834 As you can see, the longa is not printed. To get a longa note head, you
835 have to use a different style of note heads. See [TODO].
840 If the duration is omitted then it is set equal to the previous duration
841 entered. At the start of parsing there is no previous duration, so then
842 a quarter note is assumed. The duration can be followed by a dot
843 (`@code{.}') to obtain dotted note lengths.
847 @lilypond[fragment,verbatim,center]
853 You can alter the length of duration by writing `@code{*}@var{fraction}'
854 after it. This will not affect the appearance of note heads or rests.
856 @c. {Multi measure rests}
857 @node Multi measure rests
858 @subsection Multi measure rests
859 @cindex Multi measure rests
863 Multi_measure_rest are entered using `@code{R}'. It is specifically
864 meant for entering parts: the rest can expand to fill a score with
865 rests, or it can be printed as a single multimeasure rest This expansion
866 is controlled by the property @code{Score.skipBars}. If this is set to true,
867 Lily will not expand empty measures, and the multimeasure rests
868 automatically adds the appropriate number.
871 \time 3/4; R2.*2 \property Score.skipBars = ##t R2.*17 R2.*4
874 Note that there is currently no way to condense multiple rests into a
875 single multimeasure rest.
884 \skip @var{duration} @code{;}
888 Skips the amount of time specified by @var{duration}. If no other
889 music is played, a gap will be left for the skipped time with no
890 notes printed. It works in Note Mode or Lyrics Mode. In Note mode,
891 this has the same effect as the spacer rest.
899 @section Music notation
900 @cindex Music notation
918 @code{\key} @var{pitch} @var{type} @code{;}
920 @cindex @code{\minor}
921 @cindex @code{\major}
922 @cindex @code{\minor}
923 @cindex @code{\ionian}
924 @cindex @code{\locrian}
925 @cindex @code{\aeolian}
926 @cindex @code{\mixolydian}
927 @cindex @code{\lydian}
928 @cindex @code{\phrygian}
929 @cindex @code{\dorian}
931 Change the key signature. @var{type} should be @code{\major} or
932 @code{\minor} to get @var{pitch}-major or @var{pitch}-minor,
933 respectively. The second argument is optional; the default is major
934 keys. The @var{\context} argument can also be given as an integer,
935 which tells the number of semitones that should be added to the pitch
936 given in the subsequent @code{\key} commands to get the corresponding
937 major key, e.g., @code{\minor} is defined as 3. The standard mode names
938 @code{\ionian}, @code{\locrian}, @code{\aeolian}, @code{\mixolydian},
939 @code{\lydian}, @code{\phrygian}, and @code{\dorian} are also defined.
949 @subsubsection Clef changes
952 \clef @var{clefname} @code{;}
958 \property Clef.clefGlyph = @var{symbol associated with clefname}
959 \property Clef.clefPosition = @var{clef Y-position for clefname}
960 \property Clef.clefOctavation = @var{extra pitch of clefname}
963 Supported clef-names include
970 @subsection Time signature
971 @cindex Time signature
976 \time @var{numerator}@code{/}@var{denominator} @code{;}
979 A short-cut for doing
981 \property Score.timeSignatureFraction = #'(@var{numerator} . @var{denominator})
984 See the documentation of @code{timeSignatureFraction}
988 @subsubsection Partial
992 @cindex partial measure
993 @cindex measure, partial
994 @cindex shorten measures
995 @cindex @code{\partial}
997 \partial @var{duration} @code{;}
1003 \property Score.measurePosition = @var{length of duration}
1007 See the documentation of @code{measurePosition}.
1013 @subsection Spanners
1022 * Crescendo and Decrescendo::
1033 @c. {Automatic beams}
1034 @unnumberedsubsubsec Automatic beams
1036 @cindex automatic beam generation
1039 @cindex @code{Voice.noAutoBeaming}
1041 LilyPond will group flagged notes and generate beams autmatically, where
1042 appropriate. This feature can be disabled by setting the
1043 @code{Voice.noAutoBeaming} property to true, which you may find
1044 necessary for the melody that goes with lyrics, eg. Automatic beaming
1045 can easily be overridden for specific cases by specifying explicit
1046 beams, see @ref{Manual beams}.
1048 @cindex @code{Voice.autoBeamSettings}
1049 @cindex @code{(end * * * *)}
1050 @cindex @code{(begin * * * *)}
1052 A large number of Voice properties are used to decide how to generate
1053 beams. Their default values appear in @file{scm/auto-beam.scm}. In
1054 general, beams can begin anywhere, but their ending location is
1055 significant. Beams can end on a beat, or at durations specified by the
1056 properties in @code{Voice.autoBeamSettings}. To end beams every quarter
1057 note, for example, you could set the property @code{(end * * * *)} to
1058 @code{(make-moment 1 4)}. To end beams at every three eighth notes you
1059 would set it to @code{(make-moment 1 8)}. The same syntax can be used
1060 to specify beam starting points using @code{(begin * * * *)}, eg:
1063 \property Voice.autoBeamSettings \override
1064 #'(end * * * *) = #(make-moment 1 4)
1065 \property Voice.autoBeamSettings \override
1066 #'(begin * * * *) = #(make-moment 1 8)
1070 To allow different settings for different time signatures, instead of
1071 the first two asterisks @code{* *} you can specify a time signature; use
1072 @code{(end N M * *)} to restrict the definition to
1073 `@var{N}@code{/}@var{M}' time. For example, to specify beams ending
1074 only for 6/8 time you would use the property @code{(end 6 8 * *)}.
1076 To allow different endings for notes of different durations, instead of
1077 th last two asterisks you can specify a duration; use @code{(end * * N
1078 M)} to restrict the definition to beams that contain notes of
1079 `@var{N}@code{/}@var{M}' duration.
1081 For example, to specify beam endings for beams that contain 32nd notes,
1082 you would use @code{(end * * 1 32)}.
1087 @cindex Automatic beams
1088 @unnumberedsubsubsec Manual beams
1089 @cindex beams, manual
1093 For most situations, beaming can be generated automatically; see section
1094 @ref{Automatic Beaming}. In certain cases it may be necessary to
1095 override the automatic beaming decisions that LilyPond makes. You can
1096 do this by specifying beams explicitely.
1098 A manual beam is specified by surrounding the notes that should make up
1099 the beam, with brackets `@code{[}' and `@code{]}'.
1101 FIXME: example. (or tell: why would the auto-beamer fail here?)
1103 @lilypond[fragment,verbatim,center]
1104 [a'8 a'] [a'16 a' a' a']
1105 [a'16 <a' c''> c'' <a' c''>]
1106 \times 2/3 { [e'8 f' g'] }
1111 @c. {Adjusting beams}
1112 @unnumberedsubsubsec Adjusting beams
1113 @cindex Adjusting beams
1125 Slurs connects chords and try to avoid crossing stems. A slur is
1126 started with @code{(} and stopped with @code{)}. The
1127 starting @code{(} appears to the right of the first note in
1128 the slur. The terminal @code{)} appears to the left of the
1129 first note in the slur. This makes it possible to put a note in
1130 slurs from both sides:
1132 @lilypond[fragment,verbatim,center]
1133 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1138 @c. {Adjusting slurs}
1139 @unnumberedsubsubsec Adjusting slurs
1141 @cindex Adusting slurs
1149 A tie connects two adjacent note heads of the same pitch. When used
1150 with chords, it connects all of the note heads whose pitches match.
1151 Ties are indicated using the tilde symbol `@code{~}'.
1152 If you try to tie together chords which have no common pitches, a
1153 warning message will appear and no ties will be created.
1155 @lilypond[fragment,verbatim,center]
1156 e' ~ e' <c' e' g'> ~ <c' e' g'>
1164 @subsubsection Tuplet
1167 A @rgrob{TupletBracket} is typeset automatically for music that
1168 is time scaled, see @ref{Times}.
1175 @subsubsection Volta
1178 A @rgrob{VoltaBracket} is typeset automatically for music that contains a
1179 repetition, see @ref{Repeat}.
1182 @c. {Crescendo and Decrescendo}
1183 @node Crescendo and Decrescendo
1184 @subsubsection Crescendo and Decrescendo
1185 @cindex Crescendo and Decrescendo
1189 @cindex @code{\decr}
1190 @cindex @code{\rced}
1197 A crescendo mark is started with @code{\cr} and terminated with
1198 @code{\rc}, the textual reverse of @code{cr}. A decrescendo mark is
1199 started with @code{\decr} and terminated with @code{\rced}. There are
1200 also shorthands for these marks. A crescendo can be started with
1201 @code{\<} and a decrescendo can be started with @code{\>}. Either one
1202 can be terminated with @code{\!}. Note that @code{\!} must go before
1203 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
1204 after the last note. Because these marks are bound to notes, if you
1205 want to get several marks during one note, you must use spacer notes.
1207 @lilypond[fragment,verbatim,center]
1208 c'' \< \! c'' d'' \decr e'' \rced
1209 < f''1 { s4 \< \! s2 \> \! s4 } >
1217 @subsubsection Text spanner
1218 @cindex Text spanner
1220 Have crescendo set a text spanner instead of hairpin
1222 @lilypond[fragment,relative,verbatim]
1224 \property Voice.crescendoText = "cresc."
1225 \property Voice.crescendoSpanner = #'dashed-line
1232 @subsubsection Ottava
1234 @unnumberedsubsubsec Ottava
1236 @lilypond[fragment,relative,verbatim]
1238 \property Voice.TextSpanner \set #'type = #'dotted-line
1239 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1240 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1241 \property Staff.centralCPosition = #-13
1242 a\spanrequest \start "text" b c a \spanrequest \stop "text"
1247 @c. {Text crescendo and decrescendo}
1248 @unnumberedsubsubsec Text crescendo and decrescendo
1254 @subsubsection Span requests
1255 @cindex Span requests
1257 @cindex @code{\spanrequest}
1260 \spanrequest @var{startstop} @var{type}
1262 @cindex @code{\start}
1263 @cindex @code{\stop}
1265 Define a spanning request. The @var{startstop} parameter is either -1
1266 (@code{\start}) or 1 (@code{\stop}) and @var{type} is a string that
1267 describes what should be started. Supported types are @code{crescendo},
1268 @code{decrescendo}, @code{beam}, @code{slur}. This is an internal
1269 command. Users should use the shorthands which are defined in the
1270 initialization file @file{spanners.ly}.
1272 You can attach a (general) span request to a note using
1274 @lilypond[fragment,verbatim,center]
1275 c'4-\spanrequest \start "slur"
1276 c'4-\spanrequest \stop "slur"
1279 The slur syntax with parentheses is a shorthand for this.
1284 @subsection Ornaments
1301 @subsubsection Articulation
1302 @cindex Articulation
1304 @cindex articulations
1308 A variety of symbols can appear above and below notes to indicate
1309 different characteristics of the performance. These symbols can be
1310 added to a note with `@var{note}@code{-\}@var{name}'. Numerous symbols
1311 are defined in @file{script.ly} and @file{script.scm}. Symbols can be
1312 forced to appear above or below the note by writing
1313 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1314 respectively. Here is a chart showing symbols above notes, with the
1315 name of the corresponding symbol appearing underneath.
1321 \property Score.LyricSyllable \override #'font-family =
1323 \property Score.LyricSyllable \override #'font-shape = #'upright
1324 c''-\accent c''-\marcato c''-\staccatissimo c''-\fermata
1325 c''-\stopped c''-\staccato c''-\tenuto c''-\upbow
1326 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1327 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1328 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1329 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1330 c''-\thumb c''-\segno c''-\coda
1332 \context Lyrics \lyrics {
1333 accent__ marcato__ staccatissimo__ fermata
1334 stopped__ staccato__ tenuto__ upbow
1335 downbow__ lheel__ rheel__ ltoe
1336 rtoe__ turn__ open__ flageolet
1337 reverseturn__ trill__ prall__ mordent
1338 prallprall__ prallmordent__ uprall__ downprall
1339 thumb__ segno__ coda
1343 linewidth = 5.875\in;
1352 @subsubsection Text scripts
1353 @cindex Text scripts
1357 In addition, it is possible to place arbitrary strings of text or
1358 @TeX{} above or below notes by using a string instead of an
1359 identifier: @code{c^"text"}. Fingerings
1360 can be placed by simply using digits. All of these note ornaments
1361 appear in the printed output but have no effect on the MIDI rendering of
1365 @unnumberedsubsubsec Fingerings
1368 To save typing, fingering instructions (digits 0 to 9 are
1369 supported) and single characters shorthands exist for a few
1374 \notes \context Voice {
1375 \property Voice.TextScript \set #'font-family = #'typewriter
1376 \property Voice.TextScript \set #'font-shape = #'upright
1382 c''4-^_"c-\\^{ }" s4
1389 linewidth = 5.875 \in;
1397 @cindex @code{\textscript}
1401 \textscript @var{text} @var{style}
1404 Defines a text to be printed over or under a note. @var{style} is a
1405 string that may be one of @code{roman}, @code{italic}, @code{typewriter},
1406 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1408 You can attach a general textscript request using this syntax:
1413 c4-\textscript "6" "finger"
1414 c4-\textscript "foo" "normal"
1419 This is equivalent to @code{c4-6 c4-"foo"}.
1421 @cindex @code{\script}
1428 @cindex @code{\script}
1430 Prints a symbol above or below a note. The argument is a string which
1431 points into the script-alias table defined in @file{scm/script.scm}, for
1432 information on how to add scripts, read the comments in that file.
1433 Usually the @code{\script} keyword is not used directly. Various
1434 helpful identifier definitions appear in @file{script.ly}.
1441 @subsubsection Grace notes
1444 See @ref{Grace music}.
1448 @subsubsection Stem tremolo
1449 @cindex tremolo marks
1450 @cindex @code{tremoloFlags}
1452 [FIXME: should be \repeat]
1454 Tremolo marks can be printed on a single note by adding
1455 `@code{:}[@var{length}]' after the note. The length must be at
1456 least 8. A @var{length} value of 8 gives one line across
1457 the note stem. If the length is omitted, then the last value is
1458 used, or the value of the @code{tremoloFlags} property if there was
1461 @lilypond[verbatim,fragment,center]
1468 @subsubsection Arpeggio
1471 @cindex broken arpeggio
1472 @cindex @code{\arpeggio}
1474 You can specify an @rgrob{Arpeggio} sign on a chord by issuing an
1477 @code{\arpeggio} request:
1481 @lilypond[fragment,relative,verbatim]
1482 \context Voice <c'\arpeggio e g c>
1486 Typesetting of simultanious chords with arpeggios can be controlled with
1487 the property @code{PianoStaff.connectArpeggios} @footnote{ FIXME:
1488 connectArpeggios. Can't find the English terms for two kinds of
1489 arpeggio (Dutch: gebroken arpeggio vs doorlopend arpeggio).} By
1490 default, LilyPond prints broken arpeggios; when set to true, one
1491 extended arpeggio sign is printed.
1494 @lilypond[fragment,relative,verbatim]
1495 \context PianoStaff <
1496 \property PianoStaff.connectArpeggios = ##t
1497 \context Staff \context Voice <c''\arpeggio e g c>
1498 \context Staff=other \context Voice <c,\arpeggio e g>
1506 @subsubsection Glissando
1509 @cindex @code{\glissando}
1511 A @rgrob{Glissando} line can be requested by issuing a
1514 @code{\glissando} request:
1518 @lilypond[fragment,relative,verbatim]
1523 Printing of the additional text @samp{gliss.} must be done manually.
1527 @subsubsection Follow Thread
1528 @cindex follow thread
1529 @cindex staff switching
1532 @c Documented here because it looks like a glissando...
1533 @cindex @code{followThread}
1534 A glissando-like line can be printed to connect notes whenever a thread
1535 switches to another staff. This is enabled if the property
1536 @code{PianoStaff.followThread} is set to true:
1539 @lilypond[fragment,relative,verbatim]
1540 \context PianoStaff <
1541 \property PianoStaff.followThread = ##t
1542 \context Staff \context Voice {
1544 \translator Staff=two
1547 \context Staff=two {\clef bass; \skip 1*2;}
1556 @subsubsection Dynamics
1559 @unnumberedsubsec Dynamics
1569 @cindex @code{\ffff}
1578 Dynamic marks are specified by using an identifier after a note:
1579 @code{c4-\ff} (the dash is optional for dynamics: `@code{c4 \ff})'.
1580 The available dynamic marks are:
1582 @code{\pp}, @code{\p}, @code{\mp},
1583 @code{\mf}, @code{\f}, @code{\ff},
1584 @code{\fff}, @code{\fff},
1585 @code{\fp}, @code{\sf},
1586 @code{\sff}, @code{\sp},
1587 @code{\spp}, @code{\sfz}, and
1590 See also @ref{Crescendo and Decrescendo}
1595 @subsubsection Bar lines
1599 @cindex measure lines
1606 This is a short-cut for doing
1608 \property Score.whichBar = @var{bartype}
1611 You are encouraged to use @code{\repeat} for repetitions. See
1612 @ref{Repeat}, @ref{Volta}, and the documentation of @code{whichBar} in
1613 @ref{(lilypond-internals)LilyPond context properties}.
1620 @subsubsection Breath marks
1621 @cindex Breath marks
1623 @c. {Rehearsal marks}
1624 @node Rehearsal marks
1625 @subsubsection Rehearsal marks
1626 @cindex Rehearsal marks
1628 @cindex @code{\mark}
1631 \mark @var{unsigned};
1632 @cindex @code{Mark_engraver}
1636 Prints a mark over or under the staff.
1641 @subsection Bar check
1645 @cindex @code{barCheckNoSynchronize}
1649 Bar checks help you find errors in the input: Whenever one is
1650 encountered during interpretation, a warning message is issued if it
1651 doesn't fall at a measure boundary. Depending on the value of
1652 @code{barCheckNoSynchronize}, the beginning of the measure will be
1653 relocated, so this can also be used to shorten measures.
1655 A bar check is entered using the bar symbol, @code{|}
1657 This can help you finding errors in the input.
1662 @section Lyrics entry
1663 @cindex Lyrics entry
1675 @subsection Lyrics mode
1679 @cindex @code{\lyrics}
1681 Lyrics mode is introduced by the keyword @code{\lyrics}. This mode has
1682 rules that make it easy to include punctuation and diacritical marks in
1683 words: The purpose of Lyrics mode is that you can enter lyrics in @TeX{}
1684 format or a standard encoding without needing quotes. The precise
1685 definition of this mode is ludicrous, and this will remain so until the
1686 authors of LilyPond acquire a deeper understanding of character
1687 encoding, or someone else steps up to fix this.
1689 A word in Lyrics mode begins with: an alphabetic character, @code{_},
1690 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
1691 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
1692 any 8-bit character with ASCII code over 127, or a two-character
1693 combination of a backslash followed by one of @code{`}, @code{'},
1694 @code{"}, or @code{^}.
1696 Subsequent characters of a word can be any character that is not a digit
1697 and not white space. One important consequence of this is that a word
1698 can end with `@code{@}}', which may be confusing. However, LilyPond will
1699 issue a warning. Any @code{_} character which appears in an unquoted
1700 word is converted to a space. This provides a mechanism for introducing
1701 spaces into words without using quotes. Quoted words can also be used
1702 in Lyrics mode to specify words that cannot be written with the above
1703 rules. Here are some examples. Not all of these words are printable by
1708 2B_||_!2B % not a word because it starts with a digit
1709 ``Hello'' % not a word because it starts with `
1710 _ _ _ _ % 4 words, each one a space
1713 Since combinations of numbers and dots are used for indicating
1714 durations, you can not enter real numbers in this mode.
1716 [todo: include short table showing differences]
1718 @cindex lyrics expressions
1720 Syllables are entered like notes, with pitches replaced by text. For
1721 example, @code{Twin-4 kle4 twin-4 kle4} enters four syllables, each
1722 with quarter note duration. Note that the hyphen has no special
1723 meaning for lyrics, and does not introduce special symbols. See
1724 section @ref{Lexical modes} for a description of what is interpreted as
1727 Spaces can be introduced into a lyric either by using quotes
1728 (@code{"}) or by using an underscore without quotes: @code{He_could4
1729 not4}. All unquoted underscores are converted to spaces. Printing
1730 lyrics is discussed in section @ref{lyricprint}.
1733 @c. {Printing Lyrics}
1734 @node Printing lyrics
1735 @subsection lyricprint
1739 @cindex printing!lyrics
1742 Lyric syllables must be interpreted within a @code{Lyrics} context
1744 @cindex context!Lyrics
1747 Here is a full example:
1753 \notes \transpose c'' {
1755 e f g2 | e4 f g2 \bar "|.";
1757 \context Lyrics \lyrics {
1758 Va-4 der Ja- cob Va- der Ja- cob
1759 Slaapt gij nog?2 Slaapt4 gij nog?2
1767 You may want a continuous line after the syllables to show melismata.
1768 To achieve this effect, add a @code{__} lyric as a separate word
1769 after the lyric to be extended. This will create an extender, a line
1770 that extends over the entire duration of the lyric. This line will
1771 run all the way to the start of the next lyric, so you may want to
1772 shorten it by using a blank lyric (using @code{_}).
1779 \notes \relative c'' {
1780 a4 () b () c () d | c () d () b () a | c () d () b () a
1782 \context Lyrics \lyrics {
1783 foo1 __ | bar2. __ _4 | baz1 __
1792 If you want to have hyphens centered between syllables (rather than
1793 attached to the end of the first syllable) you can use the special
1794 `@code{-}@code{-}' lyric as a separate word between syllables. This
1795 will result in a hyphen which length varies depending on the space
1796 between syllables, and which will be centered between the syllables.
1804 \notes \transpose c'' {
1806 e f g2 | e4 f g2 \bar "|.";
1808 \context Lyrics \lyrics {
1809 Va4 -- der Ja -- cob | Va -- der Ja -- cob |
1810 Slaapt gij nog?2 | Slaapt4 gij nog?2
1823 @subsection Lyric hyphen
1824 @cindex Lyric hyphen
1826 The syntax for a spanning hyphen (i.e., a hyphen that will be printed
1827 between two lyric syllables) is `@code{-}@code{-}'.
1829 @c. {Lyric extender}
1830 @node Lyric extender
1831 @subsection Lyric extender
1832 @cindex Lyric extender
1834 @cindex lyric extender
1837 The syntax for an extender mark is @code{__}. This syntax can only
1838 be used within lyrics mode.
1845 @subsection Addlyrics
1849 [explain automatic phrasing]
1850 @cindex automatic lyric durations
1851 @cindex @code{\addlyrics}
1853 If you have lyrics that are set to a melody, you can import the rhythm
1854 of that melody into the lyrics using @code{\addlyrics}. The syntax for
1857 \addlyrics @var{musicexpr1 musicexpr2}
1860 This means that both @var{musicexpr1} and @var{musicexpr2} are
1861 interpreted, but that every non-command atomic music expression
1862 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1863 of @var{musicexpr1}.
1864 @cindex @code{automaticMelismata}
1866 If the property @code{automaticMelismata} is set in the
1867 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1871 @lilypond[verbatim,fragment]
1874 \property Voice.automaticMelismata = ##t
1875 c8 () cis d8. e16 f2
1877 \context Lyrics \lyrics {
1882 You should use a single rhythm melody, and single rhythm lyrics (a
1883 constant duration is the obvious choice). If you do not, you will get
1884 undesired effects when using multiple stanzas:
1887 @lilypond[verbatim,fragment]
1890 c8 () cis d8. e16 f2
1892 \context Lyrics \lyrics
1899 It is valid (but probably not very useful) to use notes instead of
1900 lyrics for @var{musicexpr2}.
1906 @section Chord entry
1911 * Entering named chords::
1912 * Printing named chords::
1917 @subsection Chords mode
1920 Chord mode is introduced by the keyword
1921 @code{\chords}. It is similar to Note mode, but
1922 words are also looked up in a chord modifier table (containing
1923 @code{maj}, @code{dim}, etc).
1925 Since combinations of numbers and dots are used for indicating
1926 durations, you can not enter real numbers in this mode. Dashes
1927 and carets are used to indicate chord additions and subtractions,
1928 so scripts can not be entered in Chord mode.
1930 @c. {Entering named chords}
1931 @node Entering named chords
1932 @subsection Entering named chords
1933 @cindex Chords names
1935 Chord names are a way to generate simultaneous music expressions that
1936 correspond with traditional chord names. It can only be used in
1937 Chord mode (see section @ref{Lexical modes}).
1941 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1944 @var{tonic} should be the tonic note of the chord, and @var{duration}
1945 is the chord duration in the usual notation. There are two kinds of
1946 modifiers. One type is @emph{chord additions}, which are obtained by
1947 listing intervals separated by dots. An interval is written by its
1948 number with an optional @code{+} or @code{-} to indicate raising or
1949 lowering by half a step. Chord additions has two effects: It adds
1950 the specified interval and all lower odd numbered intervals to the
1951 chord, and it may lower or raise the specified interval. Intervals
1952 must be separated by a dot (@code{.}).
1955 Throughout these examples, chords have been shifted around the staff
1956 using @code{\transpose}.
1961 @lilypond[fragment,verbatim]
1965 c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1977 The second type of modifier that may appear after the @code{:} is a
1978 named modifier. Named modifiers are listed in the file
1979 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
1980 @code{min} which lower the 3rd half a step, `@code{aug}' which
1981 raises the 5th, `@code{dim}' which lowers the 5th,
1982 `@code{maj}' which adds a raised 7th, and `@code{sus}'
1983 which replaces the 5th with a 4th.
1987 @lilypond[fragment,verbatim]
1990 c1:m c:min7 c:maj c:aug c:dim c:sus
1998 Chord subtractions are used to eliminate notes from a chord. The
1999 notes to be subtracted are listed after a @code{^} character,
2002 @lilypond[fragment,verbatim,center]
2011 Chord inversions can be specified by appending `@code{/}' and
2012 the name of a single note to a chord. This has the effect of
2013 lowering the specified note by an octave so it becomes the lowest
2014 note in the chord. If the specified note is not in the chord, a
2015 warning will be printed.
2017 @lilypond[fragment,verbatim,center]
2027 Bass notes can be added by `@code{/+}' and
2028 the name of a single note to a chord. This has the effect of
2029 adding the specified note to the chord, lowered by an octave,
2030 so it becomes the lowest note in the chord.
2032 @lilypond[fragment,verbatim,center]
2041 The most interesting application is printing chords using chord names,
2042 See @ref{Chord names}.
2044 You should not combine @code{\relative} with named chords. [FIXME]
2046 @c. {Printing named chords}
2047 @node Printing named chords
2048 @subsection Printing named chords
2053 @cindex printing!chord names
2054 @cindex @code{ChordNames}
2055 @cindex @code{ChordNameVoice}
2057 For displaying printed chord names, use the @code{ChordNames} and
2058 @code{ChordNameVoice} contexts. The chords may be entered either using
2059 the notation described above, or directly using simultaneous music.
2064 \chords {a1 b c} <d f g> <e g b>
2068 \context ChordNamesVoice \scheme
2069 \context Staff \transpose c'' \scheme
2071 \paper { linewidth = -1.; }
2076 You can make the chord changes stand out more by setting property
2077 @code{ChordNames.chordChanges} to true. This will only display chord
2078 names when there's a change in the chords scheme, but always display the
2079 chord name after a line break:
2085 c1:m \break c:m c:m c:m d
2090 \context ChordNames \scheme
2091 \context Staff \transpose c'' \scheme
2094 linewidth = 40 * \staffspace;
2106 LilyPond examines chords specified as lists of notes to determine a
2107 name to give the chord. LilyPond will not try to
2108 identify chord inversions or added base, which may result in strange
2109 chord names when chords are entered as a list of pitches:
2112 @lilypond[verbatim,center]
2121 \context ChordNamesVoice \scheme
2122 \context Staff \scheme
2124 \paper { linewidth = -1.; }
2129 To specify chord inversions, append @code{/<notename>}. To specify an
2130 added bass note, append @code{/+<notename}:
2133 @lilypond[verbatim,center]
2140 \context ChordNames \scheme
2141 \context Staff \transpose c'' \scheme
2143 \paper { linewidth = -1.; }
2148 The chord names that LilyPond should print are fully customizable. The
2149 code to print chord names is written in Scheme. It can be found in
2150 @file{scm/chord-name.scm}. Chord names are based on Banter style
2151 naming, which is unambiguous and has a logical structure. Typical
2152 American style chord names are implemented as a variation on Banter
2153 names, they can be selected by setting property @code{ChordName.style}
2158 \include "english.ly"
2163 df:m5- % Diminished triad
2164 c:5^3 % Root-fifth chord
2165 c:4^3 % Suspended fourth triad
2166 c:5+ % Augmented triad
2168 c:m5-.7- % Diminished seventh
2169 c:7+ % Major seventh
2170 c:7.4^3 % Dominant seventh suspended fourth
2171 c:5+.7 % Augmented dominant seventh
2172 c:m5-.7 % "Half" diminished seventh
2173 c:5-.7 % Dominant seventh flat fifth
2174 c:5-.7+ % Major seventh flat fifth
2175 c:m7+ % Minor-major seventh
2176 c:m7 % Minor seventh
2177 c:7 % Dominant seventh
2180 c:9^7 % Major triad w/added ninth
2181 c:6.9^7 % Six/Nine chord
2182 c:9 % Dominant ninth
2183 c:7+.9 % Major ninth
2184 c:m7.9 % Minor ninth
2189 \context ChordNames \scheme
2190 \context Staff \transpose c'' \scheme
2195 ChordName \override #'word-space = #1
2196 ChordName \override #'style = #'american
2203 Similarly, Jazz style chord names are implemented as a variation on
2204 American style names:
2210 c:6 % 6 = major triad with added sixth
2211 c:maj % triangle = maj
2216 c:m % m = minor triad
2217 c:m.6 % m6 = minor triad with added sixth
2218 c:m.7+ % m triangle = minor major seventh chord
2226 c:7.5+ % +7 = augmented dominant
2227 c:7.5- % 7b5 = hard diminished dominant
2234 c:13.9-^11 % 7(b9,13)
2235 c:13.9+^11 % 7(#9,13)
2237 c:13-.9-^11 % 7(b9,b13)
2238 c:13-.9+^11 % 7(#9,b13)
2240 % half diminished chords
2241 c:m5-.7 % slashed o = m7b5
2242 c:9.3-.5- % o/7(pure 9)
2245 c:m5-.7- % o = diminished seventh chord
2250 \context ChordNames \scheme
2251 \context Staff \transpose c'' \scheme
2256 ChordName \override #'word-space = #1
2257 ChordName \override #'style = #'jazz
2269 @section Page layout
2283 @subsection Paper block
2286 The most important output definition is the @code{\paper} block, for
2287 music notation. The syntax is
2290 @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2293 where each of the items is one of
2296 @item An assignment. The assignment must be terminated by a
2299 @item A context definition. See section @ref{contextdefs} for
2300 more information on context definitions.
2309 A margin shape declaration. The syntax is
2310 @cindex @code{\shape}
2313 \shape @var{indent1}@code{,} @var{width1}@code{,}
2314 @var{indent2}@code{,} @var{width2} @dots{} @code{;}
2319 Each pair of @var{indent} and @var{width} values is a dimension
2320 specifying how far to indent and how wide to make the line.
2321 The indentation and width of successive lines are specified by
2322 the successive pairs of dimensions. The last pair of
2323 dimensions will define the characeristics of all lines beyond
2324 those explicitly specified.
2327 @item \stylesheet declaration. Its syntax is
2329 \stylesheet @var{alist}
2332 See @file{font.scm} for details of @var{alist}.
2335 @c. {Paper variables}
2336 @node Paper variables
2337 @subsection Paper variables
2338 @cindex Paper variables
2340 The paper block has some variables you may want to use or change:
2343 @cindex @code{indent}
2345 The indentation of the first line of music.
2346 @cindex @code{staffspace}
2348 @item @code{staffspace}
2349 The distance between two staff lines, calculated from the center
2350 of the lines. You should use either this or @code{rulethickness}
2351 as a unit for distances you modify.
2353 @cindex @code{linewidth}
2354 @item @code{linewidth}
2355 Sets the width of the lines. If set to -1.0, a single
2356 unjustified line is produced. If you use this variable, you
2357 probably want to define it in staff spaces, ie
2359 linewidth = 30 * \staffspace;
2361 @cindex @code{textheight}
2363 @item @code{textheight}
2364 Sets the total height of the music on each page. Only used by
2366 @cindex @code{interscoreline}
2368 @item @code{interscoreline}
2369 Sets the spacing between the score lines. Defaults to 16 pt.
2370 @cindex @code{interscorelinefill}
2372 @item @code{interscorelinefill}
2373 If set to a positive number, the distance between the score
2374 lines will stretch in order to fill the full page. In that
2375 case @code{interscoreline} specifies the minimum spacing.
2377 @cindex @code{stafflinethickness}
2379 @item @code{stafflinethickness}
2380 Determines the thickness of staff lines, and also acts as a scaling
2381 parameter for other line thicknesses.
2387 @subsection Font size
2390 The Feta font provides musical symbols at six different sizes. These
2391 fonts are 11 point, 13 point, 16 point, 20 point,
2392 23 point, and 26 point. The point size of a font is the
2393 height of the five lines in a staff when displayed in the font.
2395 Definitions for these sizes are the files @file{paperSZ.ly}, where
2396 @code{SZ} is one of 11, 13, 16, 20, 23 and 26. If you include any of
2397 these files, the identifiers @code{paperEleven}, @code{paperThirteen},
2398 @code{paperSixteen}, @code{paperTwenty}, @code{paperTwentythree}, and
2399 @code{paperTwentysix} are defined respectively. The default
2400 @code{\paper} block is also set.
2402 The font definitions are generated using a Scheme function. For more
2403 details, see the file @file{font.scm}.
2409 @subsection Paper size
2414 @cindex @code{papersize}
2416 To change the paper size, you must first set the
2417 @code{papersize} variable at top level. Set it to
2418 the strings @code{a4}, @code{letter}, or @code{legal}. After this
2419 specification, you must set the font as described above. If you want
2420 the default font, then use the 20 point font. The new paper size will
2421 not take effect if the font is not loaded and selected afterwards.
2425 \include "paper16.ly"
2429 \paper @{ \paperSixteen @}
2433 The file "paper16.ly" will now include a file named @file{a4.ly}, which
2434 will set the paper variables @code{hsize} and @code{vsize} (used by
2445 @subsection Line break
2449 @cindex @code{\penalty}
2452 \penalty @var{int} @code{;}
2455 Discourage or encourage line breaks. See @ref{Page layout}.
2461 @cindex breaking lines
2463 Line breaks are normally computed automatically. They are chosen such
2464 that the resulting spacing has low variation, and looks neither cramped
2467 Occasionally you might want to override the automatic breaks; you can do
2468 this by specifying @code{\break} (see also @ref{Pre-defined
2469 Identifiers}). This will force a line break at this point. Do remember
2470 that line breaks can only occur at places where there are barlines. If
2471 you want to have a line break where there is no barline, you can force a
2472 barline by entering @code{\bar "";}.
2479 @subsection Page break
2483 Not implemented, but see @ref{Tricks}
2485 Page breaks are normally computed by @TeX{}, so they are not under direct
2486 control. However, you can insert a commands into the .tex output to
2487 instruct @TeX{} where to break pages. For more details, see the
2488 example file @file{input/test/between-systems.ly}
2492 @cindex breaking pages
2504 * MIDI instrument names::
2510 @subsection MIDI block
2514 The MIDI block is analogous to the paper block, but it is somewhat
2515 simpler. The @code{\midi} block can contain:
2519 @item a @code{\tempo} definition
2520 @item context definitions
2523 Assignments in the @code{\midi} block are not allowed.
2527 @cindex context definition
2529 Context definitions follow precisely the same syntax as within the
2530 \paper block. Translation modules for sound are called performers.
2531 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2534 @c. {MIDI instrument names}
2535 @node MIDI instrument names
2536 @subsection MIDI instrument names
2537 @cindex instrument names
2538 @cindex @code{Staff.midiInstrument}
2539 @cindex @code{Staff.instrument}
2541 The MIDI instrument name is set by the @code{Staff.midiInstrument}
2542 property or, if that property is not set, the @code{Staff.instrument}
2543 property. The instrument name should be chosen from the following list.
2544 If the selected string does not exactly match, then LilyPond uses the
2547 [FIXME: to appendix ]
2551 "acoustic grand" "contrabass" "lead 7 (fifths)"
2552 "bright acoustic" "tremolo strings" "lead 8 (bass+lead)"
2553 "electric grand" "pizzicato strings" "pad 1 (new age)"
2554 "honky-tonk" "orchestral strings" "pad 2 (warm)"
2555 "electric piano 1" "timpani" "pad 3 (polysynth)"
2556 "electric piano 2" "string ensemble 1" "pad 4 (choir)"
2557 "harpsichord" "string ensemble 2" "pad 5 (bowed)"
2558 "clav" "synthstrings 1" "pad 6 (metallic)"
2559 "celesta" "synthstrings 2" "pad 7 (halo)"
2560 "glockenspiel" "choir aahs" "pad 8 (sweep)"
2561 "music box" "voice oohs" "fx 1 (rain)"
2562 "vibraphone" "synth voice" "fx 2 (soundtrack)"
2563 "marimba" "orchestra hit" "fx 3 (crystal)"
2564 "xylophone" "trumpet" "fx 4 (atmosphere)"
2565 "tubular bells" "trombone" "fx 5 (brightness)"
2566 "dulcimer" "tuba" "fx 6 (goblins)"
2567 "drawbar organ" "muted trumpet" "fx 7 (echoes)"
2568 "percussive organ" "french horn" "fx 8 (sci-fi)"
2569 "rock organ" "brass section" "sitar"
2570 "church organ" "synthbrass 1" "banjo"
2571 "reed organ" "synthbrass 2" "shamisen"
2572 "accordion" "soprano sax" "koto"
2573 "harmonica" "alto sax" "kalimba"
2574 "concertina" "tenor sax" "bagpipe"
2575 "acoustic guitar (nylon)" "baritone sax" "fiddle"
2576 "acoustic guitar (steel)" "oboe" "shanai"
2577 "electric guitar (jazz)" "english horn" "tinkle bell"
2578 "electric guitar (clean)" "bassoon" "agogo"
2579 "electric guitar (muted)" "clarinet" "steel drums"
2580 "overdriven guitar" "piccolo" "woodblock"
2581 "distorted guitar" "flute" "taiko drum"
2582 "guitar harmonics" "recorder" "melodic tom"
2583 "acoustic bass" "pan flute" "synth drum"
2584 "electric bass (finger)" "blown bottle" "reverse cymbal"
2585 "electric bass (pick)" "skakuhachi" "guitar fret noise"
2586 "fretless bass" "whistle" "breath noise"
2587 "slap bass 1" "ocarina" "seashore"
2588 "slap bass 2" "lead 1 (square)" "bird tweet"
2589 "synth bass 1" "lead 2 (sawtooth)" "telephone ring"
2590 "synth bass 2" "lead 3 (calliope)" "helicopter"
2591 "violin" "lead 4 (chiff)" "applause"
2592 "viola" "lead 5 (charang)" "gunshot"
2593 "cello" "lead 6 (voice)"
2604 @cindex beats per minute
2605 @cindex metronome marking
2607 @cindex @code{\tempo}
2609 \tempo @var{duration} = @var{perminute} @code{;}
2612 Used to specify the tempo. For example, @code{\tempo 4 = 76;} requests
2613 output with 76 quarter notes per minute.
2621 @section Music entry
2624 * Pre-defined Identifiers::
2628 @c. {Pre-defined Identifiers}
2629 @node Pre-defined Identifiers
2630 @subsection Pre-defined Identifiers
2631 @cindex pre-defined identifiers
2634 Various identifiers are defined in the initialization files to
2635 provide shorthands for some settings. Most of them are in
2636 @file{ly/declarations.ly} and @file{ly/property.ly}.
2639 @cindex @code{\break}
2641 Force a line break in music by using a large argument for the
2642 keyword @code{\penalty}.
2644 @cindex @code{\nobreak}
2645 @item @code{\nobreak}
2646 Prevent a line break in music by using a large negative argument
2647 for the keyword @code{\penalty}.
2649 @cindex @code{\shiftOff}
2650 @item @code{\shiftOff}
2651 Disable horizontal shifting of note heads that collide.
2653 @cindex @code{\shiftOn}
2654 @item @code{\shiftOn}
2655 Enable note heads that collide with other note heads to be
2656 shifted horiztonally. Also @code{\shiftOnn} and @code{\shiftOnnn}
2657 set different shift values.
2659 @cindex @code{\stemBoth}
2660 @item @code{\stemBoth}
2661 Allow stems, beams, and slurs to point either upwards or
2662 downwards, decided automatically by LilyPond.
2664 @cindex @code{\stemDown}
2665 @item @code{\stemDown}
2666 Force stems, beams, and slurs to point down.
2668 @cindex @code{\stemUp}
2669 @item @code{\stemUp}
2670 Force stems, beams and slurs to point up.
2675 @c. {Point and click}
2676 @node Point and click
2677 @subsection Point and click
2686 * Context definitions::
2687 * Notation Contexts::
2690 @c. {Context definitions}
2691 @node Context definitions
2692 @subsection Context definitions
2694 @cindex context definition
2695 @cindex translator definition
2696 @cindex engraver hacking
2699 A notation contexts is defined by the following information
2704 @item The LilyPond modules that do the actual conversion of music to
2705 notation. Each module is a so-called
2710 @item How these modules should cooperate, i.e. which ``cooperation
2711 module'' should be used. This cooperation module is a special
2714 @item What other contexts the context can contain,
2716 @item What properties are defined.
2719 A context definition has this syntax:
2723 \translator @code{@{}
2724 @var{translatorinit} @var{translatormodifierlist}
2728 @var{translatorinit} can be an identifier or of the form
2732 \type @var{typename} @code{;}
2735 @var{typename} is one of
2738 @cindex @code{Engraver_group_engraver}
2739 @item @code{Engraver_group_engraver}
2740 The standard cooperation engraver.
2741 @cindex @code{Score_engraver}
2743 @item @code{Score_engraver}
2744 This is cooperation module that should be in the top level context.
2745 @cindex @code{Grace_engraver_group}
2747 @item @code{Grace_engraver_group}
2748 This is a special cooperation module (resembling
2749 @code{Score_engraver}) that is used to created an embedded
2753 @var{translatormodifierlist} is a list of items where each item is
2757 @item @code{\consists} @var{engravername} @code{;}
2758 Add @var{engravername} to the list of modules in this context.
2759 The order of engravers added with @code{\consists} is
2762 @item @code{\consistsend} @var{engravername} @code{;}
2763 Analogous to @code{\consists}, but makes sure that
2764 @var{engravername} is always added to the end of the list of
2767 Some engraver types need to be at the end of the list; this
2768 insures they are put there, and stay there, if a user adds or
2769 removes engravers. This command is usually not needed for
2772 @item @code{\accepts} @var{contextname} @code{;}
2773 Add @var{contextname} to the list of context this context can
2774 contain. The first listed context is the context to create by
2777 @item @code{\denies}. The opposite of @code{\accepts}. Added for
2778 completeness, but is never used in practice.
2781 @item @code{\remove} @var{engravername} @code{;}
2782 Remove a previously added (with @code{\consists}) engraver.
2784 @item @code{\name} @var{contextname} @code{;}
2785 This sets name of the context, e.g. @code{Staff}, @code{Voice}. If
2786 the name is not specified, the translator won't do anything.
2788 @item @var{propname} @code{=} @var{value} @code{;}
2789 A property assignment. It is allowed to use reals for
2793 In the @code{\paper} block, it is also possible to define translator
2794 identifiers. Like other block identifiers, the identifier can only
2795 be used as the very first item of a translator. In order to define
2796 such an identifier outside of @code{\score}, you must do
2802 foo = \translator @{ @dots{} @}
2809 \translator @{ \foo @dots{} @}
2817 @cindex paper types, engravers, and pre-defined translators
2819 Some pre-defined identifiers can simplify modification of
2820 translators. The pre-defined identifiers are:
2823 @cindex @code{StaffContext}
2824 @item @code{StaffContext}
2825 Default Staff context.
2826 @cindex @code{RhythmicStaffContext}
2828 @item @code{RhythmicStaffContext}
2829 Default RhythmicStaff context.
2830 @cindex @code{VoiceContext}
2832 @item @code{VoiceContext}
2833 Default Voice context.
2834 @cindex @code{ScoreContext}
2836 @item @code{ScoreContext}
2837 Default Score context.
2838 @cindex @code{ScoreWithNumbers}
2840 @item @code{ScoreWithNumbers}
2841 Score context with numbering at the Score level.
2842 @cindex @code{BarNumberingStaffContext}
2844 @item @code{BarNumberingStaffContext}
2845 Staff context with numbering at the Staff level.
2846 @cindex @code{HaraKiriStaffContext}
2848 @item @code{HaraKiriStaffContext}
2849 Staff context that does not print if it only contains rests.
2850 Useful for orchestral scores.@footnote{Harakiri, also called
2851 Seppuku, is the ritual suicide of the Japanese Samourai warriors.}
2852 @cindex @code{OrchestralPartStaffContext}
2854 @item @code{OrchestralPartStaffContext}
2855 @cindex @code{OrchestralScoreContext}
2857 @item @code{OrchestralScoreContext}
2860 Using these pre-defined values, you can remove or add items to the
2869 \remove Some_engraver;
2870 \consists Different_engraver;
2880 @c. {Notation Contexts}
2881 @node Notation Contexts
2882 @subsection Notation Contexts
2884 @cindex notation contexts
2886 Notation contexts are objects that only exist during a run of
2887 LilyPond. During the interpretation phase of LilyPond, the Music
2888 expression contained in a @code{\score} block is interpreted in time
2889 order. This is the order in which humans read, play, and write
2892 A context is an object that holds the reading state of the
2893 expression; it contains information like
2896 @item What notes are playing at this point?
2897 @item What symbols will be printed at this point?
2898 @item In what style will they printed?
2899 @item What is the current key signature, time signature, point within
2903 Contexts are grouped hierarchically: A @code{Voice} context is
2904 contained in a @code{Staff} context (because a staff can contain
2905 multiple voices at any point), a @code{Staff} context is contained in
2906 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
2907 these can all contain multiple staffs).
2909 Contexts associated with sheet music output are called @emph{notation
2910 contexts}, those for sound output are called performance contexts.
2912 Contexts are created either manually or automatically. Initially, the
2913 top level music expression is interpreted by the top level context (the
2914 @code{Score} context). When a atomic music expression (i.e. a note, a
2915 rest, etc.), a nested set of contexts is created that can process these
2916 atomic expressions, as in this example:
2919 \score @{ \notes @{ c4 @} @}
2922 The sequential music, `@code{@{ c4 @}}' is interpreted by @code{Score}
2923 context. When the note @code{c4} itself is interpreted, a set of
2924 contexts is needed that will accept notes. The default for this is a
2925 @code{Voice} context, contained in a @code{Staff} context. Creation of
2926 these contexts results in the staff being printed.
2930 You can also create contexts manually, and you probably have to do so
2931 if you want to typeset complicated multiple part material. If a
2932 `@code{\context} @var{name} @var{musicexpr}' expression is encountered
2933 during the interpretation phase, the @var{musicexpr} argument will be
2934 interpreted with a context of type @var{name}. If you specify a name,
2935 the specific context with that name is searched.
2939 If a context of the specified type and name can not be found, a new
2940 one is created. For example,
2946 \notes \relative c'' {
2947 c4 <d4 \context Staff = "another" e4> f
2954 In this example, the @code{c} and @code{d} are printed on the
2955 default staff. For the @code{e}, a context Staff called
2956 @code{another} is specified; since that does not exist, a new
2957 context is created. Within @code{another}, a (default) Voice context
2958 is created for the @code{e4}. When all music referring to a
2959 context is finished, the context is ended as well. So after the
2960 third quarter, @code{another} is removed.
2962 Almost all music expressions inherit their interpretation context
2963 from their parent. In other words, suppose that the syntax for a
2968 \keyword @var{musicexpr1} @var{musicexpr2} @dots{}
2971 When the interpretation of this music expression starts, the context
2972 for @var{musicexpr1}, @var{musicexpr2}, etc. is that of the total
2975 Lastly, you may wonder, why this:
2981 \notes \relative c'' @{
2989 doesn't result in this:
2994 \notes \relative c'' {
3001 For the @code{c4}, a default @code{Staff} (with a contained
3002 @code{Voice}) context is created. After the @code{c4} ends, no
3003 music refers to this default staff, so it would be ended, with the
3004 result shown. To prevent this inconvenient behavior, the context to
3005 which the sequential music refers is adjusted during the
3006 interpretation. So after the @code{c4} ends, the context of the
3007 sequential music is also the default @code{Voice} context.
3008 The @code{d4} gets interpreted in the same context
3011 Properties that are set in one context are inherited by all of the
3012 contained contexts. This means that a property valid for the
3013 @code{Voice} context can be set in the @code{Score} context (for
3014 example) and thus take effect in all @code{Voice} contexts.
3016 Properties can be preset within the @code{\translator} block
3017 corresponding to the appropriate context. In this case, the syntax
3021 @var{propname} @code{=} @var{value}
3024 This assignment happens before interpretation starts, so a
3025 @code{\property} expression will override any predefined settings.
3027 The property settings are used during the interpretation phase. They
3028 are read by the LilyPond modules where interpretation contexts are
3029 built of. These modules are called @emph{translators}. Translators for
3030 notation are called @emph{engravers}, and translators for sound are
3031 called @emph{performers}.
3037 @section Lexer innards
3038 @cindex Lexer innards
3050 @subsection Top level
3053 This section describes what you may enter at top level.
3056 @unnumberedsubsec Score definition
3057 @cindex score definition
3059 The output is generated combining a music expression with an output
3060 definition. A score block has the following syntax:
3063 \score @{ @var{musicexpr} @var{outputdefs} @}
3066 @var{outputdefs} are zero or more output definitions. If no output
3067 definition is supplied, the default @code{\paper} block will be added.
3071 @subsubsection Score
3075 @subsubsection Paper
3083 @subsubsection Header
3085 @cindex @code{\header}
3090 \header @{ @var{key1} = @var{val1};
3091 @cindex @code{ly2dvi}
3092 @var{key2} = @var{val2}; @dots{} @}
3096 A header describes the file's contents. It can also appear in a
3097 @code{\score} block. Tools like @code{ly2dvi} can use this
3098 information for generating titles. Key values that are used by
3099 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
3100 metre, arranger, piece and tagline.
3102 It is customary to put the @code{\header} at the top of the file.
3104 @subsubsection Default output
3106 A @code{\midi} or @code{\paper} block at top-level sets the default
3108 paper block for all scores that lack an explicit paper block.
3112 @subsection Identifiers
3115 All of the information in a LilyPond input file, is represented as a
3116 Scheme value. In addition to normal Scheme data types (such as pair,
3117 number, boolean, etc.), LilyPond has a number of specialized data types,
3122 @item Music: see @ref{Music expressions}
3124 @item Translator_def:
3125 See section @ref{contextdefs} for more information
3129 @item Music_output_def
3130 @item Moment (rational number)
3133 LilyPond also includes some transient object types. Objects of these
3134 types are built during a LilyPond run, and do not `exist' per se within
3135 your input file. These objects are created as a result of your input
3136 file, so you can include commands in the input to manipulate them,
3137 during a lilypond run.
3140 @item Grob: short for Graphical object. See @ref{Grobs}.
3141 @item Molecule: device-independent page output object,
3142 including dimensions. Produced by some Grob functions
3144 @item Translator: object that produces audio objects or Grobs. This is
3145 not yet user accessible.
3146 @item Font_metric: object representing a font. (See @ref{Font metrics})
3153 @subsection Assignments
3156 Identifiers allow objects to be assigned to names during the parse
3157 stage. To assign an identifier, you use @var{name}@code{=}@var{value}
3158 and to refer to an identifier, you preceed its name with a backslash:
3159 `@code{\}@var{name}'. @var{value} is any valid Scheme value or any of
3160 the input-types listed above. Identifier assignments can appear at top
3161 level in the LilyPond file, but also in @code{\paper} blocks.
3163 Semicolons are forbidden after top level assignments, but mandatory in
3164 other places. The rules about semicolons and assignments are very
3165 confusing, but when LilyPond input evolves more towards Scheme, we hope
3166 that this problem will grow smaller.
3168 An identifier can be created with any string for its name, but you will
3169 only be able to refer to identifiers whose names begin with a letter,
3170 being entirely alphanumeric. It is impossible to refer to an identifier
3171 whose name is the same as the name of a keyword.
3173 The right hand side of an identifier assignment is parsed completely
3174 before the assignment is done, so it is allowed to redefine an
3175 identifier in terms of its old value, e.g.
3181 When an identifier is referenced, the information it points to is
3182 copied. For this reason, an identifier reference must always be the
3183 first item in a block.
3187 \paperIdent % wrong and invalid
3191 \paperIdent % correct
3198 @c. {Lexical details}
3199 @node Lexical details
3200 @subsection Lexical details
3201 @cindex Lexical details
3206 @subsubsection Comments
3212 A one line comment is introduced by a @code{%} character.
3213 Block comments are started by @code{%@{} and ended by `@code{%@}}'.
3214 They cannot be nested.
3217 @subsubsection Direct Scheme
3220 @cindex Scheme, in-line code
3223 LilyPond contains a Scheme interpreter (the GUILE library) for
3224 internal use. In some places Scheme expressions also form valid syntax:
3225 whereever it is allowed,
3229 evaluates the specified Scheme code. If this is used at toplevel, then
3230 the result is discarded. Example:
3232 \property Staff.TestObject \override #'foobar = #(+ 1 2)
3235 @code{\override} expects two Scheme expressions, so there are two Scheme
3236 expressions. The first one is a symbol (@code{foobar}), the second one
3237 an integer (namely, 3).
3239 Scheme is a full-blown programming language, and a full discussion is
3240 outside the scope of this document. Interested readers are referred to
3241 the website @uref{http://www.schemers.org/} for more information on
3246 @subsubsection Keywords
3250 Keywords start with a backslash, followed by a number of lower case
3251 alphabetic characters. These are all the keywords.
3254 apply arpeggio autochange spanrequest commandspanrequest
3255 simultaneous sequential accepts alternative bar breathe
3256 char chordmodifiers chords clef cm consists consistsend
3257 context denies duration dynamicscript elementdescriptions
3258 font grace header in lyrics key mark pitch
3259 time times midi mm name pitchnames notes outputproperty
3260 override set revert partial paper penalty property pt
3261 relative remove repeat addlyrics partcombine score
3262 script stylesheet skip textscript tempo translator
3267 @subsubsection Integers
3275 Formed from an optional minus sign followed by digits. Arithmetic
3276 operations cannot be done with integers, and integers cannot be mixed
3280 @subsubsection Reals
3281 @cindex real numbers
3287 Formed from an optional minus sign and a sequence of digits followed
3288 by a @emph{required} decimal point and an optional exponent such as
3289 @code{-1.2e3}. Reals can be built up using the usual operations:
3290 `@code{+}', `@code{-}', `@code{*}', and
3291 `@code{/}', with parentheses for grouping.
3299 A real constant can be followed by one of the dimension keywords:
3300 @code{\mm} @code{\pt}, @code{\in}, or @code{\cm}, for millimeters,
3301 points, inches and centimeters, respectively. This converts the number
3302 to a real that is the internal representation of dimensions.
3306 @subsubsection Strings
3310 Begins and ends with the @code{"} character. To include a @code{"}
3311 character in a string write @code{\"}. Various other backslash
3312 sequences have special interpretations as in the C language. A string
3313 that contains no spaces can be written without the quotes. See
3314 @ref{Lexical modes} for details on unquoted strings; their interpretation varies
3315 depending on the situation. Strings can be concatenated with the
3318 The tokenizer accepts the following commands. They have no grammatical
3319 function, hence they can appear anywhere in the input.
3323 @subsubsection Main input
3326 @cindex @code{\maininput}
3328 The @code{\maininput} command is used in init files to signal that the
3329 user file must be read. This command cannot be used in a user file.
3331 @c. {File inclusion}
3332 @subsubsection Main input
3335 @subsubsection File inclusion
3336 @cindex @code{\include}
3338 \include @var{filename}
3341 Include @var{filename}. The argument @var{filename} may be a quoted string (an
3342 unquoted string will not work here!) or a string identifier. The full
3343 filename including the @file{.ly} extension must be given,
3345 @subsubsection Version information
3346 @cindex @code{\version}
3348 \version @var{string} ;
3351 Specify the version of LilyPond that a file was written for. The
3352 argument is a version string in quotes, for example @code{"1.2.0"}.
3353 This is used to detect invalid input, and to aid
3354 @code{convert-ly} a tool that automatically upgrades input files. See
3355 See @ref{convert-ly} for more information on @code{convert-ly}.
3363 @subsubsection Pitch names
3364 @cindex Lexical modes
3368 @cindex chord modifier names
3370 Note names and chord modifiers can be customised for nationalities.
3371 languages and conventions. The syntax is as follows.
3372 @cindex @code{\pitchnames}
3373 @cindex @code{\chordmodifiers}
3376 \pitchnames @var{scheme-alist}
3377 \chordmodifiers @var{scheme-alist}
3380 See @file{ly/nederlands.ly} and @file{ly/chord-modifiers.ly} for
3381 specific examples how to do this. tables can be tailored specified
3382 using. Some national note names have been provided, see
3383 section @ref{Other languages}.
3384 A @code{\paper} block at top level sets the default paper block. A
3385 @code{\midi} block at top level works similarly.
3388 @subsubsection Assignments
3392 Identifier assignments may appear at top level. @ref{Assignments}
3397 @subsubsection Direct scheme
3398 @cindex Direct scheme
3400 Scheme statements maybe issued to produce interesting side-effects.
3405 @subsection Lexical modes
3406 @cindex Lexical modes
3408 @cindex Lexical modes
3411 To simplify entering notes, lyrics, and chords, LilyPond has three
3412 special input modes on top of the default mode. In each mode, words
3413 are identified on the input. If @code{"word"} is encountered, it is
3414 treated as a string. If @code{\word} is encountered, it is treated as
3415 a keyword or as an identifier. The behavior of the modes differs in
3416 two ways: Different modes treat unquoted words differently, and
3417 different modes have different rules for deciding what is a word.
3423 At the start of parsing, LilyPond is in Normal mode. In Normal
3424 mode, a word is an alphabetic character followed by alphanumeric
3425 characters. If @code{word} is encountered on the input it is
3426 treated as a string.
3429 See @ref{Note entry}.
3432 See @ref{Lyrics entry}.
3435 See @ref{Chord entry}.
3442 @cindex @code{\notes}
3443 @cindex @code{\chords}
3444 @cindex @code{\lyrics}
3446 Mode switching keywords form compound music expressions: @code{\notes}
3447 @var{musicexpr}, @code{\chords} @var{musicexpr},
3448 and @code{\lyrics} @var{musicexpr}. These
3449 expressions do not add anything to the meaning of their arguments. They
3450 are just a way to indicate that the arguments should be parsed in
3451 indicated mode. See @ref{Lexical modes} for more information on modes.
3455 @subsection Ambiguities
3460 The grammar contains a number of ambiguities. We hope to resolve them at
3464 @item The assignment
3470 can be interpreted as making a string identifier @code{\foo}
3471 containing @code{"bar"}, or a music identifier @code{\foo}
3472 containing the syllable `bar'.
3474 @item The assignment
3480 can be interpreted as making an integer identifier
3481 containing -6, or a Request identifier containing the
3482 fingering `6' (with neutral direction).
3484 @item If you do a nested repeat like
3496 then it is ambiguous to which @code{\repeat} the
3497 @code{\alternative} belongs. This is the classic if-then-else
3498 dilemma. It may be solved by using braces.
3500 @item (an as yet unidentified ambiguity :-)
3516 @unnumberedsubsec Translation property
3518 @cindex @code{\property}
3520 \property @var{contextname}.@var{propname} = @var{value}
3523 Sets the @var{propname} property of the context @var{contextname} to
3524 the specified @var{value}. All three arguments are strings.
3525 Depending on the context, it may be necessary to quote the strings or
3526 to leave space on both sides of the dot.
3528 @cindex translator switches
3529 @unnumberedsubsec Translator switches
3531 @cindex @code{\translator}
3533 \translator @var{contexttype} = @var{name}
3536 A music expression indicating that the context which is a direct
3537 child of the a context of type @var{contexttype} should be shifted to
3538 a context of type @var{contexttype} and the specified name.
3540 Usually this is used to switch staffs in Piano music, e.g.
3543 \translator Staff = top @var{Music}
3547 @cindex output properties
3548 @unnumberedsubsec Output properties
3550 These allow you to tweak what is happening in the back-end
3551 directly. If you want to control every detail of the output
3552 formatting, this is the feature to use. The downside to this is that
3553 you need to know exactly how the backend works. Example:
3556 @lilypond[fragment,verbatim]
3558 \context Staff \outputproperty
3559 #(make-type-checker 'note-head-interface)
3560 #'extra-offset = #'(5.0 . 7.5)
3564 This selects all note heads occurring at current staff level, and sets
3565 the @code{extra-offset} of those heads to @code{(5,7.5)}, shifting them
3568 Use of this feature is entirely on your own risk: if you use this, the
3569 result will depend very heavily on the implementation of the backend,
3570 which we change regularly and unscrupulously.
3573 @c.{Local emacs vars}
3576 @c minor-mode: font-lock
3577 @c minor-mode: outline
3578 @c outline-layout: (-1 : 0)
3579 @c outline-use-mode-specific-leader: "@c\."
3580 @c outline-primary-bullet: "{"
3581 @c outline-stylish-prefixes: nil
3582 @c outline-override-protect: t