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
10 @chapter Reference Manual
16 * Note specification::
33 describes the the GNU LilyPond input format This format represents a
34 piece of music in an elegant way, but contains enough information for
35 both automatic typesetting and automatic performances.
37 This document has been revised for LilyPond 1.3.125
41 There are two things to note here. The format contains musical
42 concepts like pitches and durations, instead of symbols and positions:
43 the input format tries to capture the meaning of @emph{music}, and not
44 notation. Second, the format tries to be @emph{context-free}:
45 a note will sound the same regardless of the current time signature,
48 The purpose of LilyPond is explained informally by the term `music
49 typesetter'. This is not a fully correct name: not only does the
50 program print musical symbols, it also makes esthetic decisions. All
51 symbols and their placement is @emph{generated} from a high-level musical
52 description. In other words, LilyPond would be best
53 described by `music compiler' or `music to notation compiler'.
55 LilyPond input can be classified into three types:
57 @item musical expressions: a musical expression is some combination of
59 @item output definitions: recipes for translating those musical
60 expressions into performances (MIDI) or graphics (eg. PostScript).
62 @item declarations: by declaring and naming musical expressions, you
63 can enter and edit them in manageable chunks.
67 @c_ {Music constructs}
68 @node Music constructs
69 @section Music constructs
70 @cindex Music constructs
74 * Simultanious music::
75 * Compound music expressions::
77 * Explicit atomic music::
80 @c_ {Music expressions}
81 @node Music expressions
82 @subsection Music expressions
84 @cindex music expressions
86 Music in LilyPond is entered as a music expression. Notes, rests,
87 lyric syllables are music expressions (the atomic
89 @cindex atomic music expressions
90 and you can combine music expressions to form new ones. This example
91 forms a compound expressions out of the quarter @code{c} note and a
95 \sequential @{ c4 d4 @}
98 The meaning of this compound expression is to play the @code{c}
99 first, and then the @code{d} (as opposed to playing them
100 simultaneously, for instance).
102 Atomic music expression are discussed in
103 subsection @ref{Atomic music expressions}. Compound music expressions are
104 discussed in subsection @ref{Compound music expressions}.
107 @c_ {Sequential music}
108 @node Sequential music
109 @subsection Sequential music
110 @cindex Sequential music
111 @cindex @code{\sequential}
112 @cindex sequential music
115 \sequential @code{@{} @var{musicexprlist} @code{@}}
118 This means that list should be played or written in sequence, i.e.,
119 the second after the first, the third after the second. The duration
120 of sequential music is the the sum of the durations of the elements.
121 There is a shorthand, which leaves out the keyword:
127 @code{@{} @var{musicexprlist} @code{@}}
130 @c_ {Simultanious music}
131 @node Simultanious music
132 @subsection Simultanious music
133 @cindex Simultanious music
134 @cindex @code{\simultaneous}
137 \simultaneous @code{@{} @var{musicexprlist} @code{@}}
140 It constructs a music expression where all of its arguments start at
141 the same moment. The duration is the maximum of the durations of the
142 elements. The following shorthand is a common idiom:
145 @code{<} @var{musicexprlist} @code{>}
148 If you try to use a chord as the first thing in your score, you might
149 get multiple staffs instead of a chord.
151 @lilypond[verbatim,center]
160 This happens because the chord is interpreted by a score context.
161 Each time a note is encountered a default Voice context (along with a
162 Staff context) is created. The solution is to explicitly instantiate
165 @lilypond[verbatim,center]
167 \notes\context Voice <c''4 e''>
174 @c_ {Compound music expressions}
175 @node Compound music expressions
176 @subsection Compound music expressions
178 @cindex Compound music expressions
180 Music expressions are compound data structures. You can nest music
181 expressions any way you like. This simple example shows how three
182 chords can be expressed in two different ways:
184 @lilypond[fragment,verbatim,center]
185 \notes \context Staff {
186 <a c'> <b d' > <c' e'>
187 < { a b c' } { c' d' e' } >
192 @cindex @code{\context}
193 @cindex context selection
196 \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
199 Interpret @var{musicexpr} within a context of type @var{contexttype}.
200 If the context does not exist, it will be created. The new context
201 can optionally be given a name.
204 @c_ {Grace music} <-> Grace notes
206 @subsection Grace music
208 @cindex @code{\grace}
211 @cindex @code{graceAlignPosition}
214 \grace @var{musicexpr}
217 A grace note expression has duration 0; the next real note is
218 assumed to be the main note.
220 You cannot have the grace note after the main note, in terms of
221 duration, and main notes, but you can typeset the grace notes to the
222 right of the main note using the property
223 @code{graceAlignPosition}.
224 @cindex @code{flagStyle}
226 When grace music is interpreted, a score-within-a-score is set up:
227 @var{musicexpr} has its own time bookkeeping, and you could (for
228 example) have a separate time signature within grace notes. While in
229 this score-within-a-score, you can create notes, beams, slurs, etc.
230 Unbeamed eighth notes and shorter by default have a slash through the
231 stem. This behavior can be controlled with the
232 @code{flagStyle} property.
235 @lilypond[fragment,verbatim]
237 \grace c8 c4 \grace { [c16 c16] } c4
238 \grace { \property Grace.flagStyle = "" c16 } c4
243 @cindex @code{\grace}
245 At present, nesting @code{\grace} notes is not supported. The following
246 may cause run-time errors:
248 @code{\grace @{ \grace c32 c16 @} c4}
250 Since the meaning of such a construct is unclear, we don't consider
251 this a loss. Similarly, juxtaposing two @code{\grace} sections is
252 syntactically valid, but makes no sense and may cause runtime errors.
254 Ending a staff or score with grace notes may also generate a run-time
255 error, since there will be no main note to attach the grace notes to.
257 The present implementation is not robust and generally kludgy. We expect
258 it to change after LilyPond 1.4
261 @c_ {Explicit atomic music}
262 @node Explicit atomic music
263 @subsection Explicit atomic music
264 @cindex Explicit atomic music
269 The syntax for pitch specification is
271 @cindex @code{\pitch}
273 \pitch @var{scmpitch}
276 @var{scmpitch} is a pitch scheme object, see @ref{Pitch}.
278 In Note and Chord mode, pitches may be designated by names. See
279 section @ref{Other languages} for pitch names in different languages.
282 @cindex @code{\duration}
284 The syntax for duration specification is
286 \duration @var{scmduration}
289 In Note, Chord, and Lyrics mode, durations may be designated by
295 @c_ {Modifying music}
296 @node Modifying music
297 @section Modifying music
298 @cindex Modifying music
311 @cindex relative octave specification
313 It is easy to get confused by octave changing marks and accidentally
314 putting a pitch in the wrong octave. A much better way of entering a
315 note's octave is `the relative octave' mode.
317 @cindex @code{\relative}
319 \relative @var{startpitch} @var{musicexpr}
322 The octave of notes that appear in @var{musicexpr} are calculated as
323 follows: If no octave changing marks are used, the basic interval
324 between this and the last note is always taken to be a fourth or
325 less.@footnote{The interval is determined without regarding
326 accidentals. A @code{fisis} following a @code{ceses} will be put above
327 the @code{ceses}.} The octave changing marks @code{'} and @code{,}
328 can then be added to raise or lower the pitch by an extra octave.
329 Upon entering relative mode, an absolute starting pitch must be
330 specified that will act as the predecessor of the first note of
333 Entering scales is straightforward in relative mode.
335 @lilypond[fragment,verbatim,center]
341 And octave changing marks are used for intervals greater than a fourth.
343 @lilypond[fragment,verbatim,center]
348 If the preceding item is a chord, the first note of the chord is used
349 to determine the first note of the next chord. But other notes
350 within the second chord are determined by looking at the immediately
353 @lilypond[fragment,verbatim,center]
360 @cindex @code{\notes}
362 The pitch after the @code{\relative} contains a notename. To parse
363 the pitch as a notename, you have to be in note mode, so there must
364 be a surrounding @code{\notes} keyword (which is not
367 The relative conversion will not affect @code{\transpose} or
368 @code{\relative} sections in its argument. If you want to use
369 relative within transposed music, you must place an additional
370 @code{\relative} inside the @code{\transpose}.
372 It is strongly recommended to use relative pitch mode: less work,
373 less error-prone, and more readable.
377 @subsection Transpose
379 @cindex transposition of pitches
380 @cindex @code{\transpose}
382 A music expression can be transposed with @code{\transpose}. The syntax
385 \transpose @var{pitch} @var{musicexpr}
388 This means that middle C in @var{musicexpr} is transposed to
391 @code{\transpose} distinguishes between enharmonic pitches: both
392 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
393 a tone. The first version will print sharps and the second version
397 @lilypond[fragment,verbatim]
400 { \key e \major; c d e f }
402 \transpose des'' { \key e \major; c d e f }
403 \transpose cis'' { \key e \major; c d e f }
409 If you want to use both @code{\transpose} and @code{\relative}, then
410 you must use @code{\transpose} first. @code{\relative} will have no
411 effect music that appears inside a @code{\transpose}.
420 [TODO: document #'repeatCommands.]
422 @cindex @code{\repeat}
424 In order to specify repeats, use the @code{\repeat}
425 keyword. Since repeats look and sound differently when played or
426 printed, there are a few different variants of repeats.
430 Repeated music is fully written (played) out. Useful for MIDI
434 This is the normal notation: Repeats are not written out, but
435 alternative endings (voltas) are printed, left to right.
438 Alternative endings are written stacked. Which is unfortunately not
439 practical for anything right now.
445 The syntax for repeats is
448 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
451 If you have alternative endings, you may add
453 @cindex @code{\alternative}
455 \alternative @code{@{} @var{alternative1}
457 @var{alternative3} @dots{} @code{@}}
460 where each @var{alternative} is a Music expression.
462 Normal notation repeats are used like this:
466 @lilypond[fragment,verbatim]
468 \repeat volta 2 { c'4 d' e' f' }
469 \repeat volta 2 { f' e' d' c' }
474 With alternative endings:
478 @lilypond[fragment,verbatim]
480 \repeat volta 2 {c'4 d' e' f'}
481 \alternative { {d'2 d'} {f' f} }
486 Folded repeats look like this:@footnote{Folded repeats offer little
487 more over simultaneous music. However, it is to be expected that
488 more functionality -- especially for the MIDI backend -- will be
493 @lilypond[fragment,verbatim]
495 \repeat fold 2 {c'4 d' e' f'}
496 \alternative { {d'2 d'} {f' f} }
503 @lilypond[fragment,verbatim]
507 \repeat volta 2 { e | c2 d2 | e2 f2 | }
508 \alternative { { g4 g g } { a | a a a a | b1 } }
515 If you don't give enough alternatives for all of the repeats, then
516 the first alternative is assumed to be repeated often enough to equal
517 the specified number of repeats.
520 @lilypond[fragment,verbatim]
523 \repeat volta 3 { \partial 4; e | c2 d2 | e2 f2 | }
524 \alternative { { g4 g g }
525 {\partial 1; e4 e e }
526 {\partial 1; a a a a | b1 } }
532 As you can see, LilyPond doesn't remember the timing information, nor
533 are slurs or ties repeated. We hope to fix this after 1.4.
535 It is possible to nest @code{\repeat}. This is not entirely
536 supported: the notes will come be in the right places, but the repeat
539 To place tremolo marks between notes, use @code{\repeat} with tremolo
541 @cindex tremolo beams
542 To create tremolo beams on a single note, simply attach
543 `@code{:}@var{length}' to the note itself.
545 @lilypond[verbatim,center]
547 \context Voice \notes\relative c' {
548 \repeat "tremolo" 8 { c16 d16 }
549 \repeat "tremolo" 4 { c16 d16 }
550 \repeat "tremolo" 2 { c16 d16 }
553 linewidth = 40*\staffspace;
559 @lilypond[fragment,verbatim,center]
569 Tuplets are made out of a music expression by multiplying their
570 duration with a fraction.
572 @cindex @code{\times}
574 \times @var{fraction} @var{musicexpr}
577 The duration of @var{musicexpr} will be multiplied by the fraction.
578 In print, the fraction's denominator will be printed over the notes,
579 optionally with a bracket. The most common tuplet is the triplet in
580 which 3 notes have the length of 2, so the notes are 2/3 of
581 their written length:
583 @lilypond[fragment,verbatim,center]
584 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
592 Apply allows a Scheme-function to operate directly on the internal
593 representation of music.
595 \apply #@var{func} @var{music}
597 The function takes two arguments, being a function and an musical
598 argument for that function. The function should return a music
601 This example replaces the text string of a script. It also shows a dump
602 of the music it processes.
604 #(define (testfunc x)
605 (if (eq? (ly-get-mus-property x 'text) "foo")
606 (ly-set-mus-property x 'text "bar"))
608 (ly-set-mus-property x 'elements
609 (map testfunc (ly-get-mus-property x 'elements)))
614 \apply #testfunc { c4_"foo" }
618 For more information on what is possible, see the @ref{Tricks} and the
619 automatically generated documentation.
623 @subsection Transform
639 @subsection Notes mode
643 @cindex @code{\notes}
644 Note mode is introduced by the keyword
645 @code{\notes}. In Note mode, words can only
646 contain alphabetic characters. If @code{word} is encountered,
647 LilyPond first checks for a notename of @code{word}. If no
648 notename is found, then @code{word} is treated as a string.
650 Since combinations of numbers and dots are used for indicating
651 durations, it is not possible to enter real numbers in this mode.
658 @subsection Pitch names
660 @node Note specification
661 @section Note specification
662 @cindex Note specification
665 @cindex entering notes
667 A note specification has the form
670 @var{pitch}[@var{octavespec}][!][?][@var{duration}]
673 The pitch of the note is specified by the note's name.
676 The default names are the Dutch note names. The notes are specified
677 by the letters @code{c} through @code{b}, where @code{c} is an
678 octave below middle C and the letters span the octave above that C.
680 @cindex note names, Dutch
681 a sharp is formed by adding @code{-is} to the end of a pitch name. A
682 flat is formed by adding @code{-es}. Double sharps and double flats are
683 obtained by adding @code{-isis} or @code{-eses}. @code{aes} and
684 @code{ees} are contracted to @code{as} and @code{es} in Dutch, but both
685 forms will be accepted.
687 LilyPond has predefined sets of notenames for various other languages.
688 To use them, simply include the language specific init file. For
689 example: @code{\include "english.ly"}. The available language files and
690 the names they define are:
693 Note Names sharp flat
694 nederlands.ly c d e f g a bes b -is -es
695 english.ly c d e f g a bf b -s/-sharp -f/-flat
696 deutsch.ly c d e f g a b h -is -es
697 norsk.ly c d e f g a b h -iss/-is -ess/-es
698 svenska.ly c d e f g a b h -iss -ess
699 italiano.ly do re mi fa sol la sib si -d -b
700 catalan.ly do re mi fa sol la sib si -d/-s -b
705 Pitch names can be redefined using the @code{\pitchnames} command, see
711 The optional octave specification takes the form of a series of
712 single quote (`@code{'}') characters or a series of comma
713 (`@code{,}') characters. Each @code{'} raises the pitch by one
714 octave; each @code{,} lowers the pitch by an octave.
716 @lilypond[fragment,verbatim,center]
717 c' d' e' f' g' a' b' c''
720 @lilypond[fragment,verbatim,center]
721 cis' dis' eis' fis' gis' ais' bis'
724 @lilypond[fragment,verbatim,center]
725 ces' des' es' fes' ges' as' bes'
728 @lilypond[fragment,verbatim,center]
729 cisis' eisis' gisis' aisis' beses'
732 @lilypond[fragment,verbatim,center]
733 ceses' eses' geses' ases' beses'
736 LilyPond will determine what accidentals to typeset depending on the key
737 and context, so alteration refer to what note is heard, not to whether
738 accidentals are printed. A reminder accidental
739 @cindex reminder accidental
741 can be forced by adding an exclamation mark @code{!} after the pitch.
742 A cautionary accidental,
743 @cindex cautionary accidental
745 i.e., an accidental within parentheses can be obtained by adding the
746 question mark `@code{?}' after the pitch.
748 @lilypond[fragment,verbatim,center]
749 cis' d' e' cis' c'? d' e' c'!
757 * Multi measure rests::
765 Rests are entered like notes, with note name `@code{r}'.
766 There is also a note name
767 `@code{s}', which produces a space of the specified
773 @subsection Durations
776 Durations are entered as their reciprocal values. For notes longer
777 than a whole note, use identifiers.
783 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
785 r1 r2 r4 r8 r16 r32 r64 r64
791 \notes \relative c'' {
792 a\longa a\breve \autoBeamOff
793 a1 a2 a4 a8 a16 a32 a64 a64
795 r1 r2 r4 r8 r16 r32 r64 r64
800 \remove "Clef_engraver";
801 \remove "Staff_symbol_engraver";
802 \remove "Time_signature_engraver";
803 \consists "Pitch_squash_engraver";
810 As you can see, the longa is not printed. To get a longa note head, you
811 have to use a different style of note heads. See [TODO].
816 If the duration is omitted then it is set equal to the previous duration
817 entered. At the start of parsing there is no previous duration, so then
818 a quarter note is assumed. The duration can be followed by a dot
819 (`@code{.}') to obtain dotted note lengths.
823 @lilypond[fragment,verbatim,center]
829 You can alter the length of duration by writing `@code{*}@var{fraction}'
830 after it. This will not affect the appearance of note heads or rests.
832 @c_ {Multi measure rests}
833 @node Multi measure rests
834 @subsection Multi measure rests
835 @cindex Multi measure rests
839 Multi_measure_rest are entered using `@code{R}'. It is specifically
840 meant for entering parts: the rest can expand to fill a score with
841 rests, or it can be printed as a single multimeasure rest This expansion
842 is controlled by the property @code{Score.skipBars}. If this is set to true,
843 Lily will not expand empty measures, and the multimeasure rests
844 automatically adds the appropriate number.
847 \time 3/4; R2.*2 \property Score.skipBars = ##t R2.*17 R2.*4
850 Note that there is currently no way to condense multiple rests into a
851 single multimeasure rest.
860 \skip @var{duration} @code{;}
864 Skips the amount of time specified by @var{duration}. If no other
865 music is played, a gap will be left for the skipped time with no
866 notes printed. It works in Note Mode or Lyrics Mode. In Note mode,
867 this has the same effect as the spacer rest.
875 @section Music notation
876 @cindex Music notation
894 @code{\key} @var{pitch} @var{type} @code{;}
896 @cindex @code{\minor}
897 @cindex @code{\major}
898 @cindex @code{\minor}
899 @cindex @code{\ionian}
900 @cindex @code{\locrian}
901 @cindex @code{\aeolian}
902 @cindex @code{\mixolydian}
903 @cindex @code{\lydian}
904 @cindex @code{\phrygian}
905 @cindex @code{\dorian}
907 Change the key signature. @var{type} should be @code{\major} or
908 @code{\minor} to get @var{pitch}-major or @var{pitch}-minor,
909 respectively. The second argument is optional; the default is major
910 keys. The @var{\context} argument can also be given as an integer,
911 which tells the number of semitones that should be added to the pitch
912 given in the subsequent @code{\key} commands to get the corresponding
913 major key, e.g., @code{\minor} is defined as 3. The standard mode names
914 @code{\ionian}, @code{\locrian}, @code{\aeolian}, @code{\mixolydian},
915 @code{\lydian}, @code{\phrygian}, and @code{\dorian} are also defined.
925 @subsubsection Clef changes
928 \clef @var{clefname} @code{;}
934 \property Clef.clefGlyph = @var{symbol associated with clefname}
935 \property Clef.clefPosition = @var{clef Y-position for clefname}
936 \property Clef.clefOctavation = @var{extra pitch of clefname}
939 Supported clef-names include
946 @subsection Time signature
947 @cindex Time signature
952 \time @var{numerator}@code{/}@var{denominator} @code{;}
955 A short-cut for doing
957 \property Score.timeSignatureFraction = #'(@var{numerator} . @var{denominator})
960 See the documentation of @code{timeSignatureFraction}
964 @subsubsection Partial
968 @cindex partial measure
969 @cindex measure, partial
970 @cindex shorten measures
971 @cindex @code{\partial}
973 \partial @var{duration} @code{;}
979 \property Score.measurePosition = @var{length of duration}
983 See the documentation of @code{measurePosition}.
998 * Crescendo and Decrescendo::
1007 @c_ {Automatic beams}
1008 @unnumberedsubsubsec Automatic beams
1010 @cindex automatic beam generation
1013 @cindex @code{Voice.noAutoBeaming}
1015 By default, LilyPond will generate beams automatically. This feature
1016 can be disabled by setting the @code{Voice.noAutoBeaming} property to
1017 true. It can be overridden for specific cases by specifying explicit
1020 @cindex @code{Voice.autoBeamSettings}
1021 @cindex @code{(end * * * *)}
1022 @cindex @code{(begin * * * *)}
1024 A large number of Voice properties are used to decide how to generate
1025 beams. Their default values appear in @file{scm/auto-beam.scm}. In
1026 general, beams can begin anywhere, but their ending location is
1027 significant. Beams can end on a beat, or at durations specified by the
1029 @code{Voice.autoBeamSettings}.
1030 To end beams every quarter note, for example, you could set the property
1031 @code{(end * * * *)} to @code{(make-moment 1
1032 4)}. To end beams at every three eighth notes you would set
1033 it to @code{(make-moment 1 8)}.
1034 The same syntax can be used to specify beam
1035 starting points using
1036 @code{(begin * * * *)}, eg:
1039 \property Voice.autoBeamSettings \override
1040 #'(end * * * *) = #(make-moment 1 4)
1041 \property Voice.autoBeamSettings \override
1042 #'(begin * * * *) = #(make-moment 1 8)
1046 To allow different settings for different time signatures, instead of
1047 the first two asterisks @code{* *} you can specify a time signature; use
1048 @code{(end N M * *)} to restrict the definition to
1049 `@var{N}@code{/}@var{M}' time. For example, to specify beams ending
1050 only for 6/8 time you would use the property @code{(end 6 8 * *)}.
1052 To allow different endings for notes of different durations, instead of
1053 th last two asterisks you can specify a duration; use @code{(end * * N
1054 M)} to restrict the definition to beams that contain notes of
1055 `@var{N}@code{/}@var{M}' duration.
1057 For example, to specify beam endings for beams that contain 32nd notes,
1058 you would use @code{(end * * 1 32)}.
1063 @cindex Automatic beams
1064 @unnumberedsubsubsec Manual beams
1066 @cindex beams, manual
1071 Beaming can be generated automatically; see section @ref{Automatic Beaming}.
1073 A beam is specified by surrounding the beamed notes with brackets
1074 `@code{[}' and `@code{]}'.
1076 @lilypond[fragment,verbatim,center]
1077 [a'8 a'] [a'16 a' a' a']
1078 [a'16 <a' c''> c'' <a' c''>]
1079 \times 2/3 { [e'8 f' g'] }
1083 @cindex @code{-}@code{-}
1086 @c_ {Adjusting beams}
1087 @unnumberedsubsubsec Adjusting beams
1088 @cindex Adjusting beams
1099 Slurs connects chords and try to avoid crossing stems. A slur is
1100 started with @code{(} and stopped with @code{)}. The
1101 starting @code{(} appears to the right of the first note in
1102 the slur. The terminal @code{)} appears to the left of the
1103 first note in the slur. This makes it possible to put a note in
1104 slurs from both sides:
1106 @lilypond[fragment,verbatim,center]
1107 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1112 @c_ {Adjusting slurs}
1113 @unnumberedsubsubsec Adjusting slurs
1115 @cindex Adusting slurs
1123 A tie connects two adjacent note heads of the same pitch. When used
1124 with chords, it connects all of the note heads whose pitches match.
1125 Ties are indicated using the tilde symbol `@code{~}'.
1126 If you try to tie together chords which have no common pitches, a
1127 warning message will appear and no ties will be created.
1129 @lilypond[fragment,verbatim,center]
1130 e' ~ e' <c' e' g'> ~ <c' e' g'>
1138 @subsubsection Tuplet
1145 @subsubsection Volta
1150 @c_ {Crescendo and Decrescendo}
1151 @node Crescendo and Decrescendo
1152 @subsubsection Crescendo and Decrescendo
1153 @cindex Crescendo and Decrescendo
1157 @cindex @code{\decr}
1158 @cindex @code{\rced}
1165 A crescendo mark is started with @code{\cr} and terminated with
1166 @code{\rc}, the textual reverse of @code{cr}. A decrescendo mark is
1167 started with @code{\decr} and terminated with @code{\rced}. There are
1168 also shorthands for these marks. A crescendo can be started with
1169 @code{\<} and a decrescendo can be started with @code{\>}. Either one
1170 can be terminated with @code{\!}. Note that @code{\!} must go before
1171 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
1172 after the last note. Because these marks are bound to notes, if you
1173 want to get several marks during one note, you must use spacer notes.
1175 @lilypond[fragment,verbatim,center]
1176 c'' \< \! c'' d'' \decr e'' \rced
1177 < f''1 { s4 \< \! s2 \> \! s4 } >
1185 @subsubsection Text spanner
1186 @cindex Text spanner
1188 Have crescendo set a text spanner instead of hairpin
1190 @lilypond[fragment,relative,verbatim]
1192 \property Voice.crescendoText = "cresc."
1193 \property Voice.crescendoSpanner = #'dashed-line
1200 @subsubsection Ottava
1202 @unnumberedsubsubsec Ottava
1204 @lilypond[fragment,relative,verbatim]
1206 \property Voice.TextSpanner \set #'type = #'dotted-line
1207 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1208 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1209 \property Staff.centralCPosition = #-13
1210 a\spanrequest \start "text" b c a \spanrequest \stop "text"
1215 @c_ {Text crescendo and decrescendo}
1216 @unnumberedsubsubsec Text crescendo and decrescendo
1222 @subsubsection Span requests
1223 @cindex Span requests
1225 @cindex @code{\spanrequest}
1228 \spanrequest @var{startstop} @var{type}
1230 @cindex @code{\start}
1231 @cindex @code{\stop}
1233 Define a spanning request. The @var{startstop} parameter is either -1
1234 (@code{\start}) or 1 (@code{\stop}) and @var{type} is a string that
1235 describes what should be started. Supported types are @code{crescendo},
1236 @code{decrescendo}, @code{beam}, @code{slur}. This is an internal
1237 command. Users should use the shorthands which are defined in the
1238 initialization file @file{spanners.ly}.
1240 You can attach a (general) span request to a note using
1242 @lilypond[fragment,verbatim,center]
1243 c'4-\spanrequest \start "slur"
1244 c'4-\spanrequest \stop "slur"
1247 The slur syntax with parentheses is a shorthand for this.
1252 @subsection Ornaments
1269 @subsubsection Articulation
1270 @cindex Articulation
1272 @cindex articulations
1276 A variety of symbols can appear above and below notes to indicate
1277 different characteristics of the performance. These symbols can be
1278 added to a note with `@var{note}@code{-\}@var{name}'. Numerous symbols
1279 are defined in @file{script.ly} and @file{script.scm}. Symbols can be
1280 forced to appear above or below the note by writing
1281 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1282 respectively. Here is a chart showing symbols above notes, with the
1283 name of the corresponding symbol appearing underneath.
1289 \property Score.LyricSyllable \override #'font-family =
1291 \property Score.LyricSyllable \override #'font-shape = #'upright
1292 c''-\accent c''-\marcato c''-\staccatissimo c''-\fermata
1293 c''-\stopped c''-\staccato c''-\tenuto c''-\upbow
1294 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1295 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1296 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1297 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1298 c''-\thumb c''-\segno c''-\coda
1300 \context Lyrics \lyrics {
1301 accent__ marcato__ staccatissimo__ fermata
1302 stopped__ staccato__ tenuto__ upbow
1303 downbow__ lheel__ rheel__ ltoe
1304 rtoe__ turn__ open__ flageolet
1305 reverseturn__ trill__ prall__ mordent
1306 prallprall__ prallmordent__ uprall__ downprall
1307 thumb__ segno__ coda
1311 linewidth = 5.875\in;
1320 @subsubsection Text scripts
1321 @cindex Text scripts
1325 In addition, it is possible to place arbitrary strings of text or
1326 @TeX{} above or below notes by using a string instead of an
1327 identifier: @code{c^"text"}. Fingerings
1328 can be placed by simply using digits. All of these note ornaments
1329 appear in the printed output but have no effect on the MIDI rendering of
1333 @unnumberedsubsubsec Fingerings
1336 To save typing, fingering instructions (digits 0 to 9 are
1337 supported) and single characters shorthands exist for a few
1342 \notes \context Voice {
1343 \property Voice.TextScript \set #'font-family = #'typewriter
1344 \property Voice.TextScript \set #'font-shape = #'upright
1350 c''4-^_"c-\\^{ }" s4
1357 linewidth = 5.875 \in;
1365 @cindex @code{\textscript}
1369 \textscript @var{text} @var{style}
1372 Defines a text to be printed over or under a note. @var{style} is a
1373 string that may be one of @code{roman}, @code{italic}, @code{typewriter},
1374 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1376 You can attach a general textscript request using this syntax:
1381 c4-\textscript "6" "finger"
1382 c4-\textscript "foo" "normal"
1387 This is equivalent to @code{c4-6 c4-"foo"}.
1389 @cindex @code{\script}
1396 @cindex @code{\script}
1398 Prints a symbol above or below a note. The argument is a string which
1399 points into the script-alias table defined in @file{scm/script.scm}, for
1400 information on how to add scripts, read the comments in that file.
1401 Usually the @code{\script} keyword is not used directly. Various
1402 helpful identifier definitions appear in @file{script.ly}.
1409 @subsubsection Grace notes
1412 See @ref{Grace music}.
1416 @subsubsection Stem tremolo
1417 @cindex tremolo marks
1418 @cindex @code{tremoloFlags}
1420 [FIXME: should be \repeat]
1422 Tremolo marks can be printed on a single note by adding
1423 `@code{:}[@var{length}]' after the note. The length must be at
1424 least 8. A @var{length} value of 8 gives one line across
1425 the note stem. If the length is omitted, then the last value is
1426 used, or the value of the @code{tremoloFlags} property if there was
1429 @lilypond[verbatim,fragment,center]
1436 @subsubsection Arpeggio
1439 @cindex broken arpeggio
1440 @cindex @code{\arpeggio}
1442 You can specify an @rgrob{Arpeggio} sign on a chord by issuing an
1444 @c @code{\arpeggio} request:
1445 @code{\arpeggio} request:
1449 @lilypond[fragment,relative,verbatim]
1450 \context Voice <c'\arpeggio e g c>
1454 Typesetting of simultanious chords with arpeggios can be controlled with
1455 the property @code{PianoStaff.connectArpeggios} @footnote{ FIXME:
1456 connectArpeggios. Can't find the English terms for two kinds of
1457 arpeggio (Dutch: gebroken arpeggio vs doorlopend arpeggio).} By
1458 default, LilyPond prints broken arpeggios; when set to true, one
1459 extended arpeggio sign is printed.
1462 @lilypond[fragment,relative,verbatim]
1463 \context PianoStaff <
1464 \property PianoStaff.connectArpeggios = ##t
1465 \context Staff \context Voice <c''\arpeggio e g c>
1466 \context Staff=other \context Voice <c,\arpeggio e g>
1474 @subsubsection Glissando
1477 @cindex @code{\glissando}
1479 A @rgrob{Glissando} line can be requested by issuing a
1481 @c @code{\glissando} request:
1482 @code{\glissando} request:
1486 @lilypond[fragment,relative,verbatim]
1491 Printing of the additional text @samp{gliss.} must be done manually.
1495 @subsubsection Follow Thread
1496 @cindex follow thread
1497 @cindex staff switching
1500 @c Documented here because it looks like a glissando...
1501 @cindex @code{followThread}
1502 A glissando-like line can be printed to connect notes whenever a thread
1503 switches to another staff. This is enabled if the property
1504 @code{PianoStaff.followThread} is set to true:
1507 @lilypond[fragment,relative,verbatim]
1508 \context PianoStaff <
1509 \property PianoStaff.followThread = ##t
1510 \context Staff \context Voice {
1512 \translator Staff=two
1515 \context Staff=two {\clef bass; \skip 1*2;}
1524 @subsubsection Dynamics
1527 @unnumberedsubsec Dynamics
1537 @cindex @code{\ffff}
1546 Dynamic marks are specified by using an identifier after a note:
1547 @code{c4-\ff} (the dash is optional for dynamics: `@code{c4 \ff})'.
1548 The available dynamic marks are:
1550 @code{\pp}, @code{\p}, @code{\mp},
1551 @code{\mf}, @code{\f}, @code{\ff},
1552 @code{\fff}, @code{\fff},
1553 @code{\fp}, @code{\sf},
1554 @code{\sff}, @code{\sp},
1555 @code{\spp}, @code{\sfz}, and
1558 See also @ref{Crescendo and Decrescendo}
1563 @subsubsection Bar lines
1567 @cindex measure lines
1574 This is a short-cut for doing
1576 \property Score.whichBar = @var{bartype}
1579 You are encouraged to use @code{\repeat} for repetitions. See
1580 @ref{Repeat}, @ref{Volta}, and the documentation of @code{whichBar} in
1581 @ref{(lilypond-internals)LilyPond context properties}.
1588 @subsubsection Breath marks
1589 @cindex Breath marks
1591 @c_ {Rehearsal marks}
1592 @node Rehearsal marks
1593 @subsubsection Rehearsal marks
1594 @cindex Rehearsal marks
1596 @cindex @code{\mark}
1599 \mark @var{unsigned};
1600 @cindex @code{Mark_engraver}
1604 Prints a mark over or under the staff.
1609 @subsection Bar check
1613 @cindex @code{barCheckNoSynchronize}
1617 Bar checks help you find errors in the input: Whenever one is
1618 encountered during interpretation, a warning message is issued if it
1619 doesn't fall at a measure boundary. Depending on the value of
1620 @code{barCheckNoSynchronize}, the beginning of the measure will be
1621 relocated, so this can also be used to shorten measures.
1623 A bar check is entered using the bar symbol, @code{|}
1625 This can help you finding errors in the input.
1630 @section Lyrics entry
1631 @cindex Lyrics entry
1643 @subsection Lyrics mode
1647 @cindex @code{\lyrics}
1649 Lyrics mode is introduced by the keyword @code{\lyrics}. This mode has
1650 rules that make it easy to include punctuation and diacritical marks in
1651 words: The purpose of Lyrics mode is that you can enter lyrics in @TeX{}
1652 format or a standard encoding without needing quotes. The precise
1653 definition of this mode is ludicrous, and this will remain so until the
1654 authors of LilyPond acquire a deeper understanding of character
1655 encoding, or someone else steps up to fix this.
1657 A word in Lyrics mode begins with: an alphabetic character, @code{_},
1658 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
1659 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
1660 any 8-bit character with ASCII code over 127, or a two-character
1661 combination of a backslash followed by one of @code{`}, @code{'},
1662 @code{"}, or @code{^}.
1664 Subsequent characters of a word can be any character that is not a digit
1665 and not white space. One important consequence of this is that a word
1666 can end with `@code{@}}', which may be confusing. However, LilyPond will
1667 issue a warning. Any @code{_} character which appears in an unquoted
1668 word is converted to a space. This provides a mechanism for introducing
1669 spaces into words without using quotes. Quoted words can also be used
1670 in Lyrics mode to specify words that cannot be written with the above
1671 rules. Here are some examples. Not all of these words are printable by
1676 2B_||_!2B % not a word because it starts with a digit
1677 ``Hello'' % not a word because it starts with `
1678 _ _ _ _ % 4 words, each one a space
1681 Since combinations of numbers and dots are used for indicating
1682 durations, you can not enter real numbers in this mode.
1684 [todo: include short table showing differences]
1686 @cindex lyrics expressions
1688 Syllables are entered like notes, with pitches replaced by text. For
1689 example, @code{Twin-4 kle4 twin-4 kle4} enters four syllables, each
1690 with quarter note duration. Note that the hyphen has no special
1691 meaning for lyrics, and does not introduce special symbols. See
1692 section @ref{Lexical modes} for a description of what is interpreted as
1695 Spaces can be introduced into a lyric either by using quotes
1696 (@code{"}) or by using an underscore without quotes: @code{He_could4
1697 not4}. All unquoted underscores are converted to spaces. Printing
1698 lyrics is discussed in section @ref{lyricprint}.
1701 @c_ {Printing Lyrics}
1702 @node Printing lyrics
1703 @subsection lyricprint
1707 @cindex printing!lyrics
1710 Lyric syllables must be interpreted within a @code{Lyrics} context
1712 @cindex context!Lyrics
1715 Here is a full example:
1721 \notes \transpose c'' {
1723 e f g2 | e4 f g2 \bar "|.";
1725 \context Lyrics \lyrics {
1726 Va-4 der Ja- cob Va- der Ja- cob
1727 Slaapt gij nog?2 Slaapt4 gij nog?2
1735 You may want a continuous line after the syllables to show melismata.
1736 To achieve this effect, add a @code{__} lyric as a separate word
1737 after the lyric to be extended. This will create an extender, a line
1738 that extends over the entire duration of the lyric. This line will
1739 run all the way to the start of the next lyric, so you may want to
1740 shorten it by using a blank lyric (using @code{_}).
1747 \notes \relative c'' {
1748 a4 () b () c () d | c () d () b () a | c () d () b () a
1750 \context Lyrics \lyrics {
1751 foo1 __ | bar2. __ _4 | baz1 __
1760 If you want to have hyphens centered between syllables (rather than
1761 attached to the end of the first syllable) you can use the special
1762 `@code{-}@code{-}' lyric as a separate word between syllables. This
1763 will result in a hyphen which length varies depending on the space
1764 between syllables, and which will be centered between the syllables.
1772 \notes \transpose c'' {
1774 e f g2 | e4 f g2 \bar "|.";
1776 \context Lyrics \lyrics {
1777 Va4 -- der Ja -- cob | Va -- der Ja -- cob |
1778 Slaapt gij nog?2 | Slaapt4 gij nog?2
1791 @subsection Lyric hyphen
1792 @cindex Lyric hyphen
1794 The syntax for a spanning hyphen (i.e., a hyphen that will be printed
1795 between two lyric syllables) is `@code{-}@code{-}'.
1797 @c_ {Lyric extender}
1798 @node Lyric extender
1799 @subsection Lyric extender
1800 @cindex Lyric extender
1802 @cindex lyric extender
1805 The syntax for an extender mark is @code{__}. This syntax can only
1806 be used within lyrics mode.
1813 @subsection Addlyrics
1817 [explain automatic phrasing]
1818 @cindex automatic lyric durations
1819 @cindex @code{\addlyrics}
1821 If you have lyrics that are set to a melody, you can import the rhythm
1822 of that melody into the lyrics using @code{\addlyrics}. The syntax for
1825 \addlyrics @var{musicexpr1 musicexpr2}
1828 This means that both @var{musicexpr1} and @var{musicexpr2} are
1829 interpreted, but that every non-command atomic music expression
1830 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1831 of @var{musicexpr1}.
1832 @cindex @code{automaticMelismata}
1834 If the property @code{automaticMelismata} is set in the
1835 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1839 @lilypond[verbatim,fragment]
1842 \property Voice.automaticMelismata = ##t
1843 c8 () cis d8. e16 f2
1845 \context Lyrics \lyrics {
1850 You should use a single rhythm melody, and single rhythm lyrics (a
1851 constant duration is the obvious choice). If you do not, you will get
1852 undesired effects when using multiple stanzas:
1855 @lilypond[verbatim,fragment]
1858 c8 () cis d8. e16 f2
1860 \context Lyrics \lyrics
1867 It is valid (but probably not very useful) to use notes instead of
1868 lyrics for @var{musicexpr2}.
1874 @section Chord entry
1879 * Entering named chords::
1880 * Printing named chords::
1885 @subsection Chords mode
1888 Chord mode is introduced by the keyword
1889 @code{\chords}. It is similar to Note mode, but
1890 words are also looked up in a chord modifier table (containing
1891 @code{maj}, @code{dim}, etc).
1893 Since combinations of numbers and dots are used for indicating
1894 durations, you can not enter real numbers in this mode. Dashes
1895 and carets are used to indicate chord additions and subtractions,
1896 so scripts can not be entered in Chord mode.
1898 @c_ {Entering named chords}
1899 @node Entering named chords
1900 @subsection Entering named chords
1901 @cindex Chords names
1903 Chord names are a way to generate simultaneous music expressions that
1904 correspond with traditional chord names. It can only be used in
1905 Chord mode (see section @ref{Lexical modes}).
1909 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1912 @var{tonic} should be the tonic note of the chord, and @var{duration}
1913 is the chord duration in the usual notation. There are two kinds of
1914 modifiers. One type is @emph{chord additions}, which are obtained by
1915 listing intervals separated by dots. An interval is written by its
1916 number with an optional @code{+} or @code{-} to indicate raising or
1917 lowering by half a step. Chord additions has two effects: It adds
1918 the specified interval and all lower odd numbered intervals to the
1919 chord, and it may lower or raise the specified interval. Intervals
1920 must be separated by a dot (@code{.}).
1923 Throughout these examples, chords have been shifted around the staff
1924 using @code{\transpose}.
1929 @lilypond[fragment,verbatim]
1933 c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1945 The second type of modifier that may appear after the @code{:} is a
1946 named modifier. Named modifiers are listed in the file
1947 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
1948 @code{min} which lower the 3rd half a step, `@code{aug}' which
1949 raises the 5th, `@code{dim}' which lowers the 5th,
1950 `@code{maj}' which adds a raised 7th, and `@code{sus}'
1951 which replaces the 5th with a 4th.
1955 @lilypond[fragment,verbatim]
1958 c1:m c:min7 c:maj c:aug c:dim c:sus
1966 Chord subtractions are used to eliminate notes from a chord. The
1967 notes to be subtracted are listed after a @code{^} character,
1970 @lilypond[fragment,verbatim,center]
1979 Chord inversions can be specified by appending `@code{/}' and
1980 the name of a single note to a chord. This has the effect of
1981 lowering the specified note by an octave so it becomes the lowest
1982 note in the chord. If the specified note is not in the chord, a
1983 warning will be printed.
1985 @lilypond[fragment,verbatim,center]
1995 Bass notes can be added by `@code{/+}' and
1996 the name of a single note to a chord. This has the effect of
1997 adding the specified note to the chord, lowered by an octave,
1998 so it becomes the lowest note in the chord.
2000 @lilypond[fragment,verbatim,center]
2009 The most interesting application is printing chords using chord names,
2010 See @ref{Chord names}.
2012 You should not combine @code{\relative} with named chords. [FIXME]
2014 @c_ {Printing named chords}
2015 @node Printing named chords
2016 @subsection Printing named chords
2021 @cindex printing!chord names
2022 @cindex @code{ChordNames}
2023 @cindex @code{ChordNameVoice}
2025 For displaying printed chord names, use the @code{ChordNames} and
2026 @code{ChordNameVoice} contexts. The chords may be entered either using
2027 the notation described above, or directly using simultaneous music.
2032 \chords {a1 b c} <d f g> <e g b>
2036 \context ChordNamesVoice \scheme
2037 \context Staff \transpose c'' \scheme
2039 \paper { linewidth = -1.; }
2044 You can make the chord changes stand out more by setting property
2045 @code{ChordNames.chordChanges} to true. This will only display chord
2046 names when there's a change in the chords scheme, but always display the
2047 chord name after a line break:
2053 c1:m \break c:m c:m c:m d
2058 \context ChordNames \scheme
2059 \context Staff \transpose c'' \scheme
2062 linewidth = 40 * \staffspace;
2074 LilyPond examines chords specified as lists of notes to determine a
2075 name to give the chord. LilyPond will not try to
2076 identify chord inversions or added base, which may result in strange
2077 chord names when chords are entered as a list of pitches:
2080 @lilypond[verbatim,center]
2089 \context ChordNamesVoice \scheme
2090 \context Staff \scheme
2092 \paper { linewidth = -1.; }
2097 To specify chord inversions, append @code{/<notename>}. To specify an
2098 added bass note, append @code{/+<notename}:
2101 @lilypond[verbatim,center]
2108 \context ChordNames \scheme
2109 \context Staff \transpose c'' \scheme
2111 \paper { linewidth = -1.; }
2116 The chord names that LilyPond should print are fully customizable. The
2117 code to print chord names is written in Scheme. It can be found in
2118 @file{scm/chord-name.scm}. Chord names are based on Banter style
2119 naming, which is unambiguous and has a logical structure. Typical
2120 American style chord names are implemented as a variation on Banter
2121 names, they can be selected by setting property @code{ChordName.style}
2126 \include "english.ly"
2131 df:m5- % Diminished triad
2132 c:5^3 % Root-fifth chord
2133 c:4^3 % Suspended fourth triad
2134 c:5+ % Augmented triad
2136 c:m5-.7- % Diminished seventh
2137 c:7+ % Major seventh
2138 c:7.4^3 % Dominant seventh suspended fourth
2139 c:5+.7 % Augmented dominant seventh
2140 c:m5-.7 % "Half" diminished seventh
2141 c:5-.7 % Dominant seventh flat fifth
2142 c:5-.7+ % Major seventh flat fifth
2143 c:m7+ % Minor-major seventh
2144 c:m7 % Minor seventh
2145 c:7 % Dominant seventh
2148 c:9^7 % Major triad w/added ninth
2149 c:6.9^7 % Six/Nine chord
2150 c:9 % Dominant ninth
2151 c:7+.9 % Major ninth
2152 c:m7.9 % Minor ninth
2157 \context ChordNames \scheme
2158 \context Staff \transpose c'' \scheme
2163 ChordName \override #'word-space = #1
2164 ChordName \override #'style = #'american
2171 Similarly, Jazz style chord names are implemented as a variation on
2172 American style names:
2178 c:6 % 6 = major triad with added sixth
2179 c:maj % triangle = maj
2184 c:m % m = minor triad
2185 c:m.6 % m6 = minor triad with added sixth
2186 c:m.7+ % m triangle = minor major seventh chord
2194 c:7.5+ % +7 = augmented dominant
2195 c:7.5- % 7b5 = hard diminished dominant
2202 c:13.9-^11 % 7(b9,13)
2203 c:13.9+^11 % 7(#9,13)
2205 c:13-.9-^11 % 7(b9,b13)
2206 c:13-.9+^11 % 7(#9,b13)
2208 % half diminished chords
2209 c:m5-.7 % slashed o = m7b5
2210 c:9.3-.5- % o/7(pure 9)
2213 c:m5-.7- % o = diminished seventh chord
2218 \context ChordNames \scheme
2219 \context Staff \transpose c'' \scheme
2224 ChordName \override #'word-space = #1
2225 ChordName \override #'style = #'jazz
2237 @section Page layout
2251 @subsection Paper block
2254 The most important output definition is the @code{\paper} block, for
2255 music notation. The syntax is
2258 @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2261 where each of the items is one of
2264 @item An assignment. The assignment must be terminated by a
2267 @item A context definition. See section @ref{contextdefs} for
2268 more information on context definitions.
2277 A margin shape declaration. The syntax is
2278 @cindex @code{\shape}
2281 \shape @var{indent1}@code{,} @var{width1}@code{,}
2282 @var{indent2}@code{,} @var{width2} @dots{} @code{;}
2287 Each pair of @var{indent} and @var{width} values is a dimension
2288 specifying how far to indent and how wide to make the line.
2289 The indentation and width of successive lines are specified by
2290 the successive pairs of dimensions. The last pair of
2291 dimensions will define the characeristics of all lines beyond
2292 those explicitly specified.
2295 @item \stylesheet declaration. Its syntax is
2297 \stylesheet @var{alist}
2300 See @file{font.scm} for details of @var{alist}.
2303 @c_ {Paper variables}
2304 @node Paper variables
2305 @subsection Paper variables
2306 @cindex Paper variables
2308 The paper block has some variables you may want to use or change:
2311 @cindex @code{indent}
2313 The indentation of the first line of music.
2314 @cindex @code{staffspace}
2316 @item @code{staffspace}
2317 The distance between two staff lines, calculated from the center
2318 of the lines. You should use either this or @code{rulethickness}
2319 as a unit for distances you modify.
2321 @cindex @code{linewidth}
2322 @item @code{linewidth}
2323 Sets the width of the lines. If set to -1.0, a single
2324 unjustified line is produced. If you use this variable, you
2325 probably want to define it in staff spaces, ie
2327 linewidth = 30 * \staffspace;
2329 @cindex @code{textheight}
2331 @item @code{textheight}
2332 Sets the total height of the music on each page. Only used by
2334 @cindex @code{interscoreline}
2336 @item @code{interscoreline}
2337 Sets the spacing between the score lines. Defaults to 16 pt.
2338 @cindex @code{interscorelinefill}
2340 @item @code{interscorelinefill}
2341 If set to a positive number, the distance between the score
2342 lines will stretch in order to fill the full page. In that
2343 case @code{interscoreline} specifies the minimum spacing.
2345 @cindex @code{stafflinethickness}
2347 @item @code{stafflinethickness}
2348 Determines the thickness of staff lines, and also acts as a scaling
2349 parameter for other line thicknesses.
2355 @subsection Font size
2358 The Feta font provides musical symbols at six different sizes. These
2359 fonts are 11 point, 13 point, 16 point, 20 point,
2360 23 point, and 26 point. The point size of a font is the
2361 height of the five lines in a staff when displayed in the font.
2363 Definitions for these sizes are the files @file{paperSZ.ly}, where
2364 @code{SZ} is one of 11, 13, 16, 20, 23 and 26. If you include any of
2365 these files, the identifiers @code{paperEleven}, @code{paperThirteen},
2366 @code{paperSixteen}, @code{paperTwenty}, @code{paperTwentythree}, and
2367 @code{paperTwentysix} are defined respectively. The default
2368 @code{\paper} block is also set.
2370 The font definitions are generated using a Scheme function. For more
2371 details, see the file @file{font.scm}.
2377 @subsection Paper size
2382 @cindex @code{papersize}
2384 To change the paper size, you must first set the
2385 @code{papersize} variable at top level. Set it to
2386 the strings @code{a4}, @code{letter}, or @code{legal}. After this
2387 specification, you must set the font as described above. If you want
2388 the default font, then use the 20 point font. The new paper size will
2389 not take effect if the font is not loaded and selected afterwards.
2393 \include "paper16.ly"
2397 \paper @{ \paperSixteen @}
2401 The file "paper16.ly" will now include a file named @file{a4.ly}, which
2402 will set the paper variables @code{hsize} and @code{vsize} (used by
2413 @subsection Line break
2417 @cindex @code{\penalty}
2420 \penalty @var{int} @code{;}
2423 Discourage or encourage line breaks. See @ref{Page layout}.
2429 @cindex breaking lines
2431 Line breaks are normally computed automatically. They are chosen such
2432 that the resulting spacing has low variation, and looks neither cramped
2435 Occasionally you might want to override the automatic breaks; you can do
2436 this by specifying @code{\break} (see also @ref{Pre-defined
2437 Identifiers}). This will force a line break at this point. Do remember
2438 that line breaks can only occur at places where there are barlines. If
2439 you want to have a line break where there is no barline, you can force a
2440 barline by entering @code{\bar "";}.
2447 @subsection Page break
2451 Not implemented, but see @ref{Tricks}
2453 Page breaks are normally computed by @TeX{}, so they are not under direct
2454 control. However, you can insert a commands into the .tex output to
2455 instruct @TeX{} where to break pages. For more details, see the
2456 example file @file{input/test/between-systems.ly}
2460 @cindex breaking pages
2472 * MIDI instrument names::
2478 @subsection MIDI block
2482 The MIDI block is analogous to the paper block, but it is somewhat
2483 simpler. The @code{\midi} block can contain:
2487 @item a @code{\tempo} definition
2488 @item context definitions
2491 Assignments in the @code{\midi} block are not allowed.
2495 @cindex context definition
2497 Context definitions follow precisely the same syntax as within the
2498 \paper block. Translation modules for sound are called performers.
2499 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2502 @c_ {MIDI instrument names}
2503 @node MIDI instrument names
2504 @subsection MIDI instrument names
2505 @cindex instrument names
2506 @cindex @code{Staff.midiInstrument}
2507 @cindex @code{Staff.instrument}
2509 The MIDI instrument name is set by the @code{Staff.midiInstrument}
2510 property or, if that property is not set, the @code{Staff.instrument}
2511 property. The instrument name should be chosen from the following list.
2512 If the selected string does not exactly match, then LilyPond uses the
2515 [FIXME: to appendix ]
2519 "acoustic grand" "contrabass" "lead 7 (fifths)"
2520 "bright acoustic" "tremolo strings" "lead 8 (bass+lead)"
2521 "electric grand" "pizzicato strings" "pad 1 (new age)"
2522 "honky-tonk" "orchestral strings" "pad 2 (warm)"
2523 "electric piano 1" "timpani" "pad 3 (polysynth)"
2524 "electric piano 2" "string ensemble 1" "pad 4 (choir)"
2525 "harpsichord" "string ensemble 2" "pad 5 (bowed)"
2526 "clav" "synthstrings 1" "pad 6 (metallic)"
2527 "celesta" "synthstrings 2" "pad 7 (halo)"
2528 "glockenspiel" "choir aahs" "pad 8 (sweep)"
2529 "music box" "voice oohs" "fx 1 (rain)"
2530 "vibraphone" "synth voice" "fx 2 (soundtrack)"
2531 "marimba" "orchestra hit" "fx 3 (crystal)"
2532 "xylophone" "trumpet" "fx 4 (atmosphere)"
2533 "tubular bells" "trombone" "fx 5 (brightness)"
2534 "dulcimer" "tuba" "fx 6 (goblins)"
2535 "drawbar organ" "muted trumpet" "fx 7 (echoes)"
2536 "percussive organ" "french horn" "fx 8 (sci-fi)"
2537 "rock organ" "brass section" "sitar"
2538 "church organ" "synthbrass 1" "banjo"
2539 "reed organ" "synthbrass 2" "shamisen"
2540 "accordion" "soprano sax" "koto"
2541 "harmonica" "alto sax" "kalimba"
2542 "concertina" "tenor sax" "bagpipe"
2543 "acoustic guitar (nylon)" "baritone sax" "fiddle"
2544 "acoustic guitar (steel)" "oboe" "shanai"
2545 "electric guitar (jazz)" "english horn" "tinkle bell"
2546 "electric guitar (clean)" "bassoon" "agogo"
2547 "electric guitar (muted)" "clarinet" "steel drums"
2548 "overdriven guitar" "piccolo" "woodblock"
2549 "distorted guitar" "flute" "taiko drum"
2550 "guitar harmonics" "recorder" "melodic tom"
2551 "acoustic bass" "pan flute" "synth drum"
2552 "electric bass (finger)" "blown bottle" "reverse cymbal"
2553 "electric bass (pick)" "skakuhachi" "guitar fret noise"
2554 "fretless bass" "whistle" "breath noise"
2555 "slap bass 1" "ocarina" "seashore"
2556 "slap bass 2" "lead 1 (square)" "bird tweet"
2557 "synth bass 1" "lead 2 (sawtooth)" "telephone ring"
2558 "synth bass 2" "lead 3 (calliope)" "helicopter"
2559 "violin" "lead 4 (chiff)" "applause"
2560 "viola" "lead 5 (charang)" "gunshot"
2561 "cello" "lead 6 (voice)"
2572 @cindex beats per minute
2573 @cindex metronome marking
2575 @cindex @code{\tempo}
2577 \tempo @var{duration} = @var{perminute} @code{;}
2580 Used to specify the tempo. For example, @code{\tempo 4 = 76;} requests
2581 output with 76 quarter notes per minute.
2589 @section Music entry
2592 * Pre-defined Identifiers::
2597 @node Pre-defined Identifiers
2598 @subsection Pre-defined Identifiers
2599 @cindex pre-defined identifiers
2602 Various identifiers are defined in the initialization files to
2603 provide shorthands for some settings. Most of them are in
2604 @file{ly/declarations.ly} and @file{ly/property.ly}.
2607 @cindex @code{\break}
2609 Force a line break in music by using a large argument for the
2610 keyword @code{\penalty}.
2612 @cindex @code{\nobreak}
2613 @item @code{\nobreak}
2614 Prevent a line break in music by using a large negative argument
2615 for the keyword @code{\penalty}.
2617 @cindex @code{\shiftOff}
2618 @item @code{\shiftOff}
2619 Disable horizontal shifting of note heads that collide.
2621 @cindex @code{\shiftOn}
2622 @item @code{\shiftOn}
2623 Enable note heads that collide with other note heads to be
2624 shifted horiztonally. Also @code{\shiftOnn} and @code{\shiftOnnn}
2625 set different shift values.
2627 @cindex @code{\stemBoth}
2628 @item @code{\stemBoth}
2629 Allow stems, beams, and slurs to point either upwards or
2630 downwards, decided automatically by LilyPond.
2632 @cindex @code{\stemDown}
2633 @item @code{\stemDown}
2634 Force stems, beams, and slurs to point down.
2636 @cindex @code{\stemUp}
2637 @item @code{\stemUp}
2638 Force stems, beams and slurs to point up.
2643 @c_ {Point and click}
2644 @node Point and click
2645 @subsection Point and click
2654 * Context definitions::
2655 * Notation Contexts::
2658 @c_ {Context definitions}
2659 @node Context definitions
2660 @subsection Context definitions
2662 @cindex context definition
2663 @cindex translator definition
2664 @cindex engraver hacking
2667 A notation contexts is defined by the following information
2672 @item The LilyPond modules that do the actual conversion of music to
2673 notation. Each module is a so-called
2678 @item How these modules should cooperate, i.e. which ``cooperation
2679 module'' should be used. This cooperation module is a special
2682 @item What other contexts the context can contain,
2684 @item What properties are defined.
2687 A context definition has this syntax:
2691 \translator @code{@{}
2692 @var{translatorinit} @var{translatormodifierlist}
2696 @var{translatorinit} can be an identifier or of the form
2700 \type @var{typename} @code{;}
2703 @var{typename} is one of
2706 @cindex @code{Engraver_group_engraver}
2707 @item @code{Engraver_group_engraver}
2708 The standard cooperation engraver.
2709 @cindex @code{Score_engraver}
2711 @item @code{Score_engraver}
2712 This is cooperation module that should be in the top level context.
2713 @cindex @code{Grace_engraver_group}
2715 @item @code{Grace_engraver_group}
2716 This is a special cooperation module (resembling
2717 @code{Score_engraver}) that is used to created an embedded
2721 @var{translatormodifierlist} is a list of items where each item is
2725 @item @code{\consists} @var{engravername} @code{;}
2726 Add @var{engravername} to the list of modules in this context.
2727 The order of engravers added with @code{\consists} is
2730 @item @code{\consistsend} @var{engravername} @code{;}
2731 Analogous to @code{\consists}, but makes sure that
2732 @var{engravername} is always added to the end of the list of
2735 Some engraver types need to be at the end of the list; this
2736 insures they are put there, and stay there, if a user adds or
2737 removes engravers. This command is usually not needed for
2740 @item @code{\accepts} @var{contextname} @code{;}
2741 Add @var{contextname} to the list of context this context can
2742 contain. The first listed context is the context to create by
2745 @item @code{\denies}. The opposite of @code{\accepts}. Added for
2746 completeness, but is never used in practice.
2749 @item @code{\remove} @var{engravername} @code{;}
2750 Remove a previously added (with @code{\consists}) engraver.
2752 @item @code{\name} @var{contextname} @code{;}
2753 This sets name of the context, e.g. @code{Staff}, @code{Voice}. If
2754 the name is not specified, the translator won't do anything.
2756 @item @var{propname} @code{=} @var{value} @code{;}
2757 A property assignment. It is allowed to use reals for
2761 In the @code{\paper} block, it is also possible to define translator
2762 identifiers. Like other block identifiers, the identifier can only
2763 be used as the very first item of a translator. In order to define
2764 such an identifier outside of @code{\score}, you must do
2770 foo = \translator @{ @dots{} @}
2777 \translator @{ \foo @dots{} @}
2785 @cindex paper types, engravers, and pre-defined translators
2787 Some pre-defined identifiers can simplify modification of
2788 translators. The pre-defined identifiers are:
2791 @cindex @code{StaffContext}
2792 @item @code{StaffContext}
2793 Default Staff context.
2794 @cindex @code{RhythmicStaffContext}
2796 @item @code{RhythmicStaffContext}
2797 Default RhythmicStaff context.
2798 @cindex @code{VoiceContext}
2800 @item @code{VoiceContext}
2801 Default Voice context.
2802 @cindex @code{ScoreContext}
2804 @item @code{ScoreContext}
2805 Default Score context.
2806 @cindex @code{ScoreWithNumbers}
2808 @item @code{ScoreWithNumbers}
2809 Score context with numbering at the Score level.
2810 @cindex @code{BarNumberingStaffContext}
2812 @item @code{BarNumberingStaffContext}
2813 Staff context with numbering at the Staff level.
2814 @cindex @code{HaraKiriStaffContext}
2816 @item @code{HaraKiriStaffContext}
2817 Staff context that does not print if it only contains rests.
2818 Useful for orchestral scores.@footnote{Harakiri, also called
2819 Seppuku, is the ritual suicide of the Japanese Samourai warriors.}
2820 @cindex @code{OrchestralPartStaffContext}
2822 @item @code{OrchestralPartStaffContext}
2823 @cindex @code{OrchestralScoreContext}
2825 @item @code{OrchestralScoreContext}
2828 Using these pre-defined values, you can remove or add items to the
2837 \remove Some_engraver;
2838 \consists Different_engraver;
2848 @c_ {Notation Contexts}
2849 @node Notation Contexts
2850 @subsection Notation Contexts
2852 @cindex notation contexts
2854 Notation contexts are objects that only exist during a run of
2855 LilyPond. During the interpretation phase of LilyPond, the Music
2856 expression contained in a @code{\score} block is interpreted in time
2857 order. This is the order in which humans read, play, and write
2860 A context is an object that holds the reading state of the
2861 expression; it contains information like
2864 @item What notes are playing at this point?
2865 @item What symbols will be printed at this point?
2866 @item In what style will they printed?
2867 @item What is the current key signature, time signature, point within
2871 Contexts are grouped hierarchically: A @code{Voice} context is
2872 contained in a @code{Staff} context (because a staff can contain
2873 multiple voices at any point), a @code{Staff} context is contained in
2874 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
2875 these can all contain multiple staffs).
2877 Contexts associated with sheet music output are called @emph{notation
2878 contexts}, those for sound output are called performance contexts.
2880 Contexts are created either manually or automatically. Initially, the
2881 top level music expression is interpreted by the top level context (the
2882 @code{Score} context). When a atomic music expression (i.e. a note, a
2883 rest, etc.), a nested set of contexts is created that can process these
2884 atomic expressions, as in this example:
2887 \score @{ \notes @{ c4 @} @}
2890 The sequential music, `@code{@{ c4 @}}' is interpreted by @code{Score}
2891 context. When the note @code{c4} itself is interpreted, a set of
2892 contexts is needed that will accept notes. The default for this is a
2893 @code{Voice} context, contained in a @code{Staff} context. Creation of
2894 these contexts results in the staff being printed.
2898 You can also create contexts manually, and you probably have to do so
2899 if you want to typeset complicated multiple part material. If a
2900 `@code{\context} @var{name} @var{musicexpr}' expression is encountered
2901 during the interpretation phase, the @var{musicexpr} argument will be
2902 interpreted with a context of type @var{name}. If you specify a name,
2903 the specific context with that name is searched.
2907 If a context of the specified type and name can not be found, a new
2908 one is created. For example,
2914 \notes \relative c'' {
2915 c4 <d4 \context Staff = "another" e4> f
2922 In this example, the @code{c} and @code{d} are printed on the
2923 default staff. For the @code{e}, a context Staff called
2924 @code{another} is specified; since that does not exist, a new
2925 context is created. Within @code{another}, a (default) Voice context
2926 is created for the @code{e4}. When all music referring to a
2927 context is finished, the context is ended as well. So after the
2928 third quarter, @code{another} is removed.
2930 Almost all music expressions inherit their interpretation context
2931 from their parent. In other words, suppose that the syntax for a
2936 \keyword @var{musicexpr1} @var{musicexpr2} @dots{}
2939 When the interpretation of this music expression starts, the context
2940 for @var{musicexpr1}, @var{musicexpr2}, etc. is that of the total
2943 Lastly, you may wonder, why this:
2949 \notes \relative c'' @{
2957 doesn't result in this:
2962 \notes \relative c'' {
2969 For the @code{c4}, a default @code{Staff} (with a contained
2970 @code{Voice}) context is created. After the @code{c4} ends, no
2971 music refers to this default staff, so it would be ended, with the
2972 result shown. To prevent this inconvenient behavior, the context to
2973 which the sequential music refers is adjusted during the
2974 interpretation. So after the @code{c4} ends, the context of the
2975 sequential music is also the default @code{Voice} context.
2976 The @code{d4} gets interpreted in the same context
2979 Properties that are set in one context are inherited by all of the
2980 contained contexts. This means that a property valid for the
2981 @code{Voice} context can be set in the @code{Score} context (for
2982 example) and thus take effect in all @code{Voice} contexts.
2984 Properties can be preset within the @code{\translator} block
2985 corresponding to the appropriate context. In this case, the syntax
2989 @var{propname} @code{=} @var{value}
2992 This assignment happens before interpretation starts, so a
2993 @code{\property} expression will override any predefined settings.
2995 The property settings are used during the interpretation phase. They
2996 are read by the LilyPond modules where interpretation contexts are
2997 built of. These modules are called @emph{translators}. Translators for
2998 notation are called @emph{engravers}, and translators for sound are
2999 called @emph{performers}.
3005 @section Lexer innards
3006 @cindex Lexer innards
3018 @subsection Top level
3021 This section describes what you may enter at top level.
3024 @unnumberedsubsec Score definition
3025 @cindex score definition
3027 The output is generated combining a music expression with an output
3028 definition. A score block has the following syntax:
3031 \score @{ @var{musicexpr} @var{outputdefs} @}
3034 @var{outputdefs} are zero or more output definitions. If no output
3035 definition is supplied, the default @code{\paper} block will be added.
3039 @subsubsection Score
3043 @subsubsection Paper
3051 @subsubsection Header
3053 @cindex @code{\header}
3058 \header @{ @var{key1} = @var{val1};
3059 @cindex @code{ly2dvi}
3060 @var{key2} = @var{val2}; @dots{} @}
3064 A header describes the file's contents. It can also appear in a
3065 @code{\score} block. Tools like @code{ly2dvi} can use this
3066 information for generating titles. Key values that are used by
3067 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
3068 metre, arranger, piece and tagline.
3070 It is customary to put the @code{\header} at the top of the file.
3072 @subsubsection Default output
3074 A @code{\midi} or @code{\paper} block at top-level sets the default
3076 paper block for all scores that lack an explicit paper block.
3080 @subsection Identifiers
3083 All of the information in a LilyPond input file, is represented as a
3084 Scheme value. In addition to normal Scheme data types (such as pair,
3085 number, boolean, etc.), LilyPond has a number of specialized data types,
3090 @item Music: see @ref{Music expressions}
3092 @item Translator_def:
3093 See section @ref{contextdefs} for more information
3097 @item Music_output_def
3098 @item Moment (rational number)
3101 LilyPond also includes some transient object types. Objects of these
3102 types are built during a LilyPond run, and do not `exist' per se within
3103 your input file. These objects are created as a result of your input
3104 file, so you can include commands in the input to manipulate them,
3105 during a lilypond run.
3108 @item Grob: short for Graphical object. See @ref{Grobs}.
3109 @item Molecule: device-independent page output object,
3110 including dimensions. Produced by some Grob functions
3112 @item Translator: object that produces audio objects or Grobs. This is
3113 not yet user accessible.
3114 @item Font_metric: object representing a font. (See @ref{Font metrics})
3115 @c @item Audio_element: (todo, smobme)
3121 @subsection Assignments
3124 Identifiers allow objects to be assigned to names during the parse
3125 stage. To assign an identifier, you use @var{name}@code{=}@var{value}
3126 and to refer to an identifier, you preceed its name with a backslash:
3127 `@code{\}@var{name}'. @var{value} is any valid Scheme value or any of
3128 the input-types listed above. Identifier assignments can appear at top
3129 level in the LilyPond file, but also in @code{\paper} blocks.
3131 Semicolons are forbidden after top level assignments, but mandatory in
3132 other places. The rules about semicolons and assignments are very
3133 confusing, but when LilyPond input evolves more towards Scheme, we hope
3134 that this problem will grow smaller.
3136 An identifier can be created with any string for its name, but you will
3137 only be able to refer to identifiers whose names begin with a letter,
3138 being entirely alphanumeric. It is impossible to refer to an identifier
3139 whose name is the same as the name of a keyword.
3141 The right hand side of an identifier assignment is parsed completely
3142 before the assignment is done, so it is allowed to redefine an
3143 identifier in terms of its old value, e.g.
3149 When an identifier is referenced, the information it points to is
3150 copied. For this reason, an identifier reference must always be the
3151 first item in a block.
3155 \paperIdent % wrong and invalid
3159 \paperIdent % correct
3166 @c_ {Lexical details}
3167 @node Lexical details
3168 @subsection Lexical details
3169 @cindex Lexical details
3174 @subsubsection Comments
3180 A one line comment is introduced by a @code{%} character.
3181 Block comments are started by @code{%@{} and ended by `@code{%@}}'.
3182 They cannot be nested.
3185 @subsubsection Direct Scheme
3188 @cindex Scheme, in-line code
3191 LilyPond contains a Scheme interpreter (the GUILE library) for
3192 internal use. In some places Scheme expressions also form valid syntax:
3193 whereever it is allowed,
3197 evaluates the specified Scheme code. If this is used at toplevel, then
3198 the result is discarded. Example:
3200 \property Staff.TestObject \override #'foobar = #(+ 1 2)
3203 @code{\override} expects two Scheme expressions, so there are two Scheme
3204 expressions. The first one is a symbol (@code{foobar}), the second one
3205 an integer (namely, 3).
3207 Scheme is a full-blown programming language, and a full discussion is
3208 outside the scope of this document. Interested readers are referred to
3209 the website @uref{http://www.schemers.org/} for more information on
3214 @subsubsection Keywords
3218 Keywords start with a backslash, followed by a number of lower case
3219 alphabetic characters. These are all the keywords.
3222 apply arpeggio autochange spanrequest commandspanrequest
3223 simultaneous sequential accepts alternative bar breathe
3224 char chordmodifiers chords clef cm consists consistsend
3225 context denies duration dynamicscript elementdescriptions
3226 font grace header in lyrics key mark pitch
3227 time times midi mm name pitchnames notes outputproperty
3228 override set revert partial paper penalty property pt
3229 relative remove repeat addlyrics partcombine score
3230 script stylesheet skip textscript tempo translator
3235 @subsubsection Integers
3243 Formed from an optional minus sign followed by digits. Arithmetic
3244 operations cannot be done with integers, and integers cannot be mixed
3248 @subsubsection Reals
3249 @cindex real numbers
3255 Formed from an optional minus sign and a sequence of digits followed
3256 by a @emph{required} decimal point and an optional exponent such as
3257 @code{-1.2e3}. Reals can be built up using the usual operations:
3258 `@code{+}', `@code{-}', `@code{*}', and
3259 `@code{/}', with parentheses for grouping.
3267 A real constant can be followed by one of the dimension keywords:
3268 @code{\mm} @code{\pt}, @code{\in}, or @code{\cm}, for millimeters,
3269 points, inches and centimeters, respectively. This converts the number
3270 to a real that is the internal representation of dimensions.
3274 @subsubsection Strings
3278 Begins and ends with the @code{"} character. To include a @code{"}
3279 character in a string write @code{\"}. Various other backslash
3280 sequences have special interpretations as in the C language. A string
3281 that contains no spaces can be written without the quotes. See
3282 @ref{Lexical modes} for details on unquoted strings; their interpretation varies
3283 depending on the situation. Strings can be concatenated with the
3286 The tokenizer accepts the following commands. They have no grammatical
3287 function, hence they can appear anywhere in the input.
3291 @subsubsection Main input
3294 @cindex @code{\maininput}
3296 The @code{\maininput} command is used in init files to signal that the
3297 user file must be read. This command cannot be used in a user file.
3299 @c_ {File inclusion}
3300 @subsubsection Main input
3303 @subsubsection File inclusion
3304 @cindex @code{\include}
3306 \include @var{filename}
3309 Include @var{filename}. The argument @var{filename} may be a quoted string (an
3310 unquoted string will not work here!) or a string identifier. The full
3311 filename including the @file{.ly} extension must be given,
3313 @subsubsection Version information
3314 @cindex @code{\version}
3316 \version @var{string} ;
3319 Specify the version of LilyPond that a file was written for. The
3320 argument is a version string in quotes, for example @code{"1.2.0"}.
3321 This is used to detect invalid input, and to aid
3322 @code{convert-ly} a tool that automatically upgrades input files. See
3323 See @ref{convert-ly} for more information on @code{convert-ly}.
3331 @subsubsection Pitch names
3332 @cindex Lexical modes
3336 @cindex chord modifier names
3338 Note names and chord modifiers can be customised for nationalities.
3339 languages and conventions. The syntax is as follows.
3340 @cindex @code{\pitchnames}
3341 @cindex @code{\chordmodifiers}
3344 \pitchnames @var{scheme-alist}
3345 \chordmodifiers @var{scheme-alist}
3348 See @file{ly/nederlands.ly} and @file{ly/chord-modifiers.ly} for
3349 specific examples how to do this. tables can be tailored specified
3350 using. Some national note names have been provided, see
3351 section @ref{Other languages}.
3352 A @code{\paper} block at top level sets the default paper block. A
3353 @code{\midi} block at top level works similarly.
3356 @subsubsection Assignments
3360 Identifier assignments may appear at top level. @ref{Assignments}
3365 @subsubsection Direct scheme
3366 @cindex Direct scheme
3368 Scheme statements maybe issued to produce interesting side-effects.
3373 @subsection Lexical modes
3374 @cindex Lexical modes
3376 @cindex Lexical modes
3379 To simplify entering notes, lyrics, and chords, LilyPond has three
3380 special input modes on top of the default mode. In each mode, words
3381 are identified on the input. If @code{"word"} is encountered, it is
3382 treated as a string. If @code{\word} is encountered, it is treated as
3383 a keyword or as an identifier. The behavior of the modes differs in
3384 two ways: Different modes treat unquoted words differently, and
3385 different modes have different rules for deciding what is a word.
3391 At the start of parsing, LilyPond is in Normal mode. In Normal
3392 mode, a word is an alphabetic character followed by alphanumeric
3393 characters. If @code{word} is encountered on the input it is
3394 treated as a string.
3397 See @ref{Note entry}.
3400 See @ref{Lyrics entry}.
3403 See @ref{Chord entry}.
3410 @cindex @code{\notes}
3411 @cindex @code{\chords}
3412 @cindex @code{\lyrics}
3414 Mode switching keywords form compound music expressions: @code{\notes}
3415 @var{musicexpr}, @code{\chords} @var{musicexpr},
3416 and @code{\lyrics} @var{musicexpr}. These
3417 expressions do not add anything to the meaning of their arguments. They
3418 are just a way to indicate that the arguments should be parsed in
3419 indicated mode. See @ref{Lexical modes} for more information on modes.
3423 @subsection Ambiguities
3428 The grammar contains a number of ambiguities. We hope to resolve them at
3432 @item The assignment
3438 can be interpreted as making a string identifier @code{\foo}
3439 containing @code{"bar"}, or a music identifier @code{\foo}
3440 containing the syllable `bar'.
3442 @item The assignment
3448 can be interpreted as making an integer identifier
3449 containing -6, or a Request identifier containing the
3450 fingering `6' (with neutral direction).
3452 @item If you do a nested repeat like
3464 then it is ambiguous to which @code{\repeat} the
3465 @code{\alternative} belongs. This is the classic if-then-else
3466 dilemma. It may be solved by using braces.
3468 @item (an as yet unidentified ambiguity :-)
3484 @unnumberedsubsec Translation property
3486 @cindex @code{\property}
3488 \property @var{contextname}.@var{propname} = @var{value}
3491 Sets the @var{propname} property of the context @var{contextname} to
3492 the specified @var{value}. All three arguments are strings.
3493 Depending on the context, it may be necessary to quote the strings or
3494 to leave space on both sides of the dot.
3496 @cindex translator switches
3497 @unnumberedsubsec Translator switches
3499 @cindex @code{\translator}
3501 \translator @var{contexttype} = @var{name}
3504 A music expression indicating that the context which is a direct
3505 child of the a context of type @var{contexttype} should be shifted to
3506 a context of type @var{contexttype} and the specified name.
3508 Usually this is used to switch staffs in Piano music, e.g.
3511 \translator Staff = top @var{Music}
3515 @cindex output properties
3516 @unnumberedsubsec Output properties
3518 These allow you to tweak what is happening in the back-end
3519 directly. If you want to control every detail of the output
3520 formatting, this is the feature to use. The downside to this is that
3521 you need to know exactly how the backend works. Example:
3524 @lilypond[fragment,verbatim]
3526 \context Staff \outputproperty
3527 #(make-type-checker 'note-head-interface)
3528 #'extra-offset = #'(5.0 . 7.5)
3532 This selects all note heads occurring at current staff level, and sets
3533 the @code{extra-offset} of those heads to @code{(5,7.5)}, shifting them
3536 Use of this feature is entirely on your own risk: if you use this, the
3537 result will depend very heavily on the implementation of the backend,
3538 which we change regularly and unscrupulously.
3541 @c_{Local emacs vars}
3544 @c minor-mode: font-lock
3545 @c minor-mode: outline
3546 @c xoutline-layout: (0 : -1 -1 0)
3547 @c outline-layout: (-1 : 0)
3548 @c outline-primary-bullet: "{"
3549 @c outline-stylish-prefixes: nil
3550 @c outline-override-protect: t