1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
12 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
15 This section discusses rhythms, durations, and bars.
20 * Displaying rhythms::
23 * Special rhythmic concerns::
28 @subsection Writing rhythms
37 @unnumberedsubsubsec Durations
44 When entering notes, durations are designated by numbers and dots:
45 durations are entered as their reciprocal values. For example, a
46 quarter note is entered using a @code{4} (since it is a 1/4 note),
47 while a half note is entered using a @code{2} (since it is a 1/2
48 note). For notes longer than a whole you must use the
49 @code{\longa} (a double breve) and @code{\breve} commands. Note
50 durations as short as 64th notes may be specified.
52 @c Two 64th notes are needed to obtain beams
53 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
60 and the same durations with automatic beaming turned off
61 see @ref{Automatic beams}:
63 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
70 If the duration is omitted then it is set to the previously
71 entered duration. The default for the first note is a quarter
74 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
81 To obtain dotted note lengths, simply add a dot (@samp{.}) to the
82 number. Double-dotted notes are produced in a similar way.
84 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
85 a4 b c4. b8 a4. b4.. c8.
88 Some durations cannot be entered using only binary durations
89 and dots, and can only be represented by tying two or more
90 notes together. Tied notes are covered in @ref{Ties}.
94 Dots are normally moved up to avoid staff lines, except in
95 polyphonic situations. The following commands may be used to
96 force a particular direction manually
102 @funindex \dotsNeutral
105 @c TODO: after deciding the link question, fix these. -gp
106 Durations are entered in the same way in @code{drummode},
107 @code{chordmode}, @code{figuremode} and (optionally)
112 For ways of specifying durations for the syllables of lyrics
113 and ways of aligning lyrics to notes see
114 This manual: @ref{Vocal music}
116 For a description of how to enter rests see
117 This manual: @ref{Writing rests}
119 A note with the duration of a quadruple breve may be
120 entered with \maxima, but this is supported only within
121 ancient music notation.
122 See this manual: @ref{Ancient notation}
124 Optionally, notes can be spaced proportionately to their duration.
125 For details of this and other settings which control
126 proportional notation see @ref{Proportional notation}.
128 Program reference: @internalsref{Dots}, and
129 @internalsref{DotColumn}.
133 @unnumberedsubsubsec Tuplets
139 @c TODO Add Tuplet to glossary
141 Tuplets are made out of a music expression by multiplying all
142 durations with a fraction
145 \times @var{fraction} @var{musicexpr}
149 The duration of @var{musicexpr} will be multiplied by the
150 fraction. The fraction's denominator will be printed over or
151 under the notes, optionally with a bracket. The most common
152 tuplet is the triplet in which 3 notes have the length of 2, so
153 the notes are 2/3 of their written length.
155 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
156 g4 \times 2/3 {c4 c c} d4 d4
159 Tuplets may be nested, for example,
161 @lilypond[fragment,ragged-right,verbatim,relative=2]
162 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
165 \times 3/5 { a a a a a }
173 @funindex \tupletDown
175 @funindex \tupletNeutral
176 @code{\tupletNeutral}.
181 @funindex tupletNumberFormatFunction
182 @cindex tuplet formatting
184 The property @code{tupletSpannerDuration} specifies how long each
185 bracket should last. With this, you can make lots of tuplets
186 while typing @code{\times} only once, thus saving lots of typing.
187 In the next example, there are two triplets shown, while
188 @code{\times} was only used once
190 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
191 \set tupletSpannerDuration = #(ly:make-moment 1 4)
192 \times 2/3 { c8 c c c c c }
196 For more information about @code{make-moment}, see
197 @ref{Time administration}.
199 The format of the number is determined by the property @code{text}
200 in @code{TupletNumber}. The default prints only the denominator,
201 but if it is set to the function
202 @code{tuplet-number::calc-fraction-text}, @var{num}:@var{den} will
205 To avoid printing tuplet numbers, use
207 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
208 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
209 \override TupletNumber #'transparent = ##t
210 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
213 Use the @code{\tweak} function to override nested tuplets
214 beginning at the same music moment. In this example,
215 @code{\tweak} specifies fraction text for the outer
216 @code{TupletNumber} and denominator text for the
217 @code{TupletNumber} of the first of the three inner tuplets.
219 @lilypond[quote,ragged-right,verbatim,relative=2]
221 \tweak #'text #tuplet-number::calc-fraction-text
223 \tweak #'text #tuplet-number::calc-denominator-text
224 \times 2/3 { c8[ c8 c8] }
225 \times 2/3 { c8[ c8 c8] }
226 \times 2/3 { c8[ c8 c8] }
231 Here @code{\tweak} and @code{\override} work together to specify
232 @code{TupletBracket} direction. The first @code{\tweak} positions
233 the @code{TupletBracket} of the outer tuplet above the staff. The
234 second @code{\tweak} positions the @code{TupletBracket} of the
235 first of the three inner tuplets below the staff. Note that this
236 pair of @code{\tweak} functions affects only the outer tuplet and
237 the first of the three inner tuplets because only those two
238 tuplets begin at the same music moment. We use @code{\override}
239 in the usual way to position the @code{TupletBrackets} of the
240 second and third of the inner tuplets below the staff.
242 @lilypond[quote,ragged-right,verbatim,relative=2]
244 \tweak #'text #tuplet-number::calc-fraction-text
245 \tweak #'direction #up
247 \tweak #'direction #down
248 \times 2/3 { c8[ c8 c8] }
249 \override TupletBracket #'direction = #down
250 \times 2/3 { c8[ c8 c8] }
251 \times 2/3 { c8[ c8 c8] }
256 Tuplet brackets can be made to run to prefatory matter or the next
259 @lilypond[ragged-right]
261 \set tupletFullLength = ##t
266 \set tupletFullLengthNote = ##t
276 Tuplets which cross barlines will prevent a line break at that
281 Program reference: @internalsref{TupletBracket},
282 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
286 @node Scaling durations
287 @unnumberedsubsubsec Scaling durations
289 You can alter the length of duration by a fraction @var{N/M}
290 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).
291 This will not affect the appearance of the notes or rests
292 produced. These may be combined such as @samp{*M*N}.
294 In the following example, the first three notes take up exactly
295 two beats, but no triplet bracket is printed.
297 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
299 a4*2/3 gis4*2/3 a4*2/3
307 This manual: @ref{Tuplets}.
313 @subsection Writing rests
318 * Multi measure rests::
322 @unnumberedsubsubsec Rests
329 Rests are entered like notes with the note name @code{r}
331 @c \time 16/1 is used to avoid spurious barlines
332 @c and long tracts of empty bars
333 @lilypond[fragment,quote,ragged-right,verbatim]
336 \override Staff.TimeSignature #'stencil = ##f
338 r\longa r\breve r1 r2
343 Whole bar rests, centered in middle of the bar, must be entered as
344 multi-measure rests. They can be used for a single bar as well as
345 many bars, and are discussed in @ref{Multi measure rests}.
347 To explicitly specify a rest's vertical position, write a note
348 followed by @code{\rest}. A rest will be placed in the position
349 where the note would appear,
351 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
356 This makes manual formatting of polyphonic music much easier,
357 since the automatic rest collision formatter will leave these
362 Program reference: @internalsref{Rest}.
366 @unnumberedsubsubsec Skips
369 @cindex Invisible rest
374 An invisible rest (also called a @q{skip}) can be entered like a
375 note with note name @samp{s} or with @code{\skip @var{duration}}
377 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
378 a4 a4 s4 a4 \skip 1 a4
381 The @code{s} syntax is only available in note mode and chord mode.
382 In other situations, for example, when entering lyrics, you should
383 use the @code{\skip} command
385 @lilypond[quote,ragged-right,verbatim,relative=2]
388 \new Lyrics \lyricmode { \skip 2 bla2 }
392 The skip command is merely an empty musical placeholder. It does
393 not produce any output, not even transparent output.
395 The @code{s} skip command does create @internalsref{Staff} and
396 @internalsref{Voice} when necessary, similar to note and rest
397 commands. For example, the following results in an empty staff.
399 @lilypond[quote,ragged-right,verbatim]
403 The fragment @code{@{ \skip 4 @} } would produce an empty page.
407 Program reference: @internalsref{SkipMusic}.
410 @node Multi measure rests
411 @unnumberedsubsubsec Multi measure rests
413 @cindex multi measure rests
414 @cindex full measure rests
415 @cindex Rests, multi measure
416 @cindex Rests, full measure
417 @cindex whole rests for a full measure
420 Rests for one or more full measures are entered using
421 @code{R} followed by a duration (see @ref{Durations}).
422 The duration should correspond to an integral number
423 of bars, otherwise a barcheck warning is printed.
424 Multi-measure rests are principally used to indicate
425 that a part in a multi-part score should be silent:
427 @c Ragged-right is omitted here as otherwise
428 @c the annotation collides. When a better
429 @c way of avoiding collisions is discovered this
430 @c example should be changed
431 @c TODO But leaving it out seems to have no effect!!
432 @lilypond[quote,fragment,verbatim]
434 \set Score.skipBars = ##t
442 A multi-measure rest can be expanded in the printed score
443 to show all the rest bars explicitly, or, as above, it can be
444 condensed to a single bar
445 containing a multi-measure rest symbol, with the number of
446 bars of rest printed above the bar. This expansion
447 is controlled by the property @code{Score.skipBars}. If this is
448 set to true, empty measures will condensed to a single bar.
450 @lilypond[quote,ragged-right,fragment,verbatim]
451 \time 4/4 r1 | R1 | R1*2 |
454 \set Score.skipBars = ##t
458 The @code{1} in @code{R1} is similar to the duration notation
459 used for notes and is the length of a bar in 2/2 or 4/4 time.
460 The duration in a multi-measure rest must always be an integral
461 number of bar-lengths, so in other time signatures augmentation
462 dots or fractions must be used:
464 @lilypond[quote,ragged-right,fragment,verbatim]
465 \set Score.skipBars = ##t
469 R1*13/8 | R1*13/8*12 |
474 An @code{R} spanning a single measure is printed as either a whole
475 or breve rest, centered in the measure, regardless of the time
478 @c TODO: add link to @rglos{church rests}
480 If there are 10 or fewer measures of rest, LilyPond prints
481 @notation{church rests} (a series of longa and breve rests)
483 prints a simple line otherwise. This default number of 10
484 may be changed by overriding
485 @code{MultiMeasureRest.expand-limit}.
487 @lilypond[quote,ragged-right,fragment,verbatim]
488 \set Score.skipBars = ##t
490 \override MultiMeasureRest #'expand-limit = 3
494 Note that the vertical position on the staff of the multi-measure
495 rest symbol of either form cannot be changed.
497 @cindex text on multi-measure rest
498 @cindex script on multi-measure rest
499 @cindex fermata on multi-measure rest
501 Text can be added to multi-measure rests by using the
502 @var{note}-@code{markup} syntax @ref{Text markup}. A variable
503 (@code{\fermataMarkup}) is provided for adding fermatas
505 @lilypond[quote,ragged-right,verbatim,fragment]
506 \set Score.skipBars = ##t
508 R2.*10^\markup { \italic "ad lib." }
512 Warning! This text is created by @code{MultiMeasureRestText}, not
515 @lilypond[quote,ragged-right,verbatim,fragment]
516 \override TextScript #'padding = #5
518 \override MultiMeasureRestText #'padding = #5
522 Text attached to a multi-measure rest will be centered above
523 (or below) it. Long text attached in this way will not cause
524 the bar to expand, and may collide with text in adjacent bars.
525 Long text is better attached to a zero-length skip note preceding
526 the rest, preceded by @code{\fatText}, since this will
527 cause the bar to expand to accommodate
528 the length of the text:
530 @lilypond[quote,ragged-right,verbatim,fragment]
531 \set Score.skipBars = ##t
533 s1*0^\markup {[MAJOR GENERAL]}
535 s1*0^\markup {[MABEL] }
536 s1*0_\markup {\italic {Cue: ... it is yours}}
538 s1^\markup {CHORUS} % Chorus notes would go here
544 This manual: @ref{Text}
548 @internalsref{MultiMeasureRest}.
550 The layout object @internalsref{MultiMeasureRestNumber} is for the
551 default number, and @internalsref{MultiMeasureRestText} for user
557 If an attempt is made to use fingerings (e.g.,
558 @code{R1*10-4}) to put numbers over multi-measure rests, the
559 fingering numeral (4) may collide with the bar counter
562 @cindex condensing rests
564 There is no way to automatically condense multiple rests into a
565 single multi-measure rest. Multi-measure rests do not take part
568 Be careful when entering multi-measure rests followed by whole
569 notes. The following will enter two notes lasting four measures
577 @node Displaying rhythms
578 @subsection Displaying rhythms
584 * Polymetric notation::
585 * Automatic note splitting::
589 @unnumberedsubsubsec Time signature
591 @cindex Time signature
595 Time signature indicates the meter of a piece: a regular pattern
596 of strong and weak beats. It is denoted by a fraction at the
599 The time signature is set with the @code{\time} command
601 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
602 \time 2/4 c2 \time 3/4 c2.
607 The symbol that is printed can be customized with the @code{style}
608 property. Setting it to @code{#'()} uses fraction style for 4/4
611 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
614 \override Staff.TimeSignature #'style = #'()
619 There are many more options for its layout. See @ref{Ancient time
620 signatures}, for more examples.
622 @code{\time} sets the property @code{timeSignatureFraction},
623 @code{beatLength} and @code{measureLength} in the @code{Timing}
624 context, which is normally aliased to @internalsref{Score}. The
625 property @code{measureLength} determines where barlines should be
626 inserted, and how automatic beams should be generated. Changing
627 the value of @code{timeSignatureFraction} also causes the symbol
630 @cindex Measure groupings
632 More options are available through the Scheme function
633 @code{set-time-signature}. In combination with the
634 @internalsref{Measure_grouping_engraver}, it will create
635 @internalsref{MeasureGrouping} signs. Such signs ease reading
636 rhythmically complex modern music. In the following example, the
637 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
638 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
640 @lilypond[quote,ragged-right,verbatim]
643 #(set-time-signature 9 8 '(2 2 2 3))
644 g8[ g] d[ d] g[ g] a8[( bes g]) |
645 #(set-time-signature 5 8 '(3 2))
651 \consists "Measure_grouping_engraver"
660 Program reference: @internalsref{TimeSignature}, and
661 @internalsref{Timing_translator}.
663 Examples: @lsr{contemporary,compound-time-signature.ly}.
668 Automatic beaming does not use the measure grouping specified with
669 @code{set-time-signature}.
673 @unnumberedsubsubsec Upbeats
677 @cindex partial measure
678 @cindex measure, partial
679 @cindex shorten measures
682 Partial measures, such as an anacrusis or upbeat, are entered
685 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
686 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
689 The syntax for this command is
692 \partial @var{duration}
695 where @code{duration} is the rhythmic length to be added before
698 This is internally translated into
701 \set Timing.measurePosition = -@var{length of duration}
704 The property @code{measurePosition} contains a rational number
705 indicating how much of the measure has passed at this point. Note
706 that this is a negative number; @code{\partial 4} is internally
707 translated to mean @qq{there is a quarter note left in the bar.}
712 This command does not take into account grace notes at the start
713 of the music. When a piece starts with graces notes in the
714 pickup, then the @code{\partial} should follow the grace notes
716 @lilypond[verbatim,quote,ragged-right,relative,fragment]
723 @code{\partial} is only intended to be used at the beginning of a
724 piece. If you use it after the beginning, some odd warnings may
728 @node Unmetered music
729 @unnumberedsubsubsec Unmetered music
733 @funindex \cadenzaOff
735 Barlines and bar numbers are calculated automatically. For
736 unmetered music (cadenzas, for example), this is not desirable.
737 To turn off automatic barlines and bar numbers, use the commands
738 @code{\cadenzaOn} and @code{\cadenzaOff}.
740 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
752 LilyPond will only insert line breaks and page breaks at a
753 barline. Unless the unmetered music ends before the end of the
754 staff line, you will need to insert invisible barlines
761 to indicate where breaks can occur.
764 @node Polymetric notation
765 @unnumberedsubsubsec Polymetric notation
767 @cindex double time signatures
768 @cindex signatures, polymetric
769 @cindex polymetric signatures
770 @cindex meter, polymetric
772 Double time signatures are not supported explicitly, but they can
773 be faked. In the next example, the markup for the time signature
774 is created with a markup text. This markup text is inserted in
775 the @internalsref{TimeSignature} grob. See also
776 @lsr{contemporary,compound-time-signature}.
778 @lilypond[verbatim,ragged-right]
781 \override #'(baseline-skip . 2) \number {
784 \bracket \column { "5" "8" }
789 \override Staff.TimeSignature #'stencil =
790 #ly:text-interface::print
791 \override Staff.TimeSignature #'text = #tsMarkup
793 c'2 \bar ":" c'4 c'4.
797 Each staff can also have its own time signature. This is done by
798 moving the @internalsref{Timing_translator} to the
799 @internalsref{Staff} context.
804 \remove "Timing_translator"
805 \remove "Default_bar_line_engraver"
809 \consists "Timing_translator"
810 \consists "Default_bar_line_engraver"
817 Now, each staff has its own time signature.
831 c4. c8 c c c4. c8 c c
836 @lilypond[quote,ragged-right]
840 \remove "Timing_translator"
841 \remove "Default_bar_line_engraver"
844 \consists "Timing_translator"
845 \consists "Default_bar_line_engraver"
860 c4. c8 c c c4. c8 c c
866 A different form of polymetric notation is where note lengths have
867 different values across staves, but the bars are all the same
870 This notation can be created by setting a common time signature
871 for each staff but replacing it manually using
872 @code{timeSignatureFraction} to the desired fraction. Then the
873 printed durations in each staff are scaled to the common time
874 signature. The latter is done with @code{\compressMusic}, which
875 is used in a similar way to @code{\times}, but does not create
876 a tuplet bracket. The syntax is
880 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
885 In this example, music with the time signatures of 3/4, 9/8, and
886 10/8 are used in parallel. In the second staff, shown durations
887 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
888 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
891 @lilypond[quote,ragged-right,verbatim,fragment]
899 \set Staff.timeSignatureFraction = #'(9 . 8)
900 \compressMusic #'(2 . 3)
901 \repeat unfold 6 { c8[ c c] }
905 \set Staff.timeSignatureFraction = #'(10 . 8)
906 \compressMusic #'(3 . 5) {
907 \repeat unfold 2 { c8[ c c] }
908 \repeat unfold 2 { c8[ c] }
909 | c4. c4. \times 2/3 { c8 c c } c4
918 When using different time signatures in parallel, the spacing is
919 aligned vertically, but barlines distort the regular spacing.
922 @node Automatic note splitting
923 @unnumberedsubsubsec Automatic note splitting
925 Long notes which overrun barlines can be converted
926 automatically to tied notes. This is
927 done by replacing the @internalsref{Note_heads_engraver} by the
928 @internalsref{Completion_heads_engraver}. In the following
929 examples, notes crossing the barline are split and tied.
931 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
933 \remove "Note_heads_engraver"
934 \consists "Completion_heads_engraver"
936 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
940 This engraver splits all running notes at the barline, and
941 inserts ties. One of its uses is to debug complex scores: if the
942 measures are not entirely filled, then the ties exactly show how
943 much each measure is off.
945 If you want to allow line breaking on the barlines where
946 @internalsref{Completion_heads_engraver} splits notes, you must
947 also remove @internalsref{Forbid_line_break_engraver}.
952 Not all durations (especially those containing tuplets) can be
953 represented exactly with normal notes and dots, but the engraver
954 will not insert tuplets.
956 @code{Completion_heads_engraver} only affects notes; it does not
962 Program reference: @internalsref{Completion_heads_engraver}.
975 @node Automatic beams
976 @unnumberedsubsubsec Automatic beams
978 By default beams are inserted automatically
980 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
982 \time 6/8 c c c c8. c16 c8
985 When these automatic decisions are not good enough, beaming
986 can be entered explicitly. It is also possible to define beaming
987 patterns that differ from the defaults. See @ref{Manual beams}
988 and @ref{Setting automatic beam behavior}.
994 Automatic beaming may be turned off and on with
995 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
997 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
998 c4 c8 c8. c16 c8. c16 c8
1008 @funindex stemLeftBeamCount
1009 @funindex stemRightBeamCount
1011 LilyPond can automatically determine beaming patterns within a
1012 beam, but this automatic behavior can sometimes produce odd
1013 results; therefore the @code{stemLeftBeamCount} and
1014 @code{stemRightBeamCount} properties can be used to override the
1015 defaults. If either property is set, its value will be used only
1016 once, and then it is erased.
1018 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1023 \set stemLeftBeamCount = #1
1028 The property @code{subdivideBeams} can be set in order to
1029 subdivide all 16th or shorter beams.
1030 When set, multiple beams will be sub-divided at beat
1031 positions, defined by the current value of @code{beatLength},
1032 by drawing only one beam over the beat.
1034 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1036 \set subdivideBeams = ##t
1038 \set Score.beatLength = #(ly:make-moment 1 8)
1041 @funindex subdivideBeams
1044 For more information about @code{make-moment}, see
1045 @ref{Time administration}.
1047 @c TODO Consider whether the section Setting automatic
1048 @c beam behavior should all be moved here. For now
1049 @c here's a link to it.
1051 For details about modifying the automatic beam behaviour
1052 see @ref{Setting automatic beam behavior}
1056 Line breaks are normally forbidden when beams cross barlines.
1057 This behavior can be changed by setting the @code{breakable}
1058 property: @code{\override Beam #'breakable = ##t}.
1060 @cindex beams and line breaks
1061 @cindex beams, kneed
1063 @cindex auto-knee-gap
1065 Kneed beams are inserted automatically when a large gap is
1066 detected between the note heads. This behavior can be tuned
1067 through the @code{auto-knee-gap} property. A kneed beam is
1068 drawn if the gap is larger than the value of
1069 @code{auto-knee-gap} plus the width of the beam object (which
1070 depends on the duration of the notes and the slope of the beam).
1071 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1073 @lilypond[fragment,ragged-right,quote,verbatim]
1075 \override Beam #'auto-knee-gap = #6
1082 Program reference: @internalsref{Beam}.
1087 Automatically kneed cross-staff beams cannot be used together with
1088 hidden staves. See @ref{Hiding staves}.
1090 Beams can collide with noteheads and accidentals in other voices
1093 @unnumberedsubsubsec Manual beams
1095 @cindex beams, manual
1097 Individual notes may be marked with @code{\noBeam} to prevent them
1100 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1101 \time 2/4 c8 c\noBeam c c
1107 In some cases it may be necessary to override the automatic
1108 beaming algorithm. For example, the autobeamer will not put beams
1109 over rests or barlines, and in choral scores the beaming is
1110 often set to follow the meter of the lyrics rather than the
1111 notes. Such beams can be specified manually by
1112 marking the begin and end point with @code{[} and @code{]}
1114 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1116 r4 r8[ g' a r8] r8 g[ | a] r8
1120 @cindex beams, feathered
1121 @funindex \featherDurations
1123 Feathered beams are used to indicate that a small group of notes
1124 should be played at an increasing (or decreasing) tempo, without
1125 changing the overall tempo of the piece. The extent of the
1126 feathered beam must be indicated manually using @code{[} and
1127 @code{]}, and the beam feathering is turned on by specifying a
1128 direction to the Beam property @code{grow-direction}.
1130 If the placement of the notes and the sound in the MIDI output
1131 is to reflect the ritardando or accelerando indicated by the
1132 feathered beam the notes must be grouped as a
1133 music expression delimited by braces and preceded by a
1134 @code{featheredDurations} command which specifies the ratio
1135 between the durations of the first and last notes in the group.
1138 show the extent of the beam and the braces show
1139 which notes are to have their durations modified. Normally
1140 these would delimit the same group of notes, but this is not
1141 required: the two commands are independent.
1143 In the following example the eight 16th notes occupy exactly
1144 the same time as a half note, but the first note is twice
1145 as short as the last one, with the intermediate notes gradually
1146 lengthening. The first four 32nd notes gradually speed up,
1147 while the last four 32nd notes are at a constant tempo.
1149 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1150 \override Beam #'grow-direction = #LEFT
1151 \featherDurations #(ly:make-moment 2 1)
1152 { c16[ c c c c c c c] }
1153 \override Beam #'grow-direction = #RIGHT
1154 \featherDurations #(ly:make-moment 2 3)
1156 % revert to non-feathered beams
1157 \override Beam #'grow-direction = #'()
1162 The spacing in the printed output represents the
1163 note durations only approximately, but the midi output is exact.
1168 Line breaking is prevented by beams which straddle barlines. The
1169 @samp{breakable} property of @code{Beam} allows this behaviour
1172 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1173 \override Beam #'breakable = ##t
1174 c8 \repeat unfold 15 {c[ c] } c
1180 The @code{\featherDurations} command only works with very short
1181 music snippets, and when numbers in the fraction are small.
1191 * Bar and bar number checks::
1196 @unnumberedsubsubsec Bar lines
1201 @cindex measure lines
1204 Barlines delimit measures, and are also used to indicate
1205 repeats. Normally, simple barlines are automatically inserted
1206 into the printed output at places
1207 based on the current time signature. It is not invalid if the
1208 final note in a bar does not end on the automatically entered
1209 barline: the note is assumed to carry over into the next bar.
1211 The simple barlines inserted automatically can be changed to
1212 other types with the @code{\bar} command. For example, a closing
1213 double barline is usually placed at the end of a piece:
1215 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1219 This and other special barlines may be inserted manually at any
1220 point. When they coincide with the end of a bar they replace
1221 the simple barline which would have been inserted there
1222 automatically. When they do not coincide
1223 with the end of a bar the specified barline is inserted at that
1224 point in the printed output. Such insertions do not affect
1225 the calculation and placement of subsequent automatic barlines.
1227 The simple barline and four types of double barline are available
1228 for manual insertion:
1230 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1231 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1235 together with dotted and dashed barlines:
1237 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1238 f1 \bar ":" g \bar "dashed" a
1242 and three types of repeat barline:
1244 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1245 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1248 Although the barline types signifying repeats may be inserted
1249 manually they do not in themselves cause LilyPond to recognise
1250 a repeated section. Such repeated sections are better entered
1251 using the various repeat commands (see @ref{Repeats}), which
1252 automatically print the appropriate barlines.
1254 In addition, you can specify @code{"||:"}, which is equivalent to
1255 @code{"|:"} except at line breaks, where it gives a double bar
1256 line at the end of the line and a start repeat at the beginning of
1259 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1260 \override Score.RehearsalMark #'padding = #3
1269 automatically broken into lines, but this happens only at
1270 manually inserted barlines or at automatically inserted barlines
1271 where these occur at the
1272 end of complete bars, i.e. where the end of a note coincides
1273 with the end of a bar. If this never happens, perhaps due to
1274 an error in entering durations, the outputted music can appear
1275 very compressed as no place can be found to make a line break.
1277 To allow a line break without printing a barline, use
1284 This will insert an invisible barline and allow (but not
1285 force) a line break to occur at this point. The bar number
1286 counter is not increased. To force a line break see
1287 @ref{Line breaking}.
1289 In scores with many staves, a @code{\bar} command in one staff is
1290 automatically applied to all staves. The resulting barlines are
1291 connected between different staves of a @code{StaffGroup},
1292 @code{PianoStaff}, or @code{GrandStaff}.
1294 @lilypond[quote,ragged-right,fragment,verbatim]
1302 \new Staff { \clef bass c4 g e g }
1304 \new Staff { \clef bass c2 c2 }
1312 @funindex defaultBarType
1314 The command @code{\bar }@var{bartype} is a short cut for
1315 @code{\set Timing.whichBar = }@var{bartype}. A barline is
1316 created whenever the @code{whichBar} property is
1319 The default bar type used for automatically inserted barlines is
1320 @code{"|"}. This may be changed at any time
1321 with @code{\set Timing.defaultBarType = }@var{bartype}.
1325 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1327 Program reference: @internalsref{BarLine} (created at
1328 @internalsref{Staff} level), @internalsref{SpanBar} (across
1329 staves), @internalsref{Timing_translator} (for Timing
1334 @unnumberedsubsubsec Bar numbers
1337 @cindex measure numbers
1338 @funindex currentBarNumber
1340 Bar numbers are typeset by default at the start of every line
1341 except the first line. The
1342 number itself is stored in the @code{currentBarNumber} property,
1343 which is normally updated automatically for every measure. It
1344 may also be set manually:
1346 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1347 \repeat unfold 4 {c4 c c c} \break
1348 \set Score.currentBarNumber = #50
1349 \repeat unfold 4 {c4 c c c}
1352 Bar numbers may only be printed at barlines; to print a bar
1353 number at the beginning of a piece, an empty barline must be
1356 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1357 \set Score.currentBarNumber = #50
1359 \repeat unfold 4 {c4 c c c} \break
1360 \repeat unfold 4 {c4 c c c}
1363 Bar numbers can be typeset at regular intervals instead of at the
1364 beginning of every line. This is illustrated in the following
1365 example, which also shows how to enclose bar numbers in boxes and
1368 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1369 % Avoid printing a bar number at the end of a line
1370 \override Score.BarNumber #'break-visibility = #end-of-line-invisible
1372 % Print a bar number every 3th bar
1373 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3)
1375 % Increase the size of the bar number by 2
1376 \override Score.BarNumber #'font-size = #2
1378 % Draw a box round the following bar number(s)
1379 \override Score.BarNumber #'stencil
1380 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1381 \repeat unfold 5 { c1 } \bar "|"
1383 % Draw a circle round the following bar number(s)
1384 \override Score.BarNumber #'stencil
1385 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1386 \repeat unfold 4 { c1 } \bar "|."
1389 Bar numbers can be removed entirely by removing the Bar number
1390 engraver from the score context.
1392 @lilypond[verbatim,ragged-right,quote]
1396 \remove "Bar_number_engraver"
1408 Program reference: @internalsref{BarNumber}.
1410 Examples: @lsrdir{staff}
1415 Bar numbers can collide with the top of the
1416 @internalsref{StaffGroup} bracket, if there is one.
1417 To solve this, the @code{padding} property of
1418 @internalsref{BarNumber} can be used to
1419 position the number correctly.
1422 @node Bar and bar number checks
1423 @unnumberedsubsubsec Bar and bar number checks
1426 @funindex barCheckSynchronize
1429 Bar checks help detect errors in the entered durations.
1430 A bar check may be entered using the bar symbol, @samp{|},
1431 at any place where a barline is expected to fall.
1432 If bar check lines are encountered at other places,
1433 a list of warnings is printed in the log file,
1434 showing the line numbers and lines
1435 in which the bar checks failed. In the next
1436 example, the second bar check will signal an error
1439 \time 3/4 c2 e4 | g2 |
1442 Bar checks can also be used in lyrics, for example
1447 Twin -- kle | Twin -- kle |
1451 An incorrect duration can result in a completely garbled score,
1452 especially if the score is polyphonic, so a good place to start
1453 correcting input is by scanning for failed bar checks and
1454 incorrect durations.
1457 @funindex pipeSymbol
1459 It is also possible to redefine the action taken when a bar check
1460 or pipe symbol, @samp{|}, is encountered in the input, so that
1461 it does something other than a bar check. This is done by
1462 assigning a music expression to @code{pipeSymbol}.
1463 In the following example @samp{|} is set to insert a double bar
1464 line wherever it appears in the input, rather than checking
1467 @lilypond[quote,ragged-right,verbatim]
1468 pipeSymbol = \bar "||"
1477 When copying large pieces of music, it can be helpful to check
1478 that the LilyPond bar number corresponds to the original that you
1479 are entering from. This can be checked with
1480 @code{\barNumberCheck}, for example,
1483 \barNumberCheck #123
1487 will print a warning if the @code{currentBarNumber} is not 123
1488 when it is processed.
1491 @node Rehearsal marks
1492 @unnumberedsubsubsec Rehearsal marks
1494 @cindex Rehearsal marks
1497 To print a rehearsal mark, use the @code{\mark} command
1499 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1508 The letter@tie{}@q{I} is skipped in accordance with engraving
1509 traditions. If you wish to include the letter @q{I}, then use
1512 \set Score.markFormatter = #format-mark-alphabet
1515 The mark is incremented automatically if you use @code{\mark
1516 \default}, but you can also use an integer argument to set the
1517 mark manually. The value to use is stored in the property
1518 @code{rehearsalMark}.
1520 The style is defined by the property @code{markFormatter}. It is
1521 a function taking the current mark (an integer) and the current
1522 context as argument. It should return a markup object. In the
1523 following example, @code{markFormatter} is set to a pre-defined
1524 procedure. After a few measures, it is set to a procedure that
1525 produces a boxed number.
1527 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1528 \set Score.markFormatter = #format-mark-numbers
1531 \set Score.markFormatter = #format-mark-box-numbers
1537 The file @file{scm/@/translation@/-functions@/.scm} contains the
1538 definitions of @code{format-mark-numbers} (the default format),
1539 @code{format-mark-box-numbers}, @code{format-mark-letters} and
1540 @code{format-mark-box-letters}. These can be used as inspiration
1541 for other formatting functions.
1543 You may use @code{format-mark-barnumbers},
1544 @code{format-mark-box-barnumbers}, and
1545 @code{format-mark-circle-barnumbers} to get bar numbers instead of
1546 incremented numbers or letters.
1548 Other styles of rehearsal mark can be specified manually
1555 @code{Score.markFormatter} does not affect marks specified in this
1556 manner. However, it is possible to apply a @code{\markup} to the
1560 \mark \markup@{ \box A1 @}
1567 Music glyphs (such as the segno sign) may be printed inside a
1570 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1571 c1 \mark \markup { \musicglyph #"scripts.segno" }
1572 c1 \mark \markup { \musicglyph #"scripts.coda" }
1573 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1578 See @ref{The Feta font}, for a list of symbols which may be
1579 printed with @code{\musicglyph}.
1581 For common tweaks to the positioning of rehearsal marks, see
1586 This manual: @ref{Text marks}.
1588 Program reference: @internalsref{RehearsalMark}.
1590 Init files: @file{scm/@/translation@/-functions@/.scm} contains
1591 the definition of @code{format-mark-numbers} and
1592 @code{format-mark-letters}. They can be used as inspiration for
1593 other formatting functions.
1595 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1598 @node Special rhythmic concerns
1599 @subsection Special rhythmic concerns
1604 * Aligning to cadenzas::
1605 * Time administration::
1609 @unnumberedsubsubsec Grace notes
1614 @cindex appoggiatura
1615 @cindex acciaccatura
1617 Grace notes are ornaments that are written out. The most common
1618 ones are acciaccatura, which should be played as very short. It
1619 is denoted by a slurred small note with a slashed stem. The
1620 appoggiatura is a grace note that takes a fixed fraction of the
1621 main note, and is denoted as a slurred note in small print without
1622 a slash. They are entered with the commands @code{\acciaccatura}
1623 and @code{\appoggiatura}, as demonstrated in the following example
1625 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1626 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1627 \acciaccatura { g16[ f] } e4
1630 Both are special forms of the @code{\grace} command. By prefixing
1631 this keyword to a music expression, a new one is formed, which
1632 will be printed in a smaller font and takes up no logical time in
1635 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1637 \grace { c16[ d16] } c2 c4
1641 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1642 @code{\grace} command does not start a slur.
1644 The placement of grace notes is synchronized between different
1645 staves. In the following example, there are two sixteenth grace
1646 notes for every eighth grace note
1648 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1649 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1650 \new Staff { c4 \grace { g8[ b] } c4 } >>
1653 @funindex \afterGrace
1655 If you want to end a note with a grace, use the @code{\afterGrace}
1656 command. It takes two arguments: the main note, and the grace
1657 notes following the main note.
1659 @lilypond[ragged-right, verbatim,relative=2,fragment]
1660 c1 \afterGrace d1 { c16[ d] } c4
1663 This will put the grace notes after a @q{space} lasting 3/4 of the
1664 length of the main note. The fraction 3/4 can be changed by
1665 setting @code{afterGraceFraction}, ie.
1668 #(define afterGraceFraction (cons 7 8))
1672 will put the grace note at 7/8 of the main note.
1674 The same effect can be achieved manually by doing
1676 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1679 { s2 \grace { c16[ d] } } >>
1685 By adjusting the duration of the skip note (here it is a
1686 half-note), the space between the main-note and the grace
1689 A @code{\grace} music expression will introduce special
1690 typesetting settings, for example, to produce smaller type, and
1691 set directions. Hence, when introducing layout tweaks, they
1692 should be inside the grace expression, for example,
1694 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1706 The overrides should also be reverted inside the grace expression.
1708 The layout of grace expressions can be changed throughout the
1709 music using the function @code{add-grace-property}. The following
1710 example undefines the @code{Stem} direction for this grace, so
1711 that stems do not always point up.
1715 #(add-grace-property 'Voice 'Stem 'direction '())
1721 Another option is to change the variables @code{startGraceMusic},
1722 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1723 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1724 @code{stopAppoggiaturaMusic}. The default values of these can be
1725 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
1726 them other effects may be obtained.
1729 The slash through the stem in acciaccaturas can be obtained in
1730 other situations by @code{\override Stem #'stroke-style =
1736 Grace notes may be forced to use align with regular notes
1737 in other staves by setting @code{strict-grace-spacing} to
1740 @lilypond[relative=2,ragged-right]
1742 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1751 c'16[ c'16 c'16 c'16]
1752 c'16[ c'16 c'16 c'16]
1761 Program reference: @internalsref{GraceMusic}.
1766 Grace note synchronization can also lead to surprises. Staff
1767 notation, such as key signatures, barlines, etc., are also
1768 synchronized. Take care when you mix staves with grace notes and
1769 staves without, for example,
1771 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1772 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1773 \new Staff { c4 \bar "|:" d4 } >>
1777 This can be remedied by inserting grace skips of the corresponding
1778 durations in the other staves. For the above example
1780 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1781 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1782 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1785 Grace sections should only be used within sequential music
1786 expressions. Nesting or juxtaposing grace sections is not
1787 supported, and might produce crashes or other errors.
1789 @node Aligning to cadenzas
1790 @unnumberedsubsubsec Aligning to cadenzas
1792 In an orchestral context, cadenzas present a special problem: when
1793 constructing a score that includes a cadenza, all other
1794 instruments should skip just as many notes as the length of the
1795 cadenza, otherwise they will start too soon or too late.
1797 A solution to this problem are the functions
1798 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
1799 functions take a piece of music as argument, and generate a
1800 multi-rest or @code{\skip}, exactly as long as the piece. The use
1801 of @code{mmrest-of-length} is demonstrated in the following
1804 @lilypond[verbatim,ragged-right,quote]
1805 cadenza = \relative c' {
1806 c4 d8 << { e f g } \\ { d4. } >>
1811 \new Staff { \cadenza c'4 }
1813 #(ly:export (mmrest-of-length cadenza))
1820 @node Time administration
1821 @unnumberedsubsubsec Time administration
1823 @cindex Time administration
1825 @funindex currentBarNumber
1826 @funindex measurePosition
1827 @funindex measureLength
1829 Time is administered by the
1830 @code{Timing_translator}, which by default is
1831 to be found in the @code{Score} context. An
1832 alias, @code{Timing}, is added to the context in which
1833 the @code{Timing_translator} is placed.
1835 The following properties of @code{Timing} are used
1836 to keep track of timing within the score.
1839 @item currentBarNumber
1840 The current measure number. For an example showing the
1841 use of this property see @ref{Bar numbers}.
1844 The length of the measures in the current time signature. For a
1845 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
1846 determines when barlines are inserted and how automatic beams
1847 should be generated.
1849 @item measurePosition
1850 The point within the measure where we currently are. This
1851 quantity is reset by subtracting @code{measureLength} whenever
1852 @code{measureLength} is reached or exceeded. When that happens,
1853 @code{currentBarNumber} is incremented.
1856 If set to true, the above variables are updated for every time
1857 step. When set to false, the engraver stays in the current
1858 measure indefinitely.
1862 Timing can be changed by setting any of these variables
1863 explicitly. In the next example, the default 4/4 time
1864 signature is printed, but @code{measureLength} is set to 5/4.
1865 At 4/8 though the third bar, the @code{measurePosition} is
1866 advanced by 1/8 to 5/8, shortening that bar by 1/8.
1867 The next barline then falls at 9/8 rather than 5/4.
1869 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1870 \set Score.measureLength = #(ly:make-moment 5 4)
1874 \set Score.measurePosition = #(ly:make-moment 5 8)
1880 As the example illustrates, @code{ly:make-moment n m} constructs a
1881 duration of n/m of a whole note. For example,
1882 @code{ly:make-moment 1 8} is an eighth note duration and
1883 @code{ly:make-moment 7 16} is the duration of seven sixteenths
1888 This manual: @ref{Bar numbers}, @ref{Unmetered music}
1890 Program Reference: @internalsref{Timing_translator},
1891 @internalsref{Score}