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]
85 a'4 b' c''4. b'8 a'4. b'4.. c''8.
91 Some durations cannot be entered using only binary durations
92 and dots, and can only be represented by tying two or more
93 notes together. Tied notes are also
94 often used prior to a syncopated section, and
95 they are also frequently used to carry notes over stronger
96 beats in a bar as well as to carry notes over barlines. To tie
97 two (or more) notes together terminate all but the last one
98 with a @code{~} (a tilde symbol):
100 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
104 fis8 e4 d8~ d8 c4 b8 |
112 Dots are normally moved up to avoid staff lines, except in
113 polyphonic situations. The following commands may be used to
114 force a particular direction manually
120 @funindex \dotsNeutral
123 @c TODO: after deciding the link question, fix these. -gp
124 Durations are entered in the same way in @code{drummode},
125 @code{chordmode}, @code{figuremode} and (optionally)
130 For ways of specifying durations for the syllables of lyrics
131 and ways of aligning lyrics to notes see
132 This manual: @ref{Vocal music}
134 For a description of how to enter rests see
135 This manual: @ref{Writing rests}
137 A note with the duration of a quadruple breve may be
138 entered with \maxima, but this is supported only within
139 ancient music notation.
140 See this manual: @ref{Ancient notation}
142 Program reference: @internalsref{Dots}, and
143 @internalsref{DotColumn}.
147 @unnumberedsubsubsec Tuplets
153 Tuplets are made out of a music expression by multiplying all
154 durations with a fraction
157 \times @var{fraction} @var{musicexpr}
161 The duration of @var{musicexpr} will be multiplied by the
162 fraction. The fraction's denominator will be printed over the
163 notes, optionally with a bracket. The most common tuplet is the
164 triplet in which 3 notes have the length of 2, so the notes are
165 2/3 of their written length
167 @lilypond[quote,ragged-right,fragment,verbatim]
168 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
171 Tuplets may be nested, for example,
173 @lilypond[fragment,ragged-right,verbatim,relative=2]
174 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
177 \times 3/5 { a a a a a }
185 @funindex \tupletDown
187 @funindex \tupletNeutral
188 @code{\tupletNeutral}.
193 @funindex tupletNumberFormatFunction
194 @cindex tuplet formatting
196 The property @code{tupletSpannerDuration} specifies how long each
197 bracket should last. With this, you can make lots of tuplets
198 while typing @code{\times} only once, thus saving lots of typing.
199 In the next example, there are two triplets shown, while
200 @code{\times} was only used once
202 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
203 \set tupletSpannerDuration = #(ly:make-moment 1 4)
204 \times 2/3 { c8 c c c c c }
208 For more information about @code{make-moment}, see
209 @ref{Time administration}.
211 The format of the number is determined by the property @code{text}
212 in @code{TupletNumber}. The default prints only the denominator,
213 but if it is set to the function
214 @code{tuplet-number::calc-fraction-text}, @var{num}:@var{den} will
217 To avoid printing tuplet numbers, use
219 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
220 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
221 \override TupletNumber #'transparent = ##t
222 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
225 Use the @code{\tweak} function to override nested tuplets
226 beginning at the same music moment. In this example,
227 @code{\tweak} specifies fraction text for the outer
228 @code{TupletNumber} and denominator text for the
229 @code{TupletNumber} of the first of the three inner tuplets.
231 @lilypond[quote,ragged-right,verbatim]
233 \tweak #'text #tuplet-number::calc-fraction-text
235 \tweak #'text #tuplet-number::calc-denominator-text
236 \times 2/3 { c'8[ c'8 c'8] }
237 \times 2/3 { c'8[ c'8 c'8] }
238 \times 2/3 { c'8[ c'8 c'8] }
243 Here @code{\tweak} and @code{\override} work together to specify
244 @code{TupletBracket} direction. The first @code{\tweak} positions
245 the @code{TupletBracket} of the outer tuplet above the staff. The
246 second @code{\tweak} positions the @code{TupletBracket} of the
247 first of the three inner tuplets below the staff. Note that this
248 pair of @code{\tweak} functions affects only the outer tuplet and
249 the first of the three inner tuplets because only those two
250 tuplets begin at the same music moment. We use @code{\override}
251 in the usual way to position the @code{TupletBrackets} of the
252 second and third of the inner tuplets below the staff.
254 @lilypond[quote,ragged-right,verbatim]
256 \tweak #'text #tuplet-number::calc-fraction-text
257 \tweak #'direction #up
259 \tweak #'direction #down
260 \times 2/3 { c'8[ c'8 c'8] }
261 \override TupletBracket #'direction = #down
262 \times 2/3 { c'8[ c'8 c'8] }
263 \times 2/3 { c'8[ c'8 c'8] }
268 Tuplet brackets can be made to run to prefatory matter or the next
271 @lilypond[ragged-right]
273 \set tupletFullLength = ##t
278 \set tupletFullLengthNote = ##t
291 Program reference: @internalsref{TupletBracket},
292 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
296 @node Scaling durations
297 @unnumberedsubsubsec Scaling durations
299 You can alter the length of duration by a fraction @var{N/M}
300 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).
301 This will not affect the appearance of the notes or rests
302 produced. These may be combined such as @samp{*M*N}.
304 In the following example, the first three notes take up exactly
305 two beats, but no triplet bracket is printed.
307 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
309 a4*2/3 gis4*2/3 a4*2/3
317 This manual: @ref{Tuplets}.
323 @subsection Writing rests
328 * Multi measure rests::
332 @unnumberedsubsubsec Rests
339 Rests are entered like notes with the note name @code{r}
341 @c \time 16/1 is used to avoid spurious barlines
342 @c and long tracts of empty bars
343 @lilypond[fragment,quote,ragged-right,verbatim]
346 \override Staff.TimeSignature #'stencil = ##f
348 r\longa r\breve r1 r2
353 Whole bar rests, centered in middle of the bar, must be entered as
354 multi-measure rests. They can be used for a single bar as well as
355 many bars, and are discussed in @ref{Multi measure rests}.
357 To explicitly specify a rest's vertical position, write a note
358 followed by @code{\rest}. A rest will be placed in the position
359 where the note would appear,
361 @lilypond[fragment,quote,ragged-right,verbatim]
366 This makes manual formatting of polyphonic music much easier,
367 since the automatic rest collision formatter will leave these
372 Program reference: @internalsref{Rest}.
376 @unnumberedsubsubsec Skips
379 @cindex Invisible rest
384 An invisible rest (also called a @q{skip}) can be entered like a
385 note with note name @samp{s} or with @code{\skip @var{duration}}
387 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
388 a4 a4 s4 a4 \skip 1 a4
391 The @code{s} syntax is only available in note mode and chord mode.
392 In other situations, for example, when entering lyrics, you should
393 use the @code{\skip} command
395 @lilypond[quote,ragged-right,verbatim]
398 \new Lyrics \lyricmode { \skip 2 bla2 }
402 The skip command is merely an empty musical placeholder. It does
403 not produce any output, not even transparent output.
405 The @code{s} skip command does create @internalsref{Staff} and
406 @internalsref{Voice} when necessary, similar to note and rest
407 commands. For example, the following results in an empty staff.
409 @lilypond[quote,ragged-right,verbatim]
413 The fragment @code{@{ \skip 4 @} } would produce an empty page.
417 Program reference: @internalsref{SkipMusic}.
420 @node Multi measure rests
421 @unnumberedsubsubsec Multi measure rests
423 @cindex multi measure rests
424 @cindex full measure rests
425 @cindex Rests, multi measure
426 @cindex Rests, full measure
427 @cindex whole rests for a full measure
430 Rests for one or more full measures are entered using
431 @code{R} followed by a duration (see @ref{Durations}).
432 The duration should correspond to an integral number
433 of bars, otherwise a barcheck warning is printed.
434 Multi-measure rests are principally used to indicate
435 that a part in a multi-part score should be silent:
437 @c Ragged-right is omitted here as otherwise
438 @c the annotation collides. When a better
439 @c way of avoiding collisions is discovered this
440 @c example should be changed
441 @c TODO But leaving it out seems to have no effect!!
442 @lilypond[quote,fragment,verbatim]
444 \set Score.skipBars = ##t
452 A multi-measure rest can be expanded in the printed score
453 to show all the rest bars explicitly, or, as above, it can be
454 condensed to a single bar
455 containing a multi-measure rest symbol, with the number of
456 bars of rest printed above the bar. This expansion
457 is controlled by the property @code{Score.skipBars}. If this is
458 set to true, empty measures will condensed to a single bar.
460 @lilypond[quote,ragged-right,fragment,verbatim]
461 \time 4/4 r1 | R1 | R1*2 |
464 \set Score.skipBars = ##t
468 The @code{1} in @code{R1} is similar to the duration notation
469 used for notes and is the length of a bar in 2/2 or 4/4 time.
470 The duration in a multi-measure rest must always be an integral
471 number of bar-lengths, so in other time signatures augmentation
472 dots or fractions must be used:
474 @lilypond[quote,ragged-right,fragment,verbatim]
475 \set Score.skipBars = ##t
479 R1*13/8 | R1*13/8*12 |
484 An @code{R} spanning a single measure is printed as either a whole
485 or breve rest, centered in the measure, regardless of the time
488 @c TODO: add link to @rglos{church rests}
490 If there are 10 or fewer measures of rest, LilyPond prints
491 @notation{church rests} (a series of longa and breve rests)
493 prints a simple line otherwise. This default number of 10
494 may be changed by overriding
495 @code{MultiMeasureRest.expand-limit}.
497 @lilypond[quote,ragged-right,fragment,verbatim]
498 \set Score.skipBars = ##t
500 \override MultiMeasureRest #'expand-limit = 3
504 Note that the vertical position on the staff of the multi-measure
505 rest symbol of either form cannot be changed.
507 @cindex text on multi-measure rest
508 @cindex script on multi-measure rest
509 @cindex fermata on multi-measure rest
511 Text can be added to multi-measure rests by using the
512 @var{note}-@code{markup} syntax @ref{Text markup}. A variable
513 (@code{\fermataMarkup}) is provided for adding fermatas
515 @lilypond[quote,ragged-right,verbatim,fragment]
516 \set Score.skipBars = ##t
518 R2.*10^\markup { \italic "ad lib." }
522 Warning! This text is created by @code{MultiMeasureRestText}, not
525 @lilypond[quote,ragged-right,verbatim,fragment]
526 \override TextScript #'padding = #5
528 \override MultiMeasureRestText #'padding = #5
532 Text attached to a multi-measure rest will be centered above
533 (or below) it. Long text attached in this way will not cause
534 the bar to expand, and may collide with text in adjacent bars.
535 Long text is better attached to a zero-length skip note preceding
536 the rest, preceded by @code{\fatText}, since this will
537 cause the bar to expand to accommodate
538 the length of the text:
540 @lilypond[quote,ragged-right,verbatim,fragment]
541 \set Score.skipBars = ##t
543 s1*0^\markup {[MAJOR GENERAL]}
545 s1*0^\markup {[MABEL] }
546 s1*0_\markup {\italic {Cue: ... it is yours}}
548 s1^\markup {CHORUS} % Chorus notes would go here
554 This manual: @ref{Text}
559 @c Following ref is invalid
560 @c @internalsref{MultiMeasureRestMusicGroup},
563 @internalsref{MultiMeasureRest}.
565 The layout object @internalsref{MultiMeasureRestNumber} is for the
566 default number, and @internalsref{MultiMeasureRestText} for user
572 If an attempt is made to use fingerings (e.g.,
573 @code{R1*10-4}) to put numbers over multi-measure rests, the
574 fingering numeral (4) may collide with the bar counter
577 @cindex condensing rests
579 There is no way to automatically condense multiple rests into a
580 single multi-measure rest. Multi-measure rests do not take part
583 Be careful when entering multi-measure rests followed by whole
584 notes. The following will enter two notes lasting four measures
592 @c Bar numbering is correct in 2.11, even with skipBars set true
593 When @code{skipBars} is
594 set, the result will look OK, but the bar numbering will be off.
598 @node Displaying rhythms
599 @subsection Displaying rhythms
605 * Polymetric notation::
606 * Automatic note splitting::
610 @unnumberedsubsubsec Time signature
612 @cindex Time signature
616 Time signature indicates the meter of a piece: a regular pattern
617 of strong and weak beats. It is denoted by a fraction at the
620 The time signature is set with the @code{\time} command
622 @lilypond[quote,ragged-right,fragment,verbatim]
623 \time 2/4 c'2 \time 3/4 c'2.
628 The symbol that is printed can be customized with the @code{style}
629 property. Setting it to @code{#'()} uses fraction style for 4/4
632 @lilypond[fragment,quote,ragged-right,verbatim]
635 \override Staff.TimeSignature #'style = #'()
640 There are many more options for its layout. See @ref{Ancient time
641 signatures}, for more examples.
643 @code{\time} sets the property @code{timeSignatureFraction},
644 @code{beatLength} and @code{measureLength} in the @code{Timing}
645 context, which is normally aliased to @internalsref{Score}. The
646 property @code{measureLength} determines where barlines should be
647 inserted, and how automatic beams should be generated. Changing
648 the value of @code{timeSignatureFraction} also causes the symbol
651 @cindex Measure groupings
653 More options are available through the Scheme function
654 @code{set-time-signature}. In combination with the
655 @internalsref{Measure_grouping_engraver}, it will create
656 @internalsref{MeasureGrouping} signs. Such signs ease reading
657 rhythmically complex modern music. In the following example, the
658 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
659 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
661 @lilypond[quote,ragged-right,verbatim]
664 #(set-time-signature 9 8 '(2 2 2 3))
665 g8[ g] d[ d] g[ g] a8[( bes g]) |
666 #(set-time-signature 5 8 '(3 2))
672 \consists "Measure_grouping_engraver"
681 Program reference: @internalsref{TimeSignature}, and
682 @internalsref{Timing_translator}.
684 Examples: @lsr{contemporary,compound-time-signature.ly}.
689 @c Still a bug in 2.11
690 Automatic beaming does not use the measure grouping specified with
691 @code{set-time-signature}.
695 @unnumberedsubsubsec Upbeats
699 @cindex partial measure
700 @cindex measure, partial
701 @cindex shorten measures
704 Partial measures, such as an anacrusis or upbeat, are entered
707 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
708 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
711 The syntax for this command is
714 \partial @var{duration}
717 where @code{duration} is the rhythmic length to be added before
720 This is internally translated into
723 \set Timing.measurePosition = -@var{length of duration}
726 The property @code{measurePosition} contains a rational number
727 indicating how much of the measure has passed at this point. Note
728 that this is a negative number; @code{\partial 4} is internally
729 translated to mean @qq{there is a quarter note left in the bar.}
734 This command does not take into account grace notes at the start
735 of the music. When a piece starts with graces notes in the
736 pickup, then the @code{\partial} should follow the grace notes
738 @lilypond[verbatim,quote,ragged-right,relative,fragment]
745 @code{\partial} is only intended to be used at the beginning of a
746 piece. If you use it after the beginning, some odd warnings may
750 @node Unmetered music
751 @unnumberedsubsubsec Unmetered music
755 @funindex \cadenzaOff
757 Barlines and bar numbers are calculated automatically. For
758 unmetered music (cadenzas, for example), this is not desirable.
759 To turn off automatic barlines and bar numbers, use the commands
760 @code{\cadenzaOn} and @code{\cadenzaOff}.
762 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
774 LilyPond will only insert line breaks and page breaks at a
775 barline. Unless the unmetered music ends before the end of the
776 staff line, you will need to insert invisible barlines
783 to indicate where breaks can occur.
786 @node Polymetric notation
787 @unnumberedsubsubsec Polymetric notation
789 @cindex double time signatures
790 @cindex signatures, polymetric
791 @cindex polymetric signatures
792 @cindex meter, polymetric
794 Double time signatures are not supported explicitly, but they can
795 be faked. In the next example, the markup for the time signature
796 is created with a markup text. This markup text is inserted in
797 the @internalsref{TimeSignature} grob. See also
798 @lsr{contemporary,compound-time-signature}.
800 @lilypond[verbatim,ragged-right]
803 \override #'(baseline-skip . 2) \number {
806 \bracket \column { "5" "8" }
811 \override Staff.TimeSignature #'stencil =
812 #ly:text-interface::print
813 \override Staff.TimeSignature #'text = #tsMarkup
815 c'2 \bar ":" c'4 c'4.
819 Each staff can also have its own time signature. This is done by
820 moving the @internalsref{Timing_translator} to the
821 @internalsref{Staff} context.
826 \remove "Timing_translator"
827 \remove "Default_bar_line_engraver"
831 \consists "Timing_translator"
832 \consists "Default_bar_line_engraver"
839 Now, each staff has its own time signature.
853 c4. c8 c c c4. c8 c c
858 @lilypond[quote,ragged-right]
862 \remove "Timing_translator"
863 \remove "Default_bar_line_engraver"
866 \consists "Timing_translator"
867 \consists "Default_bar_line_engraver"
882 c4. c8 c c c4. c8 c c
888 A different form of polymetric notation is where note lengths have
889 different values across staves, but the bars are all the same
892 This notation can be created by setting a common time signature
893 for each staff but replacing it manually using
894 @code{timeSignatureFraction} to the desired fraction. Then the
895 printed durations in each staff are scaled to the common time
896 signature. The latter is done with @code{\compressMusic}, which
897 is used in a similar way to @code{\times}, but does not create
898 a tuplet bracket. The syntax is
902 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
907 In this example, music with the time signatures of 3/4, 9/8, and
908 10/8 are used in parallel. In the second staff, shown durations
909 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
910 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
913 @lilypond[quote,ragged-right,verbatim,fragment]
921 \set Staff.timeSignatureFraction = #'(9 . 8)
922 \compressMusic #'(2 . 3)
923 \repeat unfold 6 { c8[ c c] }
927 \set Staff.timeSignatureFraction = #'(10 . 8)
928 \compressMusic #'(3 . 5) {
929 \repeat unfold 2 { c8[ c c] }
930 \repeat unfold 2 { c8[ c] }
931 | c4. c4. \times 2/3 { c8 c c } c4
940 @c This may still be a bug, but I can't demonstrate it in 2.11 -td
941 When using different time signatures in parallel, the spacing is
942 aligned vertically, but barlines distort the regular spacing.
945 @node Automatic note splitting
946 @unnumberedsubsubsec Automatic note splitting
948 Long notes which overrun barlines can be converted
949 automatically to tied notes. This is
950 done by replacing the @internalsref{Note_heads_engraver} by the
951 @internalsref{Completion_heads_engraver}. In the following
952 examples, notes crossing the barline are split and tied.
954 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
956 \remove "Note_heads_engraver"
957 \consists "Completion_heads_engraver"
959 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
963 This engraver splits all running notes at the barline, and
964 inserts ties. One of its uses is to debug complex scores: if the
965 measures are not entirely filled, then the ties exactly show how
966 much each measure is off.
968 If you want to allow line breaking on the barlines where
969 @internalsref{Completion_heads_engraver} splits notes, you must
970 also remove @internalsref{Forbid_line_break_engraver}.
975 @c Still a bug in 2.11 -td
976 Not all durations (especially those containing tuplets) can be
977 represented exactly with normal notes and dots, but the engraver
978 will not insert tuplets.
980 @c Still a bug in 2.11 (if it can be called a bug) -td
981 @code{Completion_heads_engraver} only affects notes; it does not
987 Program reference: @internalsref{Completion_heads_engraver}.
1000 @node Automatic beams
1001 @unnumberedsubsubsec Automatic beams
1003 By default beams are inserted automatically
1005 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1007 \time 6/8 c c c c8. c16 c8
1010 When these automatic decisions are not good enough, beaming
1011 can be entered explicitly. It is also possible to define beaming
1012 patterns that differ from the defaults. See @ref{Manual beams}
1013 and @ref{Setting automatic beam behavior}.
1019 Automatic beaming may be turned off and on with
1020 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1022 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1023 c4 c8 c8. c16 c8. c16 c8
1033 @funindex stemLeftBeamCount
1034 @funindex stemRightBeamCount
1036 LilyPond can automatically determine beaming patterns within a
1037 beam, but this automatic behavior can sometimes produce odd
1038 results; therefore the @code{stemLeftBeamCount} and
1039 @code{stemRightBeamCount} properties can be used to override the
1040 defaults. If either property is set, its value will be used only
1041 once, and then it is erased.
1043 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1048 \set stemLeftBeamCount = #1
1053 The property @code{subdivideBeams} can be set in order to
1054 subdivide all 16th or shorter beams.
1055 When set, multiple beams will be sub-divided at beat
1056 positions, defined by the current value of @code{beatLength},
1057 by drawing only one beam over the beat.
1059 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1061 \set subdivideBeams = ##t
1063 \set Score.beatLength = #(ly:make-moment 1 8)
1066 @funindex subdivideBeams
1069 For more information about @code{make-moment}, see
1070 @ref{Time administration}.
1072 Line breaks are normally forbidden when beams cross barlines.
1073 This behavior can be changed by setting the @code{breakable}
1074 property: @code{\override Beam #'breakable = ##t}.
1078 @cindex beams and line breaks
1079 @cindex beams, kneed
1081 @cindex auto-knee-gap
1083 Kneed beams are inserted automatically when a large gap is
1084 detected between the note heads. This behavior can be tuned
1085 through the @code{auto-knee-gap} property. A kneed beam is
1086 drawn if the gap is larger than the value of
1087 @code{auto-knee-gap} plus the width of the beam object (which
1088 depends on the duration of the notes and the slope of the beam).
1089 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1091 @lilypond[fragment,ragged-right,quote,verbatim]
1093 \override Beam #'auto-knee-gap = #6
1100 Program reference: @internalsref{Beam}.
1105 @c Is this still an issue. Don't understand it enough to test -td
1106 Automatically kneed cross-staff beams cannot be used together with
1107 hidden staves. See @ref{Hiding staves}.
1109 @c Is this still true with skyline spacing stuff? -J.Mandereau
1110 @c Simple markup text certainly avoids beams in 2.11, -td
1111 @c even in other voices. However, notes and accidentals in -td
1112 @c other voices can collide with beams. -td
1115 Beams do not avoid collisions with symbols around the notes, such
1116 as texts and accidentals.
1120 Beams can collide with noteheads and accidentals in other voices
1123 @unnumberedsubsubsec Manual beams
1125 @cindex beams, manual
1127 Individual notes may be marked with @code{\noBeam} to prevent them
1130 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1131 \time 2/4 c8 c\noBeam c c
1137 In some cases it may be necessary to override the automatic
1138 beaming algorithm. For example, the autobeamer will not put beams
1139 over rests or barlines, and in choral scores the beaming is
1140 often set to follow the meter of the lyrics rather than the
1141 notes. Such beams can be specified manually by
1142 marking the begin and end point with @code{[} and @code{]}
1144 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1146 r4 r8[ g' a r8] r8 g[ | a] r8
1150 @cindex beams, feathered
1151 @funindex \featherDurations
1153 Feathered beams are used to indicate that a small group of notes
1154 should be played at an increasing (or decreasing) tempo, without
1155 changing the overall tempo of the piece. The
1156 beam extent must be indicated manually using @code{[} and
1157 @code{]}, and the feathering is turned on by specifying a
1158 direction to the Beam property @code{grow-direction}.
1159 The ratio between the durations of the first and last notes
1160 in the group can be specified with @code{\featherDurations}.
1162 In the following example the eight 16th notes occupy exactly
1163 the same time as a half note, but the first note is twice
1164 as short as the last one, with the intermediate notes gradually
1165 lengthening. The first four 32nd notes gradually speed up,
1166 while the last four 32nd notes are constant tempo.
1168 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1169 \override Beam #'grow-direction = #LEFT
1170 \featherDurations #(ly:make-moment 2 1)
1172 \override Beam #'grow-direction = #RIGHT
1173 \featherDurations #(ly:make-moment 2 3)
1175 \override Beam #'grow-direction = #'()
1180 The spacing in the printed output represents the
1181 note durations only approximately, but the midi output is exact.
1185 The @code{\featherDurations} command only works with very short
1186 music snippets, and if the numbers in the fraction are small.
1196 * Bar and bar number checks::
1201 @unnumberedsubsubsec Bar lines
1206 @cindex measure lines
1209 Barlines delimit measures, and are also used to indicate
1210 repeats. Normally, simple barlines are automatically inserted
1211 into the printed output at places
1212 based on the current time signature. It is not invalid if the
1213 final note in a bar does not end on the automatically entered
1214 barline: the note is assumed to carry over into the next bar.
1216 The simple barlines inserted automatically can be changed to
1217 other types with the @code{\bar} command. For example, a closing
1218 double barline is usually placed at the end of a piece:
1220 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1224 This and other special barlines may be inserted manually at any
1225 point. When they coincide with the end of a bar they replace
1226 the simple barline which would have been inserted there
1227 automatically. When they do not coincide
1228 with the end of a bar the specified barline is inserted at that
1229 point in the printed output. Such insertions do not affect
1230 the calculation and placement of subsequent automatic barlines.
1232 The simple barline and four types of double barline are available
1233 for manual insertion:
1235 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1236 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1240 together with dotted and dashed barlines:
1242 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1243 f1 \bar ":" g \bar "dashed" a
1247 and three types of repeat barline:
1249 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1250 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1253 Although the barline types signifying repeats may be inserted
1254 manually they do not in themselves cause LilyPond to recognise
1255 a repeated section. Such repeated sections are better entered
1256 using the various repeat commands (see @ref{Repeats}), which
1257 automatically print the appropriate barlines.
1259 In addition, you can specify @code{"||:"}, which is equivalent to
1260 @code{"|:"} except at line breaks, where it gives a double bar
1261 line at the end of the line and a start repeat at the beginning of
1264 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1265 \override Score.RehearsalMark #'padding = #3
1274 automatically broken into lines, but this happens only at
1275 manually inserted barlines or at automatically inserted barlines
1276 where these occur at the
1277 end of complete bars, i.e. where the end of a note coincides
1278 with the end of a bar. If this never happens, perhaps due to
1279 an error in entering durations, the outputted music can appear
1280 very compressed as no place can be found to make a line break.
1282 To allow a line break without printing a barline, use
1289 This will insert an invisible barline and allow (but not
1290 force) a line break to occur at this point. The bar number
1291 counter is not increased. To force a line break see
1292 @ref{Line breaking}.
1294 In scores with many staves, a @code{\bar} command in one staff is
1295 automatically applied to all staves. The resulting barlines are
1296 connected between different staves of a @code{StaffGroup},
1297 @code{PianoStaff}, or @code{GrandStaff}.
1299 @lilypond[quote,ragged-right,fragment,verbatim]
1307 \new Staff { \clef bass c4 g e g }
1309 \new Staff { \clef bass c2 c2 }
1317 @funindex defaultBarType
1319 The command @code{\bar }@var{bartype} is a short cut for
1320 @code{\set Timing.whichBar = }@var{bartype}. A barline is
1321 created whenever the @code{whichBar} property is
1324 The default bar type used for automatically inserted barlines is
1325 @code{"|"}. This may be changed at any time
1326 with @code{\set Timing.defaultBarType = }@var{bartype}.
1330 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1332 Program reference: @internalsref{BarLine} (created at
1333 @internalsref{Staff} level), @internalsref{SpanBar} (across
1334 staves), @internalsref{Timing_translator} (for Timing
1339 @unnumberedsubsubsec Bar numbers
1342 @cindex measure numbers
1343 @funindex currentBarNumber
1345 Bar numbers are typeset by default at the start of every line
1346 except the first line. The
1347 number itself is stored in the @code{currentBarNumber} property,
1348 which is normally updated automatically for every measure. It
1349 may also be set manually:
1351 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1352 \repeat unfold 4 {c4 c c c} \break
1353 \set Score.currentBarNumber = #50
1354 \repeat unfold 4 {c4 c c c}
1357 Bar numbers may only be printed at barlines; to print a bar
1358 number at the beginning of a piece, an empty barline must be
1361 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1362 \set Score.currentBarNumber = #50
1364 \repeat unfold 4 {c4 c c c} \break
1365 \repeat unfold 4 {c4 c c c}
1368 Bar numbers can be typeset at regular intervals instead of at the
1369 beginning of every line. This is illustrated in the following
1370 example, which also shows how to enclose bar numbers in boxes and
1373 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1374 % Avoid printing a bar number at the end of a line
1375 \override Score.BarNumber #'break-visibility = #end-of-line-invisible
1377 % Print a bar number every 3th bar
1378 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3)
1380 % Increase the size of the bar number by 2
1381 \override Score.BarNumber #'font-size = #2
1383 % Draw a box round the following bar number(s)
1384 \override Score.BarNumber #'stencil
1385 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1386 \repeat unfold 5 { c1 } \bar "|"
1388 % Draw a circle round the following bar number(s)
1389 \override Score.BarNumber #'stencil
1390 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1391 \repeat unfold 4 { c1 } \bar "|."
1394 Bar numbers can be removed entirely by removing the Bar number
1395 engraver from the score context.
1397 @lilypond[verbatim,ragged-right,quote]
1401 \remove "Bar_number_engraver"
1413 Program reference: @internalsref{BarNumber}.
1415 Examples: @lsrdir{staff}
1420 @c Is this still a bug in 11?
1421 @c Yes it is, so leave it in.
1422 Bar numbers can collide with the top of the
1423 @internalsref{StaffGroup} bracket, if there is one.
1424 To solve this, the @code{padding} property of
1425 @internalsref{BarNumber} can be used to
1426 position the number correctly.
1429 @node Bar and bar number checks
1430 @unnumberedsubsubsec Bar and bar number checks
1433 @funindex barCheckSynchronize
1436 Bar checks help detect errors in the entered durations.
1437 A bar check may be entered using the bar symbol, @samp{|},
1438 at any place where a barline is expected to fall.
1439 If bar check lines are encountered at other places,
1440 a list of warnings is printed in the log file,
1441 showing the line numbers and lines
1442 in which the bar checks failed. In the next
1443 example, the second bar check will signal an error
1446 \time 3/4 c2 e4 | g2 |
1449 Bar checks can also be used in lyrics, for example
1454 Twin -- kle | Twin -- kle |
1458 An incorrect duration can result in a completely garbled score,
1459 especially if the score is polyphonic, so a good place to start
1460 correcting input is by scanning for failed bar checks and
1461 incorrect durations.
1464 @funindex pipeSymbol
1466 It is also possible to redefine the action taken when a bar check
1467 or pipe symbol, @samp{|}, is encountered in the input, so that
1468 it does something other than a bar check. This is done by
1469 assigning a music expression to @code{pipeSymbol}.
1470 In the following example @samp{|} is set to insert a double bar
1471 line wherever it appears in the input, rather than checking
1474 @lilypond[quote,ragged-right,verbatim]
1475 pipeSymbol = \bar "||"
1484 When copying large pieces of music, it can be helpful to check
1485 that the LilyPond bar number corresponds to the original that you
1486 are entering from. This can be checked with
1487 @code{\barNumberCheck}, for example,
1490 \barNumberCheck #123
1494 will print a warning if the @code{currentBarNumber} is not 123
1495 when it is processed.
1498 @node Rehearsal marks
1499 @unnumberedsubsubsec Rehearsal marks
1501 @cindex Rehearsal marks
1504 To print a rehearsal mark, use the @code{\mark} command
1506 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1515 The letter@tie{}@q{I} is skipped in accordance with engraving
1516 traditions. If you wish to include the letter @q{I}, then use
1519 \set Score.markFormatter = #format-mark-alphabet
1522 The mark is incremented automatically if you use @code{\mark
1523 \default}, but you can also use an integer argument to set the
1524 mark manually. The value to use is stored in the property
1525 @code{rehearsalMark}.
1527 The style is defined by the property @code{markFormatter}. It is
1528 a function taking the current mark (an integer) and the current
1529 context as argument. It should return a markup object. In the
1530 following example, @code{markFormatter} is set to a pre-defined
1531 procedure. After a few measures, it is set to a procedure that
1532 produces a boxed number.
1534 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1535 \set Score.markFormatter = #format-mark-numbers
1538 \set Score.markFormatter = #format-mark-box-numbers
1544 The file @file{scm/@/translation@/-functions@/.scm} contains the
1545 definitions of @code{format-mark-numbers} (the default format),
1546 @code{format-mark-box-numbers}, @code{format-mark-letters} and
1547 @code{format-mark-box-letters}. These can be used as inspiration
1548 for other formatting functions.
1550 You may use @code{format-mark-barnumbers},
1551 @code{format-mark-box-barnumbers}, and
1552 @code{format-mark-circle-barnumbers} to get bar numbers instead of
1553 incremented numbers or letters.
1555 Other styles of rehearsal mark can be specified manually
1562 @code{Score.markFormatter} does not affect marks specified in this
1563 manner. However, it is possible to apply a @code{\markup} to the
1567 \mark \markup@{ \box A1 @}
1574 Music glyphs (such as the segno sign) may be printed inside a
1577 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1578 c1 \mark \markup { \musicglyph #"scripts.segno" }
1579 c1 \mark \markup { \musicglyph #"scripts.coda" }
1580 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1585 See @ref{The Feta font}, for a list of symbols which may be
1586 printed with @code{\musicglyph}.
1588 For common tweaks to the positioning of rehearsal marks, see
1593 This manual: @ref{Text marks}.
1595 Program reference: @internalsref{RehearsalMark}.
1597 Init files: @file{scm/@/translation@/-functions@/.scm} contains
1598 the definition of @code{format-mark-numbers} and
1599 @code{format-mark-letters}. They can be used as inspiration for
1600 other formatting functions.
1602 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1605 @node Special rhythmic concerns
1606 @subsection Special rhythmic concerns
1611 * Aligning to cadenzas::
1612 * Time administration::
1613 * Proportional notation (introduction)::
1617 @unnumberedsubsubsec Grace notes
1622 @cindex appoggiatura
1623 @cindex acciaccatura
1625 Grace notes are ornaments that are written out. The most common
1626 ones are acciaccatura, which should be played as very short. It
1627 is denoted by a slurred small note with a slashed stem. The
1628 appoggiatura is a grace note that takes a fixed fraction of the
1629 main note, and is denoted as a slurred note in small print without
1630 a slash. They are entered with the commands @code{\acciaccatura}
1631 and @code{\appoggiatura}, as demonstrated in the following example
1633 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1634 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1635 \acciaccatura { g16[ f] } e4
1638 Both are special forms of the @code{\grace} command. By prefixing
1639 this keyword to a music expression, a new one is formed, which
1640 will be printed in a smaller font and takes up no logical time in
1643 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1645 \grace { c16[ d16] } c2 c4
1649 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1650 @code{\grace} command does not start a slur.
1653 @c This section on grace note timing is interesting, but
1654 @c is of no practical use to the user. Perhaps it should
1655 @c be in the reference manual.
1657 @cindex timing, internal
1659 Internally, timing for grace notes is done using a second,
1660 @q{grace} timing. Every point in time consists of two rational
1661 numbers: one denotes the logical time, one denotes the grace
1662 timing. The above example is shown here with timing tuples
1664 @lilypond[quote,ragged-right]
1667 c4 \grace c16 c4 \grace {
1670 \new Lyrics \lyricmode {
1671 \override LyricText #'font-family = #'typewriter
1675 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1676 \markup { (\fraction 1 4 , 0 ) } 4
1678 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1679 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1681 \markup { ( \fraction 2 4 , 0 ) }
1687 The placement of grace notes is synchronized between different
1688 staves. In the following example, there are two sixteenth grace
1689 notes for every eighth grace note
1691 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1692 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1693 \new Staff { c4 \grace { g8[ b] } c4 } >>
1696 @funindex \afterGrace
1698 If you want to end a note with a grace, use the @code{\afterGrace}
1699 command. It takes two arguments: the main note, and the grace
1700 notes following the main note.
1702 @lilypond[ragged-right, verbatim,relative=2,fragment]
1703 c1 \afterGrace d1 { c16[ d] } c4
1706 This will put the grace notes after a @q{space} lasting 3/4 of the
1707 length of the main note. The fraction 3/4 can be changed by
1708 setting @code{afterGraceFraction}, ie.
1711 #(define afterGraceFraction (cons 7 8))
1715 will put the grace note at 7/8 of the main note.
1717 The same effect can be achieved manually by doing
1719 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1722 { s2 \grace { c16[ d] } } >>
1728 By adjusting the duration of the skip note (here it is a
1729 half-note), the space between the main-note and the grace
1732 A @code{\grace} music expression will introduce special
1733 typesetting settings, for example, to produce smaller type, and
1734 set directions. Hence, when introducing layout tweaks, they
1735 should be inside the grace expression, for example,
1737 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1749 The overrides should also be reverted inside the grace expression.
1751 The layout of grace expressions can be changed throughout the
1752 music using the function @code{add-grace-property}. The following
1753 example undefines the @code{Stem} direction for this grace, so
1754 that stems do not always point up.
1758 #(add-grace-property 'Voice 'Stem 'direction '())
1764 Another option is to change the variables @code{startGraceMusic},
1765 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1766 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1767 @code{stopAppoggiaturaMusic}. The default values of these can be
1768 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
1769 them other effects may be obtained.
1772 The slash through the stem in acciaccaturas can be obtained in
1773 other situations by @code{\override Stem #'stroke-style =
1779 Grace notes may be forced to use align with regular notes
1780 in other staves by setting @code{strict-grace-spacing} to
1783 @lilypond[relative=2,ragged-right]
1785 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1794 c'16[ c'16 c'16 c'16]
1795 c'16[ c'16 c'16 c'16]
1804 Program reference: @internalsref{GraceMusic}.
1809 Grace note synchronization can also lead to surprises. Staff
1810 notation, such as key signatures, barlines, etc., are also
1811 synchronized. Take care when you mix staves with grace notes and
1812 staves without, for example,
1814 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1815 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1816 \new Staff { c4 \bar "|:" d4 } >>
1820 This can be remedied by inserting grace skips of the corresponding
1821 durations in the other staves. For the above example
1823 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1824 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1825 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1828 Grace sections should only be used within sequential music
1829 expressions. Nesting or juxtaposing grace sections is not
1830 supported, and might produce crashes or other errors.
1832 @node Aligning to cadenzas
1833 @unnumberedsubsubsec Aligning to cadenzas
1835 In an orchestral context, cadenzas present a special problem: when
1836 constructing a score that includes a cadenza, all other
1837 instruments should skip just as many notes as the length of the
1838 cadenza, otherwise they will start too soon or too late.
1840 A solution to this problem are the functions
1841 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
1842 functions take a piece of music as argument, and generate a
1843 multi-rest or @code{\skip}, exactly as long as the piece. The use
1844 of @code{mmrest-of-length} is demonstrated in the following
1847 @lilypond[verbatim,ragged-right,quote]
1848 cadenza = \relative c' {
1849 c4 d8 << { e f g } \\ { d4. } >>
1854 \new Staff { \cadenza c'4 }
1856 #(ly:export (mmrest-of-length cadenza))
1863 @node Time administration
1864 @unnumberedsubsubsec Time administration
1866 @cindex Time administration
1868 @funindex currentBarNumber
1869 @funindex measurePosition
1870 @funindex measureLength
1872 Time is administered by the
1873 @code{Timing_translator}, which by default is
1874 to be found in the @code{Score} context. An
1875 alias, @code{Timing}, is added to the context in which
1876 the @code{Timing_translator} is placed.
1878 The following properties of @code{Timing} are used
1879 to keep track of timing within the score.
1882 @item currentBarNumber
1883 The current measure number. For an example showing the
1884 use of this property see @ref{Bar numbers}.
1887 The length of the measures in the current time signature. For a
1888 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
1889 determines when barlines are inserted and how automatic beams
1890 should be generated.
1892 @item measurePosition
1893 The point within the measure where we currently are. This
1894 quantity is reset by subtracting @code{measureLength} whenever
1895 @code{measureLength} is reached or exceeded. When that happens,
1896 @code{currentBarNumber} is incremented.
1899 If set to true, the above variables are updated for every time
1900 step. When set to false, the engraver stays in the current
1901 measure indefinitely.
1905 Timing can be changed by setting any of these variables
1906 explicitly. In the next example, the default 4/4 time
1907 signature is printed, but @code{measureLength} is set to 5/4.
1908 At 4/8 though the third bar, the @code{measurePosition} is
1909 advanced by 1/8 to 5/8, shortening that bar by 1/8.
1910 The next barline then falls at 9/8 rather than 5/4.
1912 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1913 \set Score.measureLength = #(ly:make-moment 5 4)
1917 \set Score.measurePosition = #(ly:make-moment 5 8)
1923 As the example illustrates, @code{ly:make-moment n m} constructs a
1924 duration of n/m of a whole note. For example,
1925 @code{ly:make-moment 1 8} is an eighth note duration and
1926 @code{ly:make-moment 7 16} is the duration of seven sixteenths
1931 This manual: @ref{Bar numbers}, @ref{Unmetered music}
1933 Program Reference: @internalsref{Timing_translator},
1934 @internalsref{Score}
1937 @node Proportional notation (introduction)
1938 @unnumberedsubsubsec Proportional notation (introduction)
1939 @cindex Proportional notation
1941 Notes can be spaced proportionately to their duration by
1942 assigning a value to @code{proportionalNotationDuration}.
1943 For details of this and other setting which control
1944 proportional notation see @ref{Proportional notation}.