3 @c A menu is needed before every deeper *section nesting of @node's; run
4 @c M-x texinfo-all-menus-update
5 @c to automagically fill in these menus before saving changes
7 @c FIXME: singular vs. plural: Beams/Beam
10 @node Reference Manual
11 @chapter Reference Manual
14 <!--- @@WEB-TITLE@@=Reference Manual --->
18 This document describes GNU LilyPond and its input format. The last
19 revision of this document was made for LilyPond 1.7.10. It assumes
20 that you already know a little bit about LilyPond input (how to
21 make an input file, how to create sheet music from that input file,
22 etc). New users are encouraged to study the tutorial before reading
27 * Easier music entry::
42 * Contemporary notation::
48 @c FIXME: Note entry vs Music entry at top level menu is confusing.
54 Notes constitute the most basic elements of LilyPond input, but they do
55 not form valid input on their own without a @code{\score} block. However,
56 for the sake of brevity and simplicity we will generally omit
57 @code{\score} blocks and @code{\paper} declarations in this manual.
63 * Chromatic alterations::
68 * Automatic note splitting ::
70 * Easy Notation note heads ::
78 A note is printed by specifying its pitch and then its duration.
79 @lilypond[fragment,verbatim]
88 @cindex Note specification
90 @cindex entering notes
92 The verbose syntax for pitch specification is
99 where @var{scmpitch} is a pitch scheme object.
101 In Note and Chord mode, pitches may be designated by names. The
102 default names are the Dutch note names. The notes are specified by
103 the letters @code{a} through @code{g}, while the octave is formed with
104 notes ranging from @code{c} to @code{b}. The pitch @code{c} is an
105 octave below middle C and the letters span the octave above that C.
107 @lilypond[fragment,verbatim]
109 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
112 @cindex note names, Dutch
114 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
115 name and a flat is formed by adding @code{-es}. Double sharps and
116 double flats are obtained by adding @code{-isis} or @code{-eses}.
117 @code{aes} is contracted to @code{as} in Dutch, but both forms are
118 accepted. Similarly, both @code{es} and @code{ees} are accepted.
120 There are predefined sets of note names for various other languages.
121 To use them, include the language specific init file. For
122 example: @code{\include "english.ly"}. The available language files
123 and the note names they define are:
128 Note Names sharp flat
129 nederlands.ly c d e f g a bes b -is -es
130 english.ly c d e f g a bf b -s/-sharp -f/-flat
131 deutsch.ly c d e f g a b h -is -es
132 norsk.ly c d e f g a b h -iss/-is -ess/-es
133 svenska.ly c d e f g a b h -iss -ess
134 italiano.ly do re mi fa sol la sib si -d -b
135 catalan.ly do re mi fa sol la sib si -d/-s -b
136 espanol.ly do re mi fa sol la sib si -s -b
145 The optional octave specification takes the form of a series of
146 single quote (`@code{'}') characters or a series of comma
147 (`@code{,}') characters. Each @code{'} raises the pitch by one
148 octave; each @code{,} lowers the pitch by an octave.
150 @lilypond[fragment,verbatim,center]
151 c' c'' es' g' as' gisis' ais'
157 @internalsref{NoteEvent}, @internalsref{NoteHead}
159 @node Chromatic alterations
160 @subsection Chromatic alterations
162 Normally accidentals are printed automatically, but you may also
163 print them manually. A reminder accidental
164 @cindex reminder accidental
166 can be forced by adding an exclamation mark @code{!}
167 after the pitch. A cautionary accidental
168 @cindex cautionary accidental
169 @cindex parenthesized accidental
170 (an accidental within parentheses) can be obtained by adding the
171 question mark `@code{?}' after the pitch.
173 @lilypond[fragment,verbatim]
174 cis' cis' cis'! cis'?
178 The automatic production of accidentals can be tuned in many
179 ways. For more information, refer to @ref{Accidentals}.
186 Rests are entered like notes, with the note name @code{r}.
188 @lilypond[singleline,verbatim]
192 Whole bar rests, centered in middle of the bar, are specified using
193 @code{R} (capital R); see @ref{Multi measure rests}. See also
196 For some music, you may wish to explicitly specify the rest's vertical
197 position. This can be achieved by entering a note with the @code{\rest}
198 keyword appended. Rest collision testing will leave these rests alone.
200 @lilypond[singleline,verbatim]
204 @internalsref{RestEvent}, @internalsref{Rest}
211 @cindex Invisible rest
214 An invisible rest (also called a `skip') can be entered like a note
215 with note name `@code{s}' or with @code{\skip @var{duration}}:
217 @lilypond[singleline,verbatim]
221 The @code{s} syntax is only available in Note mode and Chord
222 mode. In other situations, you should use the @code{\skip} command,
223 which will work outside of those two modes:
225 @lilypond[singleline,verbatim]
228 { \time 4/8 \skip 2 \time 4/4 }
229 \notes\relative c'' { a2 a1 }
234 The skip command is merely an empty musical placeholder. It does not
235 produce any output, not even transparent output.
239 @internalsref{SkipEvent}
244 @subsection Durations
248 @cindex @code{\duration}
251 In Note, Chord, and Lyrics mode, durations are designated by numbers
252 and dots: durations are entered as their reciprocal values. For example,
253 a quarter note is entered using a @code{4} (since it is a 1/4 note), while
254 a half note is entered using a @code{2} (since it is a 1/2 note). For notes
255 longer than a whole you must use identifiers.
256 @c FIXME: what is an identifier? I do not think it's been introduced yet.
257 @c and if it has, I obviously skipped that part. - Graham
261 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
263 r1 r2 r4 r8 r16 r32 r64 r64
268 \notes \relative c'' {
270 a1 a2 a4 a8 a16 a32 a64 a64
272 r1 r2 r4 r8 r16 r32 r64 r64
277 \remove "Clef_engraver"
278 \remove "Staff_symbol_engraver"
279 \remove "Time_signature_engraver"
280 \consists "Pitch_squash_engraver"
287 If the duration is omitted then it is set to the previously entered
288 duration. Default for the first note is a quarter note. The duration
289 can be followed by dots (`@code{.}') in order to obtain dotted note
293 @lilypond[fragment,verbatim,center]
294 a' b' c''8 b' a'4 a'4. b'4.. c'8.
299 You can alter the length of duration by a fraction @var{N/M}
300 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
301 will not affect the appearance of the notes or rests produced.
303 @lilypond[fragment,verbatim]
304 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
307 Durations can also be produced through GUILE extension mechanism.
308 @lilypond[verbatim,fragment]
309 c'\duration #(ly:make-duration 2 1)
315 Dot placement for chords is not perfect. In some cases, dots overlap:
328 A tie connects two adjacent note heads of the same pitch. The tie in
329 effect extends the length of a note. Ties should not be confused with
330 slurs, which indicate articulation, or phrasing slurs, which indicate
331 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
333 @lilypond[fragment,verbatim,center]
334 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
337 When a tie is applied to a chord, all note heads (whose pitches match) are
338 connected. If you try to tie together chords that have no common pitches,
339 no ties will be created.
341 In its meaning a tie is just a way of extending a note duration, similar
342 to the augmentation dot: the following example are two ways of notating
343 exactly the same concept.
345 @lilypond[fragment, singleline,quote]
346 \time 3/4 c'2. c'2 ~ c'4
348 If you need to tie notes over bars, it may be easier to use automatic
349 note splitting (See @ref{Automatic note splitting}).
354 @internalsref{TieEvent}, @internalsref{NewTieEvent},
355 @internalsref{Tie}, @ref{Automatic note splitting}.
358 ties created for a chord, see @inputfileref{input/test,tie-sparse.ly}.
362 Tieing only a subset of the note heads of a pair of chords is not
363 supported in a simple way. It can be achieved by moving the
364 tie-engraver into the @internalsref{Thread} context and turning on and
365 off ties per @internalsref{Thread}.
367 Switching staves when a tie is active, will produce a horizontal tie
371 Formatting of ties is a difficult subject. LilyPond often does not
372 give optimal results.
376 @node Automatic note splitting
377 @subsection Automatic note splitting
378 @c FIXME: This subsection does not belong in @ref{Note entry}.
380 LilyPond can automatically converting long notes to tied notes. This
381 is done by replacing the @internalsref{Note_heads_engraver} by the
382 @internalsref{Completion_heads_engraver}.
384 @lilypond[verbatim,noindent]
386 \notes\relative c'{ \time 2/4
387 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
391 \remove "Note_heads_engraver"
392 \consists "Completion_heads_engraver"
396 This engraver splits all running notes at the bar line, and inserts
397 ties. One of its uses is to debug complex scores: if the measures are
398 not entirely filled, then the ties exactly show how much each measure
403 Not all durations (especially those containing tuplets) can be
404 represented exactly; the engraver will not insert tuplets.
411 @cindex @code{\times}
413 Tuplets are made out of a music expression by multiplying all durations
416 @cindex @code{\times}
418 \times @var{fraction} @var{musicexpr}
421 The duration of @var{musicexpr} will be multiplied by the fraction.
422 In the sheet music, the fraction's denominator will be printed over
423 the notes, optionally with a bracket. The most common tuplet is the
424 triplet in which 3 notes have the length of 2, so the notes are 2/3
425 of their written length:
427 @lilypond[fragment,verbatim,center]
428 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
431 The property @code{tupletSpannerDuration} specifies how long each bracket
432 should last. With this, you can make lots of tuplets while typing
433 @code{\times} only once, saving you lots of typing.
435 @lilypond[fragment, relative, singleline, verbatim]
436 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
437 \times 2/3 { c'8 c c c c c }
440 The format of the number is determined by the property
441 @code{tupletNumberFormatFunction}. The default prints only the
442 denominator, but if you set it to the Scheme function
443 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
447 @cindex @code{tupletNumberFormatFunction}
448 @cindex tuplet formatting
450 See also @seeinternals{TupletBracket}.
454 Nested tuplets are not formatted automatically. In this case, outer
455 tuplet brackets should be moved manually.
457 @node Easy Notation note heads
458 @subsection Easy Notation note heads
460 @cindex easy notation
463 The "easyplay" note head includes a note name inside the head. It is
464 used in music aimed at beginners.
466 @lilypond[singleline,verbatim,26pt]
468 \notes { c'2 e'4 f' | g'1 }
469 \paper { \translator { \EasyNotation } }
473 The @code{EasyNotation} identifier overrides a @internalsref{Score}
474 context. You probably will want to print it with magnification or a
475 large font size to make it more readable. To print with
476 magnification, you must create a DVI file (with @file{ly2dvi}) and
477 then enlarge it with something like @file{dvips -x 2000 file.dvi}.
478 See @file{man dvips} for details. To print with a larger font, see
485 If you view the result with Xdvi, then staff lines will show through
486 the letters. Printing the PostScript file obtained with ly2dvi does
487 produce the correct result.
490 @node Easier music entry
491 @section Easier music entry
496 * Skipping corrected music::
499 When entering music with LilyPond, it is easy to introduce
500 errors. This section deals with tricks and features that help you
501 enter music, and find and correct mistakes. It is also possible to
502 use external programs to enter or edit music. Refer to the website for
507 @node Relative octaves
508 @subsection Relative octaves
510 @cindex relative octave specification
512 Octaves are specified by adding @code{'} and @code{,} to pitch names.
513 When you copy existing music, it is easy to accidentally put a pitch in
514 the wrong octave and hard to find such an error. To prevent these
515 errors, LilyPond features octave entry.
517 @cindex @code{\relative}
519 \relative @var{startpitch} @var{musicexpr}
522 The octave of notes that appear in @var{musicexpr} are calculated as
523 follows: If no octave changing marks are used, the basic interval
524 between this and the last note is always taken to be a fourth or less
525 (This distance is determined without regarding alterations; a
526 @code{fisis} following a @code{ceses} will be put above the
529 The octave changing marks @code{'} and @code{,} can be added to raise or
530 lower the pitch by an extra octave. Upon entering relative mode, an
531 absolute starting pitch must be specified that will act as the
532 predecessor of the first note of @var{musicexpr}.
534 Entering music that changes octave frequently is easy in relative mode.
535 @lilypond[fragment,singleline,verbatim,center]
541 And octave changing marks are used for intervals greater than a fourth.
542 @lilypond[fragment,verbatim,center]
547 If the preceding item is a chord, the first note of the chord is used
548 to determine the first note of the next chord. However, other notes
549 within the second chord are determined by looking at the immediately
552 @lilypond[fragment,verbatim,center]
559 @cindex @code{\notes}
561 The pitch after the @code{\relative} contains a note name. To parse
562 the pitch as a note name, you have to be in note mode, so there must
563 be a surrounding @code{\notes} keyword (which is not
566 The relative conversion will not affect @code{\transpose},
567 @code{\chords} or @code{\relative} sections in its argument. If you
568 want to use relative within transposed music, you must place an
569 additional @code{\relative} inside the @code{\transpose}.
573 @subsection Bar check
577 @cindex @code{barCheckSynchronize}
581 Whenever a bar check is encountered during interpretation, a warning
582 message is issued if it does not fall at a measure boundary. This can
583 help you find errors in the input. Depending on the value of
584 @code{barCheckSynchronize}, the beginning of the measure will be
585 relocated, so this can also be used to shorten measures.
587 A bar check is entered using the bar symbol, `@code{|}'.
589 \time 3/4 c2 e4 | g2.
594 @cindex skipTypesetting
596 Failed bar checks are caused by entering incorrect
597 durations. Incorrect durations often completely garble up the score,
598 especially if it is polyphonic, so you should start correcting the
599 score by scanning for failed bar checks and incorrect durations. To
600 speed up this process, you can use @code{skipTypesetting}, described
603 @node Skipping corrected music
604 @subsection Skipping corrected music
606 The property @code{Score.skipTypesetting} can be used to switch on and
607 off typesetting completely during the interpretation phase. When
608 typesetting is switched off, the music is processed much more quickly.
609 You can use this to skip over the parts of a score that you have already
612 @lilypond[fragment,singleline,verbatim]
614 \property Score.skipTypesetting = ##t
616 \property Score.skipTypesetting = ##f
624 @section Staff notation
626 This section deals with music notation that occurs on staff level,
627 such as keys, clefs and time signatures.
629 @cindex Staff notation
641 @subsection Staff symbol
643 @cindex adjusting staff symbol
644 @cindex StaffSymbol, using \property
645 @cindex staff lines, setting number of
647 Staff is a the general name for Notes, dynamic signs, etc. are grouped
648 with a set of horizontal lines, into a staff (plural `staves'). In our
649 system, these lines are drawn using a separate graphical object called
652 This object is created whenever a @internalsref{Staff} context is
653 created. You can not change the appearance of the staff symbol by
654 using @code{\override} or @code{\set}. At the moment that
655 @code{\property Staff} is interpreted, a Staff context is made, and
656 the @internalsref{StaffSymbol} is created before any @code{\override} is
657 effective. You can deal with this either overriding properties in a
658 @code{\translator} definition, or by using @code{\outputproperty}.
662 If you end a staff halfway a piece, the staff symbol may not end
663 exactly on the barline.
667 @subsection Key signature
672 The key signature indicates the scale in which a piece is played. It
673 is denoted by a set of alterations (flats or sharps) at the start of
678 Setting or changing the key signature is done with the @code{\key}
681 @code{\key} @var{pitch} @var{type}
684 @cindex @code{\minor}
685 @cindex @code{\major}
686 @cindex @code{\minor}
687 @cindex @code{\ionian}
688 @cindex @code{\locrian}
689 @cindex @code{\aeolian}
690 @cindex @code{\mixolydian}
691 @cindex @code{\lydian}
692 @cindex @code{\phrygian}
693 @cindex @code{\dorian}
695 Here, @var{type} should be @code{\major} or @code{\minor} to get
696 @var{pitch}-major or @var{pitch}-minor, respectively.
697 The standard mode names @code{\ionian},
698 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
699 @code{\phrygian}, and @code{\dorian} are also defined.
701 This command sets the context property
702 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
703 can be specified by setting this property directly.
708 @internalsref{KeyChangeEvent}, @internalsref{KeySignature},
710 @cindex @code{keySignature}
717 The clef indicates which lines of the staff correspond to which
722 The clef can be set or changed with the @code{\clef} command:
723 @lilypond[fragment,verbatim]
724 \key f\major c''2 \clef alto g'2
727 Supported clef-names include
728 @c Moved standard clefs to the top /MB
730 @item treble, violin, G, G2
739 G clef on 1st line, so-called French violin clef
754 By adding @code{_8} or @code{^8} to the clef name, the clef is
755 transposed one octave down or up, respectively. You have to
756 enclose @var{clefname} in quotes if you use underscores or digits in the
762 This command is equivalent to setting @code{clefGlyph},
763 @code{clefPosition} (which controls the Y position of the clef),
764 @code{centralCPosition} and @code{clefOctavation}. A clef is printed
765 when any of these properties are changed.
769 The object for this symbol is @internalsref{Clef}.
775 @subsection Time signature
776 @cindex Time signature
780 Time signature indicates the metrum of a piece: a regular pattern of
781 strong and weak beats. It is denoted by a fraction at the start of the
786 The time signature is set or changed by the @code{\time}
788 @lilypond[fragment,verbatim]
789 \time 2/4 c'2 \time 3/4 c'2.
792 The actual symbol that is printed can be customized with the
793 @code{style} property. Setting it to @code{#'()} uses fraction style
794 for 4/4 and 2/2 time. There are many more options for its layout.
795 See @inputfileref{input/test,time.ly} for more examples.
798 This command sets the property @code{timeSignatureFraction},
799 @code{beatLength} and @code{measureLength} in the @code{Timing}
800 context, which is normally aliased to @internalsref{Score}. The property
801 @code{timeSignatureFraction} determine where bar lines should be
802 inserted, and how automatic beams should be generated. Changing the
803 value of @code{timeSignatureFraction} also causes a time signature
804 symbol to be printed.
806 More options are available through the Scheme function
807 @code{set-time-signature}. In combination with the
808 @internalsref{Measure_grouping_engraver}, it will create
809 @internalsref{MeasureGrouping} signs. Such signs ease reading
810 rhythmically complex modern music. In the following example, the 9/8
811 measure is subdivided in 2, 2, 2 and 3. This is passed to
812 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
815 \score { \notes \relative c'' {
816 #(set-time-signature 9 8 '(2 2 2 3))
817 g8-[ g-] d-[ d-] g-[ g-] a8-[-( bes g-]-) |
818 #(set-time-signature 5 8 '(3 2))
823 \translator { \StaffContext
824 \consists "Measure_grouping_engraver"
830 @internalsref{TimeSignature}, @internalsref{Timing_engraver}.
835 Automatic beaming does not use measure grouping specified with
836 @code{set-time-signature}.
843 @cindex partial measure
844 @cindex measure, partial
845 @cindex shorten measures
846 @cindex @code{\partial}
848 Partial measures, for example in upbeats, are entered using the
849 @code{\partial} command:
850 @lilypond[fragment,verbatim]
851 \partial 16*5 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
854 The syntax for this command is
856 \partial @var{duration}
858 This is internally translated into
860 \property Timing.measurePosition = -@var{length of duration}
863 The property @code{measurePosition} contains a rational number
864 indicating how much of the measure has passed at this point.
866 @node Unmetered music
867 @subsection Unmetered music
869 Bar lines and bar numbers are calculated automatically. For unmetered
870 music (e.g. cadenzas), this is not desirable. By setting
871 @code{Score.timing} to false, this automatic timing can be switched
875 @subsection Bar lines
879 @cindex measure lines
883 Bar lines delimit measures, but are also used to indicate
884 repeats. Line breaks may only happen on barlines.
888 Bar lines are inserted automatically, but if you need a special type
889 of barline, you can force one using the @code{\bar} command:
890 @lilypond[relative=1,fragment,verbatim]
894 The following bar types are available
895 @lilypond[fragment, relative, singleline, verbatim]
907 In scores with many staves, the barlines are automatically placed at
908 top level, and they are connected between different staves of a
909 @internalsref{StaffGroup}:
910 @lilypond[fragment, verbatim]
911 < \context StaffGroup <
912 \context Staff = up { e'4 d'
915 \context Staff = down { \clef bass c4 g e g } >
916 \context Staff = pedal { \clef bass c2 c2 } >
920 The command @code{\bar @var{bartype}} is a short cut for
921 doing @code{\property Score.whichBar = @var{bartype}}
922 Whenever @code{whichBar} is set to a string, a bar line of that type is
923 created. @code{whichBar} is usually set automatically: at the start of
924 a measure it is set to @code{defaultBarType}. The contents of
925 @code{repeatCommands} is used to override default measure bars.
927 @code{whichBar} can also be set directly, using @code{\property} or
928 @code{\bar }. These settings take precedence over the automatic
929 @code{whichBar} settings.
932 @cindex repeatCommands
933 @cindex defaultBarType
935 You are encouraged to use @code{\repeat} for repetitions. See
942 @ref{Repeats}, @internalsref{RepeatedMusic},
943 @internalsref{VoltaRepeatedMusic},
944 @internalsref{UnfoldedRepeatedMusic}
945 @internalsref{TremoloRepeteadMusic},
946 @internalsref{FoldedRepeatedMusic}.
949 The bar line objects that are created at @internalsref{Staff} level
950 are called @internalsref{BarLine}, the bar lines that span staffs are
951 @internalsref{SpanBar}s.
958 The easiest way to enter fragments with more than one voice on a staff
959 is to split chords using the separator @code{\\}. You can use it for
960 small, short-lived voices (make a chord of voices) or for single
963 @lilypond[verbatim,fragment]
964 \context Voice = VA \relative c'' {
965 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f' \\ d' >
969 The separator causes @internalsref{Voice} contexts to be instantiated,
970 bearing the names @code{"1"}, @code{"2"}, etc. In each of these
971 contexts, vertical direction of slurs, stems, etc. are set
974 This can also be done by instantiating @internalsref{Voice} contexts
975 by hand, and using @code{\voiceOne}, up to @code{\voiceFour} to assign
976 a stem directions and horizontal shift for each part.
979 @lilypond[singleline, verbatim]
981 \context Staff < \context Voice = VA { \voiceOne cis2 b }
982 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
983 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
986 Normally, note heads with a different number of dots are not merged, but
987 if you set the object property @code{merge-differently-dotted}, they are:
988 @lilypond[verbatim,fragment,singleline]
989 \relative c' \context Voice < {
991 \property Staff.NoteCollision \override
992 #'merge-differently-dotted = ##t
994 } \\ { [g8. f16] [g8. f16] }
998 Similarly, you can merge half note heads with eighth notes, by setting
999 @code{merge-differently-headed}:
1000 @lilypond[fragment, relative=2,verbatim]
1003 \property Staff.NoteCollision
1004 \override #'merge-differently-headed = ##t
1005 c8 c4. } \\ { c2 c2 } >
1008 LilyPond also vertically shifts rests that are opposite of a stem.
1010 @lilypond[singleline,fragment,verbatim]
1011 \context Voice < c''4 \\ r4 >
1016 The objects responsible for resolving collisions are
1017 @internalsref{NoteCollision} and @internalsref{RestCollision}. See
1018 also example files @inputfileref{input/regression,collision-dots.ly},
1019 @inputfileref{input/regression,collision-head-chords.ly},
1020 @inputfileref{input/regression,collision-heads.ly},
1021 @inputfileref{input/regression,collision-mesh.ly}, and
1022 @inputfileref{input/regression,collisions.ly}.
1027 Resolving collisions is a very intricate subject, and LilyPond only
1028 handles a few situations. When it can not cope, you are advised to use
1029 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1030 rests to override typesetting decisions.
1035 Beams are used to group short notes into chunks that are aligned with
1036 the metrum. They are inserted automatically in most cases.
1038 @lilypond[fragment,verbatim, relative=2]
1039 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1042 If you are not satisfied with the automatic beaming, you can enter the
1043 beams explicitly. If you have beaming patterns that differ from the
1044 defaults, you can also set your own.
1046 See also @internalsref{Beam}.
1049 @cindex Automatic beams
1050 @subsection Manual beams
1051 @cindex beams, manual
1055 In some cases it may be necessary to override the automatic beaming
1056 algorithm. For example, the auto beamer will not beam over rests or
1057 bar lines, If you want that, specify the begin and end point manually
1058 using @code{[} and @code{]}.
1060 @lilypond[fragment,relative,verbatim]
1062 r4 r8-[ g' a r8-] r8 g-[ | a-] r8
1066 @cindex @code{stemLeftBeamCount}
1068 Normally, beaming patterns within a beam are determined automatically.
1069 When this mechanism fouls up, the properties
1070 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1071 be used to control the beam subdivision on a stem. If you set either
1072 property, its value will be used only once, and then it is erased.
1074 @lilypond[fragment,relative,verbatim]
1077 f8-[ r16 \property Voice.stemLeftBeamCount = #1 f g a-]
1080 @cindex @code{stemRightBeamCount}
1083 The property @code{subdivideBeams} can be set in order to subdivide
1084 all 16th or shorter beams at beat positions. This accomplishes the
1085 same effect as twiddling with @code{stemLeftBeamCount} and
1086 @code{stemRightBeamCount}, but it take less typing.
1089 @lilypond[relative=1,verbatim,noindent]
1090 c16-[ c c c c c c c-]
1091 \property Voice.subdivideBeams = ##t
1092 c16-[ c c c c c c c-]
1093 c32-[ c c c c c c c c c c c c c c c-]
1094 \property Score.beatLength = #(ly:make-moment 1 8)
1095 c32-[ c c c c c c c c c c c c c c c-]
1097 @cindex subdivideBeams
1099 Kneed beams are inserted automatically, when a large gap is detected
1100 between the note heads. This behavior can be tuned through the object
1101 property @code{auto-knee-gap}.
1103 @cindex beams, kneed
1105 @cindex auto-knee-gap
1113 Automatically kneed beams can not be used together with Hara Kiri
1118 The Automatic beamer does not put @strong{unfinished} beams on the
1119 last notes of a score.
1122 * Setting automatic beam behavior ::
1126 @no de Beam typography
1127 @sub section Beam typography
1129 One of the strong points of LilyPond is how beams are formatted. Beams
1130 are quantized, meaning that the left and right endpoints beams start
1131 exactly on staff lines. Without quantization, small wedges of white
1132 space appear between the beam and staff line, and this looks untidy.
1134 Beams are also slope-damped: melodies that go up or down should also
1135 have beams that go up or down, but the slope of the beams should be
1136 less than the slope of the notes themselves.
1138 Some beams should be horizontal. These are so-called concave beams.
1140 [TODO: some pictures.]
1144 @node Setting automatic beam behavior
1145 @subsection Setting automatic beam behavior
1147 @cindex @code{autoBeamSettings}
1148 @cindex @code{(end * * * *)}
1149 @cindex @code{(begin * * * *)}
1150 @cindex automatic beams, tuning
1151 @cindex tuning automatic beaming
1153 [TODO: use \applycontext]
1155 In normal time signatures, automatic beams can start on any note but can
1156 only end in a few positions within the measure: beams can end on a beat,
1157 or at durations specified by the properties in
1158 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1159 are defined in @file{scm/auto-beam.scm}.
1161 The value of @code{autoBeamSettings} is changed using
1162 @code{\override} and unset using @code{\revert}:
1164 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1165 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1167 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1168 whether the rule applies to begin or end-points. The quantity
1169 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1170 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1171 signature (wildcards, `@code{* *}' may be entered to designate all time
1174 For example, if you want automatic beams to end on every quarter note,
1175 you can use the following:
1177 \property Voice.autoBeamSettings \override
1178 #'(end * * * *) = #(ly:make-moment 1 4)
1180 Since the duration of a quarter note is 1/4 of a whole note, it is
1181 entered as @code{(ly:make-moment 1 4)}.
1183 The same syntax can be used to specify beam starting points. In this
1184 example, automatic beams can only end on a dotted quarter note.
1186 \property Voice.autoBeamSettings \override
1187 #'(end * * * *) = #(ly:make-moment 3 8)
1189 In 4/4 time signature, this means that automatic beams could end only on
1190 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1191 3/8 has passed within the measure).
1193 You can also restrict rules to specific time signatures. A rule that
1194 should only be applied in @var{N}/@var{M} time signature is formed by
1195 replacing the second asterisks by @var{N} and @var{M}. For example, a
1196 rule for 6/8 time exclusively looks like
1198 \property Voice.autoBeamSettings \override
1199 #'(begin * * 6 8) = ...
1202 If you want a rule to apply to certain types of beams, you can use the
1203 first pair of asterisks. Beams are classified according to the shortest
1204 note they contain. For a beam ending rule that only applies to beams
1205 with 32nd notes (and no shorter notes), you would use @code{(end 1
1209 @c Automatic beams can not be put on the last note in a score.
1211 If a score ends while an automatic beam has not been ended and is still
1212 accepting notes, this last beam will not be typeset at all.
1214 @cindex automatic beam generation
1216 @cindex @code{Voice.autoBeaming}
1219 For melodies that have lyrics, you may want to switch off
1220 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1226 It is not possible to specify beaming parameters for beams with mixed
1227 durations, that differ from the beaming parameters of all separate
1228 durations, i.e., you'll have to specify manual beams to get:
1230 @lilypond[singleline,fragment,relative,noverbatim,quote]
1231 \property Voice.autoBeamSettings
1232 \override #'(end * * * *) = #(ly:make-moment 3 8)
1233 \time 12/8 c'8 c c c16 c c c c c c-[ c c c-] c8 c c4
1235 It is not possible to specify beaming parameters that act differently in
1236 different parts of a measure. This means that it is not possible to use
1237 automatic beaming in irregular meters such as @code{5/8}.
1240 @section Accidentals
1243 This section describes how to change the way that LilyPond automatically
1244 inserts accidentals before the running notes.
1246 [TODO: identifier vs. macro]
1249 * Using the predefined accidental macros::
1250 * Defining your own accidental typesettings::
1253 @node Using the predefined accidental macros
1254 @subsection Using the predefined accidental macros
1255 The constructs for describing the accidental typesetting rules are
1256 quite hairy, so non-experts should stick to the macros defined in
1257 @file{ly/property-init.ly}.
1258 @cindex @file{property-init.ly}
1260 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1261 means that the macros shuold normally be invoked right after the
1262 creation of the context in which the accidental typesetting described
1263 by the macro is to take effect. I.e. if you want to use
1264 piano-accidentals in a pianostaff then you issue
1265 @code{\pianoAccidentals} first thing after the creation of the piano
1269 \notes \relative c'' <
1270 \context Staff = sa @{ cis4 d e2 @}
1271 \context GrandStaff <
1273 \context Staff = sb @{ cis4 d e2 @}
1274 \context Staff = sc @{ es2 c @}
1276 \context Staff = sd @{ es2 c @}
1280 @lilypond[singleline]
1282 \notes \relative c'' <
1283 \context Staff = sa { cis4 d e2 }
1284 \context GrandStaff <
1286 \context Staff = sb { cis4 d e2 }
1287 \context Staff = sc { es2 c }
1289 \context Staff = sd { es2 c }
1294 minimumVerticalExtent = #'(-4.0 . 4.0)
1302 @item \defaultAccidentals
1303 @cindex @code{\defaultAccidentals}
1304 This is the default typesetting behaviour. It should correspond
1305 to 18th century common practice: Accidentals are
1306 remembered to the end of the measure in which they occur and
1307 only on their own octave.
1309 @item \voiceAccidentals
1310 @cindex @code{\voiceAccidentals}
1311 The normal behaviour is to remember the accidentals on
1313 This macro, however, typesets accidentals individually for each
1315 Apart from that the rule is similar to
1316 @code{\defaultAccidentals}.
1318 This leads to some weird and often unwanted results
1319 because accidentals from one voice do not get cancelled in other
1321 @lilypond[singleline,relative,fragment,verbatim,quote]
1329 Hence you should only use @code{\voiceAccidentals} if the voices
1330 are to be read solely by individual musicians. If the staff is to be
1331 used by one musician (e.g., a conductor) then you use
1332 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1335 @item \modernAccidentals
1336 @cindex @code{\modernAccidentals}
1337 This rule corresponds to the common practice in the 20th
1339 The rule is more complex than @code{\defaultAccidentals}.
1340 You get all the same accidentals, but temporary
1341 accidentals also get cancelled in other octaves. Further more,
1342 in the same octave, they also get cancelled in the following measure:
1343 @lilypond[singleline,fragment,verbatim]
1345 cis' c'' cis'2 | c'' c'
1348 @item \modernCautionaries
1349 @cindex @code{\modernCautionaries}
1350 This rule is similar to @code{\modernAccidentals}, but the
1351 ``extra'' accidentals (the ones not typeset by
1352 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1353 (i.e. in reduced size):
1354 @lilypond[singleline,fragment,verbatim]
1356 cis' c'' cis'2 | c'' c'
1359 @cindex @code{\modernVoiceAccidentals}
1360 @item \modernVoiceAccidentals
1361 is used for multivoice accidentals to be read both by musicians
1362 playing one voice and musicians playing all voices. Accidentals are
1363 typeset for each voice, but they @emph{are} cancelled across voices in
1364 the same @internalsref{Staff}.
1366 @cindex @code{\modernVoiceCautionaries}
1367 @item \modernVoiceCautionaries
1369 @code{\modernVoiceAccidentals}, but with the extra accidentals (the
1370 ones not typeset by @code{\voiceAccidentals}) typeset as cautionaries.
1371 Even though all accidentals typeset by @code{\defaultAccidentals}
1372 @emph{are} typeset by this macro then some of them are typeset as
1375 @item \pianoAccidentals
1376 @cindex @code{\pianoAccidentals}
1377 20th century practice for piano notation. Very similar to
1378 @code{\modernAccidentals} but accidentals also get cancelled
1379 across the staves in the same @internalsref{GrandStaff} or
1380 @internalsref{PianoStaff}.
1382 @item \pianoCautionaries
1383 @cindex @code{\pianoCautionaries}
1384 As @code{\pianoAccidentals} but with the extra accidentals
1385 typeset as cautionaries.
1388 @cindex @code{\noResetKey}
1389 Same as @code{\defaultAccidentals} but with accidentals lasting
1390 ``forever'' and not only until the next measure:
1391 @lilypond[singleline,fragment,verbatim,relative]
1396 @item \forgetAccidentals
1397 @cindex @code{\forgetAccidentals}
1398 This is sort of the opposite of @code{\noResetKey}: Accidentals
1399 are not remembered at all - and hence all accidentals are
1400 typeset relative to the key signature, regardless of what was
1401 before in the music:
1402 @lilypond[singleline,fragment,verbatim,relative]
1404 \key d\major c4 c cis cis d d dis dis
1408 @node Defining your own accidental typesettings
1409 @subsection Defining your own accidental typesettings
1411 This section must be considered gurus-only, and hence it must be
1412 sufficient with a short description of the system and a reference to
1413 the internal documentation.
1415 The algorithm tries several different rules, and uses the rule
1416 that gives the highest number of accidentals. Each rule consists of
1419 In which context is the rule applied. For example, if
1420 @var{context} is @internalsref{Score} then all staves share
1421 accidentals, and if @var{context} is @internalsref{Staff} then all
1422 voices in the same staff share accidentals, but staves do not.
1424 Whether the accidental changes all octaves or only the current
1427 Over how many barlines the accidental lasts.
1428 If @var{lazyness} is @code{-1} then the accidental is forget
1429 immediately, and if @var{lazyness} is @code{#t} then the accidental
1432 [TODO: should use +infinity for this case?]
1438 @internalsref{Accidental_engraver}, @internalsref{Accidental},
1439 @internalsref{AccidentalPlacement}.
1444 Currently the simultaneous notes are considered to be entered in
1445 sequential mode. This means that in a chord the accidentals are
1446 typeset as if the notes in the chord happened one at a time - in the
1447 order in which they appear in the input file.
1449 This is only a problem when there are simultaneous notes whose
1450 accidentals depend on each other. The problem only occurs when using
1451 non-default accidentals. In the default scheme, accidentals only
1452 depend on other accidentals with the same pitch on the same staff, so
1453 no conflicts possible.
1455 This example shows two examples of the same music giving different
1456 accidentals depending on the order in which the notes occur in the
1459 @lilypond[singleline,fragment,verbatim]
1460 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1461 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2
1462 | <<cis' c''>> r | <<c'' cis'>> r |
1465 This problem can be solved by manually inserting @code{!} and @code{?}
1466 for the problematic notes.
1468 @node Expressive marks
1469 @section Expressive marks
1478 * Analysis brackets::
1485 A slur indicates that notes are to be played bound or @emph{legato}.
1489 They are entered using parentheses:
1490 @lilypond[fragment,verbatim,center]
1491 f'-( g'-)-( a'-) [a'8 b'-(-] a'4 g'2 f'4-)
1492 <<c' e'>>2-( <<b d'>>2-)
1496 @c TODO: should explain that ^( and _( set directions
1497 @c should set attachments with ^ and _ ?
1499 Slurs avoid crossing stems, and are generally attached to note heads.
1500 However, in some situations with beams, slurs may be attached to stem
1501 ends. If you want to override this layout you can do this through the
1502 object property @code{attachment} of @internalsref{Slur} in
1503 @internalsref{Voice} context. Its value is a pair of symbols, specifying
1504 the attachment type of the left and right end points.
1506 @lilypond[fragment,relative,verbatim]
1508 \property Voice.Stem \set #'length = #5.5
1510 \property Voice.Slur \set #'attachment = #'(stem . stem)
1514 If a slur would strike through a stem or beam, the slur will be moved
1515 away upward or downward. If this happens, attaching the slur to the
1516 stems might look better:
1518 @lilypond[fragment,relative,verbatim]
1521 \property Voice.Slur \set #'attachment = #'(stem . stem)
1527 @seeinternals{Slur}, @internalsref{SlurEvent}.
1532 Producing nice slurs is a difficult problem, and LilyPond currently
1533 uses a simple, empiric method to produce slurs. In some cases, the
1534 results of this method are ugly.
1537 @cindex Adjusting slurs
1539 @node Phrasing slurs
1540 @subsection Phrasing slurs
1542 @cindex phrasing slurs
1543 @cindex phrasing marks
1545 A phrasing slur (or phrasing mark) connects chords and is used to
1546 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1549 @lilypond[fragment,verbatim,center,relative]
1550 \time 6/4 c'-\( d-( e-) f-( e-) d-\)
1553 Typographically, the phrasing slur behaves almost exactly like a
1554 normal slur. Although they behave similar to normal slurs, phrasing
1555 slurs count as different objects. A @code{\slurUp} will have no
1556 effect on a phrasing slur; instead, you should use
1557 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1558 @code{\phrasingSlurBoth}.
1560 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth}
1561 will only affect normal slurs and not phrasing slurs.
1565 See also @internalsref{PhrasingSlur},
1566 @internalsref{PhrasingSlurEvent}.
1570 Phrasing slurs have the same limitations in their formatting as normal
1574 @subsection Breath marks
1576 Breath marks are entered using @code{\breathe}.
1579 @lilypond[fragment,relative]
1583 The glyph of the breath mark can be tweaked by overriding the
1584 @code{text} property of the @code{BreathingSign} grob with the name of
1585 any glyph of @ref{The Feta font}. For example,
1586 @lilypond[fragment,verbatim,relative]
1588 \property Voice.BreathingSign \override #'text = #"scripts-rvarcomma"
1595 @internalsref{BreathingSign}, @internalsref{BreathingSignEvent},
1596 @inputfileref{input/regression,breathing-sign.ly}.
1602 @cindex beats per minute
1603 @cindex metronome marking
1605 Metronome settings can be entered as follows:
1607 @cindex @code{\tempo}
1609 \tempo @var{duration} = @var{perminute}
1612 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1617 @internalsref{TempoEvent}
1621 The tempo setting is not printed, but is only used in the MIDI
1622 output. You can trick lily into producing a metronome mark,
1623 though. Details are in @ref{Text markup}.
1625 [TODO: make note markup.]
1629 @subsection Text spanners
1630 @cindex Text spanners
1632 Some textual indications, e.g. @i{rallentando} or @i{accelerando}, are
1633 often extended over many measures. This is indicated by following the
1634 text with a dotted line. You can create such texts using text
1635 spanners. The syntax is as follows:
1640 The string to be printed, as well as the style, is set through object
1643 An application is to fake octavation indications.
1645 @lilypond[fragment,relative,verbatim]
1646 \relative c' { a''' b c a
1647 \property Voice.TextSpanner \set #'type = #'dotted-line
1648 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1649 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1650 \property Staff.centralCPosition = #-13
1651 a-\startTextSpan b c a-\stopTextSpan }
1657 @internalsref{TextSpanEvent},
1658 @internalsref{TextSpanner}, @inputfileref{input/regression,text-spanner.ly}.
1661 @node Analysis brackets
1662 @subsection Analysis brackets
1664 @cindex phrasing brackets
1665 @cindex musicological analysis
1666 @cindex note grouping bracket
1668 Brackets are used in musical analysis to indicate structure in musical
1669 pieces. LilyPond supports a simple form of nested horizontal brackets.
1670 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1671 @internalsref{Staff} context. A bracket is started with
1672 @code{\groupOpen} and closed with @code{\groupClose}. This produces
1673 @internalsref{HorizontalBracket} objects.
1675 @lilypond[singleline,verbatim]
1676 \score { \notes \relative c'' {
1677 c4-\groupOpen-\groupOpen
1680 c4-\groupClose-\groupClose
1682 \paper { \translator {
1683 \StaffContext \consists "Horizontal_bracket_engraver"
1689 Bracket endings should be angled/slanted. (TODO)
1697 [TODO: ornaments vs. expressive marks]
1709 @subsection Articulations
1710 @cindex Articulations
1712 @cindex articulations
1716 A variety of symbols can appear above and below notes to indicate
1717 different characteristics of the performance. They are added to a note
1718 by adding a dash and the the character signifying the
1719 articulation. They are demonstrated here.
1721 @lilypondfile[notexidoc]{script-abbreviations.ly}
1723 The script is automatically placed, but if you need to force
1724 directions, you can use @code{_} to force them down, or @code{^} to
1726 @lilypond[fragment, verbatim]
1731 Other symbols can be added using the syntax
1732 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1733 using @code{^} and @code{_}.
1737 @cindex staccatissimo
1746 @cindex organ pedal marks
1755 @cindex prallmordent
1759 @cindex thumb marking
1764 @lilypondfile[notexidoc]{script-chart.ly}
1769 Fingering instructions can also be entered in this shorthand. For
1770 finger changes, use markup texts:
1772 @lilypond[verbatim, singleline, fragment]
1773 c'4-1 c'4-2 c'4-3 c'4-4
1774 c'^\markup { \fontsize #-3 \number "2-3" }
1777 @cindex finger change
1782 @lilypond[verbatim,singleline,fragment,relative=1]
1783 << c-1 e-2 g-3 b-5 >> 4
1784 \property Voice.fingerHorizontalDirection = #LEFT
1785 << c-1 es-3 g-5 >> 4
1786 \property Voice.fingerHorizontalDirection = #RIGHT
1787 << c-1 e-2 g-3 b-5 >> 4-\arpeggio
1788 \property Voice.fingerHorizontalDirection = #LEFT
1789 << c_1 e-2 g-3 b^5 >> 4
1794 @internalsref{ScriptEvent},
1795 @internalsref{Script}, @internalsref{FingerEvent} and @internalsref{Fingering}.
1799 All of these note ornaments appear in the printed output but have no
1800 effect on the MIDI rendering of the music.
1804 @subsection Text scripts
1805 @cindex Text scripts
1807 It is possible to place arbitrary strings of text or markup text (see
1808 @ref{Text markup}) above or below notes by using a string:
1809 @code{c^"text"}. By default, these indications do not influence the
1810 note spacing, but by using the command @code{\fatText}, the widths
1811 will be taken into account.
1813 @lilypond[fragment,singleline,verbatim] \relative c' {
1814 c4^"longtext" \fatText c4_"longlongtext" c4 }
1817 It is possible to use @TeX{} commands in the strings, but this should be
1818 avoided because it makes it impossible for LilyPond to compute the
1819 exact length of the string, which may lead to collisions. Also, @TeX{}
1820 commands will not work with direct PostScript output.
1825 @internalsref{TextScriptEvent}, @internalsref{TextScript},
1831 @subsection Grace notes
1835 @cindex @code{\grace}
1839 Grace notes are ornaments that are written out
1841 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
1845 In normal notation, grace notes take up no logical
1846 time in a measure. Such an idea is practical for normal notation, but
1847 is not strict enough to put it into a program. The model that LilyPond
1848 uses for grace notes internally is that all timing is done in two
1851 Every point in musical time consists of two rational numbers: one
1852 denotes the logical time, one denotes the grace timing. The above
1853 example is shown here with timing tuples.
1856 \score { \notes \relative c''{
1857 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
1858 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
1860 \paper { linewidth = 8.\cm }
1865 The placement of these grace notes is synchronized between different
1868 @lilypond[relative=2,verbatim,fragment]
1869 < \context Staff = SA { e4 \grace { c16-[ d e f-] } e4 }
1870 \context Staff = SB { c'4 \grace { g8 b } c4 } >
1874 Unbeamed eighth notes and shorter by default have a slash through the
1875 stem. This can be controlled with object property @code{stroke-style} of
1876 @internalsref{Stem}. The change in formatting is accomplished by
1877 inserting @code{\startGraceMusic} before handling the grace notes, and
1878 @code{\stopGraceMusic} after finishing the grace notes.
1879 You can add to these definitions to globally change grace note
1880 formatting. The standard definitions are in @file{ly/grace-init.ly}.
1882 [TODO discuss Scheme functionality.]
1885 The @code{\override} is carefully matched with a @code{\revert}.
1890 @lilypond[fragment,verbatim]
1891 \relative c'' \context Voice {
1892 \grace c8 c4 \grace { [c16 c16] } c4
1894 \property Voice.Stem \override #'stroke-style = #'()
1896 \property Voice.Stem \revert #'stroke-style
1903 If you want to end a note with a grace note, then the standard trick
1904 is to put the grace notes before a phantom ``space note'', e.g.
1905 @lilypond[fragment,verbatim, relative=2]
1908 { s2 \grace { [c16 d] } } >
1913 A @code{\grace} section has some default values, and LilyPond will
1914 use those default values unless you specify otherwise inside the
1915 @code{\grace} section. For example, if you specify \slurUp
1916 @emph{before} your @code{\grace} section, a slur which starts inside
1917 the @code{\grace} will not be forced up, even if the slur ends outside
1918 of the @code{\grace}. Note the difference between the first and
1919 second bars in this example:
1921 @lilypond[fragment,verbatim]
1922 \relative c'' \context Voice {
1941 @internalsref{GraceMusic}.
1945 Grace notes can not be used in the smallest size (@file{paper11.ly}).
1947 Grace note synchronization can also lead to surprises. Staff notation,
1948 such as key signatures, barlines, etc. are also synchronized. Take
1949 care when you mix staves with grace notes and staves without.
1951 @lilypond[relative=2,verbatim,fragment]
1952 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
1953 \context Staff = SB { c4 \bar "|:" d4 } >
1956 Grace sections should only be used within sequential music
1957 expressions. Nesting, juxtaposing, or ending sequential music with a
1958 grace section is not supported, and might produce crashes or other
1963 @subsection Glissando
1966 @cindex @code{\glissando}
1968 A glissando is a smooth change in pitch. It is denoted by a line or a
1969 wavy line between two notes.
1973 A glissando line can be requested by attaching a @code{\glissando} to
1976 @lilypond[fragment,relative,verbatim]
1982 @internalsref{Glissando}, @internalsref{GlissandoEvent}.
1987 Printing of an additional text (such as @emph{gliss.}) must be done
1992 @subsection Dynamics
2005 @cindex @code{\ffff}
2015 Absolute dynamic marks are specified using an identifier after a
2016 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2017 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2018 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2019 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2021 @lilypond[verbatim,singleline,fragment,relative]
2022 c'-\ppp c-\pp c -\p c-\mp c-\mf c-\f c-\ff c-\fff
2028 @cindex @code{\decr}
2029 @cindex @code{\rced}
2036 A crescendo mark is started with @code{\cr} and terminated with
2037 @code{\endcr}, and decrescendi similarly with @code{\decr} and
2038 @code{\enddecr}. There are also shorthands for these marks. A
2039 crescendo can be started with @code{\<} and a decrescendo can be
2040 started with @code{\>}. Either one can be terminated with @code{\!}.
2041 Because these marks are bound to notes, if you must use spacer notes
2042 if marks during one note are needed.
2044 @lilypond[fragment,verbatim,center,quote]
2045 c''-\< c''-\! d''-\decr e''-\rced
2046 < f''1 { s4 s4-\< s4-\! \> s4-\! } >
2048 This may give rise to very short hairpins. Use @code{minimum-length}
2049 in @internalsref{Voice}.@internalsref{HairPin} to lengthen these, e.g.
2052 \property Staff.Hairpin \override #'minimum-length = #5
2055 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2056 is an example how to do it:
2058 @lilypond[fragment,relative=2,verbatim]
2059 c4 \cresc c4 \endcresc c4
2066 You can also supply your own texts:
2067 @lilypond[fragment,relative,verbatim]
2069 \property Voice.crescendoText = "cresc. poco"
2070 \property Voice.crescendoSpanner = #'dashed-line
2079 @internalsref{CrescendoEvent}, @internalsref{DecrescendoEvent},
2080 @internalsref{AbsoluteDynamicEvent}.
2082 Dynamics are objects of @internalsref{DynamicText} and
2083 @internalsref{Hairpin}. Vertical positioning of these symbols is
2084 handled by the @internalsref{DynamicLineSpanner} object.
2086 If you want to adjust padding or vertical direction of the dynamics,
2087 you must set properties for the @internalsref{DynamicLineSpanner}
2088 object. Predefined identifiers to set the vertical direction are
2089 \dynamicUp and \dynamicDown.
2091 @cindex direction, of dynamics
2092 @cindex @code{\dynamicDown}
2093 @cindex @code{\dynamicUp}
2101 @cindex @code{\repeat}
2103 To specify repeats, use the @code{\repeat} keyword. Since repeats
2104 should work differently when played or printed, there are a few
2105 different variants of repeats.
2109 Repeated music is fully written (played) out. Useful for MIDI
2110 output, and entering repetitive music.
2113 This is the normal notation: Repeats are not written out, but
2114 alternative endings (voltas) are printed, left to right.
2118 Alternative endings are written stacked. This has limited use but may be
2119 used to typeset two lines of lyrics in songs with repeats, see
2120 @inputfileref{input,star-spangled-banner.ly}.
2127 Make beat or measure repeats. These look like percent signs.
2133 * Repeats and MIDI::
2134 * Manual repeat commands::
2136 * Tremolo subdivisions::
2141 @subsection Repeat syntax
2144 Repetition is a central concept in music, and multiple notations exist
2149 LilyPond has one syntactic construct for specifying different types of
2150 repeats. The syntax is
2153 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2156 If you have alternative endings, you may add
2157 @cindex @code{\alternative}
2159 \alternative @code{@{} @var{alternative1}
2161 @var{alternative3} @dots{} @code{@}}
2163 where each @var{alternative} is a music expression. If you do not
2164 give enough alternatives for all of the repeats, then the first
2165 alternative is assumed to be played more than once.
2167 Normal notation repeats are used like this:
2168 @lilypond[fragment,verbatim]
2170 \repeat volta 2 { c'4 d' e' f' }
2171 \repeat volta 2 { f' e' d' c' }
2174 With alternative endings:
2175 @lilypond[fragment,verbatim]
2177 \repeat volta 2 {c'4 d' e' f'}
2178 \alternative { {d'2 d'} {f' f} }
2182 Folded repeats look like this:
2185 @li lypond[fragment,verbatim]
2187 \repeat fold 2 {c'4 d' e' f'}
2188 \alternative { {d'2 d'} {f' f} }
2194 @lilypond[fragment,verbatim]
2198 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2199 \alternative { { g4 g g } { a | a a a a | b2. } }
2204 @node Repeats and MIDI
2205 @subsection Repeats and MIDI
2207 @cindex expanding repeats
2209 For instructions on how to unfold repeats for MIDI output, see the
2210 example file @inputfileref{input/test,unfold-all-repeats.ly}.
2215 Timing information is not remembered at the start of an alternative,
2216 so you have to reset timing information after a repeat, e.g. using a
2217 bar-check (See @ref{Bar check}), setting @code{Score.measurePosition}
2218 or entering @code{\partial}. Slurs or ties are also not repeated.
2221 @node Manual repeat commands
2222 @subsection Manual repeat commands
2224 @cindex @code{repeatCommands}
2226 The property @code{repeatCommands} can be used to control the layout of
2227 repeats. Its value is a Scheme list of repeat commands, where each repeat
2235 @item (volta . @var{text})
2236 Print a volta bracket saying @var{text}. The text can be specified as
2237 a text string or as a markup text, see @ref{Text markup}. Do not
2238 forget to change the font, as the default number font does not contain
2239 alphabetic characters.
2241 Stop a running volta bracket
2244 @lilypond[verbatim, fragment]
2246 \property Score.repeatCommands = #'((volta "93") end-repeat)
2248 \property Score.repeatCommands = #'((volta #f))
2255 @internalsref{VoltaBracket}
2257 @node Tremolo repeats
2258 @subsection Tremolo repeats
2259 @cindex tremolo beams
2261 To place tremolo marks between notes, use @code{\repeat} with tremolo
2263 @lilypond[verbatim,center,singleline]
2265 \context Voice \notes\relative c' {
2266 \repeat "tremolo" 8 { c16 d16 }
2267 \repeat "tremolo" 4 { c16 d16 }
2268 \repeat "tremolo" 2 { c16 d16 }
2269 \repeat "tremolo" 4 c16
2276 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2277 @internalsref{StemTremolo}. @internalsref{TremoloEvent}.
2282 The single stem tremolo @emph{must} be entered without @code{@{} and
2285 @node Tremolo subdivisions
2286 @subsection Tremolo subdivisions
2287 @cindex tremolo marks
2288 @cindex @code{tremoloFlags}
2290 Tremolo marks can be printed on a single note by adding
2291 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2292 A @var{length} value of 8 gives one line across the note stem. If the
2293 length is omitted, then then the last value (stored in
2294 @code{Voice.tremoloFlags}) is used.
2296 @lilypond[verbatim,fragment,center]
2297 c'2:8 c':32 | c': c': |
2300 [TODO : stok is te kort bij 32en]
2304 Tremolos in this style do not carry over into the MIDI output.
2307 @node Measure repeats
2308 @subsection Measure repeats
2310 @cindex percent repeats
2311 @cindex measure repeats
2313 In the @code{percent} style, a note pattern can be repeated. It is
2314 printed once, and then the pattern is replaced with a special sign.
2315 Patterns of a one and two measures are replaced by percent-like signs,
2316 patterns that divide the measure length are replaced by slashes.
2318 @lilypond[verbatim,singleline]
2319 \context Voice { \repeat "percent" 4 { c'4 }
2320 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2326 @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2327 @internalsref{PercentRepeatedMusic}, and
2328 @internalsref{DoublePercentRepeat}.
2333 You can not nest percent repeats, e.g. by filling in the first measure
2334 with slashes, and repeating that measure with percents.
2336 @node Rhythmic music
2337 @section Rhythmic music
2339 Sometimes you might want to show only the rhythm of a melody. This can
2340 be done with the rhythmic staff. All pitches of notes on such a staff
2341 are squashed, and the staff itself looks has a single staff line:
2343 @lilypond[fragment,relative,verbatim]
2344 \context RhythmicStaff {
2346 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2351 * Percussion staves::
2352 * Percussion midi output::
2355 @node Percussion staves
2356 @subsection Percussion staves
2360 To typeset more than one piece of percussion to be played by the same
2361 musician one typically uses a multiline staff where each staff
2362 position refers to a specific piece of percussion.
2366 LilyPond is has a set of Scheme functions that can be used to typeset
2367 percussion staves. The system is based on the general MIDI
2368 drum-pitches. Include @file{ly/drumpitch-init.ly} to use drum
2369 pitches. This file defines the pitches from the Scheme variable
2370 @code{drum-pitch-names}, the definition of which can be read in
2371 @file{scm/drums.scm}. Each piece of percussion has a full name and an
2372 abbreviated name, and both the full name or the abbreviation may be
2373 used in input files.
2375 To typeset the music on a staff apply the function @code{drums->paper}
2376 to the percussion music. This function takes a list of percussion
2377 instrument names, notehead scripts and staff positions (that is:
2378 pitches relative to the C-clef) and transforms the input
2379 music by moving the pitch, changing the notehead and (optionally)
2382 @lilypond[singleline,verbatim,quote]
2383 \include "drumpitch-init.ly"
2384 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2385 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2387 \apply #(drums->paper 'drums) \context Staff <
2389 \context Voice = up { \voiceOne \up }
2390 \context Voice = down { \voiceTwo \down }
2395 In the above example the music was transformed using the list @code{'drums}.
2396 Currently the following lists are defined in @file{scm/drums.scm}:
2399 To typeset a typical drum kit on a five-line staff.
2402 \include "drumpitch-init.ly"
2403 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2404 bd sn ss tomh tommh tomml toml tomfh tomfl }
2405 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2406 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2409 \apply #(drums->paper 'drums) \context Staff <
2413 \context Lyrics \nam
2416 linewidth = 100.0\mm
2419 \remove Bar_engraver
2420 \remove Time_signature_engraver
2421 minimumVerticalExtent = #'(-4.0 . 5.0)
2425 \remove Stem_engraver
2431 Scheme supports six different toms. When there fewer toms, simply
2432 select the toms that produce the desired result, i.e., to get toms on
2433 the three middle lines you use @code{tommh}, @code{tomml} and
2436 Because general MIDI does not contain rimshots the sidestick is used
2437 for this purpose instead.
2439 To typeset timbales on a two line staff.
2440 @lilypond[singleline]
2441 \include "drumpitch-init.ly"
2442 nam = \lyrics { timh ssh timl ssl cb }
2443 mus = \notes { timh ssh timl ssl cb s16 }
2446 \apply #(drums->paper 'timbales) \context Staff <
2450 \context Lyrics \nam
2455 \remove Bar_engraver
2456 \remove Time_signature_engraver
2457 StaffSymbol \override #'line-count = #2
2458 StaffSymbol \override #'staff-space = #2
2459 minimumVerticalExtent = #'(-3.0 . 4.0)
2463 \remove Stem_engraver
2470 To typeset congas on a two line staff.
2471 @lilypond[singleline]
2472 \include "drumpitch-init.ly"
2473 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2474 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2477 \apply #(drums->paper 'congas) \context Staff <
2481 \context Lyrics \nam
2486 \remove Bar_engraver
2487 \remove Time_signature_engraver
2488 StaffSymbol \override #'line-count = #2
2489 StaffSymbol \override #'staff-space = #2
2490 minimumVerticalExtent = #'(-3.0 . 4.0)
2494 \remove Stem_engraver
2500 To typeset bongos on a two line staff.
2501 @lilypond[singleline]
2502 \include "drumpitch-init.ly"
2503 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2504 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2507 \apply #(drums->paper 'bongos) \context Staff <
2511 \context Lyrics \nam
2516 \remove Bar_engraver
2517 \remove Time_signature_engraver
2518 StaffSymbol \override #'line-count = #2
2519 StaffSymbol \override #'staff-space = #2
2520 minimumVerticalExtent = #'(-3.0 . 4.0)
2524 \remove Stem_engraver
2530 To typeset all kinds of simple percussion on one line staves.
2531 @lilypond[singleline]
2532 \include "drumpitch-init.ly"
2533 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2534 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2537 \apply #(drums->paper 'percussion) \context Staff <
2541 \context Lyrics \nam
2546 \remove Bar_engraver
2547 \remove Time_signature_engraver
2548 StaffSymbol \override #'line-count = #1
2549 minimumVerticalExtent = #'(-2.0 . 3.0)
2553 \remove Stem_engraver
2560 If you do not like any of the predefined lists you can define your own
2561 list at the top of your file:
2563 @lilypond[singleline, verbatim]
2565 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2566 (snare default #f ,(ly:make-pitch 0 1 0))
2567 (hihat cross #f ,(ly:make-pitch 0 5 0))
2568 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2569 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2571 \include "drumpitch-init.ly"
2572 up = \notes { hh8 hh hh hh hhp4 hhp }
2573 down = \notes { bd4 sn bd toml8 toml }
2575 \apply #(drums->paper 'mydrums) \context Staff <
2577 \context Voice = up { \voiceOne \up }
2578 \context Voice = down { \voiceTwo \down }
2583 To use a modified existing list, one can prepend modifications to the
2587 #(define mydrums (append `(
2588 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2589 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2593 The file @file{drumpitch-init.ly} replaces the normal pitch names, so
2594 you have to reinclude @file{nederlands.ly} after the
2595 drum-pattern-definitions to enter normal notes.
2597 @lilypond[singleline,verbatim]
2598 \include "drumpitch-init.ly"
2599 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2600 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2601 \include "nederlands.ly"
2602 bass = \notes \transpose c c,, { a4. e8 r e g e }
2605 \apply #(drums->paper 'drums) \context Staff = drums <
2607 \context Voice = up { \voiceOne \up }
2608 \context Voice = down { \voiceTwo \down }
2610 \context Staff = bass { \clef "F_8" \bass }
2615 @node Percussion midi output
2616 @subsection Percussion midi output
2618 In order to produce correct midi output you need to produce two score
2619 blocks---one for the paper and one for the midi output. To use the
2620 percussion channel you set the property @code{instrument} to
2621 @code{'drums}. Because the drum-pitches themself are similar to the
2622 general midi pitches all you have to do is to insert the voices with
2623 none of the scheme functions to get the correct midi output:
2627 \apply #(drums->paper 'mydrums) \context Staff <
2636 \property Staff.instrument = #'drums
2645 This scheme is to be considered a temporary implementation.
2649 @section Piano music
2651 Piano staves are two normal staves coupled with a brace. The staves
2652 are largely independent, but sometimes voices can cross between the
2653 two staves. The same notation is also used for harps and other key
2654 instruments. The @internalsref{PianoStaff} is especially built to
2655 handle this cross-staffing behavior. In this section we discuss the
2656 @internalsref{PianoStaff} and some other pianistic peculiarities.
2660 * Automatic staff changes::
2661 * Manual staff switches::
2664 * Voice follower lines::
2669 There is no support for putting chords across staves. You can get
2670 this result by increasing the length of the stem in the lower stave so
2671 it reaches the stem in the upper stave, or vice versa. An example is
2672 included with the distribution as @inputfileref{input/test,stem-cross-staff.ly}.
2674 Dynamics are not centered, but kludges do exist. See
2675 @inputfileref{input/templates,piano-dynamics.ly}.
2677 @cindex cross staff stem
2678 @cindex stem, cross staff
2681 @c fixme: should have hyperlinks as well.
2687 @node Automatic staff changes
2688 @subsection Automatic staff changes
2689 @cindex Automatic staff changes
2691 Voices can switch automatically between the top and the bottom
2692 staff. The syntax for this is
2694 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2696 The autochanger switches on basis of pitch (central C is the turning
2697 point), and it looks ahead skipping over rests to switch rests in
2698 advance. Here is a practical example:
2700 @lilypond[verbatim,singleline,quote]
2701 \score { \notes \context PianoStaff <
2702 \context Staff = "up" {
2703 \autochange Staff \context Voice = VA < \relative c' {
2704 g4 a b c d r4 a g } > }
2705 \context Staff = "down" {
2710 Spacer rests are used to prevent the bottom staff from
2711 terminating too soon.
2716 The staff switches often do not end up in optimal places. For high
2717 quality output staff switches should be specified manually.
2721 @node Manual staff switches
2722 @subsection Manual staff switches
2724 @cindex manual staff switches
2725 @cindex staff switch, manual
2727 Voices can be switched between staves manually, using the following command:
2729 \translator Staff = @var{staffname} @var{music}
2731 The string @var{staffname} is the name of the staff. It switches the
2732 current voice from its current staff to the Staff called
2733 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2741 Pianos have pedals that alter the way sound are produced. Generally, a
2742 piano has three pedals, sustain, una corda, and sostenuto.
2746 Piano pedal instruction can be expressed by attaching
2747 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2748 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
2751 The symbols that are printed can be modified by setting
2752 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2753 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation
2754 of @internalsref{SustainPedal} for more information.
2756 Pedals can also be indicated by a sequence of brackets, by setting the
2757 @code{pedal-type} property of @internalsref{SustainPedal} objects:
2759 @lilypond[fragment,verbatim]
2760 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2761 c''4-\sustainDown d''4 e''4
2762 a'4-\sustainUp-\sustainDown
2763 f'4 g'4 a'4-\sustainUp
2766 A third style of pedal notation is a mixture of text and brackets,
2767 obtained by setting @code{pedal-type} to @code{mixed}:
2769 @lilypond[fragment,verbatim]
2770 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2771 c''4-\sustainDown d''4 e''4
2772 c'4-\sustainUp-\sustainDown
2773 f'4 g'4 a'4-\sustainUp
2776 The default '*Ped' style for sustain and damper pedals corresponds to
2777 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2778 for a sostenuto pedal:
2780 @lilypond[fragment,verbatim]
2781 c''4-\sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4-\sostenutoUp
2784 For fine-tuning of the appearance of a pedal bracket, the properties
2785 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2786 @code{PianoPedalBracket} objects (see the detailed documentation of
2787 @internalsref{PianoPedalBracket}) can be modified. For example, the bracket
2788 may be extended to the end of the note head.
2790 @lilypond[fragment,verbatim]
2791 \property Staff.PianoPedalBracket \override
2792 #'shorten-pair = #'(0 . -1.0)
2793 c''4-\sostenutoDown d''4 e''4 c'4
2794 f'4 g'4 a'4-\sostenutoUp
2798 @subsection Arpeggio
2801 @cindex broken arpeggio
2802 @cindex @code{\arpeggio}
2804 You can specify an arpeggio sign on a chord by attaching an
2805 @code{\arpeggio} to a chord.
2808 @lilypond[fragment,relative,verbatim]
2809 <<c e g c>>-\arpeggio
2812 When an arpeggio crosses staves in piano music, you attach an arpeggio
2813 to the chords in both staves, and set
2814 @internalsref{PianoStaff}.@code{connectArpeggios}.
2816 @lilypond[fragment,relative,verbatim]
2817 \context PianoStaff <
2818 \property PianoStaff.connectArpeggios = ##t
2819 \context Voice = one { <<c' e g c>>-\arpeggio }
2820 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
2824 This command creates @internalsref{Arpeggio} objects. Cross staff
2825 arpeggios are @internalsref{PianoStaff}.@internalsref{Arpeggio}.
2827 The direction of the arpeggio is sometimes denoted by adding an
2828 arrowhead to the wiggly line. This can be typeset by setting
2829 @code{arpeggio-direction}.
2831 @lilypond[fragment,relative,verbatim]
2833 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2834 <<c e g c>>-\arpeggio
2835 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2836 <<c e g c>>-\arpeggio
2840 A square bracket on the left indicates that the player should not
2841 arpeggiate the chord. To draw these brackets, set the
2842 @code{molecule-callback} property of @code{Arpeggio} or
2843 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2844 @code{\arpeggio} statements within the chords as before.
2846 @lilypond[fragment,relative,verbatim]
2847 \property PianoStaff.Arpeggio \override
2848 #'molecule-callback = \arpeggioBracket
2849 <<c' e g c>>-\arpeggio
2855 It is not possible to mix connected arpeggios and unconnected
2856 arpeggios in one @internalsref{PianoStaff} at the same time.
2858 @node Voice follower lines
2859 @subsection Voice follower lines
2862 [TODO: invent better name]
2864 @cindex follow voice
2865 @cindex staff switching
2868 @cindex @code{followVoice}
2870 Whenever a voice switches to another staff a line connecting the notes
2871 can be printed automatically. This is enabled if the property
2872 @code{PianoStaff.followVoice} is set to true:
2874 @lilypond[fragment,relative,verbatim]
2875 \context PianoStaff <
2876 \property PianoStaff.followVoice = ##t
2877 \context Staff \context Voice {
2879 \translator Staff=two
2882 \context Staff=two { \clef bass \skip 1*2 }
2886 The associated object is @internalsref{VoiceFollower}.
2890 @section Vocal music
2892 For a discussion of how to put lyrics into a score, see section
2893 @code{Printing lyrics} in the tutorial.
2895 [TODO: Move lyrics section from tutorial to here?]
2897 See also the sections on @ref{Slurs} and @ref{Breath marks}.
2899 [TODO: Move slurs / breath marks section to here?]
2901 [TODO: Write subsection upon usage of ChoirStaff.]
2903 For entering quotes in Lyrics mode, use the following
2905 "\"God\"" is "`King'"
2908 You can use empty syllables, e.g. @code{_4} or @code{" "4} to enter
2909 lyrics. This can confuse the LilyPond -- for example, this might put
2910 (empty) lyrics under rests. To remedy this, use @code{\skip}.
2921 The term @emph{ambitus} denotes a range of pitches for a given voice in
2922 a part of music. It also may denote the pitch range that a musical
2923 instrument is capable of playing. Most musical instruments have their
2924 ambitus standardized (or at least there is agreement upon the minimal
2925 ambitus of a particular type of instrument), such that a composer or
2926 arranger of a piece of music can easily meet the ambitus constraints of
2927 the targeted instrument. However, the ambitus of the human voice
2928 depends on individual physiological state, including education and
2929 training of the voice. Therefore, a singer potentially has to check for
2930 each piece of music if the ambitus of that piece meets his individual
2931 capabilities. This is why the ambitus of a piece may be of particular
2932 value to vocal performers.
2934 The ambitus is typically notated on a per-voice basis at the very
2935 beginning of a piece, e.g. nearby the initial clef or time signature of
2936 each staff. The range is graphically specified by two noteheads, that
2937 represent the minimum and maximum pitch. Some publishers use a textual
2938 notation: they put the range in words in front of the corresponding
2939 staff. Lilypond currently only supports the graphical ambitus notation.
2941 To apply, add the @internalsref{Ambitus_engraver} to the
2942 @internalsref{Voice} context, i.e.
2945 \paper @{ \translator @{
2947 \consists Ambitus_engraver
2953 @lilypond[singleline]
2954 upper = \notes \relative c {
2957 as'' c e2 bes f cis d4 e f2 g
2959 lower = \notes \relative c {
2962 e'4 b g a c es fis a cis b a g f e d2
2965 \context ChoirStaff {
2967 \context Staff = one { \upper }
2968 \context Staff = three { \lower }
2974 \consists Ambitus_engraver
2983 @internalsref{Ambitus}, @inputfileref{input/regression,ambitus.ly}.
2988 Tablature notation is used for notating music for plucked string
2989 instruments. It notates pitches not by using note heads, but by
2990 indicating on which string and fret a note must be played. LilyPond
2991 offers limited support for tablature.
2994 * Tablatures basic::
2995 * Non-guitar tablatures::
2998 @node Tablatures basic
2999 @subsection Tablatures basic
3000 @cindex Tablatures basic
3002 The string number associated to a note is given as a backslash
3003 followed by a number, e.g. @code{c4\3} for a C quarter on the third
3004 string. By default, string 1 is the highest one, and the tuning
3005 defaults to the standard guitar tuning (with 6 strings). The notes
3006 are printed as tablature, by using @internalsref{TabStaff} and
3007 @internalsref{TabVoice} contexts.
3009 @lilypond[fragment,verbatim]
3010 \notes \context TabStaff {
3016 If you do not specify a string number then one is selected
3017 automatically: the first string that does not give a fret number less
3018 than @code{minimumFret} is selected. The default value for
3019 @code{minimumFret} is 0.
3023 e8 fis gis a b cis' dis' e'
3024 \property TabStaff.minimumFret = #8
3025 e8 fis gis a b cis' dis' e'
3030 e8 fis gis a b cis' dis' e'
3031 \property TabStaff.minimumFret = #8
3032 e8 fis gis a b cis' dis' e'
3035 \context StaffGroup <
3036 \context Staff { \clef "G_8" \frag }
3037 \context TabStaff { \frag }
3044 @internalsref{TabStaff}, @internalsref{TabVoice}, and
3045 @internalsref{StringNumberEvent}.
3049 Chords are not handled in a special way, and hence the automatic
3050 string selector may easily select the same string to two notes in a
3054 @node Non-guitar tablatures
3055 @subsection Non-guitar tablatures
3056 @cindex Non-guitar tablatures
3058 You can change the number of strings, by setting the number of lines
3059 in the @internalsref{TabStaff} (the @code{line-count} property of
3060 @internalsref{TabStaff} can only be changed using
3061 @code{\outputproperty}, for more information, see @ref{Tuning per
3064 You can change the tuning of the strings. A string tuning is given as
3065 a Scheme list with one integer number for each string, the number
3066 being the pitch (measured in semitones relative to central C) of an
3067 open string. The numbers specified for @code{stringTuning} are the
3068 numbers of semitones to subtract or add, starting the specified pitch
3069 by default middle C, in string order: thus the notes are e, a, d, and
3072 @lilypond[fragment,verbatim]
3075 \outputproperty #(make-type-checker 'staff-symbol-interface)
3077 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3080 a,4 c' a e' e c' a e'
3085 Finally, it is possible to change the Scheme function to format the
3086 tablature note text. The default is
3087 @var{fret-number-tablature-format}, which uses the fret number. For
3088 some instruments that do not use this notation, you can create a
3089 special tablature formatting function. This function takes three
3090 argument: the string number, the string tuning and the note pitch.
3094 As tablature is a recent feature, most of the guitar special effects
3095 such as bend are not yet supported.
3102 LilyPond has support for both entering and printing chords.
3103 @lilypond[verbatim,singleline]
3104 twoWays = \notes \transpose c c' {
3114 < \context ChordNames \twoWays
3115 \context Voice \twoWays > }
3118 This example also shows that the chord printing routines do not try to
3119 be intelligent. If you enter @code{f bes d}, it does not interpret
3120 this as an inversion.
3122 Chords are represented as a set of pitches. They are internally
3123 stored as simultaneous music expressions. This means you can enter
3124 chords by name and print them as notes, enter them as notes and print
3125 them as chord names, or (the most common case) enter them by name, and
3130 * Printing chord names::
3135 @subsection Chords mode
3138 Chord mode is a mode where you can input sets of pitches using common
3139 names. It is introduced by the keyword @code{\chords}.
3140 In chords mode, a chord is entered by the root, which is entered
3141 like a common pitch, for example,
3142 @lilypond[fragment,verbatim,quote, relative=1]
3143 \chords { es4. d8 c2 }
3148 Other chords may be entered by suffixing a colon, and introducing a
3149 modifier, and optionally, a number, for example
3151 @lilypond[fragment,verbatim,quote]
3152 \chords { e1:m e1:7 e1:m7 }
3154 The first number following the root is taken to be the `type' of the
3155 chord, thirds are added to the root until it reaches the specified
3156 number, for example.
3157 @lilypond[fragment,verbatim]
3158 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
3161 @cindex root of chord
3162 @cindex additions, in chords
3163 @cindex removals, in chords
3165 More complex chords may also be constructed adding separate steps
3166 to a chord. Additions are added after the number following
3167 the colon, and are separated by dots. For example
3169 @lilypond[verbatim,fragment,quote]
3170 \chords { c:5.6 c:3.7.8 c:3.6.13 }
3172 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
3173 to the number, for example:
3174 @lilypond[verbatim,fragment,quote]
3175 \chords { c:7+ c:5+.3- c:3-.5-.7- }
3177 Removals are specified similarly, and are introduced by a caret. They
3178 must come after the additions.
3179 @lilypond[verbatim,fragment]
3180 \chords { c^3 c:7^5 c:9^3.5 }
3183 Modifiers can be used to change pitches. The following modifiers are
3187 is the minor chord. This modifier lowers the 3rd and (if present) the 7th step.
3189 is the diminished chord. This modifier lowers the 3rd, 5th and (if present)
3192 is the augmented chord. This modifier raises the 5th step.
3194 is the major 7th chord. This modifier raises the 7th step if present.
3196 is the suspended 4th or 2nd. This modifier removes the 3rd
3197 step. Append either @code{2} or @code{4} to add the 2nd or 4th step to
3200 Modifiers can be mixed with additions.
3201 @lilypond[verbatim,fragment]
3202 \chords { c:sus4 c:7sus4 c:dim7 c:m6 }
3205 @cindex modifiers, in chords.
3212 Since the unaltered 11 does sound well when combined with the
3213 unaltered 3, the 11 is removed in this case, unless it is added
3214 explicitly). For example,
3215 @lilypond[fragment,verbatim]
3216 \chords { c:13 c:13.11 c:m13 }
3221 An inversion (putting one pitch of the chord on the bottom), as well
3222 as bass notes, can be specified by appending
3223 @code{/}@var{pitch} to the chord.
3224 @lilypond[fragment,verbatim,center]
3225 \chords { c1 c/g c/f }
3228 If you do not want to remove the bass note from the chord, but rather
3229 add the note, then you can use @code{/+}@var{pitch}.
3231 @lilypond[fragment,verbatim,center]
3232 \chords { c1 c/+g c/+f }
3235 Chords is a mode similar to @code{\lyrics}, @code{\notes} etc. Most
3236 of the commands continue to work, for example, @code{r} and
3237 @code{\skip} can be used to insert rests and spaces, and
3238 @code{\property} may be used to change various settings.
3244 Each step can only be present in a chord once. The following
3245 simply produces the augmented chord, since @code{5+} is interpreted
3248 @lilypond[verbatim,fragment]
3249 \chords { c:5.5-.5+ }
3252 In chord mode, dashes and carets are used to indicate chord additions
3253 and subtractions, so articulation scripts can not be entered.
3256 @node Printing chord names
3257 @subsection Printing chord names
3259 @cindex printing chord names
3263 For displaying printed chord names, use the @internalsref{ChordNames} context.
3264 The chords may be entered either using the notation described above, or
3265 directly using simultaneous music.
3267 @lilypond[verbatim,singleline]
3269 \chords {a1 b c} <<d f g>> <<e g b>>
3273 \context ChordNames \scheme
3274 \context Staff \transpose c c' \scheme
3279 You can make the chord changes stand out by setting
3280 @internalsref{ChordNames}.@code{chordChanges} to true. This will only
3281 display chord names when there is a change in the chords scheme and at
3282 the start of a new line.
3286 c1:m c:m \break c:m c:m d
3290 \context ChordNames {
3291 \property ChordNames.chordChanges = ##t
3293 \context Staff \transpose c c' \scheme
3295 \paper{linewidth= 9.\cm}
3299 The default chord name layout is a system for Jazz music, proposed by
3300 Klaus Ignatzek (See @ref{Literature}).
3302 [TODO: add description for banter other jazz.]
3304 The Ignatzek chord name formatting can be tuned in a number of ways
3305 through the following properties:
3307 @item chordNameExceptions
3308 This is a list that contains the chords that have special formatting.
3310 @inputfileref{input/regression,chord-name-exceptions.ly}.
3312 @item majorSevenSymbol
3313 This property contains the markup object used for the 7th step, when
3314 it is major. Predefined options are @code{whiteTriangleMarkup},
3315 @code{blackTriangleMarkup}. See
3316 @inputfileref{input/regression,chord-name-major7.ly} for an example.
3318 @item chordNameSeparator
3319 Different parts of a chord name are normally separated by a
3320 slash. By setting @code{chordNameSeparator}, you can specify other
3322 @lilypond[fragment,verbatim]
3323 \context ChordNames \chords {
3325 \property ChordNames.chordNameSeparator
3330 @item chordRootNamer
3331 The root of a chord is usually printed as a letter with an optional
3332 alteration. The transformation from pitch to letter is done by this
3333 function. An application of setting this function, is providing chord
3334 names with german notation for the root.
3336 @item chordNoteNamer
3337 The default is to print single notes (as for instance the bass note)
3338 using the chordRootNamer. However, by setting this function to a non-null
3339 value you can specify a different function. I.e. you could use letters
3340 in lower case for the base note.
3346 @inputfileref{input/regression,chord-name-major7.ly},
3347 @inputfileref{input/regression,chord-name-exceptions.ly},
3348 @inputfileref{input/test,chord-names-german.ly},
3349 @file{scm/chords-ignatzek.scm}, @file{scm/chord-entry.scm}
3354 Chord names are determined solely from the list of pitches. Chord
3355 inversions are not identified, and neither are added bass notes. This
3356 may result in strange chord names when chords are entered with the
3357 @code{<< .. >>} syntax.
3363 @section Writing parts
3365 Orchestral music involves some special notation, both in the full score,
3366 as in the individual parts. This section explains how to tackle common
3367 problems in orchestral music.
3374 * Instrument names::
3376 * Multi measure rests::
3377 * Automatic part combining::
3378 * Hara kiri staves::
3379 * Sound output for transposing instruments::
3383 @node Rehearsal marks
3384 @subsection Rehearsal marks
3385 @cindex Rehearsal marks
3387 @cindex @code{\mark}
3389 To print a rehearsal mark, use the @code{\mark} command.
3390 @lilypond[fragment,verbatim]
3400 The mark is incremented automatically if you use @code{\mark
3401 \default}. The value to use is stored in the property
3402 @code{rehearsalMark} is used and automatically incremented.
3404 The @code{\mark} command can also be used to put signs like coda,
3405 segno and fermatas on a barline. Use @code{\markup} to
3406 to access the appropriate symbol.
3408 @lilypond[fragment,verbatim,relative=1]
3409 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
3413 In this case, during line breaks,
3414 marks must also be printed at the end of the line, and not at the
3415 beginning. Use the following to force that behavior
3417 \property Score.RehearsalMark \override
3418 #'break-visibility = #begin-of-line-invisible
3421 See @inputfileref{input/test,boxed-molecule.ly}. for putting boxes
3427 @cindex barlines, putting symbols on
3431 @internalsref{MarkEvent}, @internalsref{RehearsalMark},
3432 @inputfileref{input/test,boxed-molecule.ly}.
3436 @subsection Bar numbers
3440 @cindex measure numbers
3441 @cindex currentBarNumber
3443 Bar numbers are printed by default at the start of the line. The
3444 number itself is stored in the
3445 @code{currentBarNumber} property,
3446 which is normally updated automatically for every measure.
3448 Bar numbers can be typeset at regular intervals instead of at the
3449 beginning of each line. This is illustrated in the following example,
3450 whose source is available as
3451 @inputfileref{input/test,bar-number-every-fifth.ly}
3453 @lilypondfile[notexidoc]{bar-number-every-fifth.ly}
3455 The start of that numbering can also be reset, as demonstrated in
3456 @inputfileref{input/test,bar-number-every-5-reset.ly}.
3458 @lilypondfile[notexidoc]{bar-number-every-5-reset.ly}
3463 @internalsref{BarNumber}.
3464 @inputfileref{input/test,bar-number-every-5-reset.ly}.
3465 @inputfileref{input/test,bar-number-every-fifth.ly}
3469 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
3470 there is one at the top. To solve this, You have to twiddle with the
3471 @internalsref{padding} property of @internalsref{BarNumber} if your
3472 score starts with a @internalsref{StaffGroup}.
3474 @node Instrument names
3475 @subsection Instrument names
3477 In an orchestral score, instrument names are printed left of the
3480 This can be achieved by setting @internalsref{Staff}.@code{instrument}
3481 and @internalsref{Staff}.@code{instr}. This will print a string before
3482 the start of the staff. For the first start, @code{instrument} is
3483 used, for the next ones @code{instr} is used.
3485 @lilypond[verbatim,singleline]
3486 \property Staff.instrument = "ploink " { c''4 }
3489 You can also use markup texts to construct more complicated instrument
3492 @lilypond[fragment,verbatim,singleline]
3493 \notes \context Staff = treble {
3494 \property Staff.instrument = \markup {
3495 \column << "Clarinetti"
3497 \smaller \musicglyph #"accidentals--1"
3508 @internalsref{InstrumentName}
3512 When you put a name on a grand staff or piano staff the width of the
3513 brace is not taken into account. You must add extra spaces to the end of
3514 the name to avoid a collision.
3517 @subsection Transpose
3519 @cindex transposition of pitches
3520 @cindex @code{\transpose}
3522 A music expression can be transposed with @code{\transpose}. The syntax
3525 \transpose @var{from} @var{to} @var{musicexpr}
3528 This means that @var{musicexpr} is transposed by the interval
3529 between @var{from} and @var{to}.
3531 @code{\transpose} distinguishes between enharmonic pitches: both
3532 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3533 half a tone. The first version will print sharps and the second
3534 version will print flats.
3536 @lilypond[singleline, verbatim]
3537 mus =\notes { \key d \major cis d fis g }
3538 \score { \notes \context Staff {
3541 \transpose c g' \mus
3542 \transpose c f' \mus
3548 If you want to use both @code{\transpose} and @code{\relative}, then
3549 you must put @code{\transpose} outside of @code{\relative}, since
3550 @code{\relative} will have no effect music that appears inside a
3554 @node Multi measure rests
3555 @subsection Multi measure rests
3556 @cindex Multi measure rests
3560 Multi measure rests are entered using `@code{R}'. It is specifically
3561 meant for full bar rests and for entering parts: the rest can expand to
3562 fill a score with rests, or it can be printed as a single multimeasure
3563 rest. This expansion is controlled by the property
3564 @code{Score.skipBars}. If this is set to true, Lily will not expand
3565 empty measures, and the appropriate number is added automatically.
3567 @lilypond[fragment,verbatim]
3568 \time 4/4 r1 | R1 | R1*2
3569 \property Score.skipBars = ##t R1*17 R1*4
3572 The @code{1} in @code{R1} is similar to the duration notation used for
3573 notes. Hence, for time signatures other than 4/4, you must enter other
3574 durations. This can be done with augmentation dots or fractions:
3576 @lilypond[fragment,verbatim]
3577 \property Score.skipBars = ##t
3585 A @code{R} spanning a single measure is printed as a whole rest
3586 centered in the measure (or a breve when the measure lasts longer than
3587 two whole notes), regardless of the time signature.
3591 @cindex text on multi-measure rest
3592 @cindex script on multi-measure rest
3593 @cindex fermata on multi-measure rest
3595 Texts can be added to multi-measure rests by using the
3596 @var{note}-@code{markup} syntax. In this case, the number is
3597 replaced. If you need both texts and the number, you must add the
3598 number by hand. An identifier (@code{fermataMarkup}) is provided for
3602 @lilypond[verbatim,fragment]
3604 R2._\markup { "Ad lib" }
3609 @cindex whole rests for a full measure
3613 @internalsref{MultiMeasureRestEvent},
3614 @internalsref{MultiMeasureTextEvent},
3615 @internalsref{MultiMeasureRestMusicGroup},
3616 @internalsref{MultiMeasureRest}.
3618 The graphical object @internalsref{MultiMeasureRestNumber} is for the
3619 default number, and @internalsref{MultiMeasureRestText} for user
3624 It is not possible to use fingerings (e.g. @code{R1-4}) to put numbers
3625 over multi-measure rests.
3627 @cindex condensing rests
3629 There is no way to automatically condense multiple rests into a single
3630 multimeasure rest. Multi measure rests do not take part in rest
3633 Be careful when entering multimeasure rests followed by whole notes,
3637 will enter two notes lasting four measures each. The result will look
3638 ok, but the bar numbering will be off.
3640 @node Automatic part combining
3641 @subsection Automatic part combining
3642 @cindex automatic part combining
3643 @cindex part combiner
3646 Automatic part combining is used to merge two parts of music onto a
3647 staff. It is aimed at typesetting orchestral scores. When the two
3648 parts are identical for a period of time, only one is shown. In
3649 places where the two parts differ, they are typeset as separate
3650 voices, and stem directions are set automatically. Also, solo and
3651 @emph{a due} parts are identified and can be marked.
3655 The syntax for part combining is
3658 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3660 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3661 combined into one context of type @var{context}. The music expressions
3662 must be interpreted by contexts whose names should start with @code{one}
3665 The following example demonstrates the basic functionality of the part
3666 combiner: putting parts on one staff, and setting stem directions and
3669 @lilypond[verbatim,singleline,fragment]
3671 \context Voice=one \partcombine Voice
3672 \context Thread=one \relative c'' {
3675 \context Thread=two \relative c'' {
3681 The first @code{g} appears only once, although it was
3682 specified twice (once in each part). Stem, slur and tie directions are
3683 set automatically, depending whether there is a solo or unisono. The
3684 first part (with context called @code{one}) always gets up stems, and
3685 `solo', while the second (called @code{two}) always gets down stems and
3688 If you just want the merging parts, and not the textual markings, you
3689 may set the property @var{soloADue} to false.
3691 @lilypond[verbatim,singleline,fragment]
3693 \property Staff.soloADue = ##f
3694 \context Voice=one \partcombine Voice
3695 \context Thread=one \relative c'' {
3698 \context Thread=two \relative c'' {
3706 @internalsref{PartCombineMusic},
3707 @internalsref{Thread_devnull_engraver},
3708 @internalsref{Voice_devnull_engraver} and @internalsref{A2_engraver}.
3712 The syntax for naming contexts in inconsistent with the syntax for
3715 In @code{soloADue} mode, when the two voices play the same notes on and
3716 off, the part combiner may typeset @code{a2} more than once in a
3719 @lilypond[fragment,singleline]
3721 \context Voice=one \partcombine Voice
3722 \context Thread=one \relative c'' {
3725 \context Thread=two \relative c'' {
3731 The part combiner is slated to be rewritten [TODO: explain why] .
3733 @cindex @code{Thread_devnull_engraver}
3734 @cindex @code{Voice_engraver}
3735 @cindex @code{A2_engraver}
3737 @node Hara kiri staves
3738 @subsection Hara kiri staves
3740 In orchestral scores, staff lines that only have rests are usually removed.
3741 This saves some space. This style is called `French Score'.
3745 This is supported through the hara kiri@footnote{Hara kiri is the
3746 vulgar name for Seppuku, is the ritual suicide of the Japanese
3747 Samourai warriors.} staff. This staff commits suicide when it finds
3748 itself to be empty after the line-breaking process. It will not
3749 disappear when it contains normal rests, you must use multi measure
3752 For @internalsref{Lyrics}, @internalsref{LyricsVoice},
3753 @internalsref{ChordNames} and @internalsref{FiguredBass}, hara-kiri is
3754 switched on by default. For normal staffs, hara kiri is available as a
3755 specialized @internalsref{Staff} context, with the name identifier
3756 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3757 example disappears in the second line.
3761 \notes \relative c' <
3762 \context Staff = SA { e4 f g a \break c1 }
3763 \context Staff = SB { c4 d e f \break R1 }
3767 \translator { \HaraKiriStaffContext }
3773 @node Sound output for transposing instruments
3774 @subsection Sound output for transposing instruments
3776 When you want to make a MIDI file from a score containing transposed
3777 and untransposed instruments, you have to instruct LilyPond the pitch
3778 offset (in semitones) for the transposed instruments. This is done
3779 using the @code{transposing} property. It does not affect printed
3782 @cindex @code{transposing}
3785 \property Staff.instrument = #"Cl. in B-flat"
3786 \property Staff.transposing = #-2
3790 @node Ancient notation
3791 @section Ancient notation
3793 @cindex Vaticana, Editio
3794 @cindex Medicaea, Editio
3799 [TODO: write introduction on ancient notation]
3802 * Ancient note heads::
3811 @node Ancient note heads
3812 @subsection Ancient note heads
3814 To get a longa note head, you have to use mensural note heads. This
3815 is accomplished by setting the @code{style} property of the
3816 NoteHead object to @code{mensural}. There is also a note head style
3817 @code{baroque} which gives mensural note heads for @code{\longa} and
3818 @code{\breve} but standard note heads for shorter notes.
3820 @lilypond[fragment,singleline,verbatim]
3821 \property Voice.NoteHead \set #'style = #'mensural
3826 @subsection Ancient clefs
3828 LilyPond supports a variety of clefs, many of them ancient.
3830 For modern clefs, see section @ref{Clef}. For the percussion clef, see
3831 section @ref{Percussion staves}. For the @code{TAB} clef, see section
3834 The following table shows all ancient clefs that are supported via the
3835 @code{\clef} command. Some of the clefs use the same glyph, but differ
3836 only with respect to the line they are printed on. In such cases, a
3837 trailing number in the name is used to enumerate these clefs. Still,
3838 you can manually force a clef glyph to be typeset on an arbitrary line,
3839 as described in section @ref{Clef}. The note printed to the right side
3840 of each clef denotes the @code{c'} with respect to the clef.
3844 @c --- This should go somewhere else: ---
3845 @c @item modern style G clef (glyph: @code{clefs-G})
3848 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
3850 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
3852 @c @item modern style F clef (glyph: @code{clefs-F})
3855 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
3857 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
3859 @c @item modern style C clef (glyph: @code{clefs-C})
3862 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
3863 @c @code{tenor}, @code{baritone}
3865 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
3867 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
3870 @code{neo_mensural_c1}, @code{neo_mensural_c2},
3871 @code{neo_mensural_c3}, @code{neo_mensural_c4}
3873 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
3875 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
3881 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
3883 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
3889 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
3891 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
3897 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
3899 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
3905 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
3907 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
3913 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
3915 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
3920 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
3922 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
3927 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
3929 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
3932 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
3935 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
3937 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
3942 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
3944 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
3949 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
3951 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
3954 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
3956 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
3958 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
3961 @code{vaticana_fa1}, @code{vaticana_fa2}
3963 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
3965 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
3968 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
3970 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
3972 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
3975 @code{medicaea_fa1}, @code{medicaea_fa2}
3977 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
3979 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
3982 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
3984 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
3986 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
3989 @code{hufnagel_fa1}, @code{hufnagel_fa2}
3991 @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
3993 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
3996 @code{hufnagel_do_fa}
3998 @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4000 @c --- This should go somewhere else: ---
4001 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4004 @c @code{percussion}
4006 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4008 @c @item modern style tab clef (glyph: @code{clefs-tab})
4013 @c @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4017 @emph{Modern style} means ``as is typeset in current editions of
4018 transcribed mensural music''.
4020 @emph{Petrucci style} means ``inspired by printings published by the
4021 famous engraver Petrucci (1466-1539)''.
4023 @emph{Historic style} means ``as was typeset or written in contemporary
4024 historic editions (other than those of Petrucci)''.
4026 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4028 Petrucci used C clefs with differently balanced left-side vertical
4029 beams, depending on which staffline it was printed.
4033 @subsection Custodes
4038 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4039 symbol that appears at the end of a staff. It anticipates the pitch
4040 of the first note(s) of the following line and thus helps the player
4041 or singer to manage line breaks during performance, thus enhancing
4042 readability of a score.
4044 Custodes were frequently used in music notation until the 17th century.
4045 There were different appearances for different notation styles.
4046 Nowadays, they have survived only in special forms of musical notation
4047 such as via the @emph{editio vaticana} dating back to the beginning of
4052 For typesetting custodes, just put a @internalsref{Custos_engraver} into the
4053 @internalsref{Staff} context when declaring the @code{\paper} block,
4054 as shown in the following example.
4059 \consists Custos_engraver
4060 Custos \override #'style = #'mensural
4064 The result looks like this:
4068 \property Staff.Custos \set #'style = #'mensural
4073 \consists Custos_engraver
4080 The appearance of the custos symbol is controlled by it @code{style}
4081 property. The styles supported are @code{vaticana}, @code{medicaea},
4082 @code{hufnagel} and @code{mensural}. They are demonstrated in the
4090 ^\markup { \column << "vaticana"
4091 { " " \musicglyph #"custodes-vaticana-u0" } >>
4092 \column << "medicaea"
4093 { " " \musicglyph #"custodes-medicaea-u0" } >>
4094 \column << "hufnagel"
4095 { " "\musicglyph #"custodes-hufnagel-u0" } >>
4096 \column << "mensural"
4097 { " " \musicglyph #"custodes-mensural-u0" } >>
4105 \remove "Bar_number_engraver"
4109 \remove "Clef_engraver"
4110 \remove "Key_engraver"
4111 \remove "Time_signature_engraver"
4112 \remove "Staff_symbol_engraver"
4113 minimumVerticalExtent = ##f
4119 If the boolean property @code{adjust-if-on-staffline} is set to
4120 @code{#t} (which it is by default), lily typesets slightly different
4121 variants of the custos glyph, depending on whether the custos, is
4122 typeset on or between stafflines. The idea is that the glyph will
4123 optically fit well into the staff, with the appendage on the right of
4124 the custos always ending at the same vertical position between two
4125 stafflines regardless of the pitch. If you set
4126 @code{adjust-if-on-staffline} to @code{#f}, then lily takes regardless
4127 of the pitch always a glyph that is a compromise of the former two
4130 Just like stems can be attached to noteheads in two directions
4131 @emph{up} and @emph{down}, each custos glyph is available with its
4132 appendage pointing either up or down. If the pitch of a custos is
4133 above a selectable position, the appendage will point downwards; if
4134 the pitch is below this position, the appendage will point upwards.
4135 Use property @code{neutral-position} to select this position. By
4136 default, it is set to @code{0}, such that the neutral position is the
4137 center of the staff. Use property @code{neutral-direction} to control
4138 what happens if a custos is typeset on the neutral position itself.
4139 By default, this property is set to @code{-1}, such that the appendage
4140 will point downwards. If set to @code{1}, the appendage will point
4141 upwards. Other values such as @code{0} are reserved for future
4142 extensions and should not be used.
4147 @internalsref{Custos}, @inputfileref{input/test,custos-style.ly} and
4148 @inputfileref{input/regression,custos.ly}.
4152 @subsection Divisiones
4158 A @emph{divisio} (plural: @emph{divisiones}; latin word for
4159 `division') is a staff context symbol that is used to structure
4160 Gregorian music into phrases and sections. The musical meaning of
4161 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
4162 can be characterized as short, medium and long pause, somewhat like
4163 @ref{Breath marks}. The @emph{finalis} sign not only marks the end of
4164 a chant, but is also frequently used within a single
4165 antiphonal/responsorial chant to mark the end of each section.
4169 To use divisiones, include the file @code{gregorian-init.ly}. It
4170 contains definitions that you can apply by just inserting
4171 @code{\divisioMinima}, @code{\divisioMaior}, @code{\divisioMaxima},
4172 and @code{\finalis} at proper places in the input. Some editions use
4173 @emph{virgula} or @emph{caesura} instead of divisio minima.
4174 Therefore, @code{gregorian-init.ly} also defines @code{\virgula} and
4178 @lilypondfile[notexidoc]{divisiones.ly}
4182 @internalsref{BreathingSign}, @internalsref{BreathingSignEvent},
4183 @inputfileref{input/test,divisiones.ly}, @ref{Breath marks}.
4186 @subsection Ligatures
4190 @c TODO: Should double check if I recalled things correctly when I wrote
4191 @c down the following paragraph by heart.
4192 In musical terminology, a ligature is a coherent graphical symbol that
4193 represents at least two different notes. Ligatures originally appeared
4194 in the manuscripts of Gregorian chant notation roughly since the 9th
4195 century as an allusion to the accent symbols of greek lyric poetry to
4196 denote ascending or descending sequences of notes. Both, the shape and
4197 the exact meaning of ligatures changed tremendously during the following
4198 centuries: In early notation, ligatures where used for monophonic tunes
4199 (Gregorian chant) and very soon denoted also the way of performance in
4200 the sense of articulation. With upcoming multiphony, the need for a
4201 metric system arised, since multiple voices of a piece have to be
4202 synchronized some way. New notation systems were invented that used
4203 the manifold shapes of ligatures to now denote rhythmical patterns
4204 (e.g. black mensural notation, mannered notation, ars nova). With the
4205 invention of the metric system of the white mensural notation, the need
4206 for ligatures to denote such patterns disappeared. Nevertheless,
4207 ligatures were still in use in the mensural system for a couple of
4208 decades until they finally disappeared during the late 16th / early 17th
4209 century. Still, ligatures have survived in contemporary editions of
4210 Gregorian chant such as the Editio Vaticana from 1905/08.
4214 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4215 Some ligature styles (such as Editio Vaticana) may need additional input
4216 syntax specific for this particular type of ligature. By default, the
4217 @internalsref{LigatureBracket} engraver just marks the start and end of
4218 a ligature by small square angles:
4220 @lilypond[singleline,verbatim]
4222 \notes \transpose c c' {
4230 To select a specific style of ligatures, a proper ligature engraver has
4231 to be added to the @internalsref{Voice} context, as explained in the
4232 following subsections. Currently, Lilypond only supports white mensural
4233 ligatures with certain limitations. Support for Editio Vaticana will be
4234 added in the future.
4237 * White mensural ligatures::
4240 @node White mensural ligatures
4241 @subsubsection White mensural ligatures
4243 @cindex Mensural ligatures
4244 @cindex White mensural ligatures
4246 There is limited support for white mensural ligatures. The
4247 implementation is still experimental; it currently may output strange
4248 warnings or even crash in some cases or produce weird results on more
4249 complex ligatures. To engrave white mensural ligatures, in the paper
4250 block the @internalsref{Mensural_ligature_engraver} has to be put into
4251 the @internalsref{Voice} context (and you probably want to remove the
4252 @internalsref{Ligature_bracket_engraver}). There is no additional
4253 input language to describe the shape of a white mensural ligature.
4254 The shape is rather determined solely from the pitch and duration of
4255 the enclosed notes. While this approach may take a new user a while
4256 to get accustomed, it has the great advantage that the full musical
4257 information of the ligature is known internally. This is not only
4258 required for correct MIDI output, but also allows for automatic
4259 transcription of the ligatures.
4263 @lilypond[singleline,verbatim]
4265 \notes \transpose c c' {
4266 \property Score.timing = ##f
4267 \property Score.defaultBarType = "empty"
4268 \property Voice.NoteHead \set #'style = #'neo_mensural
4269 \property Staff.TimeSignature \set #'style = #'neo_mensural
4271 \[ g\longa c\breve a\breve f\breve d'\longa \]
4273 \[ e1 f1 a\breve g\longa \]
4278 \remove Ligature_bracket_engraver
4279 \consists Mensural_ligature_engraver
4285 Without replacing @internalsref{Ligature_bracket_engraver} with
4286 @internalsref{Mensural_ligature_engraver}, the same music transcribes
4289 @lilypond[singleline]
4291 \notes \transpose c c' {
4292 \property Score.timing = ##f
4293 \property Score.defaultBarType = "empty"
4294 \property Voice.NoteHead \set #'style = #'neo_mensural
4295 \property Staff.TimeSignature \set #'style = #'neo_mensural
4297 \[ g\longa c\breve a\breve f\breve d'\longa \]
4299 \[ e1 f1 a\breve g\longa \]
4305 @subsection Figured bass
4307 @cindex Basso continuo
4309 @c TODO: musicological blurb about FB
4311 LilyPond has limited support for figured bass:
4313 @lilypond[verbatim,fragment]
4315 \context Voice \notes { \clef bass dis4 c d ais}
4316 \context FiguredBass
4318 < 6 >4 < 7 >8 < 6+ [_!] >
4324 The support for figured bass consists of two parts: there is an input
4325 mode, introduced by @code{\figures}, where you can enter bass figures
4326 as numbers, and there is a context called @internalsref{FiguredBass}
4327 that takes care of making @internalsref{BassFigure} objects.
4329 In figures input mode, a group of bass figures is delimited by
4330 @code{<} and @code{>}. The duration is entered after the @code{>}.
4335 \context FiguredBass
4339 Accidentals are added to the numbers if you alterate them by
4340 appending @code{-}, @code{!} and @code{+}.
4346 \context FiguredBass
4347 \figures { <4- 6+ 7!> }
4350 Spaces or dashes may be inserted by using @code{_}. Brackets are
4351 introduced with @code{[} and @code{]}.
4357 \context FiguredBass
4358 \figures { < [4 6] 8 [_ 12]> }
4361 Although the support for figured bass may superficially resemble chord
4362 support, it works much simpler. The @code{\figures} mode simply
4363 stores the numbers , and @internalsref{FiguredBass} context prints
4364 them as entered. There is no conversion to pitches, and no
4365 realizations of the bass are played in the MIDI file.
4367 Internally, the code produces markup texts. You can use any of the
4368 markup text properties to override formatting. For example, the
4369 vertical spacing of the figures may be set with @code{baseline-skip}.
4373 Slash notation for alterations is not supported.
4376 @node Contemporary notation
4377 @section Contemporary notation
4379 In the 20th century, composers have greatly expanded the musical
4380 vocabulary. With this expansion, many innovations in musical notation
4381 have been tried. For a comprehensive overview, refer to @cite{Stone
4382 1980} (see @ref{Literature}). In general, the use of new, innovative
4383 notation makes a piece harder to understand and perform and its use
4384 should be avoided if possible. For this reason, support for
4385 contemporary notation in LilyPond is limited.
4394 @subsection Clusters
4398 In musical terminology, a @emph{cluster} denotes a range of
4399 simultaneously sounding pitches that may change over time. The set of
4400 available pitches to apply usually depends on the accoustic source.
4401 Thus, in piano music, a cluster typically consists of a continous range
4402 of the semitones as provided by the piano's fixed set of a chromatic
4403 scale. In choral music, each singer of the choir typically may sing an
4404 arbitrary pitch within the cluster's range that is not bound to any
4405 diatonic, chromatic or other scale. In electronic music, a cluster
4406 (theoretically) may even cover a continuous range of pitches, thus
4407 resulting in coloured noise, such as pink noise.
4409 Clusters can be denoted in the context of ordinary staff notation by
4410 engraving simple geometrical shapes that replace ordinary notation of
4411 notes. Ordinary notes as musical events specify starting time and
4412 duration of pitches; however, the duration of a note is expressed by the
4413 shape of the note head rather than by the horizontal graphical extent of
4414 the note symbol. In contrast, the shape of a cluster geometrically
4415 describes the development of a range of pitches (vertical extent) over
4416 time (horizontal extent). Still, the geometrical shape of a cluster
4417 covers the area in wich any single pitch contained in the cluster would
4418 be notated as an ordinary note. From this point of view, it is
4419 reasonable to specify a cluster as the envelope of a set of notes.
4423 A cluster is engraved as the envelope of a set of notes. The starting
4424 note is marked with @code{\startCluster}, and the ending note with
4425 @code{\stopCluster}, e.g.,
4433 The following example (from
4434 @inputfileref{input/regression,cluster.ly}) shows what the result
4437 @lilypondfile[notexidoc]{cluster.ly}
4439 By default, @internalsref{Cluster_engraver} is in the
4440 @internalsref{Voice} context. This allows putting ordinary notes and
4441 clusters together in the same staff, even simultaneously. In such a
4442 case no attempt is made to automatically avoid collisions between
4443 ordinary notes and clusters.
4447 @internalsref{Cluster}, @inputfileref{input/regression,cluster.ly},
4448 @internalsref{Cluster_engraver}, @internalsref{ClusterEvent}.
4452 When a cluster is active, note heads must be switched off manually using
4455 Music expressions like @code{< @{ g8 e8 @} a4 >} are not printed
4456 accurately. Use @code{<<g a>>8 <<e a>>8} instead.
4461 @subsection Fermatas
4465 The following fermata symbols, that are frequently used in contemporary
4466 music notation, are supported
4468 @lilypond[singleline]
4475 ^\markup { short fermata }
4480 ^\markup { fermata }
4485 ^\markup { long fermata }
4490 ^\markup { very long fermata }
4496 See @ref{Articulations} for general instructions how to apply scripts
4497 such as fermatas to a @code{\notes@{@}} block.
4500 @section Tuning output
4502 As much formatting as possible is performed
4503 automatically. Nevertheless, there are situations where LilyPond needs
4504 some help, or where you want to override its decisions. In this
4505 section we discuss ways to do just that.
4507 Formatting is internally done by manipulating so called objects (graphic
4508 objects). Each object carries with it a set of properties (object
4509 properties) specific to that object. For example, a stem object has
4510 properties that specify its direction, length and thickness.
4512 The most direct way of tuning the output is by altering the values of
4513 these properties. There are two ways of doing that: first, you can
4514 temporarily change the definition of a certain type of object, thus
4515 affecting a whole set of objects. Second, you can select one specific
4516 object, and set a object property in that object.
4519 * Tuning per object ::
4526 @node Tuning per object
4527 @subsection Tuning per object
4530 Tuning a single object is most often done with @code{\once \property}. The
4533 \once \property @dots{}
4541 @node Tuning objects
4542 @subsection Tuning objects
4544 @cindex object description
4546 The definition of an object is actually a list of default object
4547 properties. For example, the definition of the Stem object (available
4548 in @file{scm/grob-description.scm}), includes the following definitions for
4553 (beamed-lengths . (0.0 2.5 2.0 1.5))
4554 (Y-extent-callback . ,Stem::height)
4559 By adding variables on top of these existing definitions, the system
4560 defaults is overriden, and the appearance of a graphical objects is
4566 Changing a variable for only one object is commonly achieved with
4570 \once \property @var{context}.@var{grobname}
4571 \override @var{symbol} = @var{value}
4573 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4574 and @var{grobname} is a string and @var{value} is a Scheme expression.
4575 This command applies a setting only during one moment in the score.
4577 In the following example, only one @internalsref{Stem} object is
4578 changed from its original setting:
4580 @lilypond[verbatim, fragment, relative=1]
4582 \once \property Voice.Stem \set #'thickness = #4
4586 @cindex @code{\once}
4588 For changing more objects, the same command, without @code{\once} can
4591 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4593 This command adds @code{@var{symbol} = @var{value}} to the definition
4594 of @var{grobname} in the context @var{context}, and this definition
4595 stays in place until it is removed.
4597 An existing definition may be removed by the following command
4600 \property @var{context}.@var{grobname} \revert @var{symbol}
4603 All @code{\override} and @code{\revert} commands should be balanced.
4604 The @code{\set} shorthand, performs a revert followed by an override,
4605 and is often more convenient to use
4608 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4612 @lilypond[verbatim,quote]
4613 c'4 \property Voice.Stem \override #'thickness = #4.0
4615 c'4 \property Voice.Stem \revert #'thickness
4619 The following example gives exactly the same result as the previous
4620 one (assuming the system default for stem thickness is 0.8).
4622 @lilypond[verbatim,quote]
4623 c'4 \property Voice.Stem \set #'thickness = #4.0
4625 c'4 \property Voice.Stem \set #'thickness = #0.8
4629 If you revert a setting which was not set in the first place, then it
4630 has no effect. However, if the setting was set as a system default, it
4631 may remove the default value, and this may give surprising results,
4632 including crashes. In other words, @code{\override} and
4633 @code{\revert}, must be carefully balanced.
4635 These are examples of correct nesting of @code{\override}, @code{\set},
4638 A clumsy but correct form:
4640 \override \revert \override \revert \override \revert
4643 Shorter version of the same:
4645 \override \set \set \revert
4648 A short form, using only @code{\set}. This requires you to know the
4651 \set \set \set \set @var{to default value}
4654 If there is no default (i.e. by default, the object property is unset),
4657 \set \set \set \revert
4660 For the digirati, the object description is an Scheme association
4661 list. Since a Scheme list is a singly linked list, we can treat it as
4662 a stack, and @code{\override} and @code{\revert} are push and pop
4663 operations. The association list is stored in a normal context
4666 \property Voice.NoteHead = #'()
4668 will effectively erase @internalsref{NoteHead}s from the current
4669 @internalsref{Voice}. However, this mechanism is not guaranteed to
4670 work, and may cause crashes or other anomalous behavior.
4674 @internalsref{OverrideProperty}, @internalsref{RevertProperty},
4675 @internalsref{PropertySet}, @internalsref{backend properties},
4676 @internalsref{All Graphical Objects}.
4681 LilyPond will hang or crash if @var{value} contains cyclic references.
4682 The backend is not very strict in type-checking object properties. If you
4683 @code{\revert} properties that are expected to be set by default,
4687 @node Outputproperty
4688 @subsection Outputproperty
4690 @cindex \outputproperty
4692 A second way of tuning objects is the more arcane @code{\outputproperty}
4693 feature. The syntax is as follows:
4695 \outputproperty @var{predicate} @var{symbol} = @var{value}
4697 Here @code{predicate} is a Scheme function taking an object argument, and
4698 returning a boolean. This statement is processed by the
4699 @code{Output_property_engraver}. It instructs the engraver to feed all
4700 objects that it sees to @var{predicate}. Whenever the predicate returns
4701 true, the object property @var{symbol} will be set to @var{value}.
4703 You will need to combine this statement with @code{\context} to select
4704 the appropriate context to apply this to.
4705 @inputfileref{input/regression,output-property.ly} shows an example of
4706 the use of @code{\outputproperty}.
4710 If possible, avoid this feature: the semantics are not very clean, and
4711 the syntax and semantics are up for rewrite.
4714 @node Font selection
4715 @subsection Font selection
4717 The most common thing to change about the appearance of fonts is
4718 their size. The font size of any context can be easily
4719 changed by setting the @code{fontSize} property for that context:
4721 @lilypond[fragment,relative=1,verbatim,quote]
4722 c4 c4 \property Voice.fontSize = #-1
4725 This command will set @code{font-relative-size} (see below),
4726 and does not change the size of variable symbols, such as
4727 beams or slurs. You can use this command to get smaller symbol for
4728 cue notes, but that involves some more subtleties. An elaborate
4729 example of those is in @inputfileref{input/test,cue-notes.ly}.
4731 @cindex magnification
4733 The size of the font may be scaled with the object property
4734 @code{font-magnification}. For example, @code{2.0} blows up all
4735 letters by a factor 2 in both directions.
4744 The font used for printing a object can be selected by setting
4745 @code{font-name}, e.g.
4747 \property Staff.TimeSignature
4748 \set #'font-name = #"cmr17"
4750 You may use any font which is available to @TeX{}, such as foreign
4751 fonts or fonts that do not belong to the Computer Modern font family.
4753 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4754 can also be adjusted with a more fine-grained mechanism. By setting
4755 the object properties described below, you can select a different font.
4756 All three mechanisms work for every object that supports
4757 @code{font-interface}.
4761 A symbol indicating the general class of the typeface. Supported are
4762 @code{roman} (Computer Modern), @code{braces} (for piano staff
4763 braces), @code{music} (the standard music font), @code{ancient} (the
4764 ancient notation font) @code{dynamic} (font for dynamic signs) and
4768 A symbol indicating the shape of the font, there are typically several
4769 font shapes available for each font family. Choices are @code{italic},
4770 @code{caps} and @code{upright}
4773 A symbol indicating the series of the font. There are typically several
4774 font series for each font family and shape. Choices are @code{medium}
4777 @item font-relative-size
4778 A number indicating the size relative the standard size. For example,
4779 with 20pt staff height, relative size -1 corresponds to 16pt staff
4780 height, and relative size +1 corresponds to 23 pt staff height.
4782 There are small differences in design between fonts designed for
4783 different sizes, hence font-relative-size is the preferred way to
4787 @item font-design-size
4788 A number indicating the design size of the font.
4790 This is a feature of the Computer Modern Font: each point size has a
4791 slightly different design. Smaller design sizes are relatively wider,
4792 which enhances readability.
4795 For any of these properties, the value @code{*} (i.e. the symbol
4796 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4797 to override default setting, which are always present. For example:
4799 \property Lyrics.LyricText \override #'font-series = #'bold
4800 \property Lyrics.LyricText \override #'font-family = #'typewriter
4801 \property Lyrics.LyricText \override #'font-shape = #'*
4804 @cindex @code{font-style}
4810 Relative size is not linked to any real size.
4812 There is no style sheet provided for other fonts besides the @TeX{}
4813 family, and the style sheet can not be modified easily.
4815 @cindex font selection
4816 @cindex font magnification
4817 @cindex @code{font-interface}
4821 @subsection Text markup
4826 @cindex typeset text
4828 LilyPond has an internal mechanism to typeset texts. You can access it
4829 with the keyword @code{\markup}. Within markup mode, you can enter texts
4830 similar to lyrics: simply enter them, surrounded by spaces.
4833 @lilypond[verbatim,fragment,relative=1]
4834 c1^\markup { hello }
4835 c1_\markup { hi there }
4836 c1^\markup { hi \bold there, is \italic anyone home? }
4839 @cindex font switching
4841 The line of the example demonstrates font switching commands. The
4842 command only apply to the first following word; enclose a set of texts
4843 with braces to apply a command to more words.
4845 \markup @{ \bold @{ hi there @} @}
4847 For clarity, you can also do this for single arguments, e.g.
4849 \markup @{ is \italic @{ anyone @} home @}
4852 @cindex font size, texts
4854 The following size commands set abolute sizes
4870 You can also make letter larger or smaller relative to their neighbors,
4871 with the commands @code{\larger} and @code{\smaller}.
4875 @cindex font style, for texts
4881 The following font change commands are defined:
4884 This changes to the font used for dynamic signs. Note that this font
4885 does not contain all characters of the alphabet.
4887 This changes to the font used for time signatures. It only contains
4888 numbers and a few punctuation marks.
4890 Changes @code{font-shape} to @code{italic}
4892 Changes @code{font-series} to @code{bold}
4895 @cindex raising text
4896 @cindex lowering text
4898 @cindex translating text
4903 Raising and lowering texts can be done with @code{\super} and
4906 @lilypond[verbatim,fragment,relative=1]
4907 c1^\markup { E "=" mc \super "2" }
4912 If you want to give an explicit amount for lowering or raising, use
4913 @code{\raise}. This command takes a Scheme valued first argument, and
4914 a markup object as second argument
4916 @lilypond[verbatim,fragment,relative=1,quote]
4917 c1^\markup { C \small \raise #1.0 \bold { "9/7+" }}
4919 The argument to @code{\raise} is the vertical displacement amount,
4920 measured in (global) staff spaces.
4922 Other commands taking single arguments include
4925 @item \bracket, \hbracket
4926 Bracket the argument markup with normal and horizontal brackets
4931 This is converted to a musical symbol, e.g. @code{\musicglyph
4932 #"accidentals-0"} will select the natural sign from the music font.
4933 See @ref{The Feta font} for a complete listing of the possible glyphs.
4935 This produces a single character, e.g. @code{\char #65} produces the
4938 @item \hspace #@var{amount}
4940 This produces a invisible object taking horizontal space.
4942 \markup @{ A \hspace #2.0 B @}
4944 will put extra space between A and B. Note that lilypond
4945 inserts space before and after @code{\hspace}.
4947 @item \fontsize #@var{size}
4949 This sets the relative font size, eg.
4951 A \fontsize #2 @{ B C @} D
4955 This will enlarge the B and the C by two steps.
4956 @item \translate #(cons @var{x} @var{y})
4958 This translates an object. Its first argument is a cons of numbers
4960 A \translate #(cons 2 -3) @{ B C @} D
4962 This moves `B C' 2 spaces to the right, and 3 down.
4964 @item \magnify #@var{mag}
4966 This sets the font magnification for the its argument. In the following
4967 example, the middle A will be 10% larger.
4969 A \magnify #1.1 @{ A @} A
4973 @item \override #(@var{key} . @var{value})
4975 This overrides a formatting property for its argument. The argument
4976 should be a key/value pair, e.g.
4978 m \override #'(font-family . math) m m
4982 In markup mode you can compose expressions, similar to mathematical
4983 expressions, XML documents and music expressions. The braces group
4984 notes into horizontal lines. Other types of lists also exist: you can
4985 stack expressions grouped with @code{<<}, and @code{>>} vertically with
4986 the command @code{\column}. Similarly, @code{\center} aligns texts by
4989 @lilypond[verbatim,fragment,relative=1]
4990 c1^\markup { \column << a bbbb c >> }
4991 c1^\markup { \center << a bbbb c >> }
4992 c1^\markup { \line << a b c >> }
4995 The markup mechanism is very flexible and extensible. Refer to
4996 @file{scm/new-markup.scm} for more information on extending the markup
4999 @cindex metronome mark
5001 One practical application of complicated markup is to fake a metronome
5005 eighthStem = \markup \combine
5006 \musicglyph #"flags-stem"
5007 \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
5008 eighthNote = \markup
5009 \override #'(word-space . 0.0)
5010 { \musicglyph #"noteheads-2"
5011 \translate #'(-0.05 . 0.1) \eighthStem }
5014 \notes\relative c'' {
5015 a1^\markup { \magnify #0.9 \eighthNote " = 64" }
5022 @internalsref{Markup functions}, @file{scm/new-markup.scm}
5028 LilyPond does not account for kerning in its text formatting, so it
5029 spaces texts slightly too wide.
5031 Syntax errors for markup mode are confusing.
5035 @section Global layout
5037 The global layout determined by three factors: the page layout, the
5038 line breaks and the spacing. These all influence each other: The
5039 choice of spacing determines how densely each system of music is set,
5040 where line breaks breaks are chosen, and thus ultimately how many
5041 pages a piece of music takes. In this section we will explain how the
5042 lilypond spacing engine works, and how you can tune its results.
5044 Globally spoken, this procedure happens in three steps: first,
5045 flexible distances (``springs'') are chosen, based on durations. All
5046 possible line breaking combination are tried, and the one with the
5047 best results---a layout that has uniform density and requires as
5048 little stretching or cramping as possible---is chosen. When the score
5049 is processed by @TeX{}, page are filled with systems, and page breaks
5050 are chosen whenever the page gets full.
5053 * Vertical spacing::
5054 * Horizontal spacing::
5061 @node Vertical spacing
5062 @subsection Vertical spacing
5064 @cindex vertical spacing
5065 @cindex distance between staves
5066 @cindex staff distance
5067 @cindex between staves, distance
5068 @cindex staffs per page
5071 The height of each system is determined automatically by lilypond, to
5072 keep systems from bumping into each other, some minimum distances are
5073 set. By changing these, you can put staves closer together, and thus
5074 put more systems onto one page.
5076 Normally staves are stacked vertically. To make
5077 staves maintain a distance, their vertical size is padded. This is
5078 done with the property @code{minimumVerticalExtent}. It takes a pair
5079 of numbers, so if you want to make it smaller from its, then you could
5082 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5084 This sets the vertical size of the current staff to 4 staff-space on
5085 either side of the center staff line. The argument of
5086 @code{minimumVerticalExtent} is interpreted as an interval, where the
5087 center line is the 0, so the first number is generally negative. you
5088 could also make the staff larger at the bottom by setting it to
5089 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
5091 Vertical aligment of staves is handled by the
5092 @internalsref{VerticalAlignment} object, which lives at
5093 @internalsref{Score} level.
5095 The piano staves are handled a little differently: to make cross-staff
5096 beaming work correctly, it necessary that the distance between staves
5097 is fixed. This is also done with a @internalsref{VerticalAlignment}
5098 object, created in @internalsref{PianoStaff}, but a forced distance is
5099 set. This is done with the object property #'forced-distance. If you
5100 want to override this, use a @code{\translator} block as follows:
5104 VerticalAlignment \override #'forced-distance = #9
5107 This would bring the staves together at a distance of 9 staff spaces,
5108 and again this is measured from the center line of each staff.
5112 @node Horizontal spacing
5113 @subsection Horizontal Spacing
5115 The spacing engine translates differences in durations into
5116 stretchable distances (``springs'') of differing lengths. Longer
5117 durations get more space, shorter durations get less. The basis for
5118 assigning spaces to durations, is that the shortest durations get a
5119 fixed amount of space, and the longer durations get more: doubling a
5120 duration adds a fixed amount of space to the note.
5122 For example, the following piece contains lots of half, quarter and
5123 8th notes, the eighth note is followed by 1 note head width. The The
5124 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5125 @lilypond[fragment, verbatim, relative=1]
5126 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
5129 These two amounts of space are @code{shortest-duration-space}
5130 @code{spacing-increment}, object properties of
5131 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
5132 set to 1.2, which is the width of a note head, and
5133 @code{shortest-duration-space} is set to 2.0, meaning that the
5134 shortest note gets 2 noteheads of space. For normal notes, this space
5135 is always counted from the left edge of the symbol, so the short notes
5136 in a score is generally followed by one note head width of space.
5138 If one would follow the above procedure exactly, then adding a single
5139 32th note to a score that uses 8th and 16th notes, would widen up the
5140 entire score a lot. The shortest note is no longer a 16th, but a 64th,
5141 thus adding 2 noteheads of space to every note. To prevent this, the
5142 shortest duration for spacing is not the shortest note in the score,
5143 but the most commonly found shortest note. Notes that are even
5144 shorter this are followed by a space that is proportonial to their
5145 duration relative to the common shortest note. So if we were to add
5146 only a few 16th notes to the example above, they would be followed by
5149 @lilypond[fragment, verbatim, relative=1]
5150 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
5153 The most common shortest duration is determined as follows: in every
5154 measure, the shortest duration is determined. The most common short
5155 duration, is taken as the basis for the spacing, with the stipulation
5156 that this shortest duration should always be equal to or shorter than
5157 1/8th note. The shortest duration is printed when you run lilypond
5158 with @code{--verbose}. These durations may also be customized. If you
5159 set the @code{common-shortest-duration} in
5160 @internalsref{SpacingSpanner}, then this sets the base duration for
5161 spacing. The maximum duration for this base (normally 1/8th), is set
5162 through @code{base-shortest-duration}.
5164 @cindex @code{common-shortest-duration}
5165 @cindex @code{base-shortest-duration}
5166 @cindex @code{stem-spacing-correction}
5167 @cindex @code{spacing}
5169 In the introduction it was explained that stem directions influence
5170 spacing. This is controlled with @code{stem-spacing-correction} in
5171 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
5172 same property for controlling the stem/barline spacing. In the
5173 following example shows these corrections, once with default settings,
5174 and once with exaggerated corrections.
5180 \property Staff.NoteSpacing \override #'stem-spacing-correction
5182 \property Staff.StaffSpacing \override #'stem-spacing-correction
5187 \paper { raggedright = ##t } }
5190 @cindex SpacingSpanner, overriding properties
5192 The @internalsref{SpacingSpanner}, is score wide, so its properties
5193 must be overriden from the @code{\paper} block, e.g.
5195 \paper @{ \translator @{
5197 SpacingSpanner \override #'spacing-increment = #3.0
5204 @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
5205 @internalsref{StaffSpacing}, @internalsref{SeparationItem},
5206 @internalsref{SeparatingGroupSpanner}.
5210 Spacing is determined on a score wide basis. If you have a score that
5211 changes its character (measured in durations) halfway during the
5212 score, the part containing the longer durations will be spaced too
5215 Generating optically pleasing spacing is black magic. LilyPond tries
5216 to deal with a number of frequent cases. Here is an example that is
5217 not handled correctly, due to the combination of chord collisions and
5222 \context PianoStaff \notes \transpose c c'' <
5223 \context Staff = up { s1 }
5224 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
5225 \translator Staff=down c c c] }
5227 \paper { raggedright = ##t }
5235 @subsection Font size
5236 @cindex font size, setting
5237 @cindex staff size, setting
5238 @cindex @code{paper} file
5240 The Feta font provides musical symbols at seven different sizes.
5241 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5242 point, and 26 point. The point size of a font is the height of the
5243 five lines in a staff when displayed in the font.
5245 Definitions for these sizes are the files @file{paperSZ.ly}, where
5246 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5247 of these files, the identifiers @code{paperEleven},
5248 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5249 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5250 are defined respectively. The default @code{\paper} block is also
5251 set. These files should be imported at toplevel, i.e.
5253 \include "paper26.ly"
5257 The font definitions are generated using a Scheme function. For more
5258 details, see the file @file{scm/font.scm}.
5263 @subsection Line breaking
5266 @cindex breaking lines
5268 Line breaks are normally computed automatically. They are chosen such
5269 that it looks neither cramped nor loose, and that consecutive lines have
5272 Occasionally you might want to override the automatic breaks; you can
5273 do this by specifying @code{\break}. This will force a line break at
5274 this point. Line breaks can only occur at places where there are bar
5275 lines. If you want to have a line break where there is no bar line,
5276 you can force an invisible bar line by entering @code{\bar
5277 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
5281 @cindex regular line breaks
5282 @cindex four bar music.
5284 If you want linebreaks at regular intervals, you can use the following:
5286 < \repeat 7 unfold @{ s1 * 4 \break @}
5290 This makes the following 28 measures (assuming 4/4 time) be broken every
5295 @internalsref{BreakEvent}
5299 @subsection Page layout
5302 @cindex breaking pages
5304 @cindex @code{indent}
5305 @cindex @code{linewidth}
5307 The most basic settings influencing the spacing are @code{indent} and
5308 @code{linewidth}. They are set in the @code{\paper} block. They
5309 control the indentation of the first line of music, and the lengths of
5312 If @code{raggedright} is set to true in the @code{\paper}
5313 block, then the lines are justified at their natural length. This
5314 useful for short fragments, and for checking how tight the natural
5318 @cindex vertical spacing
5320 The page layout process happens outside lilypond. Ly2dvi sets page
5321 layout instructions. Ly2dvi responds to the following variables in the
5322 @code{\paper} block. The variable @code{textheight} sets the total
5323 height of the music on each page. The spacing between systems is
5324 controlled with @code{interscoreline}, its default is 16pt.
5325 The distance between the score lines will stretch in order to fill the
5326 full page @code{interscorelinefill} is set to a positive number. In
5327 that case @code{interscoreline} specifies the minimum spacing.
5329 @cindex @code{textheight}
5330 @cindex @code{interscoreline}
5331 @cindex @code{interscorelinefill}
5333 If the variable @code{lastpagefill} is defined (that is, it gets any
5334 value assigned in the @code{\paper} block), systems are evenly
5335 distributed vertically on the last page. This might produce ugly
5336 results in case there are not enough systems on the last page. Note
5337 that @command{lilypond-book} ignores @code{lastpagefill}. See
5338 @ref{Integrating text and music with lilypond-book} for
5341 @cindex @code{lastpagefill}
5343 Page breaks are normally computed by @TeX{}, so they are not under
5344 direct control of LilyPond. However, you can insert a commands into
5345 the @file{.tex} output to instruct @TeX{} where to break pages. You
5346 can insert a @code{\newpage} from within lilypond. This is done by
5347 setting the @code{between-systems-strings} on the
5348 @internalsref{NonMusicalPaperColumn} where the system is broken.
5352 @cindex @code{papersize}
5354 To change the paper size, you must first set the
5355 @code{papersize} paper variable variable. Set it to
5356 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5357 specification, you must set the font as described above. If you want
5358 the default font, then use the 20 point font.
5361 \paper@{ papersize = "a4" @}
5362 \include "paper16.ly"
5365 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5366 will set the paper variables @code{hsize} and @code{vsize} (used by
5367 Lilypond and @code{ly2dvi})
5377 LilyPond can produce MIDI output. The performance lacks lots of
5378 interesting effects, such as swing, articulation, slurring, etc., but it
5379 is good enough for proof-hearing the music you have entered. Ties,
5380 dynamics and tempo changes are interpreted.
5382 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5383 levels. Dynamic marks translate to a fixed fraction of the available
5384 MIDI volume range, crescendi and decrescendi make the the volume vary
5385 linearly between their two extremities. The fractions be adjusted by
5386 overriding the @code{absolute-volume-alist} defined in
5387 @file{scm/midi.scm}.
5389 For each type of musical instrument (that MIDI supports), a volume range
5390 can be defined. This gives you basic equalizer control, which can
5391 enhance the quality of the MIDI output remarkably. You can add
5392 instruments and ranges or change the default settings by overriding the
5393 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5395 Both loudness controls are combined to produce the final MIDI volume.
5399 * MIDI instrument names::
5404 @subsection MIDI block
5408 The MIDI block is analogous to the paper block, but it is somewhat
5409 simpler. The @code{\midi} block can contain:
5413 @item a @code{\tempo} definition
5414 @item context definitions
5417 Assignments in the @code{\midi} block are not allowed.
5421 @cindex context definition
5423 Context definitions follow precisely the same syntax as within the
5424 \paper block. Translation modules for sound are called performers.
5425 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5428 @node MIDI instrument names
5429 @subsection MIDI instrument names
5431 @cindex instrument names
5432 @cindex @code{Staff.midiInstrument}
5433 @cindex @code{Staff.instrument}
5435 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5436 property or, if that property is not set, the @code{Staff.instrument}
5437 property. The instrument name should be chosen from the list in
5438 @ref{MIDI instruments}.
5442 If the selected string does not exactly match, then LilyPond uses the
5443 default (Grand Piano). It is not possible to select an instrument by