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
45 numbers and dots: durations are entered as their reciprocal
46 values. For example, a quarter note is entered using a @code{4}
47 (since it is a 1/4 note), while a half note is entered using a
48 @code{2} (since it is a 1/2 note). For notes longer than a whole
49 you must use the @code{\longa} (a double breve) and
50 @code{\breve} commands.
51 Note durations as short as 64th notes may be specified.
53 @c Two 64th notes are needed to obtain beams
54 @lilypond[quote,ragged-right,verbatim,fragment]
58 \override Staff.TimeSignature #'stencil = ##f
60 c'\longa c'\breve c'1 c'2
61 c'4 c'8 c'16 c'32 c'64 c'64
65 \override Staff.TimeSignature #'stencil = ##f
67 c'\longa c'\breve c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
72 If the duration is omitted then it is set to the previously
73 entered duration. The default for the first note is a quarter
76 @lilypond[quote,ragged-right,verbatim,fragment]
77 { a a a2 a a4 a a1 a }
83 To obtain dotted note lengths, simply add a dot (@samp{.}) to the
84 number. Double-dotted notes are produced in a similar way.
86 @lilypond[quote,ragged-right,fragment,verbatim]
87 a'4 b' c''4. b'8 a'4. b'4.. c''8.
92 Dots are normally moved up to avoid staff lines, except in
93 polyphonic situations. The following commands may be used to
94 force a particular direction manually
100 @funindex \dotsNeutral
103 @c TODO: after deciding the link question, fix these. -gp
104 Durations are entered in the same way in @code{drummode},
105 @code{chordmode}, @code{figuremode} and (optionally)
110 For alternative ways of aligning lyrics to notes see
111 This manual: @ref{Vocal music}
113 For a description of how to enter rests see
114 This manual: @ref{Writing rests}
116 A note with the duration of a quadruple breve may be
117 entered with \maxima, but this is supported only within
118 ancient music notation.
119 See this manual: @ref{Ancient notation}
121 Program reference: @internalsref{Dots}, and
122 @internalsref{DotColumn}.
126 @unnumberedsubsubsec Tuplets
132 Tuplets are made out of a music expression by multiplying all
133 durations with a fraction
136 \times @var{fraction} @var{musicexpr}
140 The duration of @var{musicexpr} will be multiplied by the
141 fraction. The fraction's denominator will be printed over the
142 notes, optionally with a bracket. The most common tuplet is the
143 triplet in which 3 notes have the length of 2, so the notes are
144 2/3 of their written length
146 @lilypond[quote,ragged-right,fragment,verbatim]
147 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
150 Tuplets may be nested, for example,
152 @lilypond[fragment,ragged-right,verbatim,relative=2]
153 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
156 \times 3/5 { a a a a a }
164 @funindex \tupletDown
166 @funindex \tupletNeutral
167 @code{\tupletNeutral}.
172 @funindex tupletNumberFormatFunction
173 @cindex tuplet formatting
175 The property @code{tupletSpannerDuration} specifies how long each
176 bracket should last. With this, you can make lots of tuplets
177 while typing @code{\times} only once, thus saving lots of typing.
178 In the next example, there are two triplets shown, while
179 @code{\times} was only used once
181 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
182 \set tupletSpannerDuration = #(ly:make-moment 1 4)
183 \times 2/3 { c8 c c c c c }
187 For more information about @code{make-moment}, see
188 @ref{Time administration}.
190 The format of the number is determined by the property @code{text}
191 in @code{TupletNumber}. The default prints only the denominator,
192 but if it is set to the function
193 @code{tuplet-number::calc-fraction-text}, @var{num}:@var{den} will
196 To avoid printing tuplet numbers, use
198 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
199 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
200 \override TupletNumber #'transparent = ##t
201 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
204 Use the @code{\tweak} function to override nested tuplets
205 beginning at the same music moment. In this example,
206 @code{\tweak} specifies fraction text for the outer
207 @code{TupletNumber} and denominator text for the
208 @code{TupletNumber} of the first of the three inner tuplets.
210 @lilypond[quote,ragged-right,verbatim]
212 \tweak #'text #tuplet-number::calc-fraction-text
214 \tweak #'text #tuplet-number::calc-denominator-text
215 \times 2/3 { c'8[ c'8 c'8] }
216 \times 2/3 { c'8[ c'8 c'8] }
217 \times 2/3 { c'8[ c'8 c'8] }
222 Here @code{\tweak} and @code{\override} work together to specify
223 @code{TupletBracket} direction. The first @code{\tweak} positions
224 the @code{TupletBracket} of the outer tuplet above the staff. The
225 second @code{\tweak} positions the @code{TupletBracket} of the
226 first of the three inner tuplets below the staff. Note that this
227 pair of @code{\tweak} functions affects only the outer tuplet and
228 the first of the three inner tuplets because only those two
229 tuplets begin at the same music moment. We use @code{\override}
230 in the usual way to position the @code{TupletBrackets} of the
231 second and third of the inner tuplets below the staff.
233 @lilypond[quote,ragged-right,verbatim]
235 \tweak #'text #tuplet-number::calc-fraction-text
236 \tweak #'direction #up
238 \tweak #'direction #down
239 \times 2/3 { c'8[ c'8 c'8] }
240 \override TupletBracket #'direction = #down
241 \times 2/3 { c'8[ c'8 c'8] }
242 \times 2/3 { c'8[ c'8 c'8] }
247 Tuplet brackets can be made to run to prefatory matter or the next
250 @lilypond[ragged-right]
252 \set tupletFullLength = ##t
257 \set tupletFullLengthNote = ##t
270 Program reference: @internalsref{TupletBracket},
271 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
275 @node Scaling durations
276 @unnumberedsubsubsec Scaling durations
278 You can alter the length of duration by a fraction @var{N/M}
279 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).
280 This will not affect the appearance of the notes or rests
281 produced. These may be combined such as @samp{*M*N}.
283 In the following example, the first three notes take up exactly
284 two beats, but no triplet bracket is printed.
286 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
288 a4*2/3 gis4*2/3 a4*2/3
296 This manual: @ref{Tuplets}.
302 @subsection Writing rests
307 * Multi measure rests::
311 @unnumberedsubsubsec Rests
318 Rests are entered like notes with the note name @code{r}
320 @ \time 16/1 is used to avoid spurious bar lines
321 @ and long tracts of empty bars
322 @lilypond[fragment,quote,ragged-right,verbatim]
325 \override Staff.TimeSignature #'stencil = ##f
327 r\longa r\breve r1 r2
332 Whole bar rests, centered in middle of the bar, must be entered as
333 multi-measure rests. They can be used for a single bar as well as
334 many bars, and are discussed in @ref{Multi measure rests}.
336 To explicitly specify a rest's vertical position, write a note
337 followed by @code{\rest}. A rest will be placed in the position
338 where the note would appear,
340 @lilypond[fragment,quote,ragged-right,verbatim]
345 This makes manual formatting of polyphonic music much easier,
346 since the automatic rest collision formatter will leave these
351 Program reference: @internalsref{Rest}.
355 @unnumberedsubsubsec Skips
358 @cindex Invisible rest
363 An invisible rest (also called a @q{skip}) can be entered like a
364 note with note name @samp{s} or with @code{\skip @var{duration}}
366 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
367 a4 a4 s4 a4 \skip 1 a4
370 The @code{s} syntax is only available in note mode and chord mode.
371 In other situations, for example, when entering lyrics, you should
372 use the @code{\skip} command
374 @lilypond[quote,ragged-right,verbatim]
377 \new Lyrics \lyricmode { \skip 2 bla2 }
381 The skip command is merely an empty musical placeholder. It does
382 not produce any output, not even transparent output.
384 The @code{s} skip command does create @internalsref{Staff} and
385 @internalsref{Voice} when necessary, similar to note and rest
386 commands. For example, the following results in an empty staff.
388 @lilypond[quote,ragged-right,verbatim]
392 The fragment @code{@{ \skip 4 @} } would produce an empty page.
396 Program reference: @internalsref{SkipMusic}.
399 @node Multi measure rests
400 @unnumberedsubsubsec Multi measure rests
402 @cindex multi measure rests
403 @cindex full measure rests
404 @cindex Rests, multi measure
405 @cindex Rests, full measure
406 @cindex whole rests for a full measure
409 Rests for one or more full measures are entered using
410 @code{R} followed by a duration (see @ref{Durations}).
411 The duration should correspond to an integral number
412 of bars, otherwise a barcheck warning is printed.
413 Multi-measure rests are principally used to indicate
414 that a part in a multi-part score should be silent:
416 @c Ragged-right is omitted here as otherwise
417 @c the annotation collides. When a better
418 @c way of avoiding collisions is discovered this
419 @c example should be changed
421 @lilypond[quote,fragment,verbatim]
423 \set Score.skipBars = ##t
431 A multi-measure rest can be expanded in the printed score
432 to show all the rest bars explicitly, or, as above, it can be
433 condensed to a single bar
434 containing a multi-measure rest symbol, with the number of
435 bars of rest printed above the bar. This expansion
436 is controlled by the property @code{Score.skipBars}. If this is
437 set to true, empty measures will condensed to a single bar.
439 @lilypond[quote,ragged-right,fragment,verbatim]
440 \time 4/4 r1 | R1 | R1*2 |
443 \set Score.skipBars = ##t
447 The @code{1} in @code{R1} is similar to the duration notation
448 used for notes and is the length of a bar in 2/2 or 4/4 time.
449 The duration in a multi-measure rest must always be an integral
450 number of bar-lengths, so in other time signatures you must
451 use augmentation dots or fractions:
453 @lilypond[quote,ragged-right,fragment,verbatim]
454 \set Score.skipBars = ##t
458 R1*13/8 | R1*13/8*12 |
463 An @code{R} spanning a single measure is printed as either a whole
464 or breve rest, centered in the measure, regardless of the time
467 @c TODO: add link to @rglos{church rests}
469 If there are 10 or fewer measures of rest, LilyPond prints
470 @notation{church rests} (a series of rectangles) in the staff and
471 prints a simple line otherwise. This default number
472 may be changed by overriding
473 @code{MultiMeasureRest.expand-limit}.
475 @lilypond[quote,ragged-right,fragment,verbatim]
476 \set Score.skipBars = ##t
478 \override MultiMeasureRest #'expand-limit = 3
482 @cindex text on multi-measure rest
483 @cindex script on multi-measure rest
484 @cindex fermata on multi-measure rest
486 Text can be added to multi-measure rests by using the
487 @var{note}-@code{markup} syntax @ref{Text markup}. A variable
488 (@code{\fermataMarkup}) is provided for adding fermatas
490 @lilypond[quote,ragged-right,verbatim,fragment]
491 \set Score.skipBars = ##t
493 R2.*10^\markup { \italic "ad lib." }
497 Warning! This text is created by @code{MultiMeasureRestText}, not
500 @lilypond[quote,ragged-right,verbatim,fragment]
501 \override TextScript #'padding = #5
503 \override MultiMeasureRestText #'padding = #5
507 Text attached to a multi-measure rest will be centered above
508 (or below) it. Long text attached in this way will not cause
509 the bar to expand, and may collide with text in adjacent bars.
510 Long text is better attached to a zero-length skip note preceding
511 the rest, preceeded by @code{\fatText}, since this will
512 cause the bar to expand to accommodate
513 the length of the text:
515 @lilypond[quote,ragged-right,verbatim,fragment]
516 \set Score.skipBars = ##t
518 s1*0^\markup {[MAJOR GENERAL]}
520 s1*0^\markup {[MABEL] }
521 s1*0_\markup {\italic {Cue: ... it is yours}}
523 s1^\markup {CHORUS} % Chorus notes would go here
529 This manual: @ref{Text}
531 Program reference: @internalsref{MultiMeasureRestMusicGroup},
532 @internalsref{MultiMeasureRest}.
534 The layout object @internalsref{MultiMeasureRestNumber} is for the
535 default number, and @internalsref{MultiMeasureRestText} for user
541 It is not possible to use fingerings (e.g., @code{R1-4}) to put
542 numbers over multi-measure rests. And the pitch of multi-measure
543 rests (or staff-centered rests) can not be influenced.
545 @cindex condensing rests
547 There is no way to automatically condense multiple rests into a
548 single multi-measure rest. Multi-measure rests do not take part
551 Be careful when entering multi-measure rests followed by whole
552 notes. The following will enter two notes lasting four measures
559 When @code{skipBars} is
560 set, the result will look OK, but the bar numbering will be off.
564 @node Displaying rhythms
565 @subsection Displaying rhythms
571 * Polymetric notation::
572 * Automatic note splitting::
576 @unnumberedsubsubsec Time signature
578 @cindex Time signature
582 Time signature indicates the meter of a piece: a regular pattern
583 of strong and weak beats. It is denoted by a fraction at the
586 The time signature is set with the @code{\time} command
588 @lilypond[quote,ragged-right,fragment,verbatim]
589 \time 2/4 c'2 \time 3/4 c'2.
594 The symbol that is printed can be customized with the @code{style}
595 property. Setting it to @code{#'()} uses fraction style for 4/4
598 @lilypond[fragment,quote,ragged-right,verbatim]
601 \override Staff.TimeSignature #'style = #'()
606 There are many more options for its layout. See @ref{Ancient time
607 signatures}, for more examples.
609 @code{\time} sets the property @code{timeSignatureFraction},
610 @code{beatLength} and @code{measureLength} in the @code{Timing}
611 context, which is normally aliased to @internalsref{Score}. The
612 property @code{measureLength} determines where bar lines should be
613 inserted, and how automatic beams should be generated. Changing
614 the value of @code{timeSignatureFraction} also causes the symbol
617 @cindex Measure groupings
619 More options are available through the Scheme function
620 @code{set-time-signature}. In combination with the
621 @internalsref{Measure_grouping_engraver}, it will create
622 @internalsref{MeasureGrouping} signs. Such signs ease reading
623 rhythmically complex modern music. In the following example, the
624 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
625 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
627 @lilypond[quote,ragged-right,verbatim]
630 #(set-time-signature 9 8 '(2 2 2 3))
631 g8[ g] d[ d] g[ g] a8[( bes g]) |
632 #(set-time-signature 5 8 '(3 2))
638 \consists "Measure_grouping_engraver"
647 Program reference: @internalsref{TimeSignature}, and
648 @internalsref{Timing_translator}.
650 Examples: @lsr{contemporary,compound-time-signature.ly}.
655 Automatic beaming does not use the measure grouping specified with
656 @code{set-time-signature}.
660 @unnumberedsubsubsec Upbeats
664 @cindex partial measure
665 @cindex measure, partial
666 @cindex shorten measures
669 Partial measures, such as an anacrusis or upbeat, are entered
672 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
673 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
676 The syntax for this command is
679 \partial @var{duration}
682 where @code{duration} is the rhythmic length to be added before
685 This is internally translated into
688 \set Timing.measurePosition = -@var{length of duration}
691 The property @code{measurePosition} contains a rational number
692 indicating how much of the measure has passed at this point. Note
693 that this is a negative number; @code{\partial 4} is internally
694 translated to mean @qq{there is a quarter note left in the bar.}
699 This command does not take into account grace notes at the start
700 of the music. When a piece starts with graces notes in the
701 pickup, then the @code{\partial} should follow the grace notes
703 @lilypond[verbatim,quote,ragged-right,relative,fragment]
710 @code{\partial} is only intended to be used at the beginning of a
711 piece. If you use it after the beginning, some odd warnings may
715 @node Unmetered music
716 @unnumberedsubsubsec Unmetered music
720 @funindex \cadenzaOff
722 Bar lines and bar numbers are calculated automatically. For
723 unmetered music (cadenzas, for example), this is not desirable.
724 To turn off automatic bar lines and bar numbers, use the commands
725 @code{\cadenzaOn} and @code{\cadenzaOff}.
727 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
739 LilyPond will only insert line breaks and page breaks at a
740 bar line. Unless the unmetered music ends before the end of the
741 staff line, you will need to insert invisible bar lines
748 to indicate where breaks can occur.
751 @node Polymetric notation
752 @unnumberedsubsubsec Polymetric notation
754 @cindex double time signatures
755 @cindex signatures, polymetric
756 @cindex polymetric signatures
757 @cindex meter, polymetric
759 Double time signatures are not supported explicitly, but they can
760 be faked. In the next example, the markup for the time signature
761 is created with a markup text. This markup text is inserted in
762 the @internalsref{TimeSignature} grob. See also
763 @lsr{contemporary,compound-time-signature}.
765 @lilypond[verbatim,ragged-right]
768 \override #'(baseline-skip . 2) \number {
771 \bracket \column { "5" "8" }
776 \override Staff.TimeSignature #'stencil =
777 #ly:text-interface::print
778 \override Staff.TimeSignature #'text = #tsMarkup
780 c'2 \bar ":" c'4 c'4.
784 Each staff can also have its own time signature. This is done by
785 moving the @internalsref{Timing_translator} to the
786 @internalsref{Staff} context.
791 \remove "Timing_translator"
792 \remove "Default_bar_line_engraver"
796 \consists "Timing_translator"
797 \consists "Default_bar_line_engraver"
804 Now, each staff has its own time signature.
818 c4. c8 c c c4. c8 c c
823 @lilypond[quote,ragged-right]
827 \remove "Timing_translator"
828 \remove "Default_bar_line_engraver"
831 \consists "Timing_translator"
832 \consists "Default_bar_line_engraver"
847 c4. c8 c c c4. c8 c c
853 A different form of polymetric notation is where note lengths have
854 different values across staves.
856 This notation can be created by setting a common time signature
857 for each staff but replacing it manually using
858 @code{timeSignatureFraction} to the desired fraction. Then the
859 printed durations in each staff are scaled to the common time
860 signature. The latter is done with @code{\compressMusic}, which
861 is used similar to @code{\times}, but does not create a tuplet
862 bracket. The syntax is @example \compressMusic #'(@var{numerator}
863 . @var{denominator}) @var{musicexpr} @end example
867 In this example, music with the time signatures of 3/4, 9/8, and
868 10/8 are used in parallel. In the second staff, shown durations
869 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
870 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
873 @lilypond[quote,ragged-right,verbatim,fragment]
881 \set Staff.timeSignatureFraction = #'(9 . 8)
882 \compressMusic #'(2 . 3)
883 \repeat unfold 6 { c8[ c c] }
887 \set Staff.timeSignatureFraction = #'(10 . 8)
888 \compressMusic #'(3 . 5) {
889 \repeat unfold 2 { c8[ c c] }
890 \repeat unfold 2 { c8[ c] }
891 | c4. c4. \times 2/3 { c8 c c } c4
900 When using different time signatures in parallel, the spacing is
901 aligned vertically, but bar lines distort the regular spacing.
904 @node Automatic note splitting
905 @unnumberedsubsubsec Automatic note splitting
907 Long notes can be converted automatically to tied notes. This is
908 done by replacing the @internalsref{Note_heads_engraver} by the
909 @internalsref{Completion_heads_engraver}. In the following
910 examples, notes crossing the bar line are split and tied.
912 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
914 \remove "Note_heads_engraver"
915 \consists "Completion_heads_engraver"
917 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
921 This engraver splits all running notes at the bar line, and
922 inserts ties. One of its uses is to debug complex scores: if the
923 measures are not entirely filled, then the ties exactly show how
924 much each measure is off.
926 If you want to allow line breaking on the bar lines where
927 @internalsref{Completion_heads_engraver} splits notes, you must
928 also remove @internalsref{Forbid_line_break_engraver}.
933 Not all durations (especially those containing tuplets) can be
934 represented exactly with normal notes and dots, but the engraver
935 will not insert tuplets.
937 @code{Completion_heads_engraver} only affects notes; it does not
943 Program reference: @internalsref{Completion_heads_engraver}.
956 @node Automatic beams
957 @unnumberedsubsubsec Automatic beams
959 By default beams are inserted automatically
961 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
963 \time 6/8 c c c c8. c16 c8
966 When these automatic decisions are not good enough, beaming
967 can be entered explicitly. It is also possible to define beaming
968 patterns that differ from the defaults. See @ref{Manual beams}
969 and @ref{Setting automatic beam behavior}.
975 Automatic beaming may be turned off and on with
976 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
978 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
979 c4 c8 c8. c16 c8. c16 c8
989 @funindex stemLeftBeamCount
990 @funindex stemRightBeamCount
992 LilyPond can automatically determine beaming patterns within a
993 beam, but this automatic behavior can sometimes produce odd
994 results; therefore the @code{stemLeftBeamCount} and
995 @code{stemRightBeamCount} properties can be used to override the
996 defaults. If either property is set, its value will be used only
997 once, and then it is erased.
999 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1004 \set stemLeftBeamCount = #1
1009 The property @code{subdivideBeams} can be set in order to
1010 subdivide all 16th or shorter beams.
1011 When set, multiple beams will be sub-divided at beat
1012 positions, defined by the current value of @code{beatLength},
1013 by drawing only one beam over the beat.
1015 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1017 \set subdivideBeams = ##t
1019 \set Score.beatLength = #(ly:make-moment 1 8)
1022 @funindex subdivideBeams
1025 For more information about @code{make-moment}, see
1026 @ref{Time administration}.
1028 Line breaks are normally forbidden when beams cross bar lines.
1029 This behavior can be changed by setting the @code{breakable}
1030 property: @code{\override Beam #'breakable = ##t}.
1034 @cindex beams and line breaks
1035 @cindex beams, kneed
1037 @cindex auto-knee-gap
1039 Kneed beams are inserted automatically when a large gap is
1040 detected between the note heads. This behavior can be tuned
1041 through the @code{auto-knee-gap} property. A kneed beam is
1042 drawn if the gap is larger than the value of
1043 @code{auto-knee-gap} plus the width of the beam object (which
1044 depends on the duration of the notes and the slope of the beam).
1045 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1047 @lilypond[fragment,ragged-right,quote,verbatim]
1049 \override Beam #'auto-knee-gap = #6
1053 Feathered beams are printed by setting the @code{grow-direction}
1054 property of a @code{Beam}. The @code{\featherDurations} function
1055 can be used to adjust note durations.
1057 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1058 \override Beam #'grow-direction = #LEFT
1059 \featherDurations #(ly:make-moment 5 4)
1068 Program reference: @internalsref{Beam}.
1073 Automatically kneed cross-staff beams cannot be used together with
1074 hidden staves. See @ref{Hiding staves}.
1076 @c Is this still true with skyline spacing stuff? -J.Mandereau
1077 Beams do not avoid collisions with symbols around the notes, such
1078 as texts and accidentals.
1080 The @code{\featherDurations} command only works with very short
1084 @unnumberedsubsubsec Manual beams
1086 @cindex beams, manual
1088 Individual notes may be marked with @code{\noBeam} to prevent them
1091 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1092 \time 2/4 c8 c\noBeam c c
1098 In some cases it may be necessary to override the automatic
1099 beaming algorithm. For example, the autobeamer will not put beams
1100 over rests or bar lines, and in choral scores the beaming is
1101 often set to follow the meter of the lyrics rather than the
1102 notes. Such beams can be specified manually by
1103 marking the begin and end point with @code{[} and @code{]}
1105 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1107 r4 r8[ g' a r8] r8 g[ | a] r8
1119 * Bar and bar number checks::
1124 @unnumberedsubsubsec Bar lines
1128 @cindex measure lines
1131 Bar lines delimit measures, and are also used to indicate
1132 repeats. Normally, simple bar lines are automatically inserted
1133 into the printed output at places
1134 based on the current time signature. It is not invalid if the
1135 final note in a bar does not end on the automatically entered
1136 bar line: the note is assumed to carry over into the next bar.
1138 The simple bar lines inserted automatically can be changed to
1139 other types with the @code{\bar} command. For example, a closing
1140 double bar line is usually placed at the end of a piece:
1142 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1146 This and other special bar lines may be inserted manually at any
1147 point. When they coincide with the end of a bar they replace
1148 the simple bar line which would have been inserted there
1149 automatically. When they do not coincide
1150 with the end of a bar the specified bar line is inserted at that
1151 point in the printed output. Such insertions do not affect
1152 the calculation and placement of subsequent automatic bar lines.
1154 Although the bar line types signifying repeats may be inserted
1155 manually they do not in themselves cause LilyPond to recognise
1156 a repeated section. Such repeated sections are better entered
1157 using the various repeat commands (see @ref{Repeats}), which
1158 automatically print the appropriate bar lines.
1160 The following bar types are available for manual insertion:
1162 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1177 In addition, you can specify @code{"||:"}, which is equivalent to
1178 @code{"|:"} except at line breaks, where it gives a double bar
1179 line at the end of the line and a start repeat at the beginning of
1182 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1183 \override Score.RehearsalMark #'padding = #3
1192 automatically broken into lines, but this happens only at
1193 manually inserted bar lines or at automatically inserted bar lines
1194 where these occur at the
1195 end of complete bars, i.e. where the end of a note coincides
1196 with the end of a bar. If this never happens, perhaps due to
1197 an error in entering durations, the outputted music can appear
1198 very compressed as no place can be found to make a line break.
1200 To allow a line break without printing a bar line, use
1207 This will insert an invisible bar line and allow (but not
1208 force) a line break to occur at this point. The bar number
1209 counter is not increased. To force a line break see
1210 @ref{Line breaking}.
1212 In scores with many staves, a @code{\bar} command in one staff is
1213 automatically applied to all staves. The resulting bar lines are
1214 connected between different staves of a @code{StaffGroup},
1215 @code{PianoStaff}, or @code{GrandStaff}.
1217 @lilypond[quote,ragged-right,fragment,verbatim]
1225 \new Staff { \clef bass c4 g e g }
1227 \new Staff { \clef bass c2 c2 }
1235 @funindex defaultBarType
1237 The command @code{\bar }@var{bartype} is a short cut for
1238 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1239 created whenever the @code{whichBar} property is
1242 The default bar type used for automatically inserted bar lines is
1243 @code{"|"}. This may be changed at any time
1244 with @code{\set Timing.defaultBarType = }@var{bartype}.
1247 TODO Delete this section - repeats are mentioned earlier
1249 @code{repeatCommands} are used to override default measure bars.
1251 You are encouraged to use @code{\repeat} for repetitions. See
1257 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1259 Program reference: @internalsref{BarLine} (created at
1260 @internalsref{Staff} level), @internalsref{SpanBar} (across
1261 staves), @internalsref{Timing_translator} (for Timing
1266 @unnumberedsubsubsec Bar numbers
1269 @cindex measure numbers
1270 @funindex currentBarNumber
1272 Bar numbers are typeset by default at the start of every line
1273 except the first line. The
1274 number itself is stored in the @code{currentBarNumber} property,
1275 which is normally updated automatically for every measure. It
1276 may also be set manually:
1278 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1279 \repeat unfold 4 {c4 c c c} \break
1280 \set Score.currentBarNumber = #50
1281 \repeat unfold 4 {c4 c c c}
1284 Bar numbers may only be printed at bar lines; to print a bar
1285 number at the beginning of a piece, an empty bar line must be
1288 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1289 \set Score.currentBarNumber = #50
1291 \repeat unfold 4 {c4 c c c} \break
1292 \repeat unfold 4 {c4 c c c}
1295 Bar numbers can be typeset at regular intervals instead of at the
1296 beginning of every line. This is illustrated in the following
1297 example, which also shows how to enclose bar numbers in boxes and
1301 TODO Text to be deleted ?
1302 whose source is available as
1303 @lsr{staff,making-bar-numbers-appear-at-regular-intervals.ly}.
1306 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1307 % Avoid printing a bar number at the end of a line
1308 \override Score.BarNumber #'break-visibility = #end-of-line-invisible
1310 % Print a bar number every 3th bar
1311 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3)
1313 % Increase the size of the bar number by 2
1314 \override Score.BarNumber #'font-size = #2
1316 % Draw a box round the following bar number(s)
1317 \override Score.BarNumber #'stencil
1318 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1319 \repeat unfold 5 { c1 } \bar "|"
1321 % Draw a circle round the following bar number(s)
1322 \override Score.BarNumber #'stencil
1323 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1324 \repeat unfold 4 { c1 } \bar "|."
1327 Bar numbers can be removed entirely by removing the Bar number
1328 engraver from the score context.
1330 @lilypond[verbatim,ragged-right,quote]
1334 \remove "Bar_number_engraver"
1346 Program reference: @internalsref{BarNumber}.
1348 Examples: @lsrdir{staff}
1353 @c Is this still a bug in 11?
1354 @c Yes it is, so leave it in.
1355 Bar numbers can collide with the top of the
1356 @internalsref{StaffGroup} bracket, if there is one.
1357 To solve this, the @code{padding} property of
1358 @internalsref{BarNumber} can be used to
1359 position the number correctly.
1362 @node Bar and bar number checks
1363 @unnumberedsubsubsec Bar and bar number checks
1366 @funindex barCheckSynchronize
1369 Bar checks help detect errors in the entered durations.
1370 A bar check may be entered using the bar symbol, @samp{|},
1371 at any place where a bar line is expected to fall.
1372 If bar check lines are encountered at other places,
1373 a list of warnings is printed in the log file,
1374 showing the line numbers and lines
1375 in which the bar checks failed. In the next
1376 example, the second bar check will signal an error
1379 \time 3/4 c2 e4 | g2 |
1382 Bar checks can also be used in lyrics, for example
1387 Twin -- kle | Twin -- kle |
1391 An incorrect duration can result in a completely garbled score,
1392 especially if the score is polyphonic, so a good place to start
1393 correcting input is by scanning for failed bar checks and
1394 incorrect durations.
1397 @funindex pipeSymbol
1399 It is also possible to redefine the action taken when a bar check
1400 or pipe symbol, @code{|}, is encountered in the input, so that
1401 it does something other than a bar check. This is done by
1402 assigning a music expression to @code{pipeSymbol}.
1403 In the following example @code{|} is set to insert a double bar
1404 line wherever it appears in the input, rather than checking
1407 @lilypond[quote,ragged-right,verbatim]
1408 pipeSymbol = \bar "||"
1417 When copying large pieces of music, it can be helpful to check
1418 that the LilyPond bar number corresponds to the original that you
1419 are entering from. This can be checked with
1420 @code{\barNumberCheck}, for example,
1423 \barNumberCheck #123
1427 will print a warning if the @code{currentBarNumber} is not 123
1428 when it is processed.
1431 @node Rehearsal marks
1432 @unnumberedsubsubsec Rehearsal marks
1434 @cindex Rehearsal marks
1437 To print a rehearsal mark, use the @code{\mark} command
1439 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1448 The letter@tie{}@q{I} is skipped in accordance with engraving
1449 traditions. If you wish to include the letter @q{I}, then use
1452 \set Score.markFormatter = #format-mark-alphabet
1455 The mark is incremented automatically if you use @code{\mark
1456 \default}, but you can also use an integer argument to set the
1457 mark manually. The value to use is stored in the property
1458 @code{rehearsalMark}.
1460 The style is defined by the property @code{markFormatter}. It is
1461 a function taking the current mark (an integer) and the current
1462 context as argument. It should return a markup object. In the
1463 following example, @code{markFormatter} is set to a canned
1464 procedure. After a few measures, it is set to function that
1465 produces a boxed number.
1467 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1468 \set Score.markFormatter = #format-mark-numbers
1471 \set Score.markFormatter = #format-mark-box-numbers
1477 The file @file{scm/@/translation@/-functions@/.scm} contains the
1478 definitions of @code{format-mark-numbers} (the default format),
1479 @code{format-mark-box-numbers}, @code{format-mark-letters} and
1480 @code{format-mark-box-letters}. These can be used as inspiration
1481 for other formatting functions.
1483 You may use @code{format-mark-barnumbers},
1484 @code{format-mark-box-barnumbers}, and
1485 @code{format-mark-circle-barnumbers} to get bar numbers instead of
1486 incremented numbers or letters.
1488 Other styles of rehearsal mark can be specified manually
1495 @code{Score.markFormatter} does not affect marks specified in this
1496 manner. However, it is possible to apply a @code{\markup} to the
1500 \mark \markup@{ \box A1 @}
1507 Music glyphs (such as the segno sign) may be printed inside a
1510 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1511 c1 \mark \markup { \musicglyph #"scripts.segno" }
1512 c1 \mark \markup { \musicglyph #"scripts.coda" }
1513 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1518 See @ref{The Feta font}, for a list of symbols which may be
1519 printed with @code{\musicglyph}.
1521 For common tweaks to the positioning of rehearsal marks, see
1526 This manual: @ref{Text marks}.
1528 Program reference: @internalsref{RehearsalMark}.
1530 Init files: @file{scm/@/translation@/-functions@/.scm} contains
1531 the definition of @code{format-mark-numbers} and
1532 @code{format-mark-letters}. They can be used as inspiration for
1533 other formatting functions.
1535 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1538 @node Special rhythmic concerns
1539 @subsection Special rhythmic concerns
1544 * Aligning to cadenzas::
1545 * Time administration::
1546 * Proportional notation (introduction)::
1550 @unnumberedsubsubsec Grace notes
1555 @cindex appoggiatura
1556 @cindex acciaccatura
1558 Grace notes are ornaments that are written out. The most common
1559 ones are acciaccatura, which should be played as very short. It
1560 is denoted by a slurred small note with a slashed stem. The
1561 appoggiatura is a grace note that takes a fixed fraction of the
1562 main note, and is denoted as a slurred note in small print without
1563 a slash. They are entered with the commands @code{\acciaccatura}
1564 and @code{\appoggiatura}, as demonstrated in the following example
1566 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1567 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1568 \acciaccatura { g16[ f] } e4
1571 Both are special forms of the @code{\grace} command. By prefixing
1572 this keyword to a music expression, a new one is formed, which
1573 will be printed in a smaller font and takes up no logical time in
1576 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1578 \grace { c16[ d16] } c2 c4
1582 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1583 @code{\grace} command does not start a slur.
1586 @c This section on grace note timing is interesting, but
1587 @c is of no practical use to the user. Perhaps it should
1588 @c be in the reference manual.
1590 @cindex timing, internal
1592 Internally, timing for grace notes is done using a second,
1593 @q{grace} timing. Every point in time consists of two rational
1594 numbers: one denotes the logical time, one denotes the grace
1595 timing. The above example is shown here with timing tuples
1597 @lilypond[quote,ragged-right]
1600 c4 \grace c16 c4 \grace {
1603 \new Lyrics \lyricmode {
1604 \override LyricText #'font-family = #'typewriter
1608 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1609 \markup { (\fraction 1 4 , 0 ) } 4
1611 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1612 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1614 \markup { ( \fraction 2 4 , 0 ) }
1620 The placement of grace notes is synchronized between different
1621 staves. In the following example, there are two sixteenth grace
1622 notes for every eighth grace note
1624 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1625 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1626 \new Staff { c4 \grace { g8[ b] } c4 } >>
1629 @funindex \afterGrace
1631 If you want to end a note with a grace, use the @code{\afterGrace}
1632 command. It takes two arguments: the main note, and the grace
1633 notes following the main note.
1635 @lilypond[ragged-right, verbatim,relative=2,fragment]
1636 c1 \afterGrace d1 { c16[ d] } c4
1639 This will put the grace notes after a @q{space} lasting 3/4 of the
1640 length of the main note. The fraction 3/4 can be changed by
1641 setting @code{afterGraceFraction}, ie.
1644 #(define afterGraceFraction (cons 7 8))
1648 will put the grace note at 7/8 of the main note.
1650 The same effect can be achieved manually by doing
1652 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1655 { s2 \grace { c16[ d] } } >>
1661 By adjusting the duration of the skip note (here it is a
1662 half-note), the space between the main-note and the grace
1665 A @code{\grace} music expression will introduce special
1666 typesetting settings, for example, to produce smaller type, and
1667 set directions. Hence, when introducing layout tweaks, they
1668 should be inside the grace expression, for example,
1670 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1682 The overrides should also be reverted inside the grace expression.
1684 The layout of grace expressions can be changed throughout the
1685 music using the function @code{add-grace-property}. The following
1686 example undefines the @code{Stem} direction for this grace, so
1687 that stems do not always point up.
1691 #(add-grace-property 'Voice 'Stem 'direction '())
1697 Another option is to change the variables @code{startGraceMusic},
1698 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1699 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1700 @code{stopAppoggiaturaMusic}. The default values of these can be
1701 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
1702 them other effects may be obtained.
1705 The slash through the stem in acciaccaturas can be obtained in
1706 other situations by @code{\override Stem #'stroke-style =
1712 Grace notes may be forced to use align with regular notes
1713 in other staves by setting @code{strict-grace-spacing} to
1716 @lilypond[relative=2,ragged-right]
1718 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1727 c'16[ c'16 c'16 c'16]
1728 c'16[ c'16 c'16 c'16]
1737 Program reference: @internalsref{GraceMusic}.
1742 Grace note synchronization can also lead to surprises. Staff
1743 notation, such as key signatures, bar lines, etc., are also
1744 synchronized. Take care when you mix staves with grace notes and
1745 staves without, for example,
1747 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1748 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1749 \new Staff { c4 \bar "|:" d4 } >>
1753 This can be remedied by inserting grace skips of the corresponding
1754 durations in the other staves. For the above example
1756 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1757 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1758 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1761 Grace sections should only be used within sequential music
1762 expressions. Nesting or juxtaposing grace sections is not
1763 supported, and might produce crashes or other errors.
1765 @node Aligning to cadenzas
1766 @unnumberedsubsubsec Aligning to cadenzas
1768 In an orchestral context, cadenzas present a special problem: when
1769 constructing a score that includes a cadenza, all other
1770 instruments should skip just as many notes as the length of the
1771 cadenza, otherwise they will start too soon or too late.
1773 A solution to this problem are the functions
1774 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
1775 functions take a piece of music as argument, and generate a
1776 multi-rest or @code{\skip}, exactly as long as the piece. The use
1777 of @code{mmrest-of-length} is demonstrated in the following
1780 @lilypond[verbatim,ragged-right,quote]
1781 cadenza = \relative c' {
1782 c4 d8 << { e f g } \\ { d4. } >>
1787 \new Staff { \cadenza c'4 }
1789 #(ly:export (mmrest-of-length cadenza))
1796 @node Time administration
1797 @unnumberedsubsubsec Time administration
1799 @cindex Time administration
1801 @funindex currentBarNumber
1802 @funindex measurePosition
1803 @funindex measureLength
1805 Time is administered by the
1806 @code{Timing_translator}, which by default is
1807 to be found in the @code{Score} context. An
1808 alias, @code{Timing}, is added to the context in which
1809 the @code{Timing_translator} is placed.
1811 The following properties of @code{Timing} are used
1812 to keep track of timing within the score.
1815 @item currentBarNumber
1816 The current measure number. For an example showing the
1817 use of this property see @ref{Bar numbers}.
1820 The length of the measures in the current time signature. For a
1821 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
1822 determines when bar lines are inserted and how automatic beams
1823 should be generated.
1825 @item measurePosition
1826 The point within the measure where we currently are. This
1827 quantity is reset by subtracting @code{measureLength} whenever
1828 @code{measureLength} is reached or exceeded. When that happens,
1829 @code{currentBarNumber} is incremented.
1832 If set to true, the above variables are updated for every time
1833 step. When set to false, the engraver stays in the current
1834 measure indefinitely.
1838 Timing can be changed by setting any of these variables
1839 explicitly. In the next example, the default 4/4 time
1840 signature is printed, but @code{measureLength} is set to 5/4.
1841 At 4/8 though the third bar, the @code{measurePosition} is
1842 advanced by 1/8 to 5/8, shortening that bar by 1/8.
1843 The next bar line then falls at 9/8 rather than 5/4.
1845 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1846 \set Score.measureLength = #(ly:make-moment 5 4)
1850 \set Score.measurePosition = #(ly:make-moment 5 8)
1856 As the example illustrates, @code{ly:make-moment n m} constructs a
1857 duration of n/m of a whole note. For example,
1858 @code{ly:make-moment 1 8} is an eighth note duration and
1859 @code{ly:make-moment 7 16} is the duration of seven sixteenths
1864 This manual: @ref{Bar numbers}, @ref{Unmetered music}
1866 Program Reference: @internalsref{Timing_translator},
1867 @internalsref{Score}
1870 @node Proportional notation (introduction)
1871 @unnumberedsubsubsec Proportional notation (introduction)
1872 @cindex Proportional notation
1874 See @ref{Proportional notation}.
1878 Notes can be spaced proportionally to their time-difference by
1879 assigning a duration to @code{proportionalNotationDuration}
1881 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1883 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1884 \new Staff { c8[ c c c c c] c4 c2 r2 }
1885 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1889 Setting this property only affects the ideal spacing between
1890 consecutive notes. For true proportional notation, the following
1891 settings are also required.
1895 @item True proportional notation requires that symbols are allowed
1896 to overstrike each other. That is achieved by removing the
1897 @internalsref{Separating_line_group_engraver} from
1898 @internalsref{Staff} context.
1900 @item Spacing influence of prefatory matter (clefs, bar lines,
1901 etc.) is removed by setting the @code{strict-note-spacing}
1902 property to @code{#t} in @internalsref{SpacingSpanner} grob.
1904 @item Optical spacing tweaks are switched by setting
1905 @code{uniform-stretching} in @internalsref{SpacingSpanner} to
1912 Examples: @lsr{spacing,proportional@/-spacing@/.ly},
1913 @lsr{spacing,proportional@/-strict@/-grace@/-notes@/.ly}, and
1914 @lsr{spacing,proportional@/-strict@/-notespacing@/.ly}
1916 An example of strict proportional notation is in the
1917 example file @file{input/proportional.ly}.