3 @c - Reinsert subsection commands that were lost in the
4 @c ancient conversion from YODL! /MB
5 @c - Restructure! Separate internal commands from user level commands. /MB
6 @c - Add some words about Guile. /MB
7 @c - Fix indexing (keyindex) so it doesn't add line breaks /MB
9 @node Reference Manual, , , Top
10 @chapter Reference Manual
14 * Top level:: Top level
15 * Pitch names:: Pitch names
16 * Lexical conventions:: Lexical conventions
17 * Other languages:: Note names in various languages
18 * Lexical modes:: modes
20 * Music expressions:: Music expressions
21 * Atomic music expressions:: Atomic music expressions
22 * Note specification:: notedesc
24 * Manual beams:: Manual beam
25 * stem tremolo:: tremolo
26 * Compound music expressions:: Compound music expressions
29 * transpose:: transpose
30 * Ambiguities:: Ambiguities
31 * Notation conversion specifics:: Notation conversion specifics
33 * lyricprint:: lyricprint
34 * Notation Contexts:: Notation Contexts
35 * Properties:: Changing formatting
36 * Notation output definitions:: Notation output definitions
38 * Paper variables:: papervars
39 * contextdefs:: contextdefs
40 * Sound output:: Sound output
42 * Pre-defined Identifiers:: Pre-defined Identifiers
43 @c May be fragile. Better make single link to generated doco?
44 * Interpretation contexts:(lilypond-internals)LilyPond interpretation contexts.
45 * Engravers:(lilypond-internals)LilyPond engravers.
46 * Backend:(lilypond-internals)LilyPond backend.
51 @node Overview, , , Reference Manual
54 This document@footnote{This document has been revised for LilyPond 1.2.}
55 describes the the GNU LilyPond input format This format represents a
56 piece of music in an elegant way, but contains enough information for
57 both automatic typesetting and automatic performances.
59 LilyPond input can be classified into three types:
61 @item musical expressions: a musical expression is some combination of
63 @item output definitions: recipes for translating those musical
64 expressions into performances (MIDI) or graphics (eg. PostScript).
66 @item declarations: by declaring and naming musical expressions, you
67 can enter and edit them in manageable chunks.
72 @node Top level, , , Reference Manual
77 This section describes what you may enter at top level.
81 @cindex score definition
83 The output is generated combining a music expression with an output
84 definition. A score block has the following syntax:
87 \score @{ @var{musicexpr} @var{outputdefs} @}
90 @var{outputdefs} are zero or more output definitions. If no output
91 definition is supplied, the default @code{\paper} block will be added.
100 \header @{ @var{key1} = @var{val1};
101 @var{key2} = @var{val2}; @dots{} @}
104 A header describes the file's contents. It can also appear in a
105 @code{\score} block. Tools like @code{ly2dvi}@indexcode{ly2dvi} can use this
106 information for generating titles. Key values that are used by
107 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
108 metre, arranger, piece and tagline.
110 It is customary to put the @code{\header} at the top of the file.
113 @node Pitch names, , , Reference Manual
115 Note names and chord modifiers can be customised for nationalities.
116 languages and conventions. The syntax is as follows.
118 \pitchnames @keyindex{pitchnames} @var{scheme-alist}
119 \chordmodifiers@keyindex{chordmodifiers} @var{scheme-alist}
122 See @file{ly/nederlands.ly} and @file{ly/chord-modifiers.ly} for
123 specific examples how to do this. tables can be tailored specified
124 using. Some national note names have been provided, see @ref{Other
127 A @code{\paper} block at top level sets the default paper block. A
128 @code{\midi} block at top level works similarly.
132 Identifier assignments may appear at top level. Semicolons are
133 forbidden after top level assignments.
137 @node Lexical conventions, , , Reference Manual
138 @section Lexical conventions
140 @cindex lexical conventions
144 @unnumberedsubsec Comments
151 A one line comment is introduced by a `@code{%}' character.
152 Block comments are started by `@code{%@{}' and ended by `@code{%@}}'.
153 They cannot be nested.
155 @unnumberedsubsec Scheme
159 LilyPond contains a Scheme interpreter (the GUILE library) for
160 internal use. The interpreter is accessed by the pound sign:
162 Whereever the syntax allows Scheme expressions, you may enter one as
168 Evaluates the specified Scheme code. If this is used at toplevel, then
169 the result is discarded. Example:
171 \property Staff.TestObject \override #'symbol = #(+ 1 2)
174 (in this case, @code{\override} expects two Scheme expressions.
176 [refer appendix/ online intro on Scheme]
178 @unnumberedsubsec Keywords
182 Keywords start with a backslash, followed by a number of lower case
183 alphabetic characters. These are all the keywords.
186 apply arpeggio autochange spanrequest commandspanrequest
187 simultaneous sequential accepts alternative bar breathe
188 char chordmodifiers chords clef cm consists consistsend
189 context denies duration dynamicscript elementdescriptions
190 font grace header in lyrics key mark musicalpitch
191 time times midi mm name pitchnames notes outputproperty
192 override set revert partial paper penalty property pt
193 relative remove repeat addlyrics partcombine score
194 script stylesheet skip textscript tempo translator
198 @unnumberedsubsec Integers
202 Formed from an optional minus sign followed by digits. Arithmetic
203 operations cannot be done with integers, and integers cannot be mixed
206 @unnumberedsubsec Reals
211 Formed from an optional minus sign and a sequence of digits followed
212 by a @emph{required} decimal point and an optional exponent such as
213 @code{-1.2e3}. Reals can be built up using the usual operations:
214 `@code{+}@indexcode{+}', `@code{-}@indexcode{-}', `@code{*}@indexcode{*}', and
215 `@code{/}@indexcode{/}', with parentheses for grouping.
217 A real constant can be followed by one of the dimension
220 @code{\mm}@keyindex{mm},
221 @code{\pt}@keyindex{pt}, @code{\in}@keyindex{in}, or
222 @code{\cm}@keyindex{cm}, for millimeters, points, inches and
223 centimeters, respectively. This converts the number to a real that
224 is the internal representation of dimensions.
230 Begins and ends with the `@code{"}' character. To include a `@code{"}'
231 character in a string write `@code{\"}'. Various other backslash
232 sequences have special interpretations as in the C language. A string
233 that contains no spaces can be written without the quotes. See
234 @ref{Lexical modes} for details on unquoted strings; their interpretation varies
235 depending on the situation. Strings can be concatenated with the
238 The tokenizer accepts the following commands. They have no grammatical
239 function, hence they can appear anywhere in the input.
242 \maininput@keyindex{maininput}
245 This command is used in init files to signal that the user file must
246 be read. This command cannot be used in a user file.
248 @unnumberedsubsec file inclusion
251 \include@keyindex{include} @var{file}
254 Include @var{file}. The argument @var{file} may be a quoted string (an
255 unquoted string will not work here!) or a string identifier. The full
256 filename including the @file{.ly} extension must be given,
258 @unnumberedsubsec Version information
261 \version@keyindex{version} @var{string} ;
264 Specify the version of LilyPond that a file was written for. The
265 argument is a version string in quotes, for example @code{"1.2.0"}.
266 This is used to detect invalid input, and to aid
267 @code{convert-ly}, a tool that automatically upgrades input files.
271 @cindex other languages
273 @node Other languages, , , Reference Manual
275 Note name definitions have been provided in various languages.
276 Simply include the language specific init file. For example:
277 `@code{\include "english.ly"}'. The available language files and the
278 names they define are:
281 Note Names sharp flat
282 nederlands.ly c d e f g a bes b -is -es
283 english.ly c d e f g a bf b -s/-sharp -f/-flat
284 deutsch.ly c d e f g a b h -is -es
285 norsk.ly c d e f g a b h -iss/-is -ess/-es
286 svenska.ly c d e f g a b h -iss -ess
287 italiano.ly do re mi fa sol la sib si -d -b
288 catalan.ly do re mi fa sol la sib si -d/-s -b
291 Pitch names can be redefined using the @code{\pitchnames} command, see
294 @cindex Lexical Modes
298 @node Lexical modes, , , Reference Manual
300 To simplify entering notes, lyrics, and chords, @emph{Lilypond} has three
301 special input modes on top of the default mode. In each mode, words
302 are identified on the input. If @code{"word"} is encountered, it is
303 treated as a string. If @code{\word} is encountered, it is treated as
304 a keyword or as an identifier. The behavior of the modes differs in
305 two ways: Different modes treat unquoted words differently, and
306 different modes have different rules for deciding what is a word.
312 At the start of parsing, @emph{Lilypond} is in Normal mode. In Normal
313 mode, a word is an alphabetic character followed by alphanumeric
314 characters. If @code{word} is encountered on the input it is
320 Note mode is introduced by the keyword
321 @code{\notes}@keyindex{notes}. In Note mode, words can only
322 contain alphabetic characters. If @code{word} is encountered,
323 LilyPond first checks for a notename of @code{word}. If no
324 notename is found, then @code{word} is treated as a string.
326 Since combinations of numbers and dots are used for indicating
327 durations, it is not possible to enter real numbers in this mode.
332 Chord mode is introduced by the keyword
333 @code{\chords}@keyindex{chords}. It is similar to Note mode, but
334 words are also looked up in a chord modifier table (containing
335 @code{maj}, @code{dim}, etc).
337 Since combinations of numbers and dots are used for indicating
338 durations, you can not enter real numbers in this mode. Dashes
339 and carets are used to indicate chord additions and subtractions,
340 so scripts can not be entered in Chord mode.
345 Lyrics mode is introduced by the keyword
346 @code{\lyrics}@keyindex{lyrics}. This mode has rules that make it
347 easy to include punctuation and diacritical marks in words. A
348 word in Lyrics mode begins with: an alphabetic character,
349 `@code{_}', `@code{?}', `@code{!}', `@code{:}', `@code{'}', the
350 control characters @code{^A} through @code{^F}, @code{^Q} through
351 @code{^W}, @code{^Y}, @code{^^}, any 8-bit character with ASCII code
352 over 127, or a two-character combination of a backslash followed
353 by one of `@code{`}', `@code{'}', `@code{"}', or
354 `@code{^}'.@footnote{The purpose of Lyrics mode is that you can
355 enter lyrics in @TeX{} format or a standard encoding without
356 needing quotes. The precise definition of this mode indeed is
357 ludicrous. This will remain so until the authors of LilyPond
358 acquire a deeper understanding of character encoding, or someone
359 else steps up to fix this.}
361 Subsequent characters of a word can be any character that is not
362 a digit and not white space. One important consequence of this
363 is that a word can end with `@code{@}}', which may be confusing if
364 you thought the closing brace was going to terminate Lyrics
365 mode.@footnote{LilyPond will issue a warning, though.} Any
366 `@code{_}' character which appears in an unquoted word is
367 converted to a space. This provides a mechanism for introducing
368 spaces into words without using quotes. Quoted words can also be
369 used in Lyrics mode to specify words that cannot be written with
370 the above rules. Here are some examples. Not all of these words
371 are printable by @TeX{}.
375 2B_||_!2B % not a word because it starts with a digit
376 ``Hello'' % not a word because it starts with `
377 _ _ _ _ % 4 words, each one a space
380 Since combinations of numbers and dots are used for indicating
381 durations, you can not enter real numbers in this mode.
384 [todo: include short table showign differences]
386 @node Types, , , Reference Manual
391 [say something about types]
393 All of the information in a LilyPond input file, is represented as a
394 Scheme value. In addition to normal Scheme data types (such as pair,
395 number, boolean, etc.), LilyPond has a number of specialized data types,
400 @item Music: see @ref{Music expressions}
402 @item Translator_def:
403 See section @ref{contextdefs} for more information
408 @item Music_output_def (TODO: this is not really a Scheme object
409 yet. Nevertheless, you can use identifiers to make references to them )
410 @item Moment (rational number)
413 LilyPond also includes some transient object types. Objects of these
414 types are built during a LilyPond run, and do not `exist' per se within
415 your input file. These objects are created as a result of your input
416 file, so you can include commands in the input to manipulate them,
417 during a lilypond run.
420 @item Grob: short for Graphical object. See @ref{Grobs}.
421 @item Molecule: device-independent page output object,
422 including dimensions. Produced by some Grob functions
424 @item Translator: object that produces audio objects or Grobs.
425 @item Font_metric: object representing a font. (Not yet user
428 @c @item Audio_element: (todo, smobme)
431 Identifiers allow objects to be assigned to names during the parse
432 stage. To assign an identifier, you use `@var{name}=@var{value}' and to
433 refer to an identifier, you preceed its name with a backslash:
434 `@code{\}@var{name}'. Identifier assignments must appear at top level
435 in the @emph{Lilypond} file. Semicolons are forbidden after assignments
436 appearing at top level but they are obligatory after assignments
437 appearing in the @code{\paper} block, see Section @ref{paper}.
439 @var{value} is any valid Scheme value or any of the input-types listed
442 An identifier can be created with any string for its name, but you will
443 only be able to refer to identifiers whose names begin with a letter,
444 being entirely alphanumeric. It is impossible to refer to an identifier
445 whose name is the same as the name of a keyword.
447 The right hand side of an identifier assignment is parsed completely
448 before the assignment is done, so it is allowed to redefine an
449 identifier in terms of its old value, e.g.
455 When an identifier is referenced, the information it points to is
456 copied. For this reason, an identifier reference must always be the
457 first item in a block.
461 \paperIdent % wrong and invalid
465 \paperIdent % correct
471 @node Music expressions, , , Reference Manual
472 @section Music expressions
474 @cindex music expressions
476 Music in @emph{Lilypond} is entered as a music expression. Notes, rests,
477 lyric syllables are music expressions (the atomic
479 @cindex atomic music expressions
480 , and you can combine
481 music expressions to form new ones. This example forms a compound
482 expressions out of the quarter @code{c} note and a @code{d}
486 \sequential @{ c4 d4 @}
489 The meaning of this compound expression is to play the `@code{c}'
490 first, and then the `@code{d}' (as opposed to playing them
491 simultaneously, for instance).
493 Atomic music expression are discussed in
494 subsection @ref{Atomic music expressions}. Compound music expressions are
495 discussed in subsection @ref{Compound music expressions}.
499 @node Atomic music expressions, , , Reference Manual
500 @section Atomic music expressions
510 The syntax for pitch specification is
514 \musicalpitch@keyindex{musicalpitch} @{ @var{octave} @var{note} @var{shift} @}
517 @var{octave} is specified by an integer, zero for the octave
518 containing middle C. @var{note} is a number from 0 to 7, with 0
519 corresponding to C and 7 corresponding to B. The shift is zero for a
520 natural, negative to add flats, or positive to add sharps.
522 In Note and Chord mode, pitches may be designated by names. See
523 section @ref{Other languages} for pitch names in different languages.
525 The syntax for duration specification is
528 \duration@keyindex{duration}
529 @{ @var{length} @var{dotcount} @}
532 @var{length} is the negative logarithm (base 2) of the duration:
533 1 is a half note, 2 is a quarter note, 3 is an eighth
534 note, etc. The number of dots after the note is given by
537 In Note, Chord, and Lyrics mode, durations may be designated by
541 @node Note specification, , , Reference Manual
543 @cindex note specification
547 @cindex entering notes
549 A note specification has the form
552 @var{pitch}[@var{octavespec}][!][?][@var{duration}]
555 The pitch of the note is specified by the note's name.
558 The default names are the Dutch note names. The notes are specified
559 by the letters `@code{c}' through `@code{b}', where `@code{c}' is an
560 octave below middle C and the letters span the octave above that C.
562 @cindex notenames!Dutch
563 a sharp is formed by adding `@code{-is}' to the end of a pitch name. A
564 flat is formed by adding `@code{-es}'. Double sharps and double flats
565 are obtained by adding `@code{-isis}' or `@code{-eses}'. `@code{aes}'
566 and `@code{ees}' are contracted to `@code{as}' and `@code{es}' in Dutch,
567 but both forms will be accepted.
569 LilyPond has predefined sets of notenames for various languages. See
570 @ref{Other languages}.
574 The optional octave specification takes the form of a series of
575 single quote (`@code{'}@indexcode{'}') characters or a series of comma
576 (`@code{,}@indexcode{,}') characters. Each @code{'} raises the pitch by one
577 octave; each @code{,} lowers the pitch by an octave.
579 @lilypond[fragment,verbatim,center]
580 c' d' e' f' g' a' b' c''
583 @lilypond[fragment,verbatim,center]
584 cis' dis' eis' fis' gis' ais' bis'
587 @lilypond[fragment,verbatim,center]
588 ces' des' es' fes' ges' as' bes'
591 @lilypond[fragment,verbatim,center]
592 cisis' eisis' gisis' aisis' beses'
595 @lilypond[fragment,verbatim,center]
596 ceses' eses' geses' ases' beses'
599 Whenever a C-sharp is desired, you must specify a C-sharp. LilyPond
600 will determine what accidentals to typeset depending on the key and
601 context. A reminder accidental
602 @cindex reminder accidental
604 forced by adding an exclamation mark `@code{!}' after the pitch. A
605 cautionary accidental,
606 @cindex cautionary accidental
608 accidental within parentheses can be obtained by adding the question
609 mark `@code{?}@indexcode{?}' after the pitch.
611 @lilypond[fragment,verbatim,center]
612 cis' d' e' cis' c'? d' e' c'!
618 Durations are entered as their reciprocal values. For notes longer
619 than a whole note, use identifiers.
625 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
634 \notes \relative c'' {
636 a1 a2 a4 a8 a16 a32 a64 a64
641 \remove "Clef_engraver";
642 \remove "Staff_symbol_engraver";
653 r1 r2 r4 r8 r16 r32 r64 r64
662 \notes \relative c'' {
664 r1 r2 r4 r8 r16 r32 r64 r64
667 loose_column_distance = 2.5 * \staffspace;
671 \remove "Clef_engraver";
672 \remove "Staff_symbol_engraver";
673 \remove "Bar_engraver";
680 If the duration is omitted then it is set equal to the previous
681 duration. If there is no previous duration, a quarter note is
682 assumed. The duration can be followed by a dot (`@code{.}@indexcode{.}')
683 to obtain dotted note lengths.
685 @lilypond[fragment,verbatim,center]
689 You can alter the length of duration by writing
690 `@code{*}@var{fraction}' after it. This will not affect the
691 appearance of note heads or rests.
694 Rests are entered like notes, with note name `@code{r}@indexcode{r}', or
695 `@code{R}@indexcode{R}'. There is also a note name
696 `@code{s}@indexcode{s}', which produces a space of the specified
697 duration. `@code{R}' is specifically meant for entering parts: the
698 @code{R} rest can expand to fill a score with rests, or it can be
699 printed as a single multimeasure rest.
701 You can control the expansion by setting the property
702 @code{Score.skipBars}. If this is set to true, Lily will not expand
703 empty measures, and the multimeasure rests automatically adds the
706 Note that there is currently no way to condense multiple rests into a
707 single multimeasure rest.
711 @cindex lyrics expressions
713 Syllables are entered like notes, with pitches replaced by text. For
714 example, `@code{Twin-4 kle4 twin-4 kle4}' enters four syllables, each
715 with quarter note duration. Note that the hyphen has no special
716 meaning for lyrics, and does not introduce special symbols. See
717 section @ref{Lexical modes} for a description of what is interpreted as
720 Spaces can be introduced into a lyric either by using quotes
721 (`@code{"}') or by using an underscore without quotes: `@code{He_could4
722 not4}'. All unquoted underscores are converted to spaces. Printing
723 lyrics is discussed in section @ref{lyricprint}.
730 \property@keyindex{property}
731 @var{contextname}.@var{propname} = @var{value}
734 Sets the @var{propname} property of the context @var{contextname} to
735 the specified @var{value}. All three arguments are strings.
736 Depending on the context, it may be necessary to quote the strings or
737 to leave space on both sides of the dot.
741 @cindex translator switches
744 \translator@keyindex{translator}
745 @var{contexttype} = @var{name}
748 A music expression indicating that the context which is a direct
749 child of the a context of type @var{contexttype} should be shifted to
750 a context of type @var{contexttype} and the specified name.
752 Usually this is used to switch staffs in Piano music, e.g.
755 \translator Staff = top @var{Music}
759 @cindex output properties
762 These allow you to tweak what is happening in the back-end
763 directly. If you want to control every detail of the output
764 formatting, this is the feature to use. The downside to this is that
765 you need to know exactly how the backend works. Example:
768 @lilypond[fragment,verbatim]
770 \context Staff \outputproperty
771 #(make-type-checker 'Note_head)
772 #'extra-offset = #'(5.0 . 7.5)
776 This selects all note heads occurring at current staff level, and sets
777 the extra-offset of those heads to (5,7.5), shifting them up and
780 Use of this feature is entirely on your own risk: if you use this, the
781 result will depend very heavily on the implementation of the backend,
782 which we change regularly and unscrupulously.
787 Commands are music expressions that have no duration.
792 @code{\key}@keyindex{key} @var{pitch} @var{type} @code{;}
795 Change the key signature. @var{type} should be
796 @code{\major}@keyindex{major} or @code{\minor}@keyindex{minor} to get
797 @var{pitch}-major or @var{pitch}-minor, respectively. The second
798 argument is optional; the default is major keys. The @var{\context}
799 argument can also be given as an integer, which tells the number of
800 semitones that should be added to the pitch given in the subsequent
801 @code{\key}@keyindex{key} commands to get the corresponding major key,
802 e.g., @code{\minor}@keyindex{minor} is defined as 3. The standard
803 mode names @code{\ionian}@keyindex{ionian},
804 @code{\locrian}@keyindex{locrian}, @code{\aeolian}@keyindex{aeolian},
805 @code{\mixolydian}@keyindex{mixolydian}, @code{\lydian}@keyindex{lydian},
806 @code{\phrygian}@keyindex{phrygian}, and @code{\dorian}@keyindex{dorian}
810 @code{\keysignature}@keyindex{keysignature} @var{pitchseq} @code{;}
813 Specify an arbitrary key signature. The pitches from @var{pitch} will
814 be printed in the key signature in the order that they appear on the
818 \mark@keyindex{mark} @var{unsigned};
822 Prints a mark over or under the staff. You must add
823 @code{Mark_engraver}@indexcode{Mark_engraver} to the Score context for
826 @node barlines, , , Reference Manual
829 \bar@keyindex{bar} @var{bartype};
832 This is a short-cut for doing
834 \property Score.whichBar = @var{bartype}
837 You are encouraged to use @code{\repeat} for repetitions. See
838 @ref{Repeats}, and the documentation of @code{whichBar}.
842 \time@keyindex{time} @var{numerator}@code{/}@var{denominator} @code{;}
845 A short-cut for doing
847 \property Score.timeSignatureFraction = #'(@var{numerator} . @var{denominator})
850 See the documentation of @code{timeSignatureFraction}
854 \tempo@keyindex{tempo} @var{duration} = @var{perminute} @code{;}
857 Used to specify the tempo. For example, `@code{\tempo 4 = 76;}'
858 requests output with 76 quarter notes per minute.
861 \partial@keyindex{partial} @var{duration} @code{;}
867 \property Score.measurePosition = @var{length of duration}
870 See the documentation of @code{measurePosition}.
878 @code{|}@indexcode{|}
883 @cindex shorten measures
887 `@code{|}' is a bar check. Whenever a bar check is encountered during
888 interpretation, a warning message is issued if it doesn't fall at a
889 measure boundary. This can help you finding errors in the input.
890 Depending on the value of @code{barCheckNoSynchronize}
891 @indexcode{barCheckNoSynchronize} The beginning of the measure will be
892 relocated, so this can also be used to shorten measures.
897 \penalty@keyindex{penalty} @var{int} @code{;}
900 Discourage or encourage line breaks. See identifiers
901 @code{\break}@keyindex{break} and @code{\nobreak}@keyindex{nobreak} in
902 section [on identifiers] [FIXME].
905 \clef@keyindex{clef} @var{clefname} @code{;}
911 \property Clef.clefGlyph = @var{symbol associated with clefname}
912 \property Clef.clefPosition = @var{clef Y-position for clefname}
913 \property Clef.clefOctavation = @var{extra pitch of clefname}
916 Supported clef-names include
922 \skip@keyindex{skip} @var{duration} @code{;}
925 Skips the amount of time specified by @var{duration}. If no other
926 music is played, a gap will be left for the skipped time with no
927 notes printed. It works in Note Mode or Lyrics Mode. In Note mode,
928 this has the same effect as the space rest `@code{s}'.
933 @node Manual beams, , , Reference Manual
935 A beam is specified by surrounding the beamed notes with brackets
936 `@code{[}@indexcode{[}' and `@code{]}@indexcode{]}'.
938 @lilypond[fragment,verbatim,center]
939 [a'8 a'] [a'16 a' a' a']
942 Some more elaborate constructions:
944 @lilypond[fragment,verbatim,center]
945 [a'16 <a' c''> c'' <a' c''>]
946 \times 2/3 { [e'8 f' g'] }
949 Beaming can be generated automatically; see section @ref{autobeam}.
953 To place tremolo marks between notes, use @code{\repeat} with tremolo
955 @cindex tremolo beams
956 To create tremolo beams on a single note, simply attach
957 `@code{:}@var{length}' to the note itself.
959 @lilypond[fragment,verbatim,center]
960 \repeat "tremolo" 8 { c16 d16 }
961 \repeat "tremolo" 4 { c16 d16 }
964 @lilypond[fragment,verbatim,center]
969 @cindex --@@@code{-}@code{-}
977 The syntax for an extender mark is `@code{__}'. This syntax can only
978 be used within lyrics mode. The syntax for a spanning hyphen (i.e.,
979 a hyphen that will be printed between two lyric syllables) is
985 A tie connects two adjacent note heads of the same pitch. When used
986 with chords, it connects all of the note heads whose pitches match.
987 Ties are indicated using the tilde symbol `@code{~}@indexcode{~}'.
988 If you try to tie together chords which have no common pitches, a
989 warning message will appear and no ties will be created.
991 @lilypond[fragment,verbatim,center]
992 e' ~ e' <c' e' g'> ~ <c' e' g'>
997 [TODO: explain Requests]
1000 @cindex articulations
1006 A variety of symbols can appear above and below notes to indicate
1007 different characteristics of the performance. These symbols can be
1008 added to a note with `@var{note}@code{-\}@var{name}'. Numerous symbols
1009 are defined in @file{script.ly} and @file{script.scm}. Symbols can be
1010 forced to appear above or below the note by writing
1011 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1012 respectively. Here is a chart showing symbols above notes, with the
1013 name of the corresponding symbol appearing underneath.
1019 c''-\accent c''-\marcato c''-\staccatissimo c''-\fermata
1020 c''-\stopped c''-\staccato c''-\tenuto c''-\upbow
1021 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1022 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1023 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1024 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1025 c''-\thumb c''-\segno c''-\coda
1027 \context Lyrics \lyrics {
1028 accent__ marcato__ staccatissimo__ fermata
1029 stopped__ staccato__ tenuto__ upbow
1030 downbow__ lheel__ rheel__ ltoe
1031 rtoe__ turn__ open__ flageolet
1032 reverseturn__ trill__ prall__ mordent
1033 prallprall__ prallmordent__ uprall__ downprall
1034 thumb__ segno__ coda
1038 linewidth = 5.875\in;
1045 In addition, it is possible to place arbitrary strings of text or
1046 @TeX{} above or below notes by using a string instead of an
1047 identifier: `@code{c^"text"}'. Fingerings
1050 placed by simply using digits. All of these note ornaments appear in
1051 the printed output but have no effect on the MIDI rendering of the
1054 To save typing, fingering instructions (digits 0 to 9 are
1055 supported) and single characters shorthands exist for a few
1062 \property Voice.textStyle = typewriter
1068 c''4-^_"c-\\^{ }" s4
1075 linewidth = 5.875 \in;
1082 Dynamic marks are specified by using an identifier after a note:
1083 `@code{c4-\ff}' (the dash is optional for dynamics: `@code{c4 \ff})'.
1084 The available dynamic marks are:
1085 @code{\ppp}@keyindex{ppp},
1086 @code{\pp}@keyindex{pp}, @code{\p}@keyindex{p}, @code{\mp}@keyindex{mp},
1087 @code{\mf}@keyindex{mf}, @code{\f}@keyindex{f}, @code{\ff}@keyindex{ff},
1088 @code{\fff}@keyindex{fff}, @code{\fff}@keyindex{ffff},
1089 @code{\fp}@keyindex{fp}, @code{\sf}@keyindex{sf},
1090 @code{\sff}@keyindex{sff}, @code{\sp}@keyindex{sp},
1091 @code{\spp}@keyindex{spp}, @code{\sfz}@keyindex{sfz}, and
1092 @code{\rfz}@keyindex{rfz}.
1097 \textscript@keyindex{textscript} @var{text} @var{style}
1100 Defines a text to be printed over or under a note. @var{style} is a
1101 string that may be one of @code{roman}, @code{italic}, @code{typewriter},
1102 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1104 You can attach a general textscript request using this syntax:
1109 c4-\textscript "6" "finger"
1110 c4-\textscript "foo" "normal"
1115 This is equivalent to `@code{c4-6 c4-"foo"}'.
1122 \script@keyindex{script} @var{alias}
1125 Prints a symbol above or below a note. The argument is a string
1126 which points into the script-alias table defined in @file{script.scm}.
1127 The scheme definitions specify whether the symbol follows notes into
1128 the staff, dependence of symbol placement on staff direction, and a
1129 priority for placing several symbols over one note. Usually the
1130 @code{\script}@keyindex{script} keyword is not used directly. Various
1131 helpful identifier definitions appear in @file{script.ly}.
1136 Slurs connects chords and try to avoid crossing stems. A slur is
1137 started with `@code{(}' and stopped with `@code{)}'. The
1138 starting `@code{(}' appears to the right of the first note in
1139 the slur. The terminal `@code{)}' appears to the left of the
1140 first note in the slur. This makes it possible to put a note in
1141 slurs from both sides:
1143 @lilypond[fragment,verbatim,center]
1144 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1150 A crescendo mark is started with @code{\cr}@keyindex{cr} and terminated
1151 with @code{\rc}@keyindex{rc}. A decrescendo mark is started with
1152 @code{\decr}@keyindex{decr} and terminated with
1153 @code{\rced}@keyindex{rced}. There are also shorthands for these
1154 marks. A crescendo can be started with @code{\<}@keyindex{<} and a
1155 decrescendo can be started with @code{\>}@keyindex{>}. Either one can
1156 be terminated with @code{\!}@keyindex{"!}. Note that @code{\!}
1157 must go before the last note of the dynamic mark whereas @code{\rc}
1158 and @code{\rced} go after the last note. Because these marks are
1159 bound to notes, if you want to get several marks during one note, you
1160 must use spacer notes.
1162 @lilypond[fragment,verbatim,center]
1163 c'' \< \! c'' d'' \decr e'' \rced
1164 < f''1 { s4 \< \! s2 \> \! s4 } >
1170 \spanrequest@keyindex{spanrequest} @var{startstop} @var{type}
1173 Define a spanning request. The @var{startstop} parameter is either -1
1174 (@code{\start}@keyindex{start}) or 1 (@code{\stop}@keyindex{stop}) and
1175 @var{type} is a string that describes what should be started.
1176 Supported types are @code{crescendo}, @code{decrescendo},
1177 @code{beam}, @code{slur}. This is an internal command. Users should
1178 use the shorthands which are defined in the initialization file
1181 You can attach a (general) span request to a note using
1183 @lilypond[fragment,verbatim,center]
1184 c'4-\spanrequest \start "slur"
1185 c'4-\spanrequest \stop "slur"
1188 The slur syntax with parentheses is a shorthand for this.
1192 @cindex tremolo marks
1194 @node stem tremolo, , , Reference Manual
1196 Tremolo marks can be printed on a single note by adding
1197 `@code{:}[@var{length}]' after the note. The length must be at
1198 least 8. A @var{length} value of 8 gives one line across
1199 the note stem. If the length is omitted, then the last value is
1200 used, or the value of the @code{tremoloFlags}@indexcode{tremoloFlags} property if there was
1203 @lilypond[verbatim,fragment,center]
1209 @node Compound music expressions, , , Reference Manual
1210 @section Compound music expressions
1212 @cindex compound music expressions
1214 Music expressions are compound data structures. You can nest music
1215 expressions any way you like. This simple example shows how three
1216 chords can be expressed in two different ways:
1218 @lilypond[fragment,verbatim,center]
1219 \notes \context Staff {
1221 <a c'> <b d' > <c' e'>
1222 < { a b c' } { c' d' e' } >
1226 @cindex context selection
1227 @c @keyindex{context}
1230 \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
1233 Interpret @var{musicexpr} within a context of type @var{contexttype}.
1234 If the context does not exist, it will be created. The new context
1235 can optionally be given a name.
1241 Mode switching keywords form compound music expressions: @code{\notes}
1242 @keyindex{notes} @var{musicexpr}, @code{\chords} @keyindex{chords}
1243 @var{musicexpr}, and @code{\lyrics} @keyindex{lyrics} @var{musicexpr}.
1244 These expressions do not add anything to the meaning of their
1245 arguments. They are just a way to indicate that the arguments should
1246 be parsed in indicated mode. See @ref{Lexical modes} for more
1247 information on modes.
1249 @cindex sequential music
1255 \sequential@keyindex{sequential}
1256 @code{@{} @var{musicexprlist} @code{@}}
1259 This means that list should be played or written in sequence, i.e.,
1260 the second after the first, the third after the second. The duration
1261 of sequential music is the the sum of the durations of the elements.
1262 There is a shorthand, which leaves out the keyword:
1266 @code{@{} @var{musicexprlist} @code{@}}
1271 @cindex simultaneous music
1278 \simultaneous@keyindex{simultaneous}
1279 @code{@{} @var{musicexprlist} @code{@}}
1282 It constructs a music expression where all of its arguments start at
1283 the same moment. The duration is the maximum of the durations of the
1284 elements. The following shorthand is a common idiom:
1288 @code{<} @var{musicexprlist} @code{>}
1291 If you try to use a chord as the first thing in your score, you might
1292 get multiple staffs instead of a chord.
1294 @lilypond[verbatim,center]
1303 This happens because the chord is interpreted by a score context.
1304 Each time a note is encountered a default Voice context (along with a
1305 Staff context) is created. The solution is to explicitly instantiate
1308 @lilypond[verbatim,center]
1310 \notes\context Voice <c''4 e''>
1319 @cindex relative pitch specification
1321 @node relative, , , Reference Manual
1323 It is easy to get confused by octave changing marks and accidentally
1324 putting a pitch in the wrong octave. A much better way of entering a
1325 note's octave is `the relative octave' mode.
1329 \relative@keyindex{relative} @var{startpitch} @var{musicexpr}
1332 The octave of notes that appear in @var{musicexpr} are calculated as
1333 follows: If no octave changing marks are used, the basic interval
1334 between this and the last note is always taken to be a fourth or
1335 less.@footnote{The interval is determined without regarding
1336 accidentals. A @code{fisis} following a @code{ceses} will be put above
1337 the @code{ceses}.} The octave changing marks `@code{'}' and `@code{,}'
1338 can then be added to raise or lower the pitch by an extra octave.
1339 Upon entering relative mode, an absolute starting pitch must be
1340 specified that will act as the predecessor of the first note of
1343 Entering scales is straightforward in relative mode.
1345 @lilypond[fragment,verbatim,center]
1351 And octave changing marks are used for intervals greater than a fourth.
1353 @lilypond[fragment,verbatim,center]
1355 c g c f, c' a, e'' }
1358 If the preceding item is a chord, the first note of the chord is used
1359 to determine the first note of the next chord. But other notes
1360 within the second chord are determined by looking at the immediately
1363 @lilypond[fragment,verbatim,center]
1371 The pitch after the @code{\relative} contains a notename. To parse
1372 the pitch as a notename, you have to be in note mode, so there must
1373 be a surrounding @code{\notes}@keyindex{notes} keyword (which is not
1376 The relative conversion will not affect @code{\transpose} or
1377 @code{\relative} sections in its argument. If you want to use
1378 relative within transposed music, you must place an additional
1379 @code{\relative} inside the @code{\transpose}.
1381 It is strongly recommended to use relative pitch mode: less work,
1382 less error-prone, and more readable.
1386 Chord names are a way to generate simultaneous music expressions that
1387 correspond with traditional chord names. It can only be used in
1388 Chord mode (see section @ref{Lexical modes}).
1392 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1395 @var{tonic} should be the tonic note of the chord, and @var{duration}
1396 is the chord duration in the usual notation. There are two kinds of
1397 modifiers. One type is @emph{chord additions}, which are obtained by
1398 listing intervals separated by dots. An interval is written by its
1399 number with an optional `@code{+}' or `@code{-}' to indicate raising or
1400 lowering by half a step. Chord additions has two effects: It adds
1401 the specified interval and all lower odd numbered intervals to the
1402 chord, and it may lower or raise the specified interval. Intervals
1403 must be separated by a dot (`@code{.}').
1407 @lilypond[fragment,verbatim]
1411 c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1418 The second type of modifier that may appear after the `@code{:}' is a
1419 named modifier. Named modifiers are listed in the file
1420 @file{chord-modifiers.ly}. The available modifiers are `@code{m}' and
1421 `@code{min}' which lower the 3rd half a step, `@code{aug}@indexcode{aug}' which
1422 raises the 5th, `@code{dim}@indexcode{dim}' which lowers the 5th,
1423 `@code{maj}@indexcode{maj}' which adds a raised 7th, and `@code{sus}@indexcode{sus}'
1424 which replaces the 5th with a 4th.
1428 @lilypond[fragment,verbatim]
1431 c1:m c:min7 c:maj c:aug c:dim c:sus
1439 Chord subtractions are used to eliminate notes from a chord. The
1440 notes to be subtracted are listed after a `@code{^}' character,
1443 @lilypond[fragment,verbatim,center]
1451 Chord inversions can be specified by appending `@code{/}@indexcode{/}' and
1452 the name of a single note to a chord. This has the effect of
1453 lowering the specified note by an octave so it becomes the lowest
1454 note in the chord. If the specified note is not in the chord, a
1455 warning will be printed.
1457 @lilypond[fragment,verbatim,center]
1466 Bass notes can be added by `@code{/+}@indexcode{/+}' and
1467 the name of a single note to a chord. This has the effect of
1468 adding the specified note to the chord, lowered by an octave,
1469 so it becomes the lowest note in the chord.
1471 @lilypond[fragment,verbatim,center]
1480 Throughout these examples, chords have been shifted around the staff
1481 using @code{\transpose}.
1483 You should not combine @code{\relative} with named chords.
1489 Tuplets are made out of a music expression by multiplying their
1490 duration with a fraction.
1494 \times@keyindex{times} @var{fraction} @var{musicexpr}
1497 The duration of @var{musicexpr} will be multiplied by the fraction.
1498 In print, the fraction's denominator will be printed over the notes,
1499 optionally with a bracket. The most common tuplet is the triplet in
1500 which 3 notes have the length of 2, so the notes are 2/3 of
1501 their written length:
1503 @lilypond[fragment,verbatim,center]
1504 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
1513 \grace@keyindex{grace} @var{musicexpr}
1516 A grace note expression has duration 0; the next real note is
1517 assumed to be the main note.
1519 You cannot have the grace note after the main note, in terms of
1520 duration, and main notes, but you can typeset the grace notes to the
1521 right of the main note using the property
1522 @code{graceAlignPosition}@indexcode{graceAlignPosition}.
1524 When grace music is interpreted, a score-within-a-score is set up:
1525 @var{musicexpr} has its own time bookkeeping, and you could (for
1526 example) have a separate time signature within grace notes. While in
1527 this score-within-a-score, you can create notes, beams, slurs, etc.
1528 Unbeamed eighth notes and shorter by default have a slash through the
1529 stem. This behavior can be controlled with the
1530 @code{flagStyle}@indexcode{flagStyle} property.
1534 @lilypond[fragment,verbatim]
1536 \grace c8 c4 \grace { [c16 c16] } c4
1537 \grace { \property Grace.flagStyle = "" c16 } c4
1543 At present, nesting @code{\grace}@keyindex{grace} notes, e.g.
1547 @code{\grace @{ \grace c32 c16 @} c4}
1550 may result in run-time errors of LilyPond. Since the meaning of such
1551 a construct is unclear, we don't consider this a loss. Similarly,
1552 juxtaposing two @code{\grace} sections is syntactically valid, but
1553 makes no sense and may cause runtime errors.
1555 Ending a staff or score with grace notes may also generate a run-time
1556 error, since there will be no main note to attach the grace notes to.
1562 @node Repeats, , , Reference Manual
1564 In order to specify repeats, use the @code{\repeat}@keyindex{repeat}
1565 keyword. Since repeats look and sound differently when played or
1566 printed, there are a few different variants of repeats.
1570 Repeated music is fully written (played) out. Useful for MIDI
1574 This is the normal notation: Repeats are not written out, but
1575 alternative endings (voltas) are printed, left to right.
1578 Alternative endings are written stacked, which is useful for
1582 The syntax for repeats is
1586 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
1589 If you have alternative endings, you may add
1593 \alternative@keyindex{alternative}
1594 @code{@{} @var{alternative1}
1596 @var{alternative3} @dots{} @code{@}}
1599 where each @var{alternative} is a Music expression.
1601 Normal notation repeats are used like this:
1605 @lilypond[fragment,verbatim]
1607 \repeat volta 2 { c'4 d' e' f' }
1608 \repeat volta 2 { f' e' d' c' }
1613 With alternative endings:
1617 @lilypond[fragment,verbatim]
1619 \repeat volta 2 {c'4 d' e' f'}
1620 \alternative { {d'2 d'} {f' f} }
1625 Folded repeats look like this:@footnote{Folded repeats offer little
1626 more over simultaneous music. However, it is to be expected that
1627 more functionality -- especially for the MIDI backend -- will be
1632 @lilypond[fragment,verbatim]
1634 \repeat fold 2 {c'4 d' e' f'}
1635 \alternative { {d'2 d'} {f' f} }
1642 @lilypond[fragment,verbatim]
1646 \repeat volta 2 { e | c2 d2 | e2 f2 | }
1647 \alternative { { g4 g g } { a | a a a a | b1 } }
1654 If you don't give enough alternatives for all of the repeats, then
1655 the first alternative is assumed to be repeated often enough to equal
1656 the specified number of repeats.
1660 @lilypond[fragment,verbatim]
1663 \repeat volta 3 { \partial 4; e | c2 d2 | e2 f2 | }
1664 \alternative { { g4 g g }
1665 {\partial 1; e4 e e }
1666 {\partial 1; a a a a | b1 } }
1673 It is possible to nest @code{\repeat}. This is not entirely
1674 supported: the notes will come be in the right places, but the repeat
1679 @cindex transposition of pitches
1681 @node transpose, , , Reference Manual
1683 A music expression can be transposed with
1684 @code{\transpose}@keyindex{transpose}. The syntax is
1688 \transpose @var{pitch} @var{musicexpr}
1691 This means that middle C in @var{musicexpr} is transposed to
1694 @code{\transpose} distinguishes between enharmonic pitches: both
1695 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
1696 a tone. The first version will print sharps and the second version
1701 @lilypond[fragment,verbatim]
1704 { \key e \major; c d e f }
1706 \transpose des'' { \key e \major; c d e f }
1707 \transpose cis'' { \key e \major; c d e f }
1713 If you want to use both @code{\transpose} and @code{\relative}, then
1714 you must use @code{\transpose} first. @code{\relative} will have no
1715 effect music that appears inside a @code{\transpose}.
1719 @cindex automatic lyric durations
1721 If you have lyrics that are set to a melody, you can import the
1722 rhythm of that melody into the lyrics using @code{\addlyrics}.
1723 @keyindex{addlyrics} The syntax for this is
1727 \addlyrics @var{musicexpr1 musicexpr2}
1730 This means that both @var{musicexpr1} and @var{musicexpr2} are
1731 interpreted, but that every non-command atomic music expression
1732 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1733 of @var{musicexpr1}.
1735 If the property @code{automaticMelismata}@indexcode{automaticMelismata} is set in the
1736 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1741 @lilypond[verbatim,fragment]
1744 \property Voice.automaticMelismata = ##t
1745 c8 () cis d8. e16 f2
1747 \context Lyrics \lyrics {
1753 You should use a single rhythm melody, and single rhythm lyrics (a
1754 constant duration is the obvious choice). If you do not, you will get
1755 undesired effects when using multiple stanzas:
1759 @lilypond[verbatim,fragment]
1762 c8 () cis d8. e16 f2
1764 \context Lyrics \lyrics
1771 It is valid (but probably not very useful) to use notes instead of
1772 lyrics for @var{musicexpr2}.
1777 @node Ambiguities, , , Reference Manual
1778 @section Ambiguities
1782 The grammar contains a number of ambiguities.@footnote{The authors
1783 hope to resolve them at a later time.}
1786 @item The assignment
1792 can be interpreted as making a string identifier @code{\foo}
1793 containing @code{"bar"}, or a music identifier @code{\foo}
1794 containing the syllable `bar'.
1796 @item The assignment
1802 can be interpreted as making an integer identifier
1803 containing -6, or a Request identifier containing the
1804 fingering `6' (with neutral direction).
1806 @item If you do a nested repeat like
1818 then it is ambiguous to which @code{\repeat} the
1819 @code{\alternative} belongs. This is the classic if-then-else
1820 dilemma. It may be solved by using braces.
1822 @item (an as yet unidentified ambiguity :-)
1827 @node Notation conversion specifics, , , Reference Manual
1828 @section Notation conversion specifics
1832 @cindex automatic beam generation
1834 @node autobeam, , , Reference Manual
1836 By default, LilyPond will generate beams automatically. This feature
1837 can be disabled by setting the @code{Voice.noAutoBeaming}@indexcode{Voice.noAutoBeaming}
1838 property to 1. It can be overridden for specific cases by
1839 specifying explicit beams.
1842 A large number of Voice properties are used to decide how to generate
1843 beams. Their default values appear in @file{auto-beam-settings.ly}.
1844 In general, beams can begin anywhere, but their ending location is
1845 significant. Beams can end on a beat, or at durations specified by
1846 the @code{Voice.beamAutoEnd}@indexcode{Voice.beamAutoEnd} property. To end beams every
1847 quarter note, for example, you could set
1848 @code{Voice.beamAutoEnd}@indexcode{Voice.beamAutoEnd} equal to `@code{"1/4"}'. To end beams
1849 at every three eighth notes you would set it to `@code{"3/8"}'. The
1850 same syntax can be used to specify beam starting points using
1851 @code{Voice.beamAutoBegin}@indexcode{Voice.beamAutoBegin}.
1853 To allow different settings for different time signatures, these
1854 property names can start with `@code{time}@var{N}@code{_}@var{M}' to
1855 restrict the definition to `@var{N}@code{/}@var{M}' time. For example,
1856 to specify beams ending only for 6/8 time you would use the
1857 property @code{Voice.time6_8beamAutoEnd}. To allow different endings
1858 for notes of different durations, the duration can be tacked onto the
1859 end of the property. To specify beam endings for beams that contain
1860 32nd notes, you would use @code{Voice.beamAutoEnd_32}.
1868 @cindex printing!chord names
1870 For displaying printed chord names, use the @code{ChordNames}@indexcode{ChordNames}
1871 and @code{ChordNameVoice}@indexcode{ChordNameVoice} contexts. The chords may be entered
1872 either using the notation described above, or directly using
1877 @lilypond[fragment,verbatim]
1879 \context ChordNames {
1880 \chords{a b c} \notes{<d f g> <e g b>}
1882 \context Staff \notes {
1890 LilyPond examines chords specified as lists of notes to determine a
1891 name to give the chord. By default, LilyPond will not try to
1892 identify chord inversions:
1894 @lilypond[fragment,verbatim,center]
1896 \context ChordNameVoice \notes {
1899 \context Thread \notes {
1905 If you want inversions to be recognized, you must set the property
1906 @code{ChordNames.chordInversion}@indexcode{ChordNames.chordInversion}:
1908 @lilypond[fragment,verbatim,center]
1910 \property Score.chordInversion = ##t
1911 \context ChordNameVoice \notes {
1914 \context Thread \notes {
1924 @cindex printing!lyrics
1926 @node lyricprint, , , Reference Manual
1928 Lyric syllables must be interpreted within a @code{Lyrics} context
1930 @cindex context!Lyrics
1933 Here is a full example:
1940 \notes \transpose c'' {
1942 e f g2 | e4 f g2 \bar "|.";
1944 \context Lyrics \lyrics {
1945 Va-4 der Ja- cob Va- der Ja- cob
1946 Slaapt gij nog?2 Slaapt4 gij nog?2
1954 You may want a continuous line after the syllables to show melismata.
1955 To achieve this effect, add a `@code{__}' lyric as a separate word
1956 after the lyric to be extended. This will create an extender, a line
1957 that extends over the entire duration of the lyric. This line will
1958 run all the way to the start of the next lyric, so you may want to
1959 shorten it by using a blank lyric (using `@code{_}').
1966 \notes \relative c'' {
1967 a4 () b () c () d | c () d () b () a | c () d () b () a
1969 \context Lyrics \lyrics {
1970 foo1 __ | bar2. __ _4 | baz1 __
1979 If you want to have hyphens centered between syllables (rather than
1980 attached to the end of the first syllable) you can use the special
1981 `@code{-}@code{-}' lyric as a separate word between syllables. This
1982 will result in a hyphen which length varies depending on the space
1983 between syllables, and which will be centered between the syllables.
1991 \notes \transpose c'' {
1993 e f g2 | e4 f g2 \bar "|.";
1995 \context Lyrics \lyrics {
1996 Va4 -- der Ja -- cob | Va -- der Ja -- cob |
1997 Slaapt gij nog?2 | Slaapt4 gij nog?2
2007 @node Notation Contexts, , , Reference Manual
2008 @section Notation Contexts
2010 @cindex notation contexts
2012 Notation contexts are objects that only exist during a run of
2013 LilyPond. During the interpretation phase of LilyPond, the Music
2014 expression contained in a @code{\score} block is interpreted in time
2015 order. This is the order in which humans read, play, and write
2018 A context is an object that holds the reading state of the
2019 expression; it contains information like
2022 @item What notes are playing at this point?
2023 @item What symbols will be printed at this point?
2024 @item In what style will they printed?
2025 @item What is the current key signature, time signature, point within
2029 Contexts are grouped hierarchically: A @code{Voice} context is
2030 contained in a @code{Staff} context (because a staff can contain
2031 multiple voices at any point), a @code{Staff} context is contained in
2032 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
2033 these can all contain multiple staffs).
2035 Contexts associated with sheet music output are called @emph{notation
2036 contexts}, those for sound output are called playing contexts.
2038 Contexts are created either manually or automatically. Initially,
2039 the top level music expression is interpreted by the top level
2040 context (the @code{Score} context). When a atomic music expression
2041 (i.e. a note, a rest, @code{\bar}, or @code{\time} commands), a nested
2042 set of contexts is created that can process these atomic expressions,
2048 \score @{ \notes < c4 > @}
2053 The sequential music, `@code{@{ c4 @}}' is interpreted by @code{Score}
2054 context. When the note `@code{c4}' itself is interpreted, a set of
2055 contexts is needed that will accept notes. The default for this is a
2056 @code{Voice} context, contained in a @code{Staff} context. Creation of
2057 these contexts results in the staff being printed.
2062 You can also create contexts manually, and you probably have to do so
2063 if you want to typeset complicated multiple part material. If a
2064 `@code{\context} @var{name} @var{musicexpr}' expression is encountered
2065 during the interpretation phase, the @var{musicexpr} argument will be
2066 interpreted with a context of type @var{name}. If you specify a name,
2067 the specific context with that name is searched.
2069 If a context of the specified type and name can not be found, a new
2070 one is created. For example,
2076 \notes \relative c'' {
2077 c4 <d4 \context Staff = "another" e4> f
2084 In this example, the @code{c} and @code{d} are printed on the
2085 default staff. For the @code{e}, a context Staff called
2086 `@code{another}' is specified; since that does not exist, a new
2087 context is created. Within @code{another}, a (default) Voice context
2088 is created for the @code{e4}. When all music referring to a
2089 context is finished, the context is ended as well. So after the
2090 third quarter, @code{another} is removed.
2092 Almost all music expressions inherit their interpretation context
2093 from their parent. In other words, suppose that the syntax for a
2098 \keyword @var{musicexpr1} @var{musicexpr2} @dots{}
2101 When the interpretation of this music expression starts, the context
2102 for @var{musicexpr1}, @var{musicexpr2}, etc. is that of the total
2105 Lastly, you may wonder, why this:
2111 \notes \relative c'' @{
2119 doesn't result in this:
2124 \notes \relative c'' {
2131 For the @code{c4}, a default @code{Staff} (with a contained
2132 @code{Voice}) context is created. After the @code{c4} ends, no
2133 music refers to this default staff, so it would be ended, with the
2134 result shown. To prevent this inconvenient behavior, the context to
2135 which the sequential music refers is adjusted during the
2136 interpretation. So after the @code{c4} ends, the context of the
2137 sequential music is also the default @code{Voice} context.
2138 The @code{d4} gets interpreted in the same context
2141 Properties that are set in one context are inherited by all of the
2142 contained contexts. This means that a property valid for the
2143 @code{Voice} context can be set in the @code{Score} context (for
2144 example) and thus take effect in all @code{Voice} contexts.
2146 Properties can be preset within the @code{\translator} block
2147 corresponding to the appropriate context. In this case, the syntax
2151 @var{propname} @code{=} @var{value}
2154 This assignment happens before interpretation starts, so a
2155 @code{\property} expression will override any predefined settings.
2157 The property settings are used during the interpretation phase. They
2158 are read by the LilyPond modules where interpretation contexts are
2159 built of. These modules are called @emph{translators}. Translators for
2160 notation are called @emph{engravers}, and translators for sound are
2161 called @emph{performers}.
2163 @mbinclude properties.itely
2165 @node Notation output definitions, , , Reference Manual
2166 @section Notation output definitions
2170 @cindex notation output
2172 @cindex output definition
2174 @node paper, , , Reference Manual
2176 The most important output definition is the @code{\paper} block, for
2177 music notation. The syntax is
2180 @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2183 where each of the items is one of
2186 @item An assignment. The assignment must be terminated by a
2189 @item A context definition. See section @ref{contextdefs} for
2190 more information on context definitions.
2199 A margin shape declaration. The syntax is
2203 \shape @var{indent1}@code{,} @var{width1}@code{,}
2204 @var{indent2}@code{,} @var{width2} @dots{} @code{;}
2209 Each pair of @var{indent} and @var{width} values is a dimension
2210 specifying how far to indent and how wide to make the line.
2211 The indentation and width of successive lines are specified by
2212 the successive pairs of dimensions. The last pair of
2213 dimensions will define the characeristics of all lines beyond
2214 those explicitly specified.
2217 @item \stylesheet declaration. Its syntax is
2220 \stylesheet @var{alist}
2223 See @file{font.scm} for details of @var{alist}.
2228 @cindex changing font size and paper size
2230 The Feta font provides musical symbols at six different sizes. These
2231 fonts are 11 point, 13 point, 16 point, 20 point,
2232 23 point, and 26 point. The point size of a font is the
2233 height of the five lines in a staff when displayed in the font.
2235 Definitions for these sizes are the files @file{paperSZ.ly}, where
2236 @code{SZ} is one of 11, 13, 16, 20, 23 and 26. If you include
2237 any of these files, the identifiers @code{paper_eleven},
2238 @code{paper_thirteen}, @code{paper_sixteen}, @code{paper_twenty},
2239 @code{paper_twentythree}, and @code{paper_twentysix} are defined
2240 respectively. The default @code{\paper} block is also set.
2242 To change the paper size, you must first set the
2243 @code{papersize}@indexcode{papersize} variable at top level. Set it to the strings
2244 @code{a4}, @code{letter}, or @code{legal}. After this specification,
2245 you must set the font as described above. If you want the default
2246 font, then use the 20 point font. The new paper size will not
2247 take effect if the font is not loaded and selected afterwards. Paper
2248 size selection works by loading a file named after the paper size you
2253 @cindex paper variables
2255 @node Paper variables, , , Reference Manual
2257 The paper block has some variables you may want to use or change:
2260 @item @code{indent}@indexcode{indent}
2261 The indentation of the first line of music.
2263 @item @code{staffspace}@indexcode{staffspace}
2264 The distance between two staff lines, calculated from the center
2265 of the lines. You should use either this or @code{rulethickness}
2266 as a unit for distances you modify.
2268 @item @code{linewidth}@indexcode{linewidth}
2269 Sets the width of the lines. If set to -1.0, a single
2270 unjustified line is produced.
2272 @item @code{textheight}@indexcode{textheight}
2273 Sets the total height of the music on each page. Only used by
2276 @item @code{interscoreline}@indexcode{interscoreline}
2277 Sets the spacing between the score lines. Defaults to 16 pt.
2279 @item @code{interscorelinefill}@indexcode{interscorelinefill}
2280 If set to a positive number, the distance between the score
2281 lines will stretch in order to fill the full page. In that
2282 case @code{interscoreline} specifies the minimum spacing.
2285 @item @code{stafflinethickness}@indexcode{stafflinethickness}
2286 Determines the thickness of staff lines, and also acts as a scaling
2287 parameter for other line thicknesses.
2291 @node contextdefs, , , Reference Manual
2293 @cindex context definition
2295 A notation contexts is defined by the following information
2300 @item The LilyPond modules that do the actual conversion of music to
2301 notation. Each module is a so-called
2306 @item How these modules should cooperate, i.e. which ``cooperation
2307 module'' should be used. This cooperation module is a special
2310 @item What other contexts the context can contain,
2312 @item What properties are defined.
2315 A context definition has this syntax:
2319 \translator @code{@{}
2320 @var{translatorinit} @var{translatormodifierlist}
2324 @var{translatorinit} can be an identifier or of the form
2328 \type @var{typename} @code{;}
2331 @var{typename} is one of
2334 @item @code{Engraver_group_engraver}@indexcode{Engraver_group_engraver}
2335 The standard cooperation engraver.
2337 @item @code{Score_engraver}@indexcode{Score_engraver}
2338 This is cooperation module that should be in the top level context.
2340 @item @code{Grace_engraver_group}@indexcode{Grace_engraver_group}
2341 This is a special cooperation module (resembling
2342 @code{Score_engraver}) that is used to created an embedded
2346 @var{translatormodifierlist} is a list of items where each item is
2350 @item @code{\consists} @var{engravername} @code{;}
2351 Add @var{engravername} to the list of modules in this context.
2352 The order of engravers added with @code{\consists} is
2355 @item @code{\consistsend} @var{engravername} @code{;}
2356 Analogous to @code{\consists}, but makes sure that
2357 @var{engravername} is always added to the end of the list of
2360 Some engraver types need to be at the end of the list; this
2361 insures they are put there, and stay there, if a user adds or
2362 removes engravers. This command is usually not needed for
2365 @item @code{\accepts} @var{contextname} @code{;}
2366 Add @var{contextname} to the list of context this context can
2367 contain. The first listed context is the context to create by
2370 @item @code{\denies}. The opposite of @code{\accepts}. Added for
2371 completeness, but is never used in practice.
2374 @item @code{\remove} @var{engravername} @code{;}
2375 Remove a previously added (with @code{\consists}) engraver.
2377 @item @code{\name} @var{contextname} @code{;}
2378 This sets name of the context, e.g. @code{Staff}, @code{Voice}. If
2379 the name is not specified, the translator won't do anything.
2381 @item @var{propname} @code{=} @var{value} @code{;}
2382 A property assignment. It is allowed to use reals for
2386 In the @code{\paper} block, it is also possible to define translator
2387 identifiers. Like other block identifiers, the identifier can only
2388 be used as the very first item of a translator. In order to define
2389 such an identifier outside of @code{\score}, you must do
2395 foo = \translator @{ @dots{} @}
2402 \translator @{ \foo @dots{} @}
2410 @cindex paper types, engravers, and pre-defined translators
2412 Some pre-defined identifiers can simplify modification of
2413 translators. The pre-defined identifiers are:
2416 @item @code{StaffContext}@indexcode{StaffContext}
2417 Default Staff context.
2419 @item @code{RhythmicStaffContext}@indexcode{RhythmicStaffContext}
2420 Default RhythmicStaff context.
2422 @item @code{VoiceContext}@indexcode{VoiceContext}
2423 Default Voice context.
2425 @item @code{ScoreContext}@indexcode{ScoreContext}
2426 Default Score context.
2428 @item @code{ScoreWithNumbers}@indexcode{ScoreWithNumbers}
2429 Score context with numbering at the Score level.
2431 @item @code{BarNumberingStaffContext}@indexcode{BarNumberingStaffContext}
2432 Staff context with numbering at the Staff level.
2434 @item @code{HaraKiriStaffContext}@indexcode{HaraKiriStaffContext}
2435 Staff context that does not print if it only contains rests.
2436 Useful for orchestral scores.@footnote{Harakiri, also called
2437 Seppuku, is the ritual suicide of the Samourai.}
2439 @item @code{OrchestralPartStaffContext}@indexcode{OrchestralPartStaffContext}
2441 @item @code{OrchestralScoreContext}@indexcode{OrchestralScoreContext}
2444 Using these pre-defined values, you can remove or add items to the
2453 \remove Some_engraver;
2454 \consists Different_engraver;
2462 @node Sound output, , , Reference Manual
2463 @section Sound output
2465 The MIDI block is analogous to the paper block, but it is somewhat
2466 simpler. The @code{\midi} block can contain:
2470 @item a @code{\tempo} definition
2471 @item context definitions
2474 Assignments in the @code{\midi} block are not allowed.
2478 @cindex context definition
2480 Context definitions follow precisely the same syntax as within the
2481 \paper block. Translation modules for sound are called performers.
2482 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2486 @cindex MIDI instrument names
2488 @node midilist, , , Reference Manual
2490 The MIDI instrument name is set by the
2491 @code{Staff.midiInstrument}@indexcode{Staff.midiInstrument} property or,
2492 if that property is not set, the
2493 @code{Staff.instrument}@indexcode{Staff.instrument} property. The
2494 instrument name should be chosen from the following list. If the
2495 selected string does not exactly match, then LilyPond uses the default
2501 "acoustic grand" "contrabass" "lead 7 (fifths)"
2502 "bright acoustic" "tremolo strings" "lead 8 (bass+lead)"
2503 "electric grand" "pizzicato strings" "pad 1 (new age)"
2504 "honky-tonk" "orchestral strings" "pad 2 (warm)"
2505 "electric piano 1" "timpani" "pad 3 (polysynth)"
2506 "electric piano 2" "string ensemble 1" "pad 4 (choir)"
2507 "harpsichord" "string ensemble 2" "pad 5 (bowed)"
2508 "clav" "synthstrings 1" "pad 6 (metallic)"
2509 "celesta" "synthstrings 2" "pad 7 (halo)"
2510 "glockenspiel" "choir aahs" "pad 8 (sweep)"
2511 "music box" "voice oohs" "fx 1 (rain)"
2512 "vibraphone" "synth voice" "fx 2 (soundtrack)"
2513 "marimba" "orchestra hit" "fx 3 (crystal)"
2514 "xylophone" "trumpet" "fx 4 (atmosphere)"
2515 "tubular bells" "trombone" "fx 5 (brightness)"
2516 "dulcimer" "tuba" "fx 6 (goblins)"
2517 "drawbar organ" "muted trumpet" "fx 7 (echoes)"
2518 "percussive organ" "french horn" "fx 8 (sci-fi)"
2519 "rock organ" "brass section" "sitar"
2520 "church organ" "synthbrass 1" "banjo"
2521 "reed organ" "synthbrass 2" "shamisen"
2522 "accordion" "soprano sax" "koto"
2523 "harmonica" "alto sax" "kalimba"
2524 "concertina" "tenor sax" "bagpipe"
2525 "acoustic guitar (nylon)" "baritone sax" "fiddle"
2526 "acoustic guitar (steel)" "oboe" "shanai"
2527 "electric guitar (jazz)" "english horn" "tinkle bell"
2528 "electric guitar (clean)" "bassoon" "agogo"
2529 "electric guitar (muted)" "clarinet" "steel drums"
2530 "overdriven guitar" "piccolo" "woodblock"
2531 "distorted guitar" "flute" "taiko drum"
2532 "guitar harmonics" "recorder" "melodic tom"
2533 "acoustic bass" "pan flute" "synth drum"
2534 "electric bass (finger)" "blown bottle" "reverse cymbal"
2535 "electric bass (pick)" "skakuhachi" "guitar fret noise"
2536 "fretless bass" "whistle" "breath noise"
2537 "slap bass 1" "ocarina" "seashore"
2538 "slap bass 2" "lead 1 (square)" "bird tweet"
2539 "synth bass 1" "lead 2 (sawtooth)" "telephone ring"
2540 "synth bass 2" "lead 3 (calliope)" "helicopter"
2541 "violin" "lead 4 (chiff)" "applause"
2542 "viola" "lead 5 (charang)" "gunshot"
2543 "cello" "lead 6 (voice)"
2550 @node Pre-defined Identifiers, , , Reference Manual
2552 @section Pre-defined Identifiers
2554 @cindex pre-defined identifiers
2557 Various identifiers are defined in the initialization files to
2558 provide shorthands for some settings. Most of them are in
2559 @file{ly/declarations.ly}.
2562 @item @code{\break}@keyindex{break}
2563 Force a line break in music by using a large argument for the
2564 keyword @code{\penalty}.
2566 @item @code{\nobreak}@keyindex{nobreak}
2567 Prevent a line break in music by using a large negative argument
2568 for the keyword @code{\penalty}.
2570 @item @code{\normalkey}@keyindex{normalkey}
2571 Select normal key signatures where each octave has the same key
2572 signature. This sets the @code{Staff.keyoctaviation} property.
2574 @item @code{\shiftoff}@keyindex{shiftOff}
2575 Disable horizontal shifting of note heads that collide.
2577 @item @code{\shiftOn}@keyindex{shiftOn}
2578 Enable note heads that collide with other note heads to be
2579 shifted horiztonally.
2581 @item @code{\slurBoth}@keyindex{slurBoth}
2582 Allow slurs to be above or below notes.
2584 @item @code{\slurDown}@keyindex{slurDown}
2585 Force slurs to be below notes.
2587 @item @code{\slurUp}@keyindex{slurUp}
2588 Force slurs to be above notes.
2590 @item @code{\specialkey}@keyindex{specialkey}
2591 Allow key signatures do differ in different octaves. This sets
2592 the @code{Staff.keyoctaviation} property.
2594 @item @code{\stemBoth}@keyindex{stemBoth}
2595 Allow stems, beams, and slurs to point either upwards or
2596 downwards, decided automatically by LilyPond.
2598 @item @code{\stemdown}@keyindex{stemdown}
2599 Force stems, beams, and slurs to point down.
2601 @item @code{\stemUp}@keyindex{stemUp}
2602 Force stems, beams and slurs to point up.