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
11 @chapter Notation manual
14 <!--- @@WEB-TITLE@@=Reference Manual --->
20 * Easier music entry::
27 * Fingering instructions::
37 * Contemporary notation::
43 @c FIXME: Note entry vs Music entry at top level menu is confusing.
54 * Chromatic alterations::
60 * Automatic note splitting ::
62 * Easy Notation note heads ::
70 A note is printed by specifying its pitch and then its duration.
71 @footnote{Notes constitute the most basic elements of LilyPond input,
72 but they do not form valid input on their own without a @code{\score}
73 block. However, for the sake of brevity and simplicity we will
74 generally omit @code{\score} blocks and @code{\paper} declarations in
77 @lilypond[fragment,verbatim]
86 @cindex Note specification
88 @cindex entering notes
90 The most common syntax for pitch entry is used in @code{\chords} and
91 @code{\notes} mode. In Note and Chord mode, pitches may be designated
92 by names. The notes are specified by the letters @code{a} through
93 @code{g}, while the octave is formed with notes ranging from @code{c}
94 to @code{b}. The pitch @code{c} is an octave below middle C and the
95 letters span the octave above that C.
97 @lilypond[fragment,verbatim]
99 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
102 @cindex note names, Dutch
104 A sharp is formed by adding @code{-is} to the end of a pitch
105 name and a flat is formed by adding @code{-es}. Double sharps and
106 double flats are obtained by adding @code{-isis} or @code{-eses}.
108 These default names are the Dutch note names. In Dutch, @code{aes} is
109 contracted to @code{as} in Dutch, but both forms are
110 accepted. Similarly, both @code{es} and @code{ees} are accepted.
112 There are predefined sets of note names for various other languages.
113 To use them, include the language specific init file. For
114 example: @code{\include "english.ly"}. The available language files
115 and the note names they define are:
120 Note Names sharp flat
121 nederlands.ly c d e f g a bes b -is -es
122 english.ly c d e f g a bf b -s/-sharp -f/-flat
123 deutsch.ly c d e f g a b h -is -es
124 norsk.ly c d e f g a b h -iss/-is -ess/-es
125 svenska.ly c d e f g a b h -iss -ess
126 italiano.ly do re mi fa sol la sib si -d -b
127 catalan.ly do re mi fa sol la sib si -d/-s -b
128 espanol.ly do re mi fa sol la sib si -s -b
137 The optional octave specification takes the form of a series of
138 single quote (`@code{'}') characters or a series of comma
139 (`@code{,}') characters. Each @code{'} raises the pitch by one
140 octave; each @code{,} lowers the pitch by an octave.
142 @lilypond[fragment,verbatim,center]
143 c' c'' es' g' as' gisis' ais'
147 The verbose syntax for pitch specification is
149 @cindex @code{\pitch}
151 \pitch @var{scmpitch}
154 where @var{scmpitch} is a Scheme object of the @code{Pitch} type.
159 @internalsref{NoteEvent}, @internalsref{NoteHead}
161 @node Chromatic alterations
162 @subsection Chromatic alterations
164 Normally accidentals are printed automatically, but you may also
165 print them manually. A reminder accidental
166 @cindex reminder accidental
168 can be forced by adding an exclamation mark @code{!}
169 after the pitch. A cautionary accidental
170 @cindex cautionary accidental
171 @cindex parenthesized accidental
172 (an accidental within parentheses) can be obtained by adding the
173 question mark `@code{?}' after the pitch.
175 @lilypond[fragment,verbatim]
176 cis' cis' cis'! cis'?
180 The automatic production of accidentals can be tuned in many
181 ways. For more information, refer to @ref{Accidentals}.
186 A chord is formed by a enclosing a set of pitches in @code{<<} and
189 TODO: accidental overides?
198 Rests are entered like notes, with the note name @code{r}.
200 @lilypond[singleline,verbatim]
204 Whole bar rests, centered in middle of the bar, are specified using
205 @code{R} (capital R); see @ref{Multi measure rests}. See also
208 For some music, you may wish to explicitly specify the rest's vertical
209 position. This can be achieved by entering a note with the @code{\rest}
210 keyword appended. Rest collision testing will leave these rests alone.
212 @lilypond[singleline,verbatim]
218 @internalsref{RestEvent}, @internalsref{Rest}
225 @cindex Invisible rest
228 An invisible rest (also called a `skip') can be entered like a note
229 with note name `@code{s}' or with @code{\skip @var{duration}}:
231 @lilypond[singleline,verbatim]
235 The @code{s} syntax is only available in Note mode and Chord
236 mode. In other situations, you should use the @code{\skip} command,
237 which will work outside of those two modes:
239 @lilypond[singleline,verbatim]
242 { \time 4/8 \skip 2 \time 4/4 }
243 \notes\relative c'' { a2 a1 }
248 The skip command is merely an empty musical placeholder. It does not
249 produce any output, not even transparent output.
253 @internalsref{SkipEvent}
258 @subsection Durations
262 @cindex @code{\duration}
265 In Note, Chord, and Lyrics mode, durations are designated by numbers
266 and dots: durations are entered as their reciprocal values. For example,
267 a quarter note is entered using a @code{4} (since it is a 1/4 note), while
268 a half note is entered using a @code{2} (since it is a 1/2 note). For notes
269 longer than a whole you must use variables.
271 @c FIXME: what is an identifier? I do not think it's been introduced yet.
272 @c and if it has, I obviously skipped that part. - Graham
276 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
278 r1 r2 r4 r8 r16 r32 r64 r64
283 \notes \relative c'' {
285 a1 a2 a4 a8 a16 a32 a64 a64
287 r1 r2 r4 r8 r16 r32 r64 r64
292 \remove "Clef_engraver"
293 \remove "Staff_symbol_engraver"
294 \remove "Time_signature_engraver"
295 \consists "Pitch_squash_engraver"
302 If the duration is omitted then it is set to the previously entered
303 duration. Default for the first note is a quarter note. The duration
304 can be followed by dots (`@code{.}') in order to obtain dotted note
308 @lilypond[fragment,verbatim,center]
309 a' b' c''8 b' a'4 a'4. b'4.. c'8.
314 You can alter the length of duration by a fraction @var{N/M}
315 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
316 will not affect the appearance of the notes or rests produced.
318 @lilypond[fragment,verbatim]
319 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
322 Durations can also be produced through GUILE extension mechanism.
323 @lilypond[verbatim,fragment]
324 c'\duration #(ly:make-duration 2 1)
330 Dot placement for chords is not perfect. In some cases, dots overlap:
343 A tie connects two adjacent note heads of the same pitch. The tie in
344 effect extends the length of a note. Ties should not be confused with
345 slurs, which indicate articulation, or phrasing slurs, which indicate
346 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
348 @lilypond[fragment,verbatim,center]
349 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
352 When a tie is applied to a chord, all note heads whose pitches match
353 are connected. When no note heads match, no ties will be created.
355 In its meaning a tie is just a way of extending a note duration, similar
356 to the augmentation dot: the following example are two ways of notating
357 exactly the same concept.
359 @lilypond[fragment, singleline,quote]
360 \time 3/4 c'2. c'2 ~ c'4
362 If you need to tie notes over bars, it may be easier to use automatic
363 note splitting (See @ref{Automatic note splitting}).
368 @internalsref{TieEvent}, @internalsref{NewTieEvent},
369 @internalsref{Tie}, @ref{Automatic note splitting}.
372 ties created for a chord, see @inputfileref{input/test,tie-sparse.ly}.
376 Tieing only a subset of the note heads of a pair of chords is not
377 supported in a simple way. It can be achieved by moving the
378 tie-engraver into the @internalsref{Thread} context and turning on and
379 off ties per @internalsref{Thread}.
381 Switching staves when a tie is active, will produce a horizontal tie
384 Formatting of ties is a difficult subject. The results are often not
389 @node Automatic note splitting
390 @subsection Automatic note splitting
391 @c FIXME: This subsection does not belong in @ref{Note entry}.
393 Long notes can be converted automatically to tied notes. This is done
394 by replacing the @internalsref{Note_heads_engraver} by the
395 @internalsref{Completion_heads_engraver}.
398 \paper @{ \translator @{
400 \remove "Note_heads_engraver"
401 \consists "Completion_heads_engraver"
408 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
415 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
417 \paper { \translator {
419 \remove "Note_heads_engraver"
420 \consists "Completion_heads_engraver"
425 This engraver splits all running notes at the bar line, and inserts
426 ties. One of its uses is to debug complex scores: if the measures are
427 not entirely filled, then the ties exactly show how much each measure
432 Not all durations (especially those containing tuplets) can be
433 represented exactly; the engraver will not insert tuplets.
440 @cindex @code{\times}
442 Tuplets are made out of a music expression by multiplying all durations
445 @cindex @code{\times}
447 \times @var{fraction} @var{musicexpr}
450 The duration of @var{musicexpr} will be multiplied by the fraction.
451 In the sheet music, the fraction's denominator will be printed over
452 the notes, optionally with a bracket. The most common tuplet is the
453 triplet in which 3 notes have the length of 2, so the notes are 2/3
454 of their written length:
456 @lilypond[fragment,verbatim,center]
457 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
460 The property @code{tupletSpannerDuration} specifies how long each bracket
461 should last. With this, you can make lots of tuplets while typing
462 @code{\times} only once, saving lots of typing.
464 @lilypond[fragment, relative, singleline, verbatim]
465 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
466 \times 2/3 { c'8 c c c c c }
469 The format of the number is determined by the property
470 @code{tupletNumberFormatFunction}. The default prints only the
471 denominator, but if it is set to the Scheme function
472 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
476 @cindex @code{tupletNumberFormatFunction}
477 @cindex tuplet formatting
481 @seeinternals{TupletBracket}, @seeinternals{TimeScaledMusic}.
485 Nested tuplets are not formatted automatically. In this case, outer
486 tuplet brackets should be moved manually.
488 @node Easy Notation note heads
489 @subsection Easy Notation note heads
491 @cindex easy notation
494 The `easyplay' note head includes a note name inside the head. It is
495 used in music aimed at beginners.
497 @lilypond[singleline,verbatim,26pt]
499 \notes { c'2 e'4 f' | g'1 }
500 \paper { \translator { \EasyNotation } }
504 The @code{EasyNotation} variable overrides a @internalsref{Score}
505 context. You probably will want to print it with magnification or a
506 large font size to make it more readable. To print with
507 magnification, you must create a DVI file (with @file{ly2dvi}) and
508 then enlarge it with something like @file{dvips -x 2000 file.dvi}.
509 See @file{man dvips} for details. To print with a larger font, see
516 If you view the result with Xdvi, then staff lines will show through
517 the letters. Printing the PostScript file obtained with ly2dvi does
518 produce the correct result.
521 @node Easier music entry
522 @section Easier music entry
527 * Skipping corrected music::
530 When entering music it is easy to introduce errors. This section deals
531 with tricks and features that help entering music, and find and
532 correct mistakes. It is also possible to use external programs, for
533 example GUI interfaces, or MIDI transcription programs, to enter or
534 edit music. Refer to the website for more information.
538 @node Relative octaves
539 @subsection Relative octaves
541 @cindex relative octave specification
543 Octaves are specified by adding @code{'} and @code{,} to pitch names.
544 When you copy existing music, it is easy to accidentally put a pitch
545 in the wrong octave and hard to find such an error. The relative
546 octave mode prevents these errors
548 @cindex @code{\relative}
550 \relative @var{startpitch} @var{musicexpr}
553 The octave of notes that appear in @var{musicexpr} are calculated as
554 follows: If no octave changing marks are used, the basic interval
555 between this and the last note is always taken to be a fourth or less
556 (This distance is determined without regarding alterations; a
557 @code{fisis} following a @code{ceses} will be put above the
560 The octave changing marks @code{'} and @code{,} can be added to raise or
561 lower the pitch by an extra octave. Upon entering relative mode, an
562 absolute starting pitch must be specified that will act as the
563 predecessor of the first note of @var{musicexpr}.
565 Entering music that changes octave frequently is easy in relative mode.
566 @lilypond[fragment,singleline,verbatim,center]
572 And octave changing marks are used for intervals greater than a fourth.
573 @lilypond[fragment,verbatim,center]
578 If the preceding item is a chord, the first note of the chord is used
579 to determine the first note of the next chord. However, other notes
580 within the second chord are determined by looking at the immediately
583 @lilypond[fragment,verbatim,center]
590 @cindex @code{\notes}
592 The pitch after the @code{\relative} contains a note name. To parse
593 the pitch as a note name, you have to be in note mode, so there must
594 be a surrounding @code{\notes} keyword (which is not
597 The relative conversion will not affect @code{\transpose},
598 @code{\chords} or @code{\relative} sections in its argument. If you
599 want to use relative within transposed music, you must place an
600 additional @code{\relative} inside the @code{\transpose}.
604 @subsection Bar check
608 @cindex @code{barCheckSynchronize}
612 Whenever a bar check is encountered during interpretation, a warning
613 message is issued if it does not fall at a measure boundary. This can
614 help find errors in the input. Depending on the value of
615 @code{barCheckSynchronize}, the beginning of the measure will be
616 relocated. A bar check is entered using the bar symbol, `@code{|}'.
619 \time 3/4 c2 e4 | g2.
624 @cindex skipTypesetting
626 Failed bar checks are caused by entering incorrect
627 durations. Incorrect durations often completely garble up the score,
628 especially if it is polyphonic, so you should start correcting the
629 score by scanning for failed bar checks and incorrect durations. To
630 speed up this process, you can use @code{skipTypesetting}, described
633 @node Skipping corrected music
634 @subsection Skipping corrected music
636 The property @code{Score.skipTypesetting} can be used to switch on and
637 off typesetting completely during the interpretation phase. When
638 typesetting is switched off, the music is processed much more quickly.
639 This can be used to skip over the parts of a score that have already
640 been checked for errors.
642 @lilypond[fragment,singleline,verbatim]
644 \property Score.skipTypesetting = ##t
646 \property Score.skipTypesetting = ##f
654 @section Staff notation
656 This section describes with music notation that occurs on staff level,
657 such as keys, clefs and time signatures.
659 @cindex Staff notation
672 @subsection Staff symbol
674 @cindex adjusting staff symbol
675 @cindex StaffSymbol, using \property
676 @cindex staff lines, setting number of
678 Notes, dynamic signs, etc. are grouped
679 with a set of horizontal lines, into a staff (plural `staves'). In our
680 system, these lines are drawn using a separate graphical object called
683 This object is created whenever a @internalsref{Staff} context is
684 created. The appearance of the staff symbol cannot be changed by
685 using @code{\override} or @code{\set}. At the moment that
686 @code{\property Staff} is interpreted, a @internalsref{Staff} context
687 is made, and the @internalsref{StaffSymbol} is created before any
688 @code{\override} is effective. Properties can be changed in a
689 @code{\translator} definition, or by using @code{\outputproperty}.
693 If a staff is ended halfway a piece, the staff symbol may not end
694 exactly on the barline.
698 @subsection Key signature
703 The key signature indicates the scale in which a piece is played. It
704 is denoted by a set of alterations (flats or sharps) at the start of
709 Setting or changing the key signature is done with the @code{\key}
712 @code{\key} @var{pitch} @var{type}
715 @cindex @code{\minor}
716 @cindex @code{\major}
717 @cindex @code{\minor}
718 @cindex @code{\ionian}
719 @cindex @code{\locrian}
720 @cindex @code{\aeolian}
721 @cindex @code{\mixolydian}
722 @cindex @code{\lydian}
723 @cindex @code{\phrygian}
724 @cindex @code{\dorian}
726 Here, @var{type} should be @code{\major} or @code{\minor} to get
727 @var{pitch}-major or @var{pitch}-minor, respectively.
728 The standard mode names @code{\ionian},
729 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
730 @code{\phrygian}, and @code{\dorian} are also defined.
732 This command sets the context property
733 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
734 can be specified by setting this property directly.
738 The ordering of a key restoration (alterations that change back to
739 natural) is wrong when combined with a repeat barline.
743 @internalsref{KeyChangeEvent}, @internalsref{KeySignature}.
745 @cindex @code{keySignature}
752 The clef indicates which lines of the staff correspond to which
757 The clef can be set or changed with the @code{\clef} command:
758 @lilypond[fragment,verbatim]
759 \key f\major c''2 \clef alto g'2
762 Supported clef-names include
763 @c Moved standard clefs to the top /MB
765 @item treble, violin, G, G2
774 G clef on 1st line, so-called French violin clef
789 By adding @code{_8} or @code{^8} to the clef name, the clef is
790 transposed one octave down or up, respectively. @var{clefname} must
791 be enclosed in quotes when it contains underscores or digits. For
797 This command is equivalent to setting @code{clefGlyph},
798 @code{clefPosition} (which controls the Y position of the clef),
799 @code{centralCPosition} and @code{clefOctavation}. A clef is printed
800 when any of these properties are changed.
804 The object for this symbol is @internalsref{Clef}.
808 @node Ottava brackets
809 @subsection Ottava brackets
811 ``Ottava'' brackets introduce an extra transposition of an octave for
812 the staff. They are created by invoking the function
813 @code{set-octavation}
819 @lilypond[verbatim,fragment]
828 Internally the @code{set-octavation} sets @code{ottavation} (eg. to
829 @code{"8va"}) and @code{centralCPosition} properties.
833 @internalsref{OttavaBracket}
837 @code{set-octavation} will get confused when clef changes happen
838 during an octavation bracket.
841 @subsection Time signature
842 @cindex Time signature
846 Time signature indicates the metrum of a piece: a regular pattern of
847 strong and weak beats. It is denoted by a fraction at the start of the
852 The time signature is set or changed by the @code{\time}
854 @lilypond[fragment,verbatim]
855 \time 2/4 c'2 \time 3/4 c'2.
858 The actual symbol that is printed can be customized with the
859 @code{style} property. Setting it to @code{#'()} uses fraction style
860 for 4/4 and 2/2 time. There are many more options for its layout.
861 See @inputfileref{input/test,time.ly} for more examples.
864 This command sets the property @code{timeSignatureFraction},
865 @code{beatLength} and @code{measureLength} in the @code{Timing}
866 context, which is normally aliased to @internalsref{Score}. The
867 property @code{timeSignatureFraction} determines where bar lines
868 should be inserted, and how automatic beams should be generated.
869 Changing the value of @code{timeSignatureFraction} also causes the
870 symbol to be printed.
872 More options are available through the Scheme function
873 @code{set-time-signature}. In combination with the
874 @internalsref{Measure_grouping_engraver}, it will create
875 @internalsref{MeasureGrouping} signs. Such signs ease reading
876 rhythmically complex modern music. In the following example, the 9/8
877 measure is subdivided in 2, 2, 2 and 3. This is passed to
878 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
881 \score { \notes \relative c'' {
882 #(set-time-signature 9 8 '(2 2 2 3))
883 g8-[ g-] d-[ d-] g-[ g-] a8-[-( bes g-]-) |
884 #(set-time-signature 5 8 '(3 2))
889 \translator { \StaffContext
890 \consists "Measure_grouping_engraver"
896 @internalsref{TimeSignature}, @internalsref{Timing_engraver}.
901 Automatic beaming does not use measure grouping specified with
902 @code{set-time-signature}.
909 @cindex partial measure
910 @cindex measure, partial
911 @cindex shorten measures
912 @cindex @code{\partial}
914 Partial measures, for example in upbeats, are entered using the
915 @code{\partial} command:
916 @lilypond[fragment,verbatim]
917 \partial 16*5 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
920 The syntax for this command is
922 \partial @var{duration}
924 This is internally translated into
926 \property Timing.measurePosition = -@var{length of duration}
929 The property @code{measurePosition} contains a rational number
930 indicating how much of the measure has passed at this point.
932 @node Unmetered music
933 @subsection Unmetered music
935 Bar lines and bar numbers are calculated automatically. For unmetered
936 music (e.g. cadenzas), this is not desirable. By setting
937 @code{Score.timing} to false, this automatic timing can be switched
941 @subsection Bar lines
945 @cindex measure lines
949 Bar lines delimit measures, but are also used to indicate
950 repeats. Line breaks may only happen on barlines.
954 Bar lines are inserted automatically. Special types
955 of barlines can be forced with the @code{\bar} command:
956 @lilypond[relative=1,fragment,verbatim]
960 The following bar types are available
961 @lilypond[fragment, relative, singleline, verbatim]
973 In scores with many staves, the barlines are automatically placed at
974 top level, and they are connected between different staves of a
975 @internalsref{StaffGroup}:
976 @lilypond[fragment, verbatim]
977 < \context StaffGroup <
978 \context Staff = up { e'4 d'
981 \context Staff = down { \clef bass c4 g e g } >
982 \context Staff = pedal { \clef bass c2 c2 } >
986 The command @code{\bar @var{bartype}} is a short cut for
987 doing @code{\property Score.whichBar = @var{bartype}}
988 Whenever @code{whichBar} is set to a string, a bar line of that type is
989 created. @code{whichBar} is usually set automatically: at the start of
990 a measure it is set to @code{defaultBarType}. The contents of
991 @code{repeatCommands} is used to override default measure bars.
993 @code{whichBar} can also be set directly, using @code{\property} or
994 @code{\bar }. These settings take precedence over the automatic
995 @code{whichBar} settings.
998 @cindex repeatCommands
999 @cindex defaultBarType
1001 You are encouraged to use @code{\repeat} for repetitions. See
1011 The bar line objects that are created at @internalsref{Staff} level
1012 are called @internalsref{BarLine}, the bar lines that span staffs are
1013 @internalsref{SpanBar}s.
1020 The easiest way to enter fragments with more than one voice on a staff
1021 is to split chords using the separator @code{\\}. You can use it for
1022 small, short-lived voices or for single chords:
1024 @lilypond[verbatim,fragment]
1025 \context Voice = VA \relative c'' {
1026 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f' \\ d' >
1030 The separator causes @internalsref{Voice} contexts to be instantiated,
1031 bearing the names @code{"1"}, @code{"2"}, etc. In each of these
1032 contexts, vertical direction of slurs, stems, etc. are set
1035 This can also be done by instantiating @internalsref{Voice} contexts
1036 by hand, and using @code{\voiceOne}, up to @code{\voiceFour} to assign
1037 a stem directions and horizontal shift for each part.
1040 @lilypond[singleline, verbatim]
1042 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1043 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1044 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1047 Normally, note heads with a different number of dots are not merged, but
1048 when the object property @code{merge-differently-dotted} is set in
1049 the @internalsref{NoteCollision} object, they are:
1050 @lilypond[verbatim,fragment,singleline]
1051 \relative c' \context Voice < {
1053 \property Staff.NoteCollision \override
1054 #'merge-differently-dotted = ##t
1056 } \\ { g8.-[ f16-] g8.-[ f16-] }
1060 Similarly, you can merge half note heads with eighth notes, by setting
1061 @code{merge-differently-headed}:
1062 @lilypond[fragment, relative=2,verbatim]
1065 \property Staff.NoteCollision
1066 \override #'merge-differently-headed = ##t
1067 c8 c4. } \\ { c2 c2 } >
1070 LilyPond also vertically shifts rests that are opposite of a stem.
1072 @lilypond[singleline,fragment,verbatim]
1073 \context Voice < c''4 \\ r4 >
1078 The objects responsible for resolving collisions are
1079 @internalsref{NoteCollision} and @internalsref{RestCollision}. See
1080 also example files @inputfileref{input/regression,collision-dots.ly},
1081 @inputfileref{input/regression,collision-head-chords.ly},
1082 @inputfileref{input/regression,collision-heads.ly},
1083 @inputfileref{input/regression,collision-mesh.ly}, and
1084 @inputfileref{input/regression,collisions.ly}.
1089 Resolving collisions is a intricate subject, and only a few situations
1090 are handled. When LilyPond cannot cope, the @code{force-hshift}
1091 property of the @internalsref{NoteColumn} object and pitched rests can
1092 be used to override typesetting decisions.
1097 Beams are used to group short notes into chunks that are aligned with
1098 the metrum. They are inserted automatically in most cases.
1100 @lilypond[fragment,verbatim, relative=2]
1101 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1104 When these automatic decisions are not good enough, beaming can be
1105 entered explicitly. It is also possible to define beaming patterns
1106 that differ from the defaults.
1110 @internalsref{Beam}.
1113 @cindex Automatic beams
1114 @subsection Manual beams
1115 @cindex beams, manual
1119 In some cases it may be necessary to override the automatic beaming
1120 algorithm. For example, the auto beamer will not beam over rests or
1121 bar lines, If you want that, specify the begin and end point manually
1122 using @code{[} and @code{]}.
1124 @lilypond[fragment,relative,verbatim]
1126 r4 r8-[ g' a r8-] r8 g-[ | a-] r8
1130 @cindex @code{stemLeftBeamCount}
1132 Normally, beaming patterns within a beam are determined automatically.
1133 When this mechanism fouls up, the properties
1134 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1135 be used to control the beam subdivision on a stem. If either property
1136 is set, its value will be used only once, and then it is erased.
1138 @lilypond[fragment,relative,verbatim]
1141 f8-[ r16 \property Voice.stemLeftBeamCount = #1 f g a-]
1144 @cindex @code{stemRightBeamCount}
1147 The property @code{subdivideBeams} can be set in order to subdivide
1148 all 16th or shorter beams at beat positions. This accomplishes the
1149 same effect as twiddling with @code{stemLeftBeamCount} and
1150 @code{stemRightBeamCount}, but it take less typing.
1153 @lilypond[relative=1,verbatim,noindent]
1154 c16-[ c c c c c c c-]
1155 \property Voice.subdivideBeams = ##t
1156 c16-[ c c c c c c c-]
1157 c32-[ c c c c c c c c c c c c c c c-]
1158 \property Score.beatLength = #(ly:make-moment 1 8)
1159 c32-[ c c c c c c c c c c c c c c c-]
1161 @cindex subdivideBeams
1163 Kneed beams are inserted automatically, when a large gap is detected
1164 between the note heads. This behavior can be tuned through the object
1165 property @code{auto-knee-gap}.
1167 @cindex beams, kneed
1169 @cindex auto-knee-gap
1177 Automatically kneed beams cannot be used together with Hara Kiri
1182 * Setting automatic beam behavior ::
1186 @no de Beam typography
1187 @sub section Beam typography
1189 One of the strong points of LilyPond is how beams are formatted. Beams
1190 are quantized, meaning that the left and right endpoints beams start
1191 exactly on staff lines. Without quantization, small wedges of white
1192 space appear between the beam and staff line, and this looks untidy.
1194 Beams are also slope-damped: melodies that go up or down should also
1195 have beams that go up or down, but the slope of the beams should be
1196 less than the slope of the notes themselves.
1198 Some beams should be horizontal. These are so-called concave beams.
1200 [TODO: some pictures.]
1204 @node Setting automatic beam behavior
1205 @subsection Setting automatic beam behavior
1207 @cindex @code{autoBeamSettings}
1208 @cindex @code{(end * * * *)}
1209 @cindex @code{(begin * * * *)}
1210 @cindex automatic beams, tuning
1211 @cindex tuning automatic beaming
1213 [TODO: use \applycontext]
1215 In normal time signatures, automatic beams can start on any note but can
1216 only end in a few positions within the measure: beams can end on a beat,
1217 or at durations specified by the properties in
1218 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1219 are defined in @file{scm/auto-beam.scm}.
1221 The value of @code{autoBeamSettings} is changed using
1222 @code{\override} and unset using @code{\revert}:
1224 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1225 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1227 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1228 whether the rule applies to begin or end-points. The quantity
1229 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1230 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1231 signature (wildcards, `@code{* *}' may be entered to designate all time
1234 For example, if automatic beams should end on every quarter note, use
1237 \property Voice.autoBeamSettings \override
1238 #'(end * * * *) = #(ly:make-moment 1 4)
1240 Since the duration of a quarter note is 1/4 of a whole note, it is
1241 entered as @code{(ly:make-moment 1 4)}.
1243 The same syntax can be used to specify beam starting points. In this
1244 example, automatic beams can only end on a dotted quarter note.
1246 \property Voice.autoBeamSettings \override
1247 #'(end * * * *) = #(ly:make-moment 3 8)
1249 In 4/4 time signature, this means that automatic beams could end only on
1250 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1251 3/8 has passed within the measure).
1253 Rules can also be restricted to specific time signatures. A rule that
1254 should only be applied in @var{N}/@var{M} time signature is formed by
1255 replacing the second asterisks by @var{N} and @var{M}. For example, a
1256 rule for 6/8 time exclusively looks like
1258 \property Voice.autoBeamSettings \override
1259 #'(begin * * 6 8) = ...
1262 If a rule should be to applied only to certain types of beams, use the
1263 first pair of asterisks. Beams are classified according to the
1264 shortest note they contain. For a beam ending rule that only applies
1265 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
1268 If a score ends while an automatic beam has not been ended and is still
1269 accepting notes, this last beam will not be typeset at all.
1271 @cindex automatic beam generation
1273 @cindex @code{Voice.autoBeaming}
1276 For melodies that have lyrics, you may want to switch off
1277 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1283 It is not possible to specify beaming parameters for beams with mixed
1284 durations, that differ from the beaming parameters of all separate
1285 durations, i.e., you will have to specify manual beams to get:
1287 @lilypond[singleline,fragment,relative,noverbatim,quote]
1288 \property Voice.autoBeamSettings
1289 \override #'(end * * * *) = #(ly:make-moment 3 8)
1290 \time 12/8 c'8 c c c16 c c c c c c-[ c c c-] c8 c c4
1292 It is not possible to specify beaming parameters that act differently in
1293 different parts of a measure. This means that it is not possible to use
1294 automatic beaming in irregular meters such as @code{5/8}.
1297 @section Accidentals
1300 This section describes how to change the way that LilyPond automatically
1301 inserts accidentals before the running notes.
1305 * Using the predefined accidental variables::
1306 * Customized accidental rules::
1309 @node Using the predefined accidental variables
1310 @subsection Using the predefined accidental variables
1312 The constructs for describing the accidental typesetting rules are
1313 quite hairy, so non-experts should stick to the variables
1314 defined in @file{ly/property-init.ly}.
1315 @cindex @file{property-init.ly}
1317 The variables set properties in the ``Current'' context (see
1318 @ref{Context properties}). This means that the variables should
1319 normally be added right after the creation of the context in which the
1320 accidental typesetting described by the variable is to take
1321 effect. For example, if you want to use piano-accidentals in a piano
1322 staff then issue @code{\pianoAccidentals} first thing after the
1323 creation of the piano staff:
1326 \notes \relative c'' <
1327 \context Staff = sa @{ cis4 d e2 @}
1328 \context GrandStaff <
1330 \context Staff = sb @{ cis4 d e2 @}
1331 \context Staff = sc @{ es2 c @}
1333 \context Staff = sd @{ es2 c @}
1337 @lilypond[singleline]
1339 \notes \relative c'' <
1340 \context Staff = sa { cis4 d e2 }
1341 \context GrandStaff <
1343 \context Staff = sb { cis4 d e2 }
1344 \context Staff = sc { es2 c }
1346 \context Staff = sd { es2 c }
1351 minimumVerticalExtent = #'(-4.0 . 4.0)
1359 @item \defaultAccidentals
1360 @cindex @code{\defaultAccidentals}
1361 This is the default typesetting behaviour. It should correspond
1362 to 18th century common practice: Accidentals are
1363 remembered to the end of the measure in which they occur and
1364 only on their own octave.
1366 @item \voiceAccidentals
1367 @cindex @code{\voiceAccidentals}
1369 The normal behaviour is to
1370 remember the accidentals on Staff-level. This variable, however,
1371 typesets accidentals individually for each voice. Apart from that the
1372 rule is similar to @code{\defaultAccidentals}.
1374 This leads to some weird and often unwanted results
1375 because accidentals from one voice do not get cancelled in other
1377 @lilypond[singleline,relative,fragment,verbatim,quote]
1385 Hence you should only use @code{\voiceAccidentals} if the voices
1386 are to be read solely by individual musicians. If the staff is to be
1387 used by one musician (e.g., a conductor) then you use
1388 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1391 @item \modernAccidentals
1392 @cindex @code{\modernAccidentals}
1393 This rule corresponds to the common practice in the 20th
1395 The rule is more complex than @code{\defaultAccidentals}.
1396 You get all the same accidentals, but temporary
1397 accidentals also get cancelled in other octaves. Further more,
1398 in the same octave, they also get cancelled in the following measure:
1399 @lilypond[singleline,fragment,verbatim]
1401 cis' c'' cis'2 | c'' c'
1404 @item \modernCautionaries
1405 @cindex @code{\modernCautionaries}
1406 This rule is similar to @code{\modernAccidentals}, but the
1407 ``extra'' accidentals (the ones not typeset by
1408 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1409 (i.e. in reduced size):
1410 @lilypond[singleline,fragment,verbatim]
1412 cis' c'' cis'2 | c'' c'
1415 @cindex @code{\modernVoiceAccidentals}
1416 @item \modernVoiceAccidentals
1417 is used for multivoice accidentals to be read both by musicians
1418 playing one voice and musicians playing all voices. Accidentals are
1419 typeset for each voice, but they @emph{are} cancelled across voices in
1420 the same @internalsref{Staff}.
1422 @cindex @code{\modernVoiceCautionaries}
1423 @item \modernVoiceCautionaries
1424 is the same as @code{\modernVoiceAccidentals}, but with the extra
1425 accidentals (the ones not typeset by @code{\voiceAccidentals}) typeset
1426 as cautionaries. Even though all accidentals typeset by
1427 @code{\defaultAccidentals} @emph{are} typeset by this variable then
1428 some of them are typeset as cautionaries.
1430 @item \pianoAccidentals
1431 @cindex @code{\pianoAccidentals}
1432 20th century practice for piano notation. Very similar to
1433 @code{\modernAccidentals} but accidentals also get cancelled
1434 across the staves in the same @internalsref{GrandStaff} or
1435 @internalsref{PianoStaff}.
1437 @item \pianoCautionaries
1438 @cindex @code{\pianoCautionaries}
1439 As @code{\pianoAccidentals} but with the extra accidentals
1440 typeset as cautionaries.
1443 @cindex @code{\noResetKey}
1444 Same as @code{\defaultAccidentals} but with accidentals lasting
1445 ``forever'' and not only until the next measure:
1446 @lilypond[singleline,fragment,verbatim,relative]
1451 @item \forgetAccidentals
1452 @cindex @code{\forgetAccidentals}
1453 This is sort of the opposite of @code{\noResetKey}: Accidentals
1454 are not remembered at all - and hence all accidentals are
1455 typeset relative to the key signature, regardless of what was
1456 before in the music:
1457 @lilypond[singleline,fragment,verbatim,relative]
1459 \key d\major c4 c cis cis d d dis dis
1463 @node Customized accidental rules
1464 @subsection Customized accidental rules
1466 This section must be considered gurus-only, and hence it must be
1467 sufficient with a short description of the system and a reference to
1468 the internal documentation.
1470 The algorithm tries several different rules, and uses the rule
1471 that gives the highest number of accidentals. Each rule consists of
1474 In which context is the rule applied. For example, if
1475 @var{context} is @internalsref{Score} then all staves share
1476 accidentals, and if @var{context} is @internalsref{Staff} then all
1477 voices in the same staff share accidentals, but staves do not.
1479 Whether the accidental changes all octaves or only the current
1482 Over how many barlines the accidental lasts.
1483 If @var{lazyness} is @code{-1} then the accidental is forget
1484 immediately, and if @var{lazyness} is @code{#t} then the accidental
1487 [TODO: should use +infinity for this case?]
1493 @internalsref{Accidental_engraver}, @internalsref{Accidental},
1494 @internalsref{AccidentalPlacement}.
1499 Currently the simultaneous notes are considered to be entered in
1500 sequential mode. This means that in a chord the accidentals are
1501 typeset as if the notes in the chord happened one at a time - in the
1502 order in which they appear in the input file.
1504 This is only a problem when there are simultaneous notes whose
1505 accidentals depend on each other. The problem only occurs when using
1506 non-default accidentals. In the default scheme, accidentals only
1507 depend on other accidentals with the same pitch on the same staff, so
1508 no conflicts possible.
1510 This example shows two examples of the same music giving different
1511 accidentals depending on the order in which the notes occur in the
1514 @lilypond[singleline,fragment,verbatim]
1515 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1516 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2
1517 | <<cis' c''>> r | <<c'' cis'>> r |
1520 This problem can be solved by manually inserting @code{!} and @code{?}
1521 for the problematic notes.
1523 @node Expressive marks
1524 @section Expressive marks
1533 * Analysis brackets::
1540 A slur indicates that notes are to be played bound or @emph{legato}.
1544 They are entered using parentheses:
1545 @lilypond[fragment,verbatim,center]
1546 f'-( g'-)-( a'-) a'8-[ b'-(-] a'4 g'2 f'4-)
1547 <<c' e'>>2-( <<b d'>>2-)
1551 @c TODO: should explain that ^( and _( set directions
1552 @c should set attachments with ^ and _ ?
1554 Slurs avoid crossing stems, and are generally attached to note heads.
1555 However, in some situations with beams, slurs may be attached to stem
1556 ends. If you want to override this layout you can do this through the
1557 object property @code{attachment} of @internalsref{Slur} in
1558 @internalsref{Voice} context. Its value is a pair of symbols, specifying
1559 the attachment type of the left and right end points.
1561 @lilypond[fragment,relative,verbatim]
1563 \property Voice.Stem \set #'length = #5.5
1565 \property Voice.Slur \set #'attachment = #'(stem . stem)
1569 If a slur would strike through a stem or beam, the slur will be moved
1570 away upward or downward. If this happens, attaching the slur to the
1571 stems might look better:
1573 @lilypond[fragment,relative,verbatim]
1576 \property Voice.Slur \set #'attachment = #'(stem . stem)
1582 @seeinternals{Slur}, @internalsref{SlurEvent}.
1587 Producing nice slurs is a difficult problem, and LilyPond currently
1588 uses a simple, empiric method to produce slurs. In some cases, the
1589 results of this method are ugly.
1592 @cindex Adjusting slurs
1594 @node Phrasing slurs
1595 @subsection Phrasing slurs
1597 @cindex phrasing slurs
1598 @cindex phrasing marks
1600 A phrasing slur (or phrasing mark) connects chords and is used to
1601 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1604 @lilypond[fragment,verbatim,center,relative]
1605 \time 6/4 c'-\( d-( e-) f-( e-) d-\)
1608 Typographically, the phrasing slur behaves almost exactly like a
1609 normal slur. However, they are treated as different objects. A
1610 @code{\slurUp} will have no effect on a phrasing slur; instead, you
1611 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1612 @code{\phrasingSlurBoth}.
1614 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth}
1615 will only affect normal slurs and not phrasing slurs.
1619 See also @internalsref{PhrasingSlur},
1620 @internalsref{PhrasingSlurEvent}.
1624 Phrasing slurs have the same limitations in their formatting as normal
1628 @subsection Breath marks
1630 Breath marks are entered using @code{\breathe}.
1633 @lilypond[fragment,relative]
1637 The glyph of the breath mark can be tweaked by overriding the
1638 @code{text} property of the @code{BreathingSign} grob with the name of
1639 any glyph of @ref{The Feta font}. For example,
1640 @lilypond[fragment,verbatim,relative]
1642 \property Voice.BreathingSign \override #'text = #"scripts-rvarcomma"
1649 @internalsref{BreathingSign}, @internalsref{BreathingSignEvent},
1650 @inputfileref{input/regression,breathing-sign.ly}.
1653 @node Metronome marks
1654 @subsection Metronome marks
1657 @cindex beats per minute
1658 @cindex metronome marking
1660 Metronome settings can be entered as follows:
1662 \tempo @var{duration} = @var{perminute}
1665 In the MIDI output, they are interpreted as a tempo change, and in the
1666 paper output, a metronome marking is printed
1667 @cindex @code{\tempo}
1668 @lilypond[fragment,verbatim]
1674 @internalsref{TempoEvent}
1679 @subsection Text spanners
1680 @cindex Text spanners
1682 Some performance indications, e.g. @i{rallentando} or @i{accelerando},
1683 are written as texts, and extended over many measures with dotted
1684 lines. You can create such texts using text spanners: attach
1685 @code{\startTextSpan} and @code{\stopTextSpan} to the
1686 start and ending note of the spanner.
1688 The string to be printed, as well as the style, is set through object
1691 @lilypond[fragment,relative,verbatim]
1693 \property Voice.TextSpanner \set #'direction = #-1
1694 \property Voice.TextSpanner \set #'edge-text = #'("rall " . "")
1695 c2-\startTextSpan b c-\stopTextSpan a }
1701 @internalsref{TextSpanEvent},
1702 @internalsref{TextSpanner}, @inputfileref{input/regression,text-spanner.ly}.
1705 @node Analysis brackets
1706 @subsection Analysis brackets
1708 @cindex phrasing brackets
1709 @cindex musicological analysis
1710 @cindex note grouping bracket
1712 Brackets are used in musical analysis to indicate structure in musical
1713 pieces. LilyPond supports a simple form of nested horizontal brackets.
1714 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1715 @internalsref{Staff} context. A bracket is started with
1716 @code{\startGroup} and closed with @code{\stopGroup}.
1718 @lilypond[singleline,verbatim]
1719 \score { \notes \relative c'' {
1720 c4-\startGroup-\startGroup
1723 c4-\stopGroup-\stopGroup
1725 \paper { \translator {
1726 \StaffContext \consists "Horizontal_bracket_engraver"
1732 @internalsref{HorizontalBracket}, @internalsref{NoteGroupingEvent},
1733 @inputfileref{input/regression,note-group-bracket.ly}.
1737 Bracket endings should be angled/slanted. (TODO)
1744 @section Articulations
1745 @cindex Articulations
1747 @cindex articulations
1751 A variety of symbols can appear above and below notes to indicate
1752 different characteristics of the performance. They are added to a note
1753 by adding a dash and the the character signifying the
1754 articulation. They are demonstrated here.
1756 @lilypondfile[notexidoc]{script-abbreviations.ly}
1758 The script is automatically placed, but if you need to force
1759 directions, you can use @code{_} to force them down, or @code{^} to
1761 @lilypond[fragment, verbatim]
1768 Other symbols can be added using the syntax
1769 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1770 using @code{^} and @code{_}.
1774 @cindex staccatissimo
1783 @cindex organ pedal marks
1792 @cindex prallmordent
1796 @cindex thumb marking
1801 @lilypondfile[notexidoc]{script-chart.ly}
1805 @internalsref{ScriptEvent}, @internalsref{Script}.
1809 All of these note ornaments appear in the printed output but have no
1810 effect on the MIDI rendering of the music.
1813 @node Fingering instructions
1814 @section Fingering instructions
1818 Fingering instructions can be entered using
1820 @var{note}-@var{digit}
1822 For finger changes, use markup texts:
1824 @lilypond[verbatim, singleline, fragment]
1825 c'4-1 c'4-2 c'4-3 c'4-4
1826 c'^\markup { \fontsize #-3 \number "2-3" }
1829 @cindex finger change
1834 @lilypond[verbatim,singleline,fragment,relative=1]
1835 << c-1 e-2 g-3 b-5 >> 4
1836 \property Voice.fingerHorizontalDirection = #LEFT
1837 << c-1 es-3 g-5 >> 4
1838 \property Voice.fingerHorizontalDirection = #RIGHT
1839 << c-1 e-2 g-3 b-5 >>4
1840 \property Voice.fingerHorizontalDirection = #LEFT
1841 << c_1 e-2 g-3 b^5 >>4
1846 @internalsref{FingerEvent} and @internalsref{Fingering}.
1857 @subsection Text scripts
1858 @cindex Text scripts
1860 It is possible to place arbitrary strings of text or markup text (see
1861 @ref{Text markup}) above or below notes by using a string:
1862 @code{c^"text"}. By default, these indications do not influence the
1863 note spacing, but by using the command @code{\fatText}, the widths
1864 will be taken into account.
1866 @lilypond[fragment,singleline,verbatim] \relative c' {
1867 c4^"longtext" \fatText c4_"longlongtext" c4 }
1870 It is possible to use @TeX{} commands in the strings, but this should be
1871 avoided because it makes it impossible for LilyPond to compute the
1872 exact length of the string, which may lead to collisions. Also, @TeX{}
1873 commands will not work with direct PostScript output.
1878 @internalsref{TextScriptEvent}, @internalsref{TextScript},
1884 @subsection Grace notes
1888 @cindex @code{\grace}
1892 Grace notes are ornaments that are written out
1894 @lilypond[relative=2,verbatim,fragment] c4 \grace c16 c4 \grace {
1898 In normal notation, grace notes take up no logical
1899 time in a measure. Such an idea is practical for normal notation, but
1900 is not strict enough to put it into a program. The model that LilyPond
1901 uses for grace notes internally is that all timing is done in two
1904 Every point in musical time consists of two rational numbers: one
1905 denotes the logical time, one denotes the grace timing. The above
1906 example is shown here with timing tuples.
1909 \score { \notes \relative c''{
1910 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
1911 c16_"(2/4,-1/8)"-[ d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
1913 \paper { linewidth = 8.\cm }
1918 The placement of these grace notes is synchronized between different
1921 @lilypond[relative=2,verbatim,fragment]
1922 < \context Staff = SA { e4 \grace { c16-[ d e f-] } e4 }
1923 \context Staff = SB { c'4 \grace { g8 b } c4 } >
1927 Unbeamed eighth notes and shorter by default have a slash through the
1928 stem. This can be controlled with object property @code{stroke-style} of
1929 @internalsref{Stem}. For proper matching of override and reverts of
1930 such properties, it is necessary to use a Scheme function.
1932 The following fragment overrides the default formatting Grace style stems.
1934 #(add-to-grace-init "Voice" 'Stem 'stroke-style '())
1937 The @code{\override} is carefully matched with a @code{\revert}.
1942 @lilypond[fragment,verbatim]
1943 \relative c'' \context Voice {
1944 \grace c8 c4 \grace { c16-[ c16-] } c4
1946 \property Voice.Stem \override #'stroke-style = #'()
1948 \property Voice.Stem \revert #'stroke-style
1953 If you want to end a note with a grace note, then the standard trick
1954 is to put the grace notes before a phantom ``space note'', e.g.
1955 @lilypond[fragment,verbatim, relative=2]
1958 { s2 \grace { c16-[ d-] } } >
1963 A @code{\grace} section has some default values, and LilyPond will
1964 use those default values unless you specify otherwise inside the
1965 @code{\grace} section. For example, if you specify \slurUp
1966 @emph{before} your @code{\grace} section, a slur which starts inside
1967 the @code{\grace} will not be forced up, even if the slur ends outside
1968 of the @code{\grace}. Note the difference between the first and
1969 second bars in this example:
1971 @lilypond[fragment,verbatim]
1972 \relative c'' \context Voice {
1990 @internalsref{GraceMusic}.
1994 Grace notes cannot be used in the smallest size (@file{paper11.ly}).
1996 Grace note synchronization can also lead to surprises. Staff notation,
1997 such as key signatures, barlines, etc. are also synchronized. Take
1998 care when you mix staves with grace notes and staves without.
2000 @lilypond[relative=2,verbatim,fragment]
2001 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2002 \context Staff = SB { c4 \bar "|:" d4 } >
2005 Grace sections should only be used within sequential music
2006 expressions. Nesting, juxtaposing, or ending sequential music with a
2007 grace section is not supported, and might produce crashes or other
2010 Overriding settings for grace music using @code{add-to-grace-init}
2011 cannot be done in a modular way.
2015 @subsection Glissando
2018 @cindex @code{\glissando}
2020 A glissando is a smooth change in pitch. It is denoted by a line or a
2021 wavy line between two notes.
2025 A glissando line can be requested by attaching a @code{\glissando} to
2028 @lilypond[fragment,relative,verbatim]
2034 @internalsref{Glissando}, @internalsref{GlissandoEvent}.
2039 Printing of an additional text (such as @emph{gliss.}) must be done
2044 @subsection Dynamics
2057 @cindex @code{\ffff}
2067 Absolute dynamic marks are specified using an variable after a
2068 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2069 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2070 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2071 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2073 @lilypond[verbatim,singleline,fragment,relative]
2074 c'-\ppp c-\pp c -\p c-\mp c-\mf c-\f c-\ff c-\fff
2080 @cindex @code{\decr}
2081 @cindex @code{\rced}
2088 A crescendo mark is started with @code{\cr} and terminated with
2089 @code{\endcr}, and decrescendi similarly with @code{\decr} and
2090 @code{\enddecr}. There are also shorthands for these marks. A
2091 crescendo can be started with @code{\<} and a decrescendo can be
2092 started with @code{\>}. Either one can be terminated with @code{\!}.
2093 Because these marks are bound to notes, if you must use spacer notes
2094 if multiple marks during one note are needed.
2096 @lilypond[fragment,verbatim,center,quote]
2097 c''-\< c''-\! d''-\decr e''-\rced
2098 < f''1 { s4 s4-\< s4-\! \> s4-\! } >
2100 This may give rise to very short hairpins. Use @code{minimum-length}
2101 in @internalsref{Voice}.@internalsref{HairPin} to lengthen them, for
2105 \property Staff.Hairpin \override #'minimum-length = #5
2108 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2109 is an example how to do it:
2111 @lilypond[fragment,relative=2,verbatim]
2112 c4 \cresc c4 \endcresc c4
2119 You can also supply your own texts:
2120 @lilypond[fragment,relative,verbatim]
2122 \property Voice.crescendoText = "cresc. poco"
2123 \property Voice.crescendoSpanner = #'dashed-line
2132 @internalsref{CrescendoEvent}, @internalsref{DecrescendoEvent},
2133 @internalsref{AbsoluteDynamicEvent}.
2135 Dynamics are objects of @internalsref{DynamicText} and
2136 @internalsref{Hairpin}. Vertical positioning of these symbols is
2137 handled by the @internalsref{DynamicLineSpanner} object.
2139 If you want to adjust padding or vertical direction of the dynamics,
2140 you must set properties for the @internalsref{DynamicLineSpanner}
2141 object. Predefined variables to set the vertical direction are
2142 @code{\dynamicUp} and @code{\dynamicDown}.
2144 @cindex direction, of dynamics
2145 @cindex @code{\dynamicDown}
2146 @cindex @code{\dynamicUp}
2154 @cindex @code{\repeat}
2157 Repetition is a central concept in music, and multiple notations exist
2158 for repetitions. In LilyPond, most of these notations can be captured
2159 in a uniform syntax. One of the advantages is, all these repetitions
2160 can be rendered in MIDI accurately.
2162 The following types of repetition are supported:
2166 Repeated music is fully written (played) out. Useful for MIDI
2167 output, and entering repetitive music.
2170 This is the normal notation: Repeats are not written out, but
2171 alternative endings (voltas) are printed, left to right.
2175 Alternative endings are written stacked. This has limited use but may be
2176 used to typeset two lines of lyrics in songs with repeats, see
2177 @inputfileref{input,star-spangled-banner.ly}.
2184 Make beat or measure repeats. These look like percent signs.
2190 * Repeats and MIDI::
2191 * Manual repeat commands::
2193 * Tremolo subdivisions::
2198 @subsection Repeat syntax
2202 LilyPond has one syntactic construct for specifying different types of
2203 repeats. The syntax is
2206 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2209 If you have alternative endings, you may add
2210 @cindex @code{\alternative}
2212 \alternative @code{@{} @var{alternative1}
2214 @var{alternative3} @dots{} @code{@}}
2216 where each @var{alternative} is a music expression. If you do not
2217 give enough alternatives for all of the repeats, then the first
2218 alternative is assumed to be played more than once.
2220 Normal notation repeats are used like this:
2221 @lilypond[fragment,verbatim]
2223 \repeat volta 2 { c'4 d' e' f' }
2224 \repeat volta 2 { f' e' d' c' }
2227 With alternative endings:
2228 @lilypond[fragment,verbatim]
2230 \repeat volta 2 {c'4 d' e' f'}
2231 \alternative { {d'2 d'} {f' f} }
2235 @lilypond[fragment,verbatim]
2239 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2240 \alternative { { g4 g g } { a | a a a a | b2. } }
2247 If you do a nested repeat like
2256 then it is ambiguous to which @code{\repeat} the @code{\alternative}
2257 belongs. This ambiguity is resolved by always having the
2258 @code{\alternative} belong to the inner @code{\repeat}. For clarity,
2259 it is advisable to use braces in such situations.
2262 @node Repeats and MIDI
2263 @subsection Repeats and MIDI
2265 @cindex expanding repeats
2267 For instructions on how to unfold repeats for MIDI output, see the
2268 example file @inputfileref{input/test,unfold-all-repeats.ly}.
2273 Timing information is not remembered at the start of an alternative,
2274 so you have to reset timing information after a repeat, e.g. using a
2275 bar-check (See @ref{Bar check}), setting @code{Score.measurePosition}
2276 or entering @code{\partial}. Similarly, slurs or ties are also not
2280 @node Manual repeat commands
2281 @subsection Manual repeat commands
2283 @cindex @code{repeatCommands}
2285 The property @code{repeatCommands} can be used to control the layout of
2286 repeats. Its value is a Scheme list of repeat commands, where each repeat
2294 @item (volta . @var{text})
2295 Print a volta bracket saying @var{text}. The text can be specified as
2296 a text string or as a markup text, see @ref{Text markup}. Do not
2297 forget to change the font, as the default number font does not contain
2298 alphabetic characters.
2300 Stop a running volta bracket
2303 @lilypond[verbatim, fragment]
2305 \property Score.repeatCommands = #'((volta "93") end-repeat)
2307 \property Score.repeatCommands = #'((volta #f))
2314 @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2315 @internalsref{VoltaRepeatedMusic},
2316 @internalsref{UnfoldedRepeatedMusic}
2317 @internalsref{FoldedRepeatedMusic}.
2319 @node Tremolo repeats
2320 @subsection Tremolo repeats
2321 @cindex tremolo beams
2323 To place tremolo marks between notes, use @code{\repeat} with tremolo
2325 @lilypond[verbatim,center,singleline]
2327 \context Voice \notes\relative c' {
2328 \repeat "tremolo" 8 { c16 d16 }
2329 \repeat "tremolo" 4 { c16 d16 }
2330 \repeat "tremolo" 2 { c16 d16 }
2331 \repeat "tremolo" 4 c16
2338 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2339 @internalsref{StemTremolo}. @internalsref{TremoloEvent}.
2344 The single stem tremolo @emph{must} be entered without @code{@{} and
2347 @node Tremolo subdivisions
2348 @subsection Tremolo subdivisions
2349 @cindex tremolo marks
2350 @cindex @code{tremoloFlags}
2352 Tremolo marks can be printed on a single note by adding
2353 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2354 A @var{length} value of 8 gives one line across the note stem. If the
2355 length is omitted, then then the last value (stored in
2356 @code{Voice.tremoloFlags}) is used.
2358 @lilypond[verbatim,fragment,center]
2359 c'2:8 c':32 | c': c': |
2362 [TODO : stok is te kort bij 32en]
2366 Tremolos in this style do not carry over into the MIDI output.
2369 @node Measure repeats
2370 @subsection Measure repeats
2372 @cindex percent repeats
2373 @cindex measure repeats
2375 In the @code{percent} style, a note pattern can be repeated. It is
2376 printed once, and then the pattern is replaced with a special sign.
2377 Patterns of a one and two measures are replaced by percent-like signs,
2378 patterns that divide the measure length are replaced by slashes.
2380 @lilypond[verbatim,singleline]
2381 \context Voice { \repeat "percent" 4 { c'4 }
2382 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2388 @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2389 @internalsref{PercentRepeatedMusic}, and
2390 @internalsref{DoublePercentRepeat}.
2395 Single measure and double measure percent-repeats cannot be nested.
2397 @node Rhythmic music
2398 @section Rhythmic music
2400 Sometimes you might want to show only the rhythm of a melody. This can
2401 be done with the rhythmic staff. All pitches of notes on such a staff
2402 are squashed, and the staff itself looks has a single staff line:
2404 @lilypond[fragment,relative,verbatim]
2405 \context RhythmicStaff {
2407 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2412 * Percussion staves::
2413 * Percussion midi output::
2416 @node Percussion staves
2417 @subsection Percussion staves
2421 To typeset more than one piece of percussion to be played by the same
2422 musician one typically uses a multiline staff where each staff
2423 position refers to a specific piece of percussion.
2427 LilyPond is has a set of Scheme functions that can be used to typeset
2428 percussion staves. The system is based on the general MIDI
2429 drum-pitches. Include @file{ly/drumpitch-init.ly} to use drum
2430 pitches. This file defines the pitches from the Scheme variable
2431 @code{drum-pitch-names}, the definition of which can be read in
2432 @file{scm/drums.scm}. Each piece of percussion has a full name and an
2433 abbreviated name, and both the full name or the abbreviation may be
2434 used in input files.
2436 To typeset the music on a staff apply the function @code{drums->paper}
2437 to the percussion music. This function takes a list of percussion
2438 instrument names, notehead scripts and staff positions (that is:
2439 pitches relative to the C-clef) and transforms the input
2440 music by moving the pitch, changing the notehead and (optionally)
2443 @lilypond[singleline,verbatim,quote]
2444 \include "drumpitch-init.ly"
2445 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2446 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2448 \apply #(drums->paper 'drums) \context Staff <
2450 \context Voice = up { \voiceOne \up }
2451 \context Voice = down { \voiceTwo \down }
2456 In the above example the music was transformed using the list @code{'drums}.
2457 Currently the following lists are defined in @file{scm/drums.scm}:
2460 To typeset a typical drum kit on a five-line staff.
2463 \include "drumpitch-init.ly"
2464 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2465 bd sn ss tomh tommh tomml toml tomfh tomfl }
2466 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2467 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2470 \apply #(drums->paper 'drums) \context Staff <
2474 \context Lyrics \nam
2477 linewidth = 100.0\mm
2480 \remove Bar_engraver
2481 \remove Time_signature_engraver
2482 minimumVerticalExtent = #'(-4.0 . 5.0)
2486 \remove Stem_engraver
2492 Scheme supports six different toms. When there fewer toms, simply
2493 select the toms that produce the desired result, i.e., to get toms on
2494 the three middle lines you use @code{tommh}, @code{tomml} and
2497 Because general MIDI does not contain rimshots the sidestick is used
2498 for this purpose instead.
2500 To typeset timbales on a two line staff.
2501 @lilypond[singleline]
2502 \include "drumpitch-init.ly"
2503 nam = \lyrics { timh ssh timl ssl cb }
2504 mus = \notes { timh ssh timl ssl cb s16 }
2507 \apply #(drums->paper 'timbales) \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
2531 To typeset congas on a two line staff.
2532 @lilypond[singleline]
2533 \include "drumpitch-init.ly"
2534 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2535 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2538 \apply #(drums->paper 'congas) \context Staff <
2542 \context Lyrics \nam
2547 \remove Bar_engraver
2548 \remove Time_signature_engraver
2549 StaffSymbol \override #'line-count = #2
2550 StaffSymbol \override #'staff-space = #2
2551 minimumVerticalExtent = #'(-3.0 . 4.0)
2555 \remove Stem_engraver
2561 To typeset bongos on a two line staff.
2562 @lilypond[singleline]
2563 \include "drumpitch-init.ly"
2564 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2565 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2568 \apply #(drums->paper 'bongos) \context Staff <
2572 \context Lyrics \nam
2577 \remove Bar_engraver
2578 \remove Time_signature_engraver
2579 StaffSymbol \override #'line-count = #2
2580 StaffSymbol \override #'staff-space = #2
2581 minimumVerticalExtent = #'(-3.0 . 4.0)
2585 \remove Stem_engraver
2591 To typeset all kinds of simple percussion on one line staves.
2592 @lilypond[singleline]
2593 \include "drumpitch-init.ly"
2594 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2595 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2598 \apply #(drums->paper 'percussion) \context Staff <
2602 \context Lyrics \nam
2607 \remove Bar_engraver
2608 \remove Time_signature_engraver
2609 StaffSymbol \override #'line-count = #1
2610 minimumVerticalExtent = #'(-2.0 . 3.0)
2614 \remove Stem_engraver
2621 If you do not like any of the predefined lists you can define your own
2622 list at the top of your file:
2624 @lilypond[singleline, verbatim]
2626 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2627 (snare default #f ,(ly:make-pitch 0 1 0))
2628 (hihat cross #f ,(ly:make-pitch 0 5 0))
2629 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2630 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2632 \include "drumpitch-init.ly"
2633 up = \notes { hh8 hh hh hh hhp4 hhp }
2634 down = \notes { bd4 sn bd toml8 toml }
2636 \apply #(drums->paper 'mydrums) \context Staff <
2638 \context Voice = up { \voiceOne \up }
2639 \context Voice = down { \voiceTwo \down }
2644 To use a modified existing list, one can prepend modifications to the
2648 #(define mydrums (append `(
2649 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2650 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2654 The file @file{drumpitch-init.ly} replaces the normal pitch names, so
2655 you have to reinclude @file{nederlands.ly} after the
2656 drum-pattern-definitions to enter normal notes.
2658 @lilypond[singleline,verbatim]
2659 \include "drumpitch-init.ly"
2660 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2661 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2662 \include "nederlands.ly"
2663 bass = \notes \transpose c c,, { a4. e8 r e g e }
2666 \apply #(drums->paper 'drums) \context Staff = drums <
2668 \context Voice = up { \voiceOne \up }
2669 \context Voice = down { \voiceTwo \down }
2671 \context Staff = bass { \clef "F_8" \bass }
2676 @node Percussion midi output
2677 @subsection Percussion midi output
2679 In order to produce correct midi output you need to produce two score
2680 blocks---one for the paper and one for the midi output. To use the
2681 percussion channel you set the property @code{instrument} to
2682 @code{'drums}. Because the drum-pitches themself are similar to the
2683 general midi pitches all you have to do is to insert the voices with
2684 none of the scheme functions to get the correct midi output:
2688 \apply #(drums->paper 'mydrums) \context Staff <
2697 \property Staff.instrument = #'drums
2706 This scheme is to be considered a temporary implementation.
2710 @section Piano music
2712 Piano staves are two normal staves coupled with a brace. The staves
2713 are largely independent, but sometimes voices can cross between the
2714 two staves. The same notation is also used for harps and other key
2715 instruments. The @internalsref{PianoStaff} is especially built to
2716 handle this cross-staffing behavior. In this section we discuss the
2717 @internalsref{PianoStaff} and some other pianistic peculiarities.
2721 * Automatic staff changes::
2722 * Manual staff switches::
2725 * Voice follower lines::
2730 There is no support for putting chords across staves. You can get
2731 this result by increasing the length of the stem in the lower stave so
2732 it reaches the stem in the upper stave, or vice versa. An example is
2733 included with the distribution as @inputfileref{input/test,stem-cross-staff.ly}.
2735 Dynamics are not centered, but kludges do exist. See
2736 @inputfileref{input/templates,piano-dynamics.ly}.
2738 @cindex cross staff stem
2739 @cindex stem, cross staff
2742 @c fixme: should have hyperlinks as well.
2748 @node Automatic staff changes
2749 @subsection Automatic staff changes
2750 @cindex Automatic staff changes
2752 Voices can switch automatically between the top and the bottom
2753 staff. The syntax for this is
2755 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2757 The autochanger switches on basis of pitch (central C is the turning
2758 point), and it looks ahead skipping over rests to switch rests in
2759 advance. Here is a practical example:
2761 @lilypond[verbatim,singleline,quote]
2762 \score { \notes \context PianoStaff <
2763 \context Staff = "up" {
2764 \autochange Staff \context Voice = VA < \relative c' {
2765 g4 a b c d r4 a g } > }
2766 \context Staff = "down" {
2771 Spacer rests are used to prevent the bottom staff from
2772 terminating too soon.
2777 The staff switches often do not end up in optimal places. For high
2778 quality output staff switches should be specified manually.
2782 @node Manual staff switches
2783 @subsection Manual staff switches
2785 @cindex manual staff switches
2786 @cindex staff switch, manual
2788 Voices can be switched between staves manually, using the following command:
2790 \translator Staff = @var{staffname} @var{music}
2792 The string @var{staffname} is the name of the staff. It switches the
2793 current voice from its current staff to the Staff called
2794 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2802 Pianos have pedals that alter the way sound are produced. Generally, a
2803 piano has three pedals, sustain, una corda, and sostenuto.
2807 Piano pedal instruction can be expressed by attaching
2808 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2809 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
2812 The symbols that are printed can be modified by setting
2813 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2814 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation
2815 of @internalsref{SustainPedal} for more information.
2817 Pedals can also be indicated by a sequence of brackets, by setting the
2818 @code{pedal-type} property of @internalsref{SustainPedal} objects:
2820 @lilypond[fragment,verbatim]
2821 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2822 c''4-\sustainDown d''4 e''4
2823 a'4-\sustainUp-\sustainDown
2824 f'4 g'4 a'4-\sustainUp
2827 A third style of pedal notation is a mixture of text and brackets,
2828 obtained by setting @code{pedal-type} to @code{mixed}:
2830 @lilypond[fragment,verbatim]
2831 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2832 c''4-\sustainDown d''4 e''4
2833 c'4-\sustainUp-\sustainDown
2834 f'4 g'4 a'4-\sustainUp
2837 The default '*Ped' style for sustain and damper pedals corresponds to
2838 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2839 for a sostenuto pedal:
2841 @lilypond[fragment,verbatim]
2842 c''4-\sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4-\sostenutoUp
2845 For fine-tuning of the appearance of a pedal bracket, the properties
2846 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2847 @code{PianoPedalBracket} objects (see the detailed documentation of
2848 @internalsref{PianoPedalBracket}) can be modified. For example, the bracket
2849 may be extended to the end of the note head.
2851 @lilypond[fragment,verbatim]
2852 \property Staff.PianoPedalBracket \override
2853 #'shorten-pair = #'(0 . -1.0)
2854 c''4-\sostenutoDown d''4 e''4 c'4
2855 f'4 g'4 a'4-\sostenutoUp
2859 @subsection Arpeggio
2862 @cindex broken arpeggio
2863 @cindex @code{\arpeggio}
2865 You can specify an arpeggio sign on a chord by attaching an
2866 @code{\arpeggio} to a chord.
2869 @lilypond[fragment,relative,verbatim]
2870 <<c e g c>>-\arpeggio
2873 When an arpeggio crosses staves in piano music, you attach an arpeggio
2874 to the chords in both staves, and set
2875 @internalsref{PianoStaff}.@code{connectArpeggios}.
2877 @lilypond[fragment,relative,verbatim]
2878 \context PianoStaff <
2879 \property PianoStaff.connectArpeggios = ##t
2880 \context Voice = one { <<c' e g c>>-\arpeggio }
2881 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
2885 This command creates @internalsref{Arpeggio} objects. Cross staff
2886 arpeggios are @internalsref{PianoStaff}.@internalsref{Arpeggio}.
2888 The direction of the arpeggio is sometimes denoted by adding an
2889 arrowhead to the wiggly line. This can be typeset by setting
2890 @code{arpeggio-direction}.
2892 @lilypond[fragment,relative,verbatim]
2894 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2895 <<c e g c>>-\arpeggio
2896 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2897 <<c e g c>>-\arpeggio
2901 A square bracket on the left indicates that the player should not
2902 arpeggiate the chord. To draw these brackets, set the
2903 @code{molecule-callback} property of @code{Arpeggio} or
2904 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2905 @code{\arpeggio} statements within the chords as before.
2907 @lilypond[fragment,relative,verbatim]
2908 \property PianoStaff.Arpeggio \override
2909 #'molecule-callback = \arpeggioBracket
2910 <<c' e g c>>-\arpeggio
2916 It is not possible to mix connected arpeggios and unconnected
2917 arpeggios in one @internalsref{PianoStaff} at the same time.
2919 @node Voice follower lines
2920 @subsection Voice follower lines
2923 [TODO: invent better name]
2925 @cindex follow voice
2926 @cindex staff switching
2929 @cindex @code{followVoice}
2931 Whenever a voice switches to another staff a line connecting the notes
2932 can be printed automatically. This is enabled if the property
2933 @code{PianoStaff.followVoice} is set to true:
2935 @lilypond[fragment,relative,verbatim]
2936 \context PianoStaff <
2937 \property PianoStaff.followVoice = ##t
2938 \context Staff \context Voice {
2940 \translator Staff=two
2943 \context Staff=two { \clef bass \skip 1*2 }
2947 The associated object is @internalsref{VoiceFollower}.
2951 @section Vocal music
2953 For a discussion of how to put lyrics into a score, see section
2954 @code{Printing lyrics} in the tutorial.
2956 @cindex context variables
2957 @cindex setting context variables
2958 An interpretation context has variables that tune its behavior. These
2959 variables are also called @emph{properties}. The @code{autoBeaming}
2960 variable in a @code{Staff} controls whether 8th and shorter notes are
2961 beamed automatically. Setting the variable to @code{##f}, which is the
2962 boolean value @var{false}, turns it off.
2965 This will create an extender, which is a line
2966 that extends over the entire duration of the lyric. This line will
2967 run all the way to the start of the next lyric, so you may want to
2968 shorten it by using a blank lyric (using @code{_}).
2971 @cindex @code{\lyrics}
2973 To get them printed, you must do two
2974 things: indicate that lyrics are entered with @code{\lyrics}, and
2975 indicate that this type of music must be interpreted as texts (and not
2976 notes). This is done with @code{\context Lyrics}.
2978 You can enter lyrics in a special input mode of LilyPond. This mode is
2979 called Lyrics mode, and it is introduced by the keyword
2980 @code{\lyrics}. In this mode you can enter lyrics, with punctuation
2981 and accents without any hassle. Syllables are entered like notes, but
2982 with pitches replaced by text. For example,
2990 You can use ordinary hyphens at the end of a syllable, i.e.
2994 but then the hyphen will be attached to the end of the first syllable.
2996 If you want them centered between syllables you can use the special
2997 `@code{-}@code{-}' lyric as a separate word between syllables. The
2998 hyphen will have variable length depending on the space between
2999 the syllables and it will be centered between the syllables.
3004 Normally the notes that you enter are transformed into note heads.
3005 Note heads alone make no sense. They need surrounding information: a
3006 key signature, a clef, staff lines, etc. They need @emph{context}.
3007 In LilyPond, these symbols are created by objects called
3008 `interpretation contexts'. Interpretation contexts exist for
3009 generating notation (`notation context') and for generating sound
3010 (`performance context'). These objects only exist while LilyPond is
3011 executing. For lyrics, the command
3015 must be used to interpret a set of syllables as lyrics.
3020 @cindex interpretation context
3021 @cindex notation context
3025 The melody and the lyrics can be combined with the @code{\addlyrics}:
3028 \notes \relative c' @dots{}
3029 \context Lyrics \lyrics @dots{}
3032 [TODO: Move lyrics section from tutorial to here?]
3034 See also the sections on @ref{Slurs} and @ref{Breath marks}.
3036 [TODO: Move slurs / breath marks section to here?]
3038 [TODO: Write subsection upon usage of ChoirStaff.]
3043 @section More stanzas
3048 If you have multiple stanzas printed underneath each other, the vertical
3049 groups of syllables should be aligned around punctuation. LilyPond can
3050 do this if you tell it which lyric lines belong to which melody.
3051 We show how you can do this by showing how you could print a frivolous
3052 fragment of a fictional Sesame Street duet.
3054 @lilypond[singleline,verbatim]
3057 \notes \relative c'' \context Voice = duet { \time 3/4
3059 \lyrics \context Lyrics <
3060 \context LyricsVoice = "duet-1" {
3061 \property LyricsVoice . stanza = "Bert"
3062 Hi, my name is bert. }
3063 \context LyricsVoice = "duet-2" {
3064 \property LyricsVoice . stanza = "Ernie"
3065 Ooooo, ch\'e -- ri, je t'aime. }
3070 To this end, give the Voice context an identity, and set the
3071 LyricsVoice to a name starting with that identity followed by a dash.
3072 In the following example, the Voice identity is @code{duet},
3074 \context Voice = duet @{
3079 identities of the LyricsVoices are @code{duet-1} and @code{duet-2}.
3081 \context LyricsVoice = "duet-1" @{
3082 Hi, my name is bert. @}
3083 \context LyricsVoice = "duet-2" @{
3084 Ooooo, ch\'e -- ri, je t'aime. @}
3086 The convention for naming @code{LyricsVoice} and @code{Voice} must
3087 also be used to get melismata on rests correct.
3090 We add the names of the singers. This can be done by setting
3091 @code{LyricsVoice.Stanza} (for the first system) and
3092 @code{LyricsVoice.stz} for the following systems. You must
3093 surround dots with spaces in @code{\lyrics} mode.
3096 \property LyricsVoice . stanza = "Bert"
3098 \property LyricsVoice . stanza = "Ernie"
3104 For entering quotes in Lyrics mode, use the following
3106 "\"God\"" is "`King'"
3109 You can use empty syllables, e.g. @code{_4} or @code{" "4} to enter
3110 lyrics. This can confuse the LilyPond -- for example, this might put
3111 (empty) lyrics under rests. To remedy this, use @code{\skip}.
3119 Input for lyrics introduces a syntactical ambiguity:
3126 is interpreted as assigning a string identifier @code{\foo} such that
3127 it contains @code{"bar"}. However, it could also be interpreted as
3128 making or a music identifier @code{\foo} containing the syllable
3129 `bar'. The force the latter interpretation, use
3143 The term @emph{ambitus} denotes a range of pitches for a given voice in
3144 a part of music. It also may denote the pitch range that a musical
3145 instrument is capable of playing. Most musical instruments have their
3146 ambitus standardized (or at least there is agreement upon the minimal
3147 ambitus of a particular type of instrument), such that a composer or
3148 arranger of a piece of music can easily meet the ambitus constraints of
3149 the targeted instrument. However, the ambitus of the human voice
3150 depends on individual physiological state, including education and
3151 training of the voice. Therefore, a singer potentially has to check for
3152 each piece of music if the ambitus of that piece meets his individual
3153 capabilities. This is why the ambitus of a piece may be of particular
3154 value to vocal performers.
3156 The ambitus is typically notated on a per-voice basis at the very
3157 beginning of a piece, e.g. nearby the initial clef or time signature of
3158 each staff. The range is graphically specified by two noteheads, that
3159 represent the minimum and maximum pitch. Some publishers use a textual
3160 notation: they put the range in words in front of the corresponding
3161 staff. Lilypond currently only supports the graphical ambitus notation.
3163 To apply, add the @internalsref{Ambitus_engraver} to the
3164 @internalsref{Voice} context, i.e.
3167 \paper @{ \translator @{
3169 \consists Ambitus_engraver
3175 @lilypond[singleline]
3176 upper = \notes \relative c {
3179 as'' c e2 bes f cis d4 e f2 g
3181 lower = \notes \relative c {
3184 e'4 b g a c es fis a cis b a g f e d2
3187 \context ChoirStaff {
3189 \context Staff = one { \upper }
3190 \context Staff = three { \lower }
3196 \consists Ambitus_engraver
3205 @internalsref{Ambitus}, @inputfileref{input/regression,ambitus.ly}.
3210 Tablature notation is used for notating music for plucked string
3211 instruments. It notates pitches not by using note heads, but by
3212 indicating on which string and fret a note must be played. LilyPond
3213 offers limited support for tablature.
3216 * Tablatures basic::
3217 * Non-guitar tablatures::
3220 @node Tablatures basic
3221 @subsection Tablatures basic
3222 @cindex Tablatures basic
3224 The string number associated to a note is given as a backslash
3225 followed by a number, e.g. @code{c4\3} for a C quarter on the third
3226 string. By default, string 1 is the highest one, and the tuning
3227 defaults to the standard guitar tuning (with 6 strings). The notes
3228 are printed as tablature, by using @internalsref{TabStaff} and
3229 @internalsref{TabVoice} contexts.
3231 @lilypond[fragment,verbatim]
3232 \notes \context TabStaff {
3238 If you do not specify a string number then one is selected
3239 automatically: the first string that does not give a fret number less
3240 than @code{minimumFret} is selected. The default value for
3241 @code{minimumFret} is 0.
3245 e8 fis gis a b cis' dis' e'
3246 \property TabStaff.minimumFret = #8
3247 e8 fis gis a b cis' dis' e'
3252 e8 fis gis a b cis' dis' e'
3253 \property TabStaff.minimumFret = #8
3254 e8 fis gis a b cis' dis' e'
3257 \context StaffGroup <
3258 \context Staff { \clef "G_8" \frag }
3259 \context TabStaff { \frag }
3266 @internalsref{TabStaff}, @internalsref{TabVoice}, and
3267 @internalsref{StringNumberEvent}.
3271 Chords are not handled in a special way, and hence the automatic
3272 string selector may easily select the same string to two notes in a
3276 @node Non-guitar tablatures
3277 @subsection Non-guitar tablatures
3278 @cindex Non-guitar tablatures
3280 You can change the number of strings, by setting the number of lines
3281 in the @internalsref{TabStaff} (the @code{line-count} property of
3282 @internalsref{TabStaff} can only be changed using
3283 @code{\outputproperty}, for more information, see @ref{Tuning objects}.
3285 You can change the tuning of the strings. A string tuning is given as
3286 a Scheme list with one integer number for each string, the number
3287 being the pitch (measured in semitones relative to central C) of an
3288 open string. The numbers specified for @code{stringTuning} are the
3289 numbers of semitones to subtract or add, starting the specified pitch
3290 by default middle C, in string order: thus the notes are e, a, d, and
3293 @lilypond[fragment,verbatim]
3296 \outputproperty #(make-type-checker 'staff-symbol-interface)
3298 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3301 a,4 c' a e' e c' a e'
3306 Finally, it is possible to change the Scheme function to format the
3307 tablature note text. The default is
3308 @var{fret-number-tablature-format}, which uses the fret number. For
3309 some instruments that do not use this notation, you can create a
3310 special tablature formatting function. This function takes three
3311 argument: the string number, the string tuning and the note pitch.
3315 As tablature is a recent feature, most of the guitar special effects
3316 such as bend are not yet supported.
3320 @section Chord namess
3323 LilyPond has support for both entering and printing chords.
3324 @lilypond[verbatim,singleline]
3325 twoWays = \notes \transpose c c' {
3335 < \context ChordNames \twoWays
3336 \context Voice \twoWays > }
3339 This example also shows that the chord printing routines do not try to
3340 be intelligent. If you enter @code{f bes d}, it does not interpret
3341 this as an inversion.
3343 Chords are represented as a set of pitches. They are internally
3344 stored as simultaneous music expressions. This means you can enter
3345 chords by name and print them as notes, enter them as notes and print
3346 them as chord names, or (the most common case) enter them by name, and
3351 * Printing chord names::
3356 @subsection Chords mode
3359 Chord mode is a mode where you can input sets of pitches using common
3360 names. It is introduced by the keyword @code{\chords}.
3361 In chords mode, a chord is entered by the root, which is entered
3362 like a common pitch, for example,
3363 @lilypond[fragment,verbatim,quote, relative=1]
3364 \chords { es4. d8 c2 }
3369 Other chords may be entered by suffixing a colon, and introducing a
3370 modifier, and optionally, a number, for example
3372 @lilypond[fragment,verbatim,quote]
3373 \chords { e1:m e1:7 e1:m7 }
3375 The first number following the root is taken to be the `type' of the
3376 chord, thirds are added to the root until it reaches the specified
3377 number, for example.
3378 @lilypond[fragment,verbatim]
3379 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
3382 @cindex root of chord
3383 @cindex additions, in chords
3384 @cindex removals, in chords
3386 More complex chords may also be constructed adding separate steps
3387 to a chord. Additions are added after the number following
3388 the colon, and are separated by dots. For example
3390 @lilypond[verbatim,fragment,quote]
3391 \chords { c:5.6 c:3.7.8 c:3.6.13 }
3393 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
3394 to the number, for example:
3395 @lilypond[verbatim,fragment,quote]
3396 \chords { c:7+ c:5+.3- c:3-.5-.7- }
3398 Removals are specified similarly, and are introduced by a caret. They
3399 must come after the additions.
3400 @lilypond[verbatim,fragment]
3401 \chords { c^3 c:7^5 c:9^3.5 }
3404 Modifiers can be used to change pitches. The following modifiers are
3408 is the minor chord. This modifier lowers the 3rd and (if present) the 7th step.
3410 is the diminished chord. This modifier lowers the 3rd, 5th and (if present)
3413 is the augmented chord. This modifier raises the 5th step.
3415 is the major 7th chord. This modifier raises the 7th step if present.
3417 is the suspended 4th or 2nd. This modifier removes the 3rd
3418 step. Append either @code{2} or @code{4} to add the 2nd or 4th step to
3421 Modifiers can be mixed with additions.
3422 @lilypond[verbatim,fragment]
3423 \chords { c:sus4 c:7sus4 c:dim7 c:m6 }
3426 @cindex modifiers, in chords.
3433 Since the unaltered 11 does sound well when combined with the
3434 unaltered 3, the 11 is removed in this case, unless it is added
3435 explicitly). For example,
3436 @lilypond[fragment,verbatim]
3437 \chords { c:13 c:13.11 c:m13 }
3442 An inversion (putting one pitch of the chord on the bottom), as well
3443 as bass notes, can be specified by appending
3444 @code{/}@var{pitch} to the chord.
3445 @lilypond[fragment,verbatim,center]
3446 \chords { c1 c/g c/f }
3449 If you do not want to remove the bass note from the chord, but rather
3450 add the note, then you can use @code{/+}@var{pitch}.
3452 @lilypond[fragment,verbatim,center]
3453 \chords { c1 c/+g c/+f }
3456 Chords is a mode similar to @code{\lyrics}, @code{\notes} etc. Most
3457 of the commands continue to work, for example, @code{r} and
3458 @code{\skip} can be used to insert rests and spaces, and
3459 @code{\property} may be used to change various settings.
3465 Each step can only be present in a chord once. The following
3466 simply produces the augmented chord, since @code{5+} is interpreted
3469 @lilypond[verbatim,fragment]
3470 \chords { c:5.5-.5+ }
3473 In chord mode, dashes and carets are used to indicate chord additions
3474 and subtractions, so articulation scripts cannot be entered.
3477 @node Printing chord names
3478 @subsection Printing chord names
3480 @cindex printing chord names
3484 For displaying printed chord names, use the @internalsref{ChordNames} context.
3485 The chords may be entered either using the notation described above, or
3486 directly using simultaneous music.
3488 @lilypond[verbatim,singleline]
3490 \chords {a1 b c} <<d f g>> <<e g b>>
3494 \context ChordNames \scheme
3495 \context Staff \transpose c c' \scheme
3500 You can make the chord changes stand out by setting
3501 @internalsref{ChordNames}.@code{chordChanges} to true. This will only
3502 display chord names when there is a change in the chords scheme and at
3503 the start of a new line.
3507 c1:m c:m \break c:m c:m d
3511 \context ChordNames {
3512 \property ChordNames.chordChanges = ##t
3514 \context Staff \transpose c c' \scheme
3516 \paper{linewidth= 9.\cm}
3520 The default chord name layout is a system for Jazz music, proposed by
3521 Klaus Ignatzek (See @ref{Literature}).
3523 [TODO: add description for banter other jazz.]
3525 The Ignatzek chord name formatting can be tuned in a number of ways
3526 through the following properties:
3528 @item chordNameExceptions
3529 This is a list that contains the chords that have special formatting.
3531 @inputfileref{input/regression,chord-name-exceptions.ly}.
3533 @item majorSevenSymbol
3534 This property contains the markup object used for the 7th step, when
3535 it is major. Predefined options are @code{whiteTriangleMarkup},
3536 @code{blackTriangleMarkup}. See
3537 @inputfileref{input/regression,chord-name-major7.ly} for an example.
3539 @item chordNameSeparator
3540 Different parts of a chord name are normally separated by a
3541 slash. By setting @code{chordNameSeparator}, you can specify other
3543 @lilypond[fragment,verbatim]
3544 \context ChordNames \chords {
3546 \property ChordNames.chordNameSeparator
3551 @item chordRootNamer
3552 The root of a chord is usually printed as a letter with an optional
3553 alteration. The transformation from pitch to letter is done by this
3554 function. An application of setting this function, is providing chord
3555 names with german notation for the root.
3557 @item chordNoteNamer
3558 The default is to print single notes (as for instance the bass note)
3559 using the chordRootNamer. However, by setting this function to a non-null
3560 value you can specify a different function. I.e. you could use letters
3561 in lower case for the base note.
3567 @inputfileref{input/regression,chord-name-major7.ly},
3568 @inputfileref{input/regression,chord-name-exceptions.ly},
3569 @inputfileref{input/test,chord-names-german.ly},
3570 @file{scm/chords-ignatzek.scm}, @file{scm/chord-entry.scm}
3575 Chord names are determined solely from the list of pitches. Chord
3576 inversions are not identified, and neither are added bass notes. This
3577 may result in strange chord names when chords are entered with the
3578 @code{<< .. >>} syntax.
3584 @section Writing parts
3586 Orchestral music involves some special notation, both in the full score,
3587 as in the individual parts. This section explains how to tackle common
3588 problems in orchestral music.
3595 * Instrument names::
3597 * Multi measure rests::
3598 * Automatic part combining::
3599 * Hara kiri staves::
3600 * Sound output for transposing instruments::
3604 @node Rehearsal marks
3605 @subsection Rehearsal marks
3606 @cindex Rehearsal marks
3608 @cindex @code{\mark}
3610 To print a rehearsal mark, use the @code{\mark} command.
3611 @lilypond[fragment,verbatim]
3621 The mark is incremented automatically if you use @code{\mark
3622 \default}. The value to use is stored in the property
3623 @code{rehearsalMark} is used and automatically incremented.
3625 The @code{\mark} command can also be used to put signs like coda,
3626 segno and fermatas on a barline. Use @code{\markup} to
3627 to access the appropriate symbol.
3629 @lilypond[fragment,verbatim,relative=1]
3630 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
3634 In this case, during line breaks,
3635 marks must also be printed at the end of the line, and not at the
3636 beginning. Use the following to force that behavior
3638 \property Score.RehearsalMark \override
3639 #'break-visibility = #begin-of-line-invisible
3642 See @inputfileref{input/test,boxed-molecule.ly}. for putting boxes
3648 @cindex barlines, putting symbols on
3652 @internalsref{MarkEvent}, @internalsref{RehearsalMark},
3653 @inputfileref{input/test,boxed-molecule.ly}.
3657 @subsection Bar numbers
3661 @cindex measure numbers
3662 @cindex currentBarNumber
3664 Bar numbers are printed by default at the start of the line. The
3665 number itself is stored in the
3666 @code{currentBarNumber} property,
3667 which is normally updated automatically for every measure.
3669 Bar numbers can be typeset at regular intervals instead of at the
3670 beginning of each line. This is illustrated in the following example,
3671 whose source is available as
3672 @inputfileref{input/test,bar-number-every-fifth.ly}
3674 @lilypondfile[notexidoc]{bar-number-every-fifth.ly}
3676 The start of that numbering can also be reset, as demonstrated in
3677 @inputfileref{input/test,bar-number-every-5-reset.ly}.
3679 @lilypondfile[notexidoc]{bar-number-every-5-reset.ly}
3684 @internalsref{BarNumber}.
3685 @inputfileref{input/test,bar-number-every-5-reset.ly}.
3686 @inputfileref{input/test,bar-number-every-fifth.ly}
3690 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
3691 there is one at the top. To solve this, You have to twiddle with the
3692 @internalsref{padding} property of @internalsref{BarNumber} if your
3693 score starts with a @internalsref{StaffGroup}.
3695 @node Instrument names
3696 @subsection Instrument names
3698 In an orchestral score, instrument names are printed left of the
3701 This can be achieved by setting @internalsref{Staff}.@code{instrument}
3702 and @internalsref{Staff}.@code{instr}. This will print a string before
3703 the start of the staff. For the first start, @code{instrument} is
3704 used, for the next ones @code{instr} is used.
3706 @lilypond[verbatim,singleline]
3707 \property Staff.instrument = "ploink " { c''4 }
3710 You can also use markup texts to construct more complicated instrument
3713 @lilypond[fragment,verbatim,singleline]
3714 \notes \context Staff = treble {
3715 \property Staff.instrument = \markup {
3716 \column << "Clarinetti"
3718 \smaller \musicglyph #"accidentals--1"
3729 @internalsref{InstrumentName}
3733 When you put a name on a grand staff or piano staff the width of the
3734 brace is not taken into account. You must add extra spaces to the end of
3735 the name to avoid a collision.
3738 @subsection Transpose
3740 @cindex transposition of pitches
3741 @cindex @code{\transpose}
3743 A music expression can be transposed with @code{\transpose}. The syntax
3746 \transpose @var{from} @var{to} @var{musicexpr}
3749 This means that @var{musicexpr} is transposed by the interval
3750 between @var{from} and @var{to}.
3752 @code{\transpose} distinguishes between enharmonic pitches: both
3753 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3754 half a tone. The first version will print sharps and the second
3755 version will print flats.
3757 @lilypond[singleline, verbatim]
3758 mus =\notes { \key d \major cis d fis g }
3759 \score { \notes \context Staff {
3762 \transpose c g' \mus
3763 \transpose c f' \mus
3769 @internalsref{TransposedMusic}, @internalsref{UntransposableMusic}.
3773 If you want to use both @code{\transpose} and @code{\relative}, then
3774 you must put @code{\transpose} outside of @code{\relative}, since
3775 @code{\relative} will have no effect music that appears inside a
3781 @node Multi measure rests
3782 @subsection Multi measure rests
3783 @cindex Multi measure rests
3787 Multi measure rests are entered using `@code{R}'. It is specifically
3788 meant for full bar rests and for entering parts: the rest can expand to
3789 fill a score with rests, or it can be printed as a single multimeasure
3790 rest. This expansion is controlled by the property
3791 @code{Score.skipBars}. If this is set to true, Lily will not expand
3792 empty measures, and the appropriate number is added automatically.
3794 @lilypond[fragment,verbatim]
3795 \time 4/4 r1 | R1 | R1*2
3796 \property Score.skipBars = ##t R1*17 R1*4
3799 The @code{1} in @code{R1} is similar to the duration notation used for
3800 notes. Hence, for time signatures other than 4/4, you must enter other
3801 durations. This can be done with augmentation dots or fractions:
3803 @lilypond[fragment,verbatim]
3804 \property Score.skipBars = ##t
3812 A @code{R} spanning a single measure is printed as a whole rest
3813 centered in the measure (or a breve when the measure lasts longer than
3814 two whole notes), regardless of the time signature.
3818 @cindex text on multi-measure rest
3819 @cindex script on multi-measure rest
3820 @cindex fermata on multi-measure rest
3822 Texts can be added to multi-measure rests by using the
3823 @var{note}-@code{markup} syntax. In this case, the number is
3824 replaced. If you need both texts and the number, you must add the
3825 number by hand. A variable (@code{\fermataMarkup}) is provided for
3829 @lilypond[verbatim,fragment]
3831 R2._\markup { "Ad lib" }
3836 @cindex whole rests for a full measure
3840 @internalsref{MultiMeasureRestEvent},
3841 @internalsref{MultiMeasureTextEvent},
3842 @internalsref{MultiMeasureRestMusicGroup},
3843 @internalsref{MultiMeasureRest}.
3845 The graphical object @internalsref{MultiMeasureRestNumber} is for the
3846 default number, and @internalsref{MultiMeasureRestText} for user
3851 It is not possible to use fingerings (e.g. @code{R1-4}) to put numbers
3852 over multi-measure rests.
3854 @cindex condensing rests
3856 There is no way to automatically condense multiple rests into a single
3857 multimeasure rest. Multi measure rests do not take part in rest
3860 Be careful when entering multimeasure rests followed by whole notes,
3864 will enter two notes lasting four measures each. The result will look
3865 ok, but the bar numbering will be off.
3867 @node Automatic part combining
3868 @subsection Automatic part combining
3869 @cindex automatic part combining
3870 @cindex part combiner
3873 Automatic part combining is used to merge two parts of music onto a
3874 staff. It is aimed at typesetting orchestral scores. When the two
3875 parts are identical for a period of time, only one is shown. In
3876 places where the two parts differ, they are typeset as separate
3877 voices, and stem directions are set automatically. Also, solo and
3878 @emph{a due} parts are identified and can be marked.
3882 The syntax for part combining is
3885 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3887 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3888 combined into one context of type @var{context}. The music expressions
3889 must be interpreted by contexts whose names should start with @code{one}
3892 The following example demonstrates the basic functionality of the part
3893 combiner: putting parts on one staff, and setting stem directions and
3896 @lilypond[verbatim,singleline,fragment]
3898 \context Voice=one \partcombine Voice
3899 \context Thread=one \relative c'' {
3902 \context Thread=two \relative c'' {
3908 The first @code{g} appears only once, although it was
3909 specified twice (once in each part). Stem, slur and tie directions are
3910 set automatically, depending whether there is a solo or unisono. The
3911 first part (with context called @code{one}) always gets up stems, and
3912 `solo', while the second (called @code{two}) always gets down stems and
3915 If you just want the merging parts, and not the textual markings, you
3916 may set the property @var{soloADue} to false.
3918 @lilypond[verbatim,singleline,fragment]
3920 \property Staff.soloADue = ##f
3921 \context Voice=one \partcombine Voice
3922 \context Thread=one \relative c'' {
3925 \context Thread=two \relative c'' {
3933 @internalsref{PartCombineMusic},
3934 @internalsref{Thread_devnull_engraver},
3935 @internalsref{Voice_devnull_engraver} and @internalsref{A2_engraver}.
3939 The syntax for naming contexts in inconsistent with the syntax for
3942 In @code{soloADue} mode, when the two voices play the same notes on and
3943 off, the part combiner may typeset @code{a2} more than once in a
3946 @lilypond[fragment,singleline]
3948 \context Voice=one \partcombine Voice
3949 \context Thread=one \relative c'' {
3952 \context Thread=two \relative c'' {
3958 The part combiner is slated to be rewritten [TODO: explain why] .
3960 @cindex @code{Thread_devnull_engraver}
3961 @cindex @code{Voice_engraver}
3962 @cindex @code{A2_engraver}
3964 @node Hara kiri staves
3965 @subsection Hara kiri staves
3967 In orchestral scores, staff lines that only have rests are usually removed.
3968 This saves some space. This style is called `French Score'.
3972 This is supported through the hara kiri@footnote{Hara kiri is the
3973 vulgar name for Seppuku, is the ritual suicide of the Japanese
3974 Samourai warriors.} staff. This staff commits suicide when it finds
3975 itself to be empty after the line-breaking process. It will not
3976 disappear when it contains normal rests, you must use multi measure
3979 For @internalsref{Lyrics}, @internalsref{LyricsVoice},
3980 @internalsref{ChordNames} and @internalsref{FiguredBass}, hara-kiri is
3981 switched on by default. For normal staffs, hara kiri is available as a
3982 specialized @internalsref{Staff} context, with the name variable
3983 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3984 example disappears in the second line.
3988 \notes \relative c' <
3989 \context Staff = SA { e4 f g a \break c1 }
3990 \context Staff = SB { c4 d e f \break R1 }
3994 \translator { \HaraKiriStaffContext }
4000 @node Sound output for transposing instruments
4001 @subsection Sound output for transposing instruments
4003 When you want to make a MIDI file from a score containing transposed
4004 and untransposed instruments, you have to instruct LilyPond the pitch
4005 offset (in semitones) for the transposed instruments. This is done
4006 using the @code{transposing} property. It does not affect printed
4009 @cindex @code{transposing}
4012 \property Staff.instrument = #"Cl. in B-flat"
4013 \property Staff.transposing = #-2
4017 @node Ancient notation
4018 @section Ancient notation
4020 @cindex Vaticana, Editio
4021 @cindex Medicaea, Editio
4026 [TODO: write introduction on ancient notation]
4029 * Ancient note heads::
4038 @node Ancient note heads
4039 @subsection Ancient note heads
4041 To get a longa note head, you have to use mensural note heads. This
4042 is accomplished by setting the @code{style} property of the
4043 NoteHead object to @code{mensural}. There is also a note head style
4044 @code{baroque} which gives mensural note heads for @code{\longa} and
4045 @code{\breve} but standard note heads for shorter notes.
4047 @lilypond[fragment,singleline,verbatim]
4048 \property Voice.NoteHead \set #'style = #'mensural
4053 @subsection Ancient clefs
4055 LilyPond supports a variety of clefs, many of them ancient.
4057 For modern clefs, see section @ref{Clef}. For the percussion clef, see
4058 section @ref{Percussion staves}. For the @code{TAB} clef, see section
4061 The following table shows all ancient clefs that are supported via the
4062 @code{\clef} command. Some of the clefs use the same glyph, but
4063 differ only with respect to the line they are printed on. In such
4064 cases, a trailing number in the name is used to enumerate these clefs.
4065 Still, you can manually force a clef glyph to be typeset on an
4066 arbitrary line, as described in section @ref{Clef}. The note printed
4067 to the right side of each clef in the example column denotes the
4068 @code{c'} with respect to that clef.
4070 @c --- This should go somewhere else: ---
4071 @c @item modern style G clef (glyph: @code{clefs-G})
4074 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
4076 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
4078 @c @item modern style F clef (glyph: @code{clefs-F})
4081 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
4083 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
4085 @c @item modern style C clef (glyph: @code{clefs-C})
4088 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
4089 @c @code{tenor}, @code{baritone}
4091 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
4093 @multitable @columnfractions .3 .3 .3 .1
4097 @b{Description} @tab
4098 @b{Supported Clefs} @tab
4102 @code{clefs-neo_mensural_c} @tab
4103 modern style mensural C clef @tab
4104 @code{neo_mensural_c1}, @code{neo_mensural_c2},
4105 @code{neo_mensural_c3}, @code{neo_mensural_c4} @tab
4106 @lilypond[relative 0, notime]
4107 \property Staff.TimeSignature \set #'transparent = ##t
4108 \clef "neo_mensural_c2" c
4112 @code{clefs-petrucci_c1} @tab
4113 petrucci style mensural C clef (specifically for use on 1st staffline) @tab
4114 @code{petrucci_c1} @tab
4115 @lilypond[relative 0, notime]
4116 \property Staff.TimeSignature \set #'transparent = ##t
4117 \clef "petrucci_c1" c
4121 @code{clefs-petrucci_c2} @tab
4122 petrucci style mensural C clef (specifically for use on 2nd staffline) @tab
4123 @code{petrucci_c2} @tab
4124 @lilypond[relative 0, notime]
4125 \property Staff.TimeSignature \set #'transparent = ##t
4126 \clef "petrucci_c2" c
4130 @code{clefs-petrucci_c3} @tab
4131 petrucci style mensural C clef (specifically for use on 3rd staffline) @tab
4132 @code{petrucci_c3} @tab
4133 @lilypond[relative 0, notime]
4134 \property Staff.TimeSignature \set #'transparent = ##t
4135 \clef "petrucci_c3" c
4139 @code{clefs-petrucci_c4} @tab
4140 petrucci style mensural C clef (specifically for use on 4th staffline) @tab
4141 @code{petrucci_c4} @tab
4142 @lilypond[relative 0, notime]
4143 \property Staff.TimeSignature \set #'transparent = ##t
4144 \clef "petrucci_c4" c
4148 @code{clefs-petrucci_c5} @tab
4149 petrucci style mensural C clef (specifically for use on 5th staffline) @tab
4150 @code{petrucci_c5} @tab
4151 @lilypond[relative 0, notime]
4152 \property Staff.TimeSignature \set #'transparent = ##t
4153 \clef "petrucci_c5" c
4157 @code{clefs-petrucci_f} @tab
4158 petrucci style mensural F clef @tab
4159 @code{petrucci_f} @tab
4160 @lilypond[relative 0, notime]
4161 \property Staff.TimeSignature \set #'transparent = ##t
4162 \clef "petrucci_f" c
4166 @code{clefs-petrucci_g} @tab
4167 petrucci style mensural G clef @tab
4168 @code{petrucci_g} @tab
4169 @lilypond[relative 0, notime]
4170 \property Staff.TimeSignature \set #'transparent = ##t
4171 \clef "petrucci_g" c
4175 @code{clefs-mensural_c'} @tab
4176 historic style mensural C clef @tab
4177 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
4178 @code{mensural_c4} @tab
4179 @lilypond[relative 0, notime]
4180 \property Staff.TimeSignature \set #'transparent = ##t
4181 \clef "mensural_c2" c
4185 @code{clefs-mensural_f} @tab
4186 historic style mensural F clef @tab
4187 @code{mensural_f} @tab
4188 @lilypond[relative 0, notime]
4189 \property Staff.TimeSignature \set #'transparent = ##t
4190 \clef "mensural_f" c
4194 @code{clefs-mensural_g} @tab
4195 historic style mensural G clef @tab
4196 @code{mensural_g} @tab
4197 @lilypond[relative 0, notime]
4198 \property Staff.TimeSignature \set #'transparent = ##t
4199 \clef "mensural_g" c
4203 @code{clefs-vaticana_do} @tab
4204 Editio Vaticana style do clef @tab
4205 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3} @tab
4206 @lilypond[relative 0, notime]
4208 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4209 \property Staff.TimeSignature \set #'transparent = ##t
4210 \clef "vaticana_do2" c
4214 @code{clefs-vaticana_fa} @tab
4215 Editio Vaticana style fa clef @tab
4216 @code{vaticana_fa1}, @code{vaticana_fa2} @tab
4217 @lilypond[relative 0, notime]
4219 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4220 \property Staff.TimeSignature \set #'transparent = ##t
4221 \clef "vaticana_fa2" c
4225 @code{clefs-medicaea_do} @tab
4226 Editio Medicaea style do clef @tab
4227 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3} @tab
4228 @lilypond[relative 0, notime]
4230 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4231 \property Staff.TimeSignature \set #'transparent = ##t
4232 \clef "medicaea_do2" c
4236 @code{clefs-medicaea_fa} @tab
4237 Editio Medicaea style fa clef @tab
4238 @code{medicaea_fa1}, @code{medicaea_fa2} @tab
4239 @lilypond[relative 0, notime]
4241 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4242 \property Staff.TimeSignature \set #'transparent = ##t
4243 \clef "medicaea_fa2" c
4247 @code{clefs-hufnagel_do} @tab
4248 historic style hufnagel do clef @tab
4249 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3} @tab
4250 @lilypond[relative 0, notime]
4252 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4253 \property Staff.TimeSignature \set #'transparent = ##t
4254 \clef "hufnagel_do2" c
4258 @code{clefs-hufnagel_fa} @tab
4259 historic style hufnagel fa clef @tab
4260 @code{hufnagel_fa1}, @code{hufnagel_fa2} @tab
4261 @lilypond[relative 0, notime]
4263 \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4
4264 \property Staff.TimeSignature \set #'transparent = ##t
4265 \clef "hufnagel_fa2" c
4269 @code{clefs-hufnagel_do_fa} @tab
4270 historic style hufnagel combined do/fa clef @tab
4271 @code{hufnagel_do_fa} @tab
4272 @lilypond[relative 0, notime]
4273 \property Staff.TimeSignature \set #'transparent = ##t
4274 \clef "hufnagel_do_fa" c
4279 @c --- This should go somewhere else: ---
4280 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4283 @c @code{percussion}
4285 @c @lilypond{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4287 @c @item modern style tab clef (glyph: @code{clefs-tab})
4292 @c @lilypond{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4294 @emph{Modern style} means ``as is typeset in contemporary editions of
4295 transcribed mensural music''.
4297 @emph{Petrucci style} means ``inspired by printings published by the
4298 famous engraver Petrucci (1466-1539)''.
4300 @emph{Historic style} means ``as was typeset or written in historic
4301 editions (other than those of Petrucci)''.
4303 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4305 Petrucci used C clefs with differently balanced left-side vertical
4306 beams, depending on which staffline it is printed.
4310 @subsection Custodes
4315 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4316 symbol that appears at the end of a staff. It anticipates the pitch
4317 of the first note(s) of the following line and thus helps the player
4318 or singer to manage line breaks during performance, thus enhancing
4319 readability of a score.
4321 Custodes were frequently used in music notation until the 17th
4322 century. Nowadays, they have survived only in a few particular forms
4323 of musical notation such as contemporary editions of Gregorian chant
4324 like the @emph{editio vaticana}. There are different custos glyphs
4325 used in different flavours of notational style.
4327 For typesetting custodes, just put a @internalsref{Custos_engraver} into the
4328 @internalsref{Staff} context when declaring the @code{\paper} block,
4329 as shown in the following example.
4335 \consists Custos_engraver
4336 Custos \override #'style = #'mensural
4341 The result looks like this:
4347 \property Staff.Custos \set #'style = #'mensural
4354 \consists Custos_engraver
4361 The custos glyph is selected by the @code{style} property. The styles
4362 supported are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4363 @code{mensural}. They are demonstrated in the following fragment:
4373 { " " \musicglyph #"custodes-vaticana-u0" }
4377 { " " \musicglyph #"custodes-medicaea-u0" }
4381 { " " \musicglyph #"custodes-hufnagel-u0" }
4385 { " " \musicglyph #"custodes-mensural-u0" }
4394 \remove "Bar_number_engraver"
4398 \remove "Clef_engraver"
4399 \remove "Key_engraver"
4400 \remove "Time_signature_engraver"
4401 \remove "Staff_symbol_engraver"
4402 minimumVerticalExtent = ##f
4408 If the boolean property @code{adjust-if-on-staffline} is set to
4409 @code{#t} (which it is by default), lily typesets slightly different
4410 variants of the custos glyph, depending on whether the custos, is
4411 typeset on or between stafflines. The idea is that the glyph will
4412 optically fit well into the staff, with the appendage on the right of
4413 the custos always ending at the same vertical position between two
4414 stafflines regardless of the pitch. If you set
4415 @code{adjust-if-on-staffline} to @code{#f}, then lily takes regardless
4416 of the pitch always a glyph that is a compromise of the former two
4419 Just like stems can be attached to noteheads in two directions
4420 @emph{up} and @emph{down}, each custos glyph is available with its
4421 appendage pointing either up or down. If the pitch of a custos is
4422 above a selectable position, the appendage will point downwards; if
4423 the pitch is below this position, the appendage will point upwards.
4424 Use property @code{neutral-position} to select this position. By
4425 default, it is set to @code{0}, such that the neutral position is the
4426 center of the staff. Use property @code{neutral-direction} to control
4427 what happens if a custos is typeset on the neutral position itself.
4428 By default, this property is set to @code{-1}, such that the appendage
4429 will point downwards. If set to @code{1}, the appendage will point
4430 upwards. Other values such as @code{0} are reserved for future
4431 extensions and should not be used.
4436 @internalsref{Custos}, @inputfileref{input/test,custos-style.ly} and
4437 @inputfileref{input/regression,custos.ly}.
4441 @subsection Divisiones
4447 A @emph{divisio} (plural: @emph{divisiones}; latin word for
4448 `division') is a staff context symbol that is used to structure
4449 Gregorian music into phrases and sections. The musical meaning of
4450 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
4451 can be characterized as short, medium and long pause, somewhat like
4452 @ref{Breath marks}. The @emph{finalis} sign not only marks the end of
4453 a chant, but is also frequently used within a single
4454 antiphonal/responsorial chant to mark the end of each section.
4458 To use divisiones, include the file @code{gregorian-init.ly}. It
4459 contains definitions that you can apply by just inserting
4460 @code{\divisioMinima}, @code{\divisioMaior}, @code{\divisioMaxima},
4461 and @code{\finalis} at proper places in the input. Some editions use
4462 @emph{virgula} or @emph{caesura} instead of divisio minima.
4463 Therefore, @code{gregorian-init.ly} also defines @code{\virgula} and
4467 @lilypondfile[notexidoc]{divisiones.ly}
4471 @internalsref{BreathingSign}, @internalsref{BreathingSignEvent},
4472 @inputfileref{input/test,divisiones.ly}, @ref{Breath marks}.
4475 @subsection Ligatures
4479 @c TODO: Should double check if I recalled things correctly when I wrote
4480 @c down the following paragraph by heart.
4482 In musical terminology, a ligature is a coherent graphical symbol that
4483 represents at least two different notes. Ligatures originally appeared
4484 in the manuscripts of Gregorian chant notation roughly since the 9th
4485 century as an allusion to the accent symbols of greek lyric poetry to
4486 denote ascending or descending sequences of notes. Both, the shape and
4487 the exact meaning of ligatures changed tremendously during the following
4488 centuries: In early notation, ligatures where used for monophonic tunes
4489 (Gregorian chant) and very soon denoted also the way of performance in
4490 the sense of articulation. With upcoming multiphony, the need for a
4491 metric system arised, since multiple voices of a piece have to be
4492 synchronized some way. New notation systems were invented that used
4493 the manifold shapes of ligatures to now denote rhythmical patterns
4494 (e.g. black mensural notation, mannered notation, ars nova). With the
4495 invention of the metric system of the white mensural notation, the need
4496 for ligatures to denote such patterns disappeared. Nevertheless,
4497 ligatures were still in use in the mensural system for a couple of
4498 decades until they finally disappeared during the late 16th / early 17th
4499 century. Still, ligatures have survived in contemporary editions of
4500 Gregorian chant such as the Editio Vaticana from 1905/08.
4504 Syntactically, ligatures are simply enclosed by @code{\[} and
4505 @code{\]}. Some ligature styles (such as Editio Vaticana) may need
4506 additional input syntax specific for this particular type of ligature.
4507 By default, the @internalsref{LigatureBracket} engraver just puts a
4508 square bracket above the ligature.
4510 @lilypond[singleline,verbatim]
4512 \notes \transpose c c' {
4520 To select a specific style of ligatures, a proper ligature engraver has
4521 to be added to the @internalsref{Voice} context, as explained in the
4522 following subsections. Currently, Lilypond only supports white mensural
4523 ligatures with certain limitations. Support for Editio Vaticana will be
4524 added in the future.
4527 * White mensural ligatures::
4530 @node White mensural ligatures
4531 @subsubsection White mensural ligatures
4533 @cindex Mensural ligatures
4534 @cindex White mensural ligatures
4536 There is limited support for white mensural ligatures. The
4537 implementation is still experimental; it currently may output strange
4538 warnings or even crash in some cases or produce weird results on more
4539 complex ligatures. To engrave white mensural ligatures, in the paper
4540 block the @internalsref{Mensural_ligature_engraver} has to be put into
4541 the @internalsref{Voice} context (and you probably want to remove the
4542 @internalsref{Ligature_bracket_engraver}). There is no additional
4543 input language to describe the shape of a white mensural ligature.
4544 The shape is rather determined solely from the pitch and duration of
4545 the enclosed notes. While this approach may take a new user a while
4546 to get accustomed, it has the great advantage that the full musical
4547 information of the ligature is known internally. This is not only
4548 required for correct MIDI output, but also allows for automatic
4549 transcription of the ligatures.
4553 @lilypond[singleline,verbatim]
4555 \notes \transpose c c' {
4556 \property Score.timing = ##f
4557 \property Score.defaultBarType = "empty"
4558 \property Voice.NoteHead \set #'style = #'neo_mensural
4559 \property Staff.TimeSignature \set #'style = #'neo_mensural
4561 \[ g\longa c\breve a\breve f\breve d'\longa \]
4563 \[ e1 f1 a\breve g\longa \]
4568 \remove Ligature_bracket_engraver
4569 \consists Mensural_ligature_engraver
4575 Without replacing @internalsref{Ligature_bracket_engraver} with
4576 @internalsref{Mensural_ligature_engraver}, the same music transcribes
4579 @lilypond[singleline]
4581 \notes \transpose c c' {
4582 \property Score.timing = ##f
4583 \property Score.defaultBarType = "empty"
4584 \property Voice.NoteHead \set #'style = #'neo_mensural
4585 \property Staff.TimeSignature \set #'style = #'neo_mensural
4587 \[ g\longa c\breve a\breve f\breve d'\longa \]
4589 \[ e1 f1 a\breve g\longa \]
4595 @subsection Figured bass
4597 @cindex Basso continuo
4599 @c TODO: musicological blurb about FB
4603 LilyPond has limited support for figured bass:
4605 @lilypond[verbatim,fragment]
4607 \context Voice \notes { \clef bass dis4 c d ais}
4608 \context FiguredBass
4610 < 6 >4 < 7 >8 < 6+ [_!] >
4616 The support for figured bass consists of two parts: there is an input
4617 mode, introduced by @code{\figures}, where you can enter bass figures
4618 as numbers, and there is a context called @internalsref{FiguredBass}
4619 that takes care of making @internalsref{BassFigure} objects.
4621 In figures input mode, a group of bass figures is delimited by
4622 @code{<} and @code{>}. The duration is entered after the @code{>}.
4627 \context FiguredBass
4631 Accidentals are added to the numbers if you alterate them by
4632 appending @code{-}, @code{!} and @code{+}.
4638 \context FiguredBass
4639 \figures { <4- 6+ 7!> }
4642 Spaces or dashes may be inserted by using @code{_}. Brackets are
4643 introduced with @code{[} and @code{]}.
4649 \context FiguredBass
4650 \figures { < [4 6] 8 [_ 12]> }
4653 Although the support for figured bass may superficially resemble chord
4654 support, it works much simpler. The @code{\figures} mode simply
4655 stores the numbers , and @internalsref{FiguredBass} context prints
4656 them as entered. There is no conversion to pitches, and no
4657 realizations of the bass are played in the MIDI file.
4659 Internally, the code produces markup texts. You can use any of the
4660 markup text properties to override formatting. For example, the
4661 vertical spacing of the figures may be set with @code{baseline-skip}.
4665 @internalsref{BassFigureEvent} music, @internalsref{BassFigure} grob,
4666 @internalsref{FiguredBass} context
4670 Slash notation for alterations is not supported.
4673 @node Contemporary notation
4674 @section Contemporary notation
4676 In the 20th century, composers have greatly expanded the musical
4677 vocabulary. With this expansion, many innovations in musical notation
4678 have been tried. For a comprehensive overview, refer to @cite{Stone
4679 1980} (see @ref{Literature}). In general, the use of new, innovative
4680 notation makes a piece harder to understand and perform and its use
4681 should be avoided if possible. For this reason, support for
4682 contemporary notation in LilyPond is limited.
4691 @subsection Clusters
4695 In musical terminology, a @emph{cluster} denotes a range of
4696 simultaneously sounding pitches that may change over time. The set of
4697 available pitches to apply usually depends on the accoustic source.
4698 Thus, in piano music, a cluster typically consists of a continous range
4699 of the semitones as provided by the piano's fixed set of a chromatic
4700 scale. In choral music, each singer of the choir typically may sing an
4701 arbitrary pitch within the cluster's range that is not bound to any
4702 diatonic, chromatic or other scale. In electronic music, a cluster
4703 (theoretically) may even cover a continuous range of pitches, thus
4704 resulting in coloured noise, such as pink noise.
4706 Clusters can be denoted in the context of ordinary staff notation by
4707 engraving simple geometrical shapes that replace ordinary notation of
4708 notes. Ordinary notes as musical events specify starting time and
4709 duration of pitches; however, the duration of a note is expressed by the
4710 shape of the note head rather than by the horizontal graphical extent of
4711 the note symbol. In contrast, the shape of a cluster geometrically
4712 describes the development of a range of pitches (vertical extent) over
4713 time (horizontal extent). Still, the geometrical shape of a cluster
4714 covers the area in wich any single pitch contained in the cluster would
4715 be notated as an ordinary note. From this point of view, it is
4716 reasonable to specify a cluster as the envelope of a set of notes.
4720 A cluster is engraved as the envelope of a set of notes. The starting
4721 note is marked with @code{\startCluster}, and the ending note with
4722 @code{\stopCluster}, e.g.,
4730 The following example (from
4731 @inputfileref{input/regression,cluster.ly}) shows what the result
4734 @lilypondfile[notexidoc]{cluster.ly}
4736 By default, @internalsref{Cluster_engraver} is in the
4737 @internalsref{Voice} context. This allows putting ordinary notes and
4738 clusters together in the same staff, even simultaneously. In such a
4739 case no attempt is made to automatically avoid collisions between
4740 ordinary notes and clusters.
4744 @internalsref{Cluster}, @inputfileref{input/regression,cluster.ly},
4745 @internalsref{Cluster_engraver}, @internalsref{ClusterEvent}.
4749 When a cluster is active, note heads must be switched off manually using
4752 Music expressions like @code{< @{ g8 e8 @} a4 >} are not printed
4753 accurately. Use @code{<<g a>>8 <<e a>>8} instead.
4758 @subsection Fermatas
4764 Contemporary music notation frequently uses special fermata symbols to
4765 indicate fermatas of differing lengths.
4769 The following are supported
4771 @lilypond[singleline]
4794 \context Lyrics \lyrics {
4795 "shortfermata" "fermata" "longfermata" "verylongfermata"
4800 See @ref{Articulations} for general instructions how to apply scripts
4801 such as fermatas to a @code{\notes@{@}} block.
4804 @section Tuning output
4806 As much formatting as possible is performed
4807 automatically. Nevertheless, there are situations where LilyPond needs
4808 some help, or where you want to override its decisions. In this
4809 section we discuss ways to do just that.
4811 Formatting is internally done by manipulating so called objects (graphic
4812 objects). Each object carries with it a set of properties (object
4813 properties) specific to that object. For example, a stem object has
4814 properties that specify its direction, length and thickness.
4816 The most direct way of tuning the output is by altering the values of
4817 these properties. There are two ways of doing that: first, you can
4818 temporarily change the definition of one type of object, thus
4819 affecting a whole set of objects. Second, you can select one specific
4820 object, and set a object property in that object.
4830 @node Tuning objects
4831 @subsection Tuning objects
4833 @cindex object description
4835 The definition of an object is actually a list of default object
4836 properties. For example, the definition of the Stem object (available
4837 in @file{scm/grob-description.scm}), includes the following definitions for
4842 (beamed-lengths . (0.0 2.5 2.0 1.5))
4843 (Y-extent-callback . ,Stem::height)
4848 By adding variables on top of these existing definitions, the system
4849 defaults is overriden, and the appearance of a graphical objects is
4855 Changing a variable for only one object is commonly achieved with
4859 \once \property @var{context}.@var{grobname}
4860 \override @var{symbol} = @var{value}
4862 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4863 and @var{grobname} is a string and @var{value} is a Scheme expression.
4864 This command applies a setting only during one moment in the score.
4866 In the following example, only one @internalsref{Stem} object is
4867 changed from its original setting:
4869 @lilypond[verbatim, fragment, relative=1]
4871 \once \property Voice.Stem \set #'thickness = #4
4875 @cindex @code{\once}
4877 For changing more objects, the same command, without @code{\once} can
4880 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4882 This command adds @code{@var{symbol} = @var{value}} to the definition
4883 of @var{grobname} in the context @var{context}, and this definition
4884 stays in place until it is removed.
4886 An existing definition may be removed by the following command
4889 \property @var{context}.@var{grobname} \revert @var{symbol}
4892 All @code{\override} and @code{\revert} commands should be balanced.
4893 The @code{\set} shorthand, performs a revert followed by an override,
4894 and is often more convenient to use
4897 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4901 @lilypond[verbatim,quote]
4902 c'4 \property Voice.Stem \override #'thickness = #4.0
4904 c'4 \property Voice.Stem \revert #'thickness
4908 The following example gives exactly the same result as the previous
4909 one (assuming the system default for stem thickness is 0.8).
4911 @lilypond[verbatim,quote]
4912 c'4 \property Voice.Stem \set #'thickness = #4.0
4914 c'4 \property Voice.Stem \set #'thickness = #0.8
4918 If you revert a setting which was not set in the first place, then it
4919 has no effect. However, if the setting was set as a system default, it
4920 may remove the default value, and this may give surprising results,
4921 including crashes. In other words, @code{\override} and
4922 @code{\revert}, must be carefully balanced.
4924 These are examples of correct nesting of @code{\override}, @code{\set},
4927 A clumsy but correct form:
4929 \override \revert \override \revert \override \revert
4932 Shorter version of the same:
4934 \override \set \set \revert
4937 A short form, using only @code{\set}. This requires you to know the
4940 \set \set \set \set @var{to default value}
4943 If there is no default (i.e. by default, the object property is unset),
4946 \set \set \set \revert
4949 For the digirati, the object description is an Scheme association
4950 list. Since a Scheme list is a singly linked list, we can treat it as
4951 a stack, and @code{\override} and @code{\revert} are push and pop
4952 operations. The association list is stored in a normal context
4955 \property Voice.NoteHead = #'()
4957 will effectively erase @internalsref{NoteHead}s from the current
4958 @internalsref{Voice}. However, this mechanism is not guaranteed to
4959 work, and may cause crashes or other anomalous behavior.
4963 @internalsref{OverrideProperty}, @internalsref{RevertProperty},
4964 @internalsref{PropertySet}, @internalsref{backend properties},
4965 @internalsref{All Graphical Objects}.
4970 LilyPond will hang or crash if @var{value} contains cyclic references.
4971 The backend is not very strict in type-checking object properties. If you
4972 @code{\revert} properties that are expected to be set by default,
4977 @subsection Applyoutput
4979 The most versatile way of tuning object is @code{\applyoutput}. Its
4982 \applyoutput @var{proc}
4984 where @var{proc} is a Scheme function, taking four arguments.
4986 When interpreted, the function @var{proc} is called for every grob found
4987 in the context, with the following arguments:
4989 @item the grob itself
4990 @item the context where the grob was created
4991 @item the context where @code{\applyoutput} is processed.
4994 In addition, the cause of the grob, i.e. the music expression or object
4995 that was responsible for creating the object, is in the object property
4996 @code{cause}. For example, for a note head, this is a
4997 @internalsref{NoteHead} event, and for a @internalsref{Stem} object,
4998 this is a @internalsref{NoteHead} object.
5001 @node Outputproperty
5002 @subsection Outputproperty
5004 @cindex \outputproperty
5006 Another way of tuning objects is the more arcane @code{\outputproperty}
5007 feature. The syntax is as follows:
5009 \outputproperty @var{predicate} @var{symbol} = @var{value}
5011 Here @code{predicate} is a Scheme function taking an object argument, and
5012 returning a boolean. This statement is processed by the
5013 @code{Output_property_engraver}. It instructs the engraver to feed all
5014 objects that it sees to @var{predicate}. Whenever the predicate returns
5015 true, the object property @var{symbol} will be set to @var{value}.
5017 You will need to combine this statement with @code{\context} to select
5018 the appropriate context to apply this to.
5019 @inputfileref{input/regression,output-property.ly} shows an example of
5020 the use of @code{\outputproperty}.
5024 If possible, avoid this feature: the semantics are not very clean, and
5025 the syntax and semantics are up for rewrite.
5028 @node Font selection
5029 @subsection Font selection
5031 The most common thing to change about the appearance of fonts is
5032 their size. The font size of any context can be easily
5033 changed by setting the @code{fontSize} property for that context:
5035 @lilypond[fragment,relative=1,verbatim,quote]
5036 c4 c4 \property Voice.fontSize = #-1
5039 This command will set @code{font-relative-size} (see below),
5040 and does not change the size of variable symbols, such as
5041 beams or slurs. You can use this command to get smaller symbol for
5042 cue notes, but that involves some more subtleties. An elaborate
5043 example of those is in @inputfileref{input/test,cue-notes.ly}.
5045 @cindex magnification
5047 The size of the font may be scaled with the object property
5048 @code{font-magnification}. For example, @code{2.0} blows up all
5049 letters by a factor 2 in both directions.
5058 The font used for printing a object can be selected by setting
5059 @code{font-name}, e.g.
5061 \property Staff.TimeSignature
5062 \set #'font-name = #"cmr17"
5064 You may use any font which is available to @TeX{}, such as foreign
5065 fonts or fonts that do not belong to the Computer Modern font family.
5067 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
5068 can also be adjusted with a more fine-grained mechanism. By setting
5069 the object properties described below, you can select a different font.
5070 All three mechanisms work for every object that supports
5071 @code{font-interface}.
5075 A symbol indicating the general class of the typeface. Supported are
5076 @code{roman} (Computer Modern), @code{braces} (for piano staff
5077 braces), @code{music} (the standard music font), @code{ancient} (the
5078 ancient notation font) @code{dynamic} (font for dynamic signs) and
5082 A symbol indicating the shape of the font, there are typically several
5083 font shapes available for each font family. Choices are @code{italic},
5084 @code{caps} and @code{upright}
5087 A symbol indicating the series of the font. There are typically several
5088 font series for each font family and shape. Choices are @code{medium}
5091 @item font-relative-size
5092 A number indicating the size relative the standard size. For example,
5093 with 20pt staff height, relative size -1 corresponds to 16pt staff
5094 height, and relative size +1 corresponds to 23 pt staff height.
5096 There are small differences in design between fonts designed for
5097 different sizes, hence font-relative-size is the preferred way to
5101 @item font-design-size
5102 A number indicating the design size of the font.
5104 This is a feature of the Computer Modern Font: each point size has a
5105 slightly different design. Smaller design sizes are relatively wider,
5106 which enhances readability.
5109 For any of these properties, the value @code{*} (i.e. the symbol
5110 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
5111 to override default setting, which are always present. For example:
5113 \property Lyrics.LyricText \override #'font-series = #'bold
5114 \property Lyrics.LyricText \override #'font-family = #'typewriter
5115 \property Lyrics.LyricText \override #'font-shape = #'*
5118 @cindex @code{font-style}
5124 Relative size is not linked to any real size.
5126 There is no style sheet provided for other fonts besides the @TeX{}
5127 family, and the style sheet cannot be modified easily.
5129 @cindex font selection
5130 @cindex font magnification
5131 @cindex @code{font-interface}
5135 @subsection Text markup
5140 @cindex typeset text
5142 LilyPond has an internal mechanism to typeset texts. You can access it
5143 with the keyword @code{\markup}. Within markup mode, you can enter texts
5144 similar to lyrics: simply enter them, surrounded by spaces.
5147 @lilypond[verbatim,fragment,relative=1]
5148 c1^\markup { hello }
5149 c1_\markup { hi there }
5150 c1^\markup { hi \bold there, is \italic anyone home? }
5153 @cindex font switching
5155 The line of the example demonstrates font switching commands. The
5156 command only apply to the first following word; enclose a set of texts
5157 with braces to apply a command to more words.
5159 \markup @{ \bold @{ hi there @} @}
5161 For clarity, you can also do this for single arguments, e.g.
5163 \markup @{ is \italic @{ anyone @} home @}
5166 @cindex font size, texts
5168 The following size commands set abolute sizes
5184 You can also make letter larger or smaller relative to their neighbors,
5185 with the commands @code{\larger} and @code{\smaller}.
5189 @cindex font style, for texts
5195 The following font change commands are defined:
5198 This changes to the font used for dynamic signs. This font does not
5199 contain all characters of the alphabet, so when producing ``piu f'',
5200 the ``piu'' should be done in a different font.
5204 This changes to the font used for time signatures. It only contains
5205 numbers and a few punctuation marks.
5207 Changes @code{font-shape} to @code{italic}
5209 Changes @code{font-series} to @code{bold}
5212 @cindex raising text
5213 @cindex lowering text
5215 @cindex translating text
5220 Raising and lowering texts can be done with @code{\super} and
5223 @lilypond[verbatim,fragment,relative=1]
5224 c1^\markup { E "=" mc \super "2" }
5229 If you want to give an explicit amount for lowering or raising, use
5230 @code{\raise}. This command takes a Scheme valued first argument, and
5231 a markup object as second argument
5233 @lilypond[verbatim,fragment,relative=1,quote]
5234 c1^\markup { C \small \raise #1.0 \bold { "9/7+" }}
5236 The argument to @code{\raise} is the vertical displacement amount,
5237 measured in (global) staff spaces.
5239 Other commands taking single arguments include
5242 @item \bracket, \hbracket
5243 Bracket the argument markup with normal and horizontal brackets
5248 This is converted to a musical symbol, e.g. @code{\musicglyph
5249 #"accidentals-0"} will select the natural sign from the music font.
5250 See @ref{The Feta font} for a complete listing of the possible glyphs.
5252 This produces a single character, e.g. @code{\char #65} produces the
5255 @item \hspace #@var{amount}
5257 This produces a invisible object taking horizontal space.
5259 \markup @{ A \hspace #2.0 B @}
5261 will put extra space between A and B, on top of the space that is
5262 normally inserted before elements on a line.
5264 @item \fontsize #@var{size}
5266 This sets the relative font size, eg.
5268 A \fontsize #2 @{ B C @} D
5272 This will enlarge the B and the C by two steps.
5273 @item \translate #(cons @var{x} @var{y})
5275 This translates an object. Its first argument is a cons of numbers
5277 A \translate #(cons 2 -3) @{ B C @} D
5279 This moves `B C' 2 spaces to the right, and 3 down.
5281 @item \magnify #@var{mag}
5283 This sets the font magnification for the its argument. In the following
5284 example, the middle A will be 10% larger.
5286 A \magnify #1.1 @{ A @} A
5290 @item \override #(@var{key} . @var{value})
5292 This overrides a formatting property for its argument. The argument
5293 should be a key/value pair, e.g.
5295 m \override #'(font-family . math) m m
5299 In markup mode you can compose expressions, similar to mathematical
5300 expressions, XML documents and music expressions. The braces group
5301 notes into horizontal lines. Other types of lists also exist: you can
5302 stack expressions grouped with @code{<<}, and @code{>>} vertically with
5303 the command @code{\column}. Similarly, @code{\center} aligns texts by
5306 @lilypond[verbatim,fragment,relative=1]
5307 c1^\markup { \column << a bbbb c >> }
5308 c1^\markup { \center << a bbbb c >> }
5309 c1^\markup { \line << a b c >> }
5312 The markup mechanism is very flexible and extensible. Refer to
5313 @file{scm/new-markup.scm} for more information on extending the markup
5320 @internalsref{Markup functions}, @file{scm/new-markup.scm}
5327 Text layout is ultimately done by @TeX{}, which does kerning of
5328 letters. LilyPond does not account for kerning, so texts will be
5329 spaced slightly too wide.
5331 Syntax errors for markup mode are confusing.
5335 @section Global layout
5337 The global layout determined by three factors: the page layout, the
5338 line breaks and the spacing. These all influence each other. The
5339 choice of spacing determines how densely each system of music is set,
5340 which influences where line breaks breaks are chosen, and thus
5341 ultimately how many pages a piece of music takes. In this section we
5342 will explain how the lilypond spacing engine works, and how you can
5345 Globally spoken, this procedure happens in three steps: first,
5346 flexible distances (``springs'') are chosen, based on durations. All
5347 possible line breaking combination are tried, and the one with the
5348 best results---a layout that has uniform density and requires as
5349 little stretching or cramping as possible---is chosen. When the score
5350 is processed by @TeX{}, page are filled with systems, and page breaks
5351 are chosen whenever the page gets full.
5356 * Vertical spacing::
5357 * Horizontal spacing::
5364 @node Vertical spacing
5365 @subsection Vertical spacing
5367 @cindex vertical spacing
5368 @cindex distance between staves
5369 @cindex staff distance
5370 @cindex between staves, distance
5371 @cindex staffs per page
5374 The height of each system is determined automatically by lilypond, to
5375 keep systems from bumping into each other, some minimum distances are
5376 set. By changing these, you can put staves closer together, and thus
5377 put more systems onto one page.
5379 Normally staves are stacked vertically. To make
5380 staves maintain a distance, their vertical size is padded. This is
5381 done with the property @code{minimumVerticalExtent}. It takes a pair
5382 of numbers, so if you want to make it smaller from its, then you could
5385 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5387 This sets the vertical size of the current staff to 4 staff-space on
5388 either side of the center staff line. The argument of
5389 @code{minimumVerticalExtent} is interpreted as an interval, where the
5390 center line is the 0, so the first number is generally negative. The
5391 staff can be made larger at the bottom by setting it to @code{(-6
5394 The piano staves are handled a little differently: to make cross-staff
5395 beaming work correctly, it necessary that the distance between staves
5396 is fixed. This is also done with a @internalsref{VerticalAlignment}
5397 object, created in @internalsref{PianoStaff}. In this object the
5398 distance between the staves is fixed by setting
5399 @code{forced-distance}. If you want to override this, use a
5400 @code{\translator} block as follows:
5404 VerticalAlignment \override #'forced-distance = #9
5407 This would bring the staves together at a distance of 9 staff spaces,
5408 measured from the center line of each staff.
5412 Vertical aligment of staves is handled by the
5413 @internalsref{VerticalAlignment} object.
5417 @node Horizontal spacing
5418 @subsection Horizontal Spacing
5420 The spacing engine translates differences in durations into
5421 stretchable distances (``springs'') of differing lengths. Longer
5422 durations get more space, shorter durations get less. The shortest
5423 durations get a fixed amount of space (which is controlled by
5424 @code{shortest-duration-space} in the @internalsref{SpacingSpanner}
5425 object). The longer the duration, the more space it gets: doubling a
5426 duration adds a fixed amount (this amount is controlled by
5427 @code{spacing-increment}) of space to the note.
5429 For example, the following piece contains lots of half, quarter and
5430 8th notes, the eighth note is followed by 1 note head width (NHW). The
5431 The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5432 @lilypond[fragment, verbatim, relative=1] c2 c4. c8 c4. c8 c4. c8 c8
5436 Normally, @code{shortest-duration-space} is set to 1.2, which is the
5437 width of a note head, and @code{shortest-duration-space} is set to
5438 2.0, meaning that the shortest note gets 2 NHW (2 times
5439 @code{shortest-duration-space}) of space. For normal notes, this space
5440 is always counted from the left edge of the symbol, so the shortest
5441 notes are generally followed by one NHW of space.
5443 If one would follow the above procedure exactly, then adding a single
5444 32th note to a score that uses 8th and 16th notes, would widen up the
5445 entire score a lot. The shortest note is no longer a 16th, but a 32nd,
5446 thus adding 2 noteheads of space to every note. To prevent this, the
5447 shortest duration for spacing is not the shortest note in the score,
5448 but the most commonly found shortest note. Notes that are even
5449 shorter this are followed by a space that is proportonial to their
5450 duration relative to the common shortest note. So if we were to add
5451 only a few 16th notes to the example above, they would be followed by
5454 @lilypond[fragment, verbatim, relative=2]
5455 c2 c4. c8 c4. c16-[ c-] c4. c8 c8 c8 c4 c4 c4
5458 The most common shortest duration is determined as follows: in every
5459 measure, the shortest duration is determined. The most common short
5460 duration, is taken as the basis for the spacing, with the stipulation
5461 that this shortest duration should always be equal to or shorter than
5462 1/8th note. The shortest duration is printed when you run lilypond
5463 with @code{--verbose}. These durations may also be customized. If you
5464 set the @code{common-shortest-duration} in
5465 @internalsref{SpacingSpanner}, then this sets the base duration for
5466 spacing. The maximum duration for this base (normally 1/8th), is set
5467 through @code{base-shortest-duration}.
5469 @cindex @code{common-shortest-duration}
5470 @cindex @code{base-shortest-duration}
5471 @cindex @code{stem-spacing-correction}
5472 @cindex @code{spacing}
5474 In the introduction it was explained that stem directions influence
5475 spacing. This is controlled with @code{stem-spacing-correction}
5476 property in @internalsref{NoteSpacing}, which are generated for every
5477 @internalsref{Voice} context. The @code{StaffSpacing} object
5478 (generated at @internalsref{Staff} context) contains the same property
5479 for controlling the stem/barline spacing. In the following example
5480 shows these corrections, once with default settings, and once with
5481 exaggerated corrections.
5487 \property Staff.NoteSpacing \override #'stem-spacing-correction
5489 \property Staff.StaffSpacing \override #'stem-spacing-correction
5494 \paper { raggedright = ##t } }
5497 @cindex SpacingSpanner, overriding properties
5499 Properties of the @internalsref{SpacingSpanner} must be overriden
5500 from the @code{\paper} block, since the @internalsref{SpacingSpanner}
5501 is created before any @code{\property} statements are interpreted.
5503 \paper @{ \translator @{
5505 SpacingSpanner \override #'spacing-increment = #3.0
5512 @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
5513 @internalsref{StaffSpacing}, @internalsref{SeparationItem},
5514 @internalsref{SeparatingGroupSpanner}.
5518 Spacing is determined on a score wide basis. If you have a score that
5519 changes its character (measured in durations) halfway during the
5520 score, the part containing the longer durations will be spaced too
5523 There is no convenient mechanism to manually override spacing.
5528 @subsection Font size
5529 @cindex font size, setting
5530 @cindex staff size, setting
5531 @cindex @code{paper} file
5533 The Feta font provides musical symbols at seven different sizes.
5534 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5535 point, and 26 point. The point size of a font is the height of the
5536 five lines in a staff when displayed in the font.
5538 Definitions for these sizes are the files @file{paperSZ.ly}, where
5539 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5540 of these files, the variables @code{paperEleven},
5541 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5542 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5543 are defined respectively. The default @code{\paper} block is also
5544 set. These files should be imported at toplevel, i.e.
5546 \include "paper26.ly"
5550 The font definitions are generated using a Scheme function. For more
5551 details, see the file @file{scm/font.scm}.
5556 @subsection Line breaking
5559 @cindex breaking lines
5561 Line breaks are normally computed automatically. They are chosen such
5562 that lines look neither cramped nor loose, and that consecutive lines
5563 have similar density.
5565 Occasionally you might want to override the automatic breaks; you can
5566 do this by specifying @code{\break}. This will force a line break at
5567 this point. Line breaks can only occur at places where there are bar
5568 lines. If you want to have a line break where there is no bar line,
5569 you can force an invisible bar line by entering @code{\bar
5570 ""}. Similarly, @code{\noBreak} forbids a line break at a
5574 @cindex regular line breaks
5575 @cindex four bar music.
5577 If you want linebreaks at regular intervals, you can use the following:
5579 < \repeat unfold 7 @{ s1 * 4 \break @}
5580 @emph{the real music}
5583 This makes the following 28 measures (assuming 4/4 time) be broken every
5588 @internalsref{BreakEvent}
5592 @subsection Page layout
5595 @cindex breaking pages
5597 @cindex @code{indent}
5598 @cindex @code{linewidth}
5600 The most basic settings influencing the spacing are @code{indent} and
5601 @code{linewidth}. They are set in the @code{\paper} block. They
5602 control the indentation of the first line of music, and the lengths of
5605 If @code{raggedright} is set to true in the @code{\paper}
5606 block, then the lines are justified at their natural length. This
5607 useful for short fragments, and for checking how tight the natural
5611 @cindex vertical spacing
5613 The page layout process happens outside lilypond: variables
5614 controlling page layout are passed to the output, and are further
5615 interpreted by @code{ly2dvi}. @code{ly2dvi} responds to the following
5616 variables in the @code{\paper} block. The variable @code{textheight}
5617 sets the total height of the music on each page. The spacing between
5618 systems is controlled with @code{interscoreline}, its default is 16pt.
5619 The distance between the score lines will stretch in order to fill the
5620 full page @code{interscorelinefill} is set to a positive number. In
5621 that case @code{interscoreline} specifies the minimum spacing.
5623 @cindex @code{textheight}
5624 @cindex @code{interscoreline}
5625 @cindex @code{interscorelinefill}
5627 If the variable @code{lastpagefill} is defined,
5628 @c fixme: this should only be done if lastpagefill == #t
5629 systems are evenly distributed vertically on the last page. This
5630 might produce ugly results in case there are not enough systems on the
5631 last page. The @command{lilypond-book} command ignores
5632 @code{lastpagefill}. See @ref{lilypond-book manual} for more
5635 @cindex @code{lastpagefill}
5637 Page breaks are normally computed by @TeX{}, so they are not under
5638 direct control of LilyPond. However, you can insert a commands into
5639 the @file{.tex} output to instruct @TeX{} where to break pages. This
5640 is done by setting the @code{between-systems-strings} on the
5641 @internalsref{NonMusicalPaperColumn} where the system is broken.
5642 An example is shown in @inputfileref{input/regression,between-systems.ly}.
5646 @cindex @code{papersize}
5648 To change the paper size, you must first set the
5649 @code{papersize} paper variable variable. Set it to
5650 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5651 specification, you must set the font as described above. If you want
5652 the default font, then use the 20 point font.
5655 \paper@{ papersize = "a4" @}
5656 \include "paper16.ly"
5659 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5660 will set the paper variables @code{hsize} and @code{vsize} (used by
5661 Lilypond and @code{ly2dvi})
5666 @ref{Invoking ly2dvi},
5667 @inputfileref{input/regression,between-systems.ly},
5668 @internalsref{NonMusicalPaperColumn}.
5672 There is no concept of page breaking, which makes it difficult to
5673 choose sensible page breaks in multi-page pieces.
5682 Entered music can also be converted to MIDI output. The performance
5683 is good enough for proof-hearing the music for errors.
5686 Ties, dynamics and tempo changes are interpreted. Dynamic marks,
5687 crescendi and decrescendi translate into MIDI volume levels. Dynamic
5688 marks translate to a fixed fraction of the available MIDI volume
5689 range, crescendi and decrescendi make the the volume vary linearly
5690 between their two extremities. The fractions be adjusted by
5691 @code{dynamicAbsoluteVolumeFunction} in @internalsref{Voice} context.
5693 For each type of musical instrument (that MIDI supports), a volume range
5694 can be defined. This gives you basic equalizer control, which can
5695 enhance the quality of the MIDI output remarkably. The equalizer
5696 can be controlled by setting @code{instrumentEqualizer}.
5698 Both loudness controls are combined to produce the final MIDI volume.
5702 Many musically interesting effects, such as swing, articulation,
5703 slurring, etc., are translated to MIDI.
5708 * MIDI instrument names::
5713 @subsection MIDI block
5717 The MIDI block is analogous to the paper block, but it is somewhat
5718 simpler. The @code{\midi} block can contain:
5722 @item a @code{\tempo} definition
5723 @item context definitions
5726 Assignments in the @code{\midi} block are not allowed.
5730 @cindex context definition
5732 Context definitions follow precisely the same syntax as within the
5733 \paper block. Translation modules for sound are called performers.
5734 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5737 @node MIDI instrument names
5738 @subsection MIDI instrument names
5740 @cindex instrument names
5741 @cindex @code{Staff.midiInstrument}
5742 @cindex @code{Staff.instrument}
5744 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5745 property or, if that property is not set, the @code{Staff.instrument}
5746 property. The instrument name should be chosen from the list in
5747 @ref{MIDI instruments}.
5751 If the selected string does not exactly match, then LilyPond uses the
5752 default (Grand Piano). It is not possible to select an instrument by