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 This section discusses rhythms, durations, and bars.
14 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
20 * Displaying rhythms::
23 * Special rhythmic concerns::
28 @subsection Writing rhythms
38 @unnumberedsubsubsec Durations
45 In Note, Chord, and Lyrics mode, durations are designated by
46 numbers and dots: durations are entered as their reciprocal
47 values. For example, a quarter note is entered using a @code{4}
48 (since it is a 1/4 note), while a half note is entered using a
49 @code{2} (since it is a 1/2 note). For notes longer than a whole
50 you must use the @code{\longa} and @code{\breve} commands
54 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
56 r1 r2 r4 r8 r16 r32 r64 r64
62 a\breve*1/2 \autoBeamOff
63 a1 a2 a4 a8 a16 a32 a64 a64
66 r\longa*1/4 r\breve *1/2
67 r1 r2 r4 r8 r16 r32 r64 r64
74 \remove "Bar_number_engraver"
78 \remove "Clef_engraver"
79 \override StaffSymbol #'transparent = ##t
80 \override TimeSignature #'transparent = ##t
81 \override BarLine #'transparent = ##t
82 \consists "Pitch_squash_engraver"
88 If the duration is omitted then it is set to the previously
89 entered duration. The default for the first note is a quarter
92 @lilypond[quote,ragged-right,verbatim,fragment]
93 { a a a2 a a4 a a1 a }
97 @node Augmentation dots
98 @unnumberedsubsubsec Augmentation dots
102 To obtain dotted note lengths, simply add a dot (@samp{.}) to the
103 number. Double-dotted notes are produced in a similar way.
105 @lilypond[quote,ragged-right,fragment,verbatim]
106 a'4 b' c''4. b'8 a'4. b'4.. c''8.
111 Dots are normally moved up to avoid staff lines, except in
112 polyphonic situations. The following commands may be used to
113 force a particular direction manually
119 @funindex \dotsNeutral
124 Program reference: @internalsref{Dots}, and
125 @internalsref{DotColumn}.
129 @unnumberedsubsubsec Tuplets
135 Tuplets are made out of a music expression by multiplying all
136 durations with a fraction
139 \times @var{fraction} @var{musicexpr}
143 The duration of @var{musicexpr} will be multiplied by the
144 fraction. The fraction's denominator will be printed over the
145 notes, optionally with a bracket. The most common tuplet is the
146 triplet in which 3 notes have the length of 2, so the notes are
147 2/3 of their written length
149 @lilypond[quote,ragged-right,fragment,verbatim]
150 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
153 Tuplets may be nested, for example,
155 @lilypond[fragment,ragged-right,verbatim,relative=2]
156 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
159 \times 3/5 { a a a a a }
167 @funindex \tupletDown
169 @funindex \tupletNeutral
170 @code{\tupletNeutral}.
175 @funindex tupletNumberFormatFunction
176 @cindex tuplet formatting
178 The property @code{tupletSpannerDuration} specifies how long each
179 bracket should last. With this, you can make lots of tuplets
180 while typing @code{\times} only once, thus saving lots of typing.
181 In the next example, there are two triplets shown, while
182 @code{\times} was only used once
184 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
185 \set tupletSpannerDuration = #(ly:make-moment 1 4)
186 \times 2/3 { c8 c c c c c }
190 For more information about @code{make-moment}, see
191 @ref{Time administration}.
193 The format of the number is determined by the property @code{text}
194 in @code{TupletNumber}. The default prints only the denominator,
195 but if it is set to the function
196 @code{tuplet-number::calc-fraction-text}, @var{num}:@var{den} will
199 To avoid printing tuplet numbers, use
201 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
202 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
203 \override TupletNumber #'transparent = ##t
204 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
207 Use the @code{\tweak} function to override nested tuplets
208 beginning at the same music moment. In this example,
209 @code{\tweak} specifies fraction text for the outer
210 @code{TupletNumber} and denominator text for the
211 @code{TupletNumber} of the first of the three inner tuplets.
213 @lilypond[quote,ragged-right,verbatim]
215 \tweak #'text #tuplet-number::calc-fraction-text
217 \tweak #'text #tuplet-number::calc-denominator-text
218 \times 2/3 { c'8[ c'8 c'8] }
219 \times 2/3 { c'8[ c'8 c'8] }
220 \times 2/3 { c'8[ c'8 c'8] }
225 Here @code{\tweak} and @code{\override} work together to specify
226 @code{TupletBracket} direction. The first @code{\tweak} positions
227 the @code{TupletBracket} of the outer tuplet above the staff. The
228 second @code{\tweak} positions the @code{TupletBracket} of the
229 first of the three inner tuplets below the staff. Note that this
230 pair of @code{\tweak} functions affects only the outer tuplet and
231 the first of the three inner tuplets because only those two
232 tuplets begin at the same music moment. We use @code{\override}
233 in the usual way to position the @code{TupletBrackets} of the
234 second and third of the inner tuplets below the staff.
236 @lilypond[quote,ragged-right,verbatim]
238 \tweak #'text #tuplet-number::calc-fraction-text
239 \tweak #'direction #up
241 \tweak #'direction #down
242 \times 2/3 { c'8[ c'8 c'8] }
243 \override TupletBracket #'direction = #down
244 \times 2/3 { c'8[ c'8 c'8] }
245 \times 2/3 { c'8[ c'8 c'8] }
250 Tuplet brackets can be made to run to prefatory matter or the next
253 @lilypond[ragged-right]
255 \set tupletFullLength = ##t
260 \set tupletFullLengthNote = ##t
273 Program reference: @internalsref{TupletBracket},
274 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
278 @node Scaling durations
279 @unnumberedsubsubsec Scaling durations
281 You can alter the length of duration by a fraction @var{N/M}
282 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).
283 This will not affect the appearance of the notes or rests
284 produced. These may be combined such as @samp{*M*N}.
286 In the following example, the first three notes take up exactly
287 two beats, but no triplet bracket is printed.
289 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
291 a4*2/3 gis4*2/3 a4*2/3
299 This manual: @ref{Tuplets}.
303 @subsection Writing rests
308 * Multi measure rests::
312 @unnumberedsubsubsec Rests
318 Rests are entered like notes with the note name @code{r}
320 @lilypond[fragment,quote,ragged-right,verbatim]
324 Whole bar rests, centered in middle of the bar, must be done with
325 multi-measure rests. They can be used for a single bar as well as
326 many bars, and are discussed in @ref{Multi measure rests}.
328 To explicitly specify a rest's vertical position, write a note
329 followed by @code{\rest}. A rest will be placed in the position
330 where the note would appear,
332 @lilypond[fragment,quote,ragged-right,verbatim]
337 This makes manual formatting of polyphonic music much easier,
338 since the automatic rest collision formatter will leave these
343 Program reference: @internalsref{Rest}.
347 @unnumberedsubsubsec Skips
350 @cindex Invisible rest
355 An invisible rest (also called a @q{skip}) can be entered like a
356 note with note name @samp{s} or with @code{\skip @var{duration}}
358 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
359 a4 a4 s4 a4 \skip 1 a4
362 The @code{s} syntax is only available in note mode and chord mode.
363 In other situations, for example, when entering lyrics, you should
364 use the @code{\skip} command
366 @lilypond[quote,ragged-right,verbatim]
369 \new Lyrics \lyricmode { \skip 2 bla2 }
373 The skip command is merely an empty musical placeholder. It does
374 not produce any output, not even transparent output.
376 The @code{s} skip command does create @internalsref{Staff} and
377 @internalsref{Voice} when necessary, similar to note and rest
378 commands. For example, the following results in an empty staff.
380 @lilypond[quote,ragged-right,verbatim]
384 The fragment @code{@{ \skip 4 @} } would produce an empty page.
388 Program reference: @internalsref{SkipMusic}.
391 @node Multi measure rests
392 @unnumberedsubsubsec Multi measure rests
394 @cindex multi measure rests
395 @cindex full measure rests
396 @cindex Rests, multi measure
397 @cindex Rests, full measure
398 @cindex whole rests for a full measure
401 Rests for one full measure (or many bars) are entered using
402 @samp{R}. It is specifically meant for full bar rests and for
403 entering parts: the rest can expand to fill a score with rests, or
404 it can be printed as a single multi-measure rest. This expansion
405 is controlled by the property @code{Score.skipBars}. If this is
406 set to true, empty measures will not be expanded, and the
407 appropriate number is added automatically
409 @lilypond[quote,ragged-right,fragment,verbatim]
410 \time 4/4 r1 | R1 | R1*2 \time 3/4 R2. \time 2/4 R2 \time 4/4
411 \set Score.skipBars = ##t R1*17 R1*4
414 The @code{1} in @code{R1} is similar to the duration notation used
415 for notes. Hence, for time signatures other than 4/4, you must
416 enter other durations. This can be done with augmentation dots or
419 @lilypond[quote,ragged-right,fragment,verbatim]
420 \set Score.skipBars = ##t
429 An @code{R} spanning a single measure is printed as either a whole
430 rest or a breve, centered in the measure regardless of the time
433 If there are only a few measures of rest, LilyPond prints
434 @q{church rests} (a series of rectangles) in the staff. To
435 replace that with a simple rest, use
436 @code{MultiMeasureRest.expand-limit}.
438 @lilypond[quote,ragged-right,fragment,verbatim]
439 \set Score.skipBars = ##t
441 \override MultiMeasureRest #'expand-limit = 1
445 @cindex text on multi-measure rest
446 @cindex script on multi-measure rest
447 @cindex fermata on multi-measure rest
449 Texts can be added to multi-measure rests by using the
450 @var{note}-@code{markup} syntax @ref{Text markup}. A variable
451 (@code{\fermataMarkup}) is provided for adding fermatas
453 @lilypond[quote,ragged-right,verbatim,fragment]
454 \set Score.skipBars = ##t
456 R2.*10^\markup { \italic "ad lib." }
460 Warning! This text is created by @code{MultiMeasureRestText}, not
463 @lilypond[quote,ragged-right,verbatim,fragment]
464 \override TextScript #'padding = #5
466 \override MultiMeasureRestText #'padding = #5
470 If you want to have text on the left end of a multi-measure rest,
471 attach the text to a zero-length skip note, i.e.,
481 Program reference: @internalsref{MultiMeasureRestMusicGroup},
482 @internalsref{MultiMeasureRest}.
484 The layout object @internalsref{MultiMeasureRestNumber} is for the
485 default number, and @internalsref{MultiMeasureRestText} for user
491 It is not possible to use fingerings (e.g., @code{R1-4}) to put
492 numbers over multi-measure rests. And the pitch of multi-measure
493 rests (or staff-centered rests) can not be influenced.
495 @cindex condensing rests
497 There is no way to automatically condense multiple rests into a
498 single multi-measure rest. Multi-measure rests do not take part
501 Be careful when entering multi-measure rests followed by whole
502 notes. The following will enter two notes lasting four measures
509 When @code{skipBars} is
510 set, the result will look OK, but the bar numbering will be off.
514 @node Displaying rhythms
515 @subsection Displaying rhythms
521 * Polymetric notation::
522 * Automatic note splitting::
526 @unnumberedsubsubsec Time signature
528 @cindex Time signature
532 Time signature indicates the metrum of a piece: a regular pattern
533 of strong and weak beats. It is denoted by a fraction at the
536 The time signature is set with the @code{\time} command
538 @lilypond[quote,ragged-right,fragment,verbatim]
539 \time 2/4 c'2 \time 3/4 c'2.
544 The symbol that is printed can be customized with the @code{style}
545 property. Setting it to @code{#'()} uses fraction style for 4/4
548 @lilypond[fragment,quote,ragged-right,verbatim]
551 \override Staff.TimeSignature #'style = #'()
556 There are many more options for its layout. See @ref{Ancient time
557 signatures}, for more examples.
559 @code{\time} sets the property @code{timeSignatureFraction},
560 @code{beatLength} and @code{measureLength} in the @code{Timing}
561 context, which is normally aliased to @internalsref{Score}. The
562 property @code{measureLength} determines where bar lines should be
563 inserted, and how automatic beams should be generated. Changing
564 the value of @code{timeSignatureFraction} also causes the symbol
567 More options are available through the Scheme function
568 @code{set-time-signature}. In combination with the
569 @internalsref{Measure_grouping_engraver}, it will create
570 @internalsref{MeasureGrouping} signs. Such signs ease reading
571 rhythmically complex modern music. In the following example, the
572 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
573 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
575 @lilypond[quote,ragged-right,verbatim]
578 #(set-time-signature 9 8 '(2 2 2 3))
579 g8[ g] d[ d] g[ g] a8[( bes g]) |
580 #(set-time-signature 5 8 '(3 2))
586 \consists "Measure_grouping_engraver"
595 Program reference: @internalsref{TimeSignature}, and
596 @internalsref{Timing_translator}.
598 Examples: @lsr{contemporary,compound-time-signature.ly}.
603 Automatic beaming does not use the measure grouping specified with
604 @code{set-time-signature}.
608 @unnumberedsubsubsec Upbeats
612 @cindex partial measure
613 @cindex measure, partial
614 @cindex shorten measures
617 Partial measures, such as an anacrusis or upbeat, are entered
620 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
621 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
624 The syntax for this command is
627 \partial @var{duration}
630 where @code{duration} is the rhythmic length to be added before
633 This is internally translated into
636 \set Timing.measurePosition = -@var{length of duration}
639 The property @code{measurePosition} contains a rational number
640 indicating how much of the measure has passed at this point. Note
641 that this is a negative number; @code{\partial 4} is internally
642 translated to mean @qq{there is a quarter note left in the bar.}
647 This command does not take into account grace notes at the start
648 of the music. When a piece starts with graces notes in the
649 pickup, then the @code{\partial} should follow the grace notes
651 @lilypond[verbatim,quote,ragged-right,relative,fragment]
658 @code{\partial} is only intended to be used at the beginning of a
659 piece. If you use it after the beginning, some odd warnings may
663 @node Unmetered music
664 @unnumberedsubsubsec Unmetered music
668 @funindex \cadenzaOff
670 Bar lines and bar numbers are calculated automatically. For
671 unmetered music (cadenzas, for example), this is not desirable.
672 To turn off automatic bar lines and bar numbers, use the commands
673 @code{\cadenzaOn} and @code{\cadenzaOff}.
675 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
687 LilyPond will only insert line breaks and page breaks at a
688 barline. Unless the unmetered music ends before the end of the
689 staff line, you will need to insert invisible bar lines
696 to indicate where breaks can occur.
699 @node Polymetric notation
700 @unnumberedsubsubsec Polymetric notation
702 @cindex double time signatures
703 @cindex signatures, polymetric
704 @cindex polymetric signatures
705 @cindex meter, polymetric
707 Double time signatures are not supported explicitly, but they can
708 be faked. In the next example, the markup for the time signature
709 is created with a markup text. This markup text is inserted in
710 the @internalsref{TimeSignature} grob. See also
711 @lsr{contemporary,compound-time-signature}.
713 @lilypond[verbatim,ragged-right]
716 \override #'(baseline-skip . 2) \number {
719 \bracket \column { "5" "8" }
724 \override Staff.TimeSignature #'stencil =
725 #ly:text-interface::print
726 \override Staff.TimeSignature #'text = #tsMarkup
728 c'2 \bar ":" c'4 c'4.
732 Each staff can also have its own time signature. This is done by
733 moving the @internalsref{Timing_translator} to the
734 @internalsref{Staff} context.
739 \remove "Timing_translator"
740 \remove "Default_bar_line_engraver"
744 \consists "Timing_translator"
745 \consists "Default_bar_line_engraver"
752 Now, each staff has its own time signature.
766 c4. c8 c c c4. c8 c c
771 @lilypond[quote,ragged-right]
775 \remove "Timing_translator"
776 \remove "Default_bar_line_engraver"
779 \consists "Timing_translator"
780 \consists "Default_bar_line_engraver"
795 c4. c8 c c c4. c8 c c
801 A different form of polymetric notation is where note lengths have
802 different values across staves.
804 This notation can be created by setting a common time signature
805 for each staff but replacing it manually using
806 @code{timeSignatureFraction} to the desired fraction. Then the
807 printed durations in each staff are scaled to the common time
808 signature. The latter is done with @code{\compressMusic}, which
809 is used similar to @code{\times}, but does not create a tuplet
810 bracket. The syntax is @example \compressMusic #'(@var{numerator}
811 . @var{denominator}) @var{musicexpr} @end example
815 In this example, music with the time signatures of 3/4, 9/8, and
816 10/8 are used in parallel. In the second staff, shown durations
817 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
818 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
821 @lilypond[quote,ragged-right,verbatim,fragment]
829 \set Staff.timeSignatureFraction = #'(9 . 8)
830 \compressMusic #'(2 . 3)
831 \repeat unfold 6 { c8[ c c] }
835 \set Staff.timeSignatureFraction = #'(10 . 8)
836 \compressMusic #'(3 . 5) {
837 \repeat unfold 2 { c8[ c c] }
838 \repeat unfold 2 { c8[ c] }
839 | c4. c4. \times 2/3 { c8 c c } c4
848 When using different time signatures in parallel, the spacing is
849 aligned vertically, but bar lines distort the regular spacing.
852 @node Automatic note splitting
853 @unnumberedsubsubsec Automatic note splitting
855 Long notes can be converted automatically to tied notes. This is
856 done by replacing the @internalsref{Note_heads_engraver} by the
857 @internalsref{Completion_heads_engraver}. In the following
858 examples, notes crossing the bar line are split and tied.
860 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
862 \remove "Note_heads_engraver"
863 \consists "Completion_heads_engraver"
865 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
869 This engraver splits all running notes at the bar line, and
870 inserts ties. One of its uses is to debug complex scores: if the
871 measures are not entirely filled, then the ties exactly show how
872 much each measure is off.
874 If you want to allow line breaking on the bar lines where
875 @internalsref{Completion_heads_engraver} splits notes, you must
876 also remove @internalsref{Forbid_line_break_engraver}.
881 Not all durations (especially those containing tuplets) can be
882 represented exactly with normal notes and dots, but the engraver
883 will not insert tuplets.
885 @code{Completion_heads_engraver} only affects notes; it does not
891 Program reference: @internalsref{Completion_heads_engraver}.
905 @node Automatic beams
906 @unnumberedsubsubsec Automatic beams
908 LilyPond inserts beams automatically
910 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
911 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
914 When these automatic decisions are not good enough, beaming can be
915 entered explicitly. It is also possible to define beaming
916 patterns that differ from the defaults. See @ref{Setting
917 automatic beam behavior}, for details.
919 Individual notes may be marked with @code{\noBeam} to prevent them
922 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
923 \time 2/4 c8 c\noBeam c c
929 Program reference: @internalsref{Beam}.
933 @unnumberedsubsubsec Manual beams
935 @cindex beams, manual
939 In some cases it may be necessary to override the automatic
940 beaming algorithm. For example, the autobeamer will not put beams
941 over rests or bar lines. Such beams are specified manually by
942 marking the begin and end point with @code{[} and @code{]}
944 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
946 r4 r8[ g' a r8] r8 g[ | a] r8
953 @funindex stemLeftBeamCount
954 @funindex stemRightBeamCount
957 LilyPond can automatically determine beaming patterns within a
958 beam, but this automatic behavior can sometimes produce odd
959 results; therefore the @code{stemLeftBeamCount} and
960 @code{stemRightBeamCount} properties can be used to override the
961 defaults. If either property is set, its value will be used only
962 once, and then it is erased.
964 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
969 \set stemLeftBeamCount = #1
974 The property @code{subdivideBeams} can be set in order to
975 subdivide all 16th or shorter beams at beat positions, as defined
976 by the @code{beatLength} property.
978 @lilypond[fragment,quote,relative=2,verbatim]
980 \set subdivideBeams = ##t
982 \set Score.beatLength = #(ly:make-moment 1 8)
985 @funindex subdivideBeams
988 For more information about @code{make-moment}, see
989 @ref{Time administration}.
991 Line breaks are normally forbidden when beams cross bar lines.
992 This behavior can be changed by setting @code{breakable}.
996 @cindex beams and line breaks
999 @cindex auto-knee-gap
1001 Kneed beams are inserted automatically when a large gap is
1002 detected between the note heads. This behavior can be tuned
1003 through the @code{auto-knee-gap} object.
1008 Automatically kneed cross-staff beams cannot be used together with
1009 hidden staves. See @ref{Hiding staves}.
1011 @c Is this still true with skyline spacing stuff? -J.Mandereau
1012 Beams do not avoid collisions with symbols around the notes, such
1013 as texts and accidentals.
1016 @node Feathered beams
1017 @unnumberedsubsubsec Feathered beams
1019 Feathered beams are printed by setting the @code{grow-direction}
1020 property of a @code{Beam}. The @code{\featherDurations} function
1021 can be used to adjust note durations.
1023 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1024 \override Beam #'grow-direction = #LEFT
1025 \featherDurations #(ly:make-moment 5 4)
1033 The @code{\featherDurations} command only works with very short
1050 @unnumberedsubsubsec Bar check
1053 @funindex barCheckSynchronize
1056 Bar checks help detect errors in the durations. A bar check is
1057 entered using the bar symbol, @samp{|}. Whenever it is
1058 encountered during interpretation, it should fall on a measure
1059 boundary. If it does not, a warning is printed. In the next
1060 example, the second bar check will signal an error
1063 \time 3/4 c2 e4 | g2 |
1066 Bar checks can also be used in lyrics, for example
1071 Twin -- kle | Twin -- kle
1075 Failed bar checks are caused by entering incorrect durations.
1076 Incorrect durations often completely garble up the score,
1077 especially if the score is polyphonic, so a good place to start
1078 correcting input is by scanning for failed bar checks and
1079 incorrect durations.
1082 @funindex pipeSymbol
1084 It is also possible to redefine the meaning of @code{|}. This is
1085 done by assigning a music expression to @code{pipeSymbol},
1087 @lilypond[quote,ragged-right,verbatim]
1088 pipeSymbol = \bar "||"
1095 @unnumberedsubsubsec Bar lines
1099 @cindex measure lines
1102 Bar lines delimit measures, but are also used to indicate repeats.
1103 Normally they are inserted automatically. Line breaks may only
1104 happen on bar lines.
1106 Special types of bar lines can be forced with the @code{\bar}
1109 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1113 The following bar types are available
1115 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1117 In addition, you can specify @code{"||:"}, which is equivalent to
1118 @code{"|:"} except at line breaks, where it gives a double bar
1119 line at the end of the line and a start repeat at the beginning of
1122 To allow a line break where there is no visible bar line, use
1129 This will insert an invisible bar line and allow line breaks at
1130 this point (without increasing the bar number counter).
1132 In scores with many staves, a @code{\bar} command in one staff is
1133 automatically applied to all staves. The resulting bar lines are
1134 connected between different staves of a @code{StaffGroup},
1135 @code{PianoStaff}, or @code{GrandStaff}.
1137 @lilypond[quote,ragged-right,fragment,verbatim]
1145 \new Staff { \clef bass c4 g e g }
1147 \new Staff { \clef bass c2 c2 }
1155 @funindex repeatCommands
1156 @funindex defaultBarType
1158 The command @code{\bar }@var{bartype} is a short cut for doing
1159 @code{\set Timing.whichBar = }@var{bartype}. Whenever
1160 @code{whichBar} is set to a string, a bar line of that type is
1163 A bar line is created whenever the @code{whichBar} property is
1164 set. At the start of a measure it is set to the contents of
1165 @code{Timing.defaultBarType}. The contents of
1166 @code{repeatCommands} are used to override default measure bars.
1168 You are encouraged to use @code{\repeat} for repetitions. See
1174 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1176 Program reference: @internalsref{BarLine} (created at
1177 @internalsref{Staff} level), @internalsref{SpanBar} (across
1182 @unnumberedsubsubsec Bar numbers
1185 @cindex measure numbers
1186 @funindex currentBarNumber
1188 Bar numbers are printed by default at the start of the line. The
1189 number itself is stored in the @code{currentBarNumber} property,
1190 which is normally updated automatically for every measure.
1192 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1193 \repeat unfold 4 {c4 c c c} \break
1194 \set Score.currentBarNumber = #50
1195 \repeat unfold 4 {c4 c c c}
1198 Bar numbers may only be printed at bar lines; to print a bar
1199 number at the beginning of a piece, an empty bar line must be
1202 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1203 \set Score.currentBarNumber = #50
1205 \repeat unfold 4 {c4 c c c} \break
1206 \repeat unfold 4 {c4 c c c}
1209 Bar numbers can be typeset at regular intervals instead of at the
1210 beginning of each line. This is illustrated in the following
1211 example, whose source is available as
1212 @lsr{staff,making-bar-numbers-appear-at-regular-intervals.ly}.
1214 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
1216 Bar numbers can be removed entirely by removing the Bar number
1217 engraver from the score.
1219 @lilypond[verbatim,ragged-right,quote]
1223 \remove "Bar_number_engraver"
1235 Program reference: @internalsref{BarNumber}.
1237 Examples: @lsrdir{staff}
1242 Bar numbers can collide with the @internalsref{StaffGroup}
1243 bracket, if there is one at the top. To solve this, the
1244 @code{padding} property of @internalsref{BarNumber} can be used to
1245 position the number correctly.
1248 @node Barnumber check
1249 @unnumberedsubsubsec Barnumber check
1251 When copying large pieces of music, it can be helpful to check
1252 that the LilyPond bar number corresponds to the original that you
1253 are entering from. This can be checked with
1254 @code{\barNumberCheck}, for example,
1257 \barNumberCheck #123
1261 will print a warning if the @code{currentBarNumber} is not 123
1262 when it is processed.
1265 @node Rehearsal marks
1266 @unnumberedsubsubsec Rehearsal marks
1268 @cindex Rehearsal marks
1271 To print a rehearsal mark, use the @code{\mark} command
1273 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1282 The letter@tie{}@q{I} is skipped in accordance with engraving
1283 traditions. If you wish to include the letter @q{I}, then use
1286 \set Score.markFormatter = #format-mark-alphabet
1289 The mark is incremented automatically if you use @code{\mark
1290 \default}, but you can also use an integer argument to set the
1291 mark manually. The value to use is stored in the property
1292 @code{rehearsalMark}.
1294 The style is defined by the property @code{markFormatter}. It is
1295 a function taking the current mark (an integer) and the current
1296 context as argument. It should return a markup object. In the
1297 following example, @code{markFormatter} is set to a canned
1298 procedure. After a few measures, it is set to function that
1299 produces a boxed number.
1301 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1302 \set Score.markFormatter = #format-mark-numbers
1305 \set Score.markFormatter = #format-mark-box-numbers
1311 The file @file{scm/@/translation@/-functions@/.scm} contains the
1312 definitions of @code{format-mark-numbers} (the default format),
1313 @code{format-mark-box-numbers}, @code{format-mark-letters} and
1314 @code{format-mark-box-letters}. These can be used as inspiration
1315 for other formatting functions.
1317 You may use @code{format-mark-barnumbers},
1318 @code{format-mark-box-barnumbers}, and
1319 @code{format-mark-circle-barnumbers} to get bar numbers instead of
1320 incremented numbers or letters.
1322 Other styles of rehearsal mark can be specified manually
1329 @code{Score.markFormatter} does not affect marks specified in this
1330 manner. However, it is possible to apply a @code{\markup} to the
1334 \mark \markup@{ \box A1 @}
1341 Music glyphs (such as the segno sign) may be printed inside a
1344 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1345 c1 \mark \markup { \musicglyph #"scripts.segno" }
1346 c1 \mark \markup { \musicglyph #"scripts.coda" }
1347 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1352 See @ref{The Feta font}, for a list of symbols which may be
1353 printed with @code{\musicglyph}.
1355 For common tweaks to the positioning of rehearsal marks, see
1360 This manual: @ref{Text marks}.
1362 Program reference: @internalsref{RehearsalMark}.
1364 Init files: @file{scm/@/translation@/-functions@/.scm} contains
1365 the definition of @code{format-mark-numbers} and
1366 @code{format-mark-letters}. They can be used as inspiration for
1367 other formatting functions.
1369 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1372 @node Special rhythmic concerns
1373 @subsection Special rhythmic concerns
1378 * Aligning to cadenzas::
1379 * Time administration::
1380 * Proportional notation (introduction)::
1384 @unnumberedsubsubsec Grace notes
1389 @cindex appoggiatura
1390 @cindex acciaccatura
1392 Grace notes are ornaments that are written out. The most common
1393 ones are acciaccatura, which should be played as very short. It
1394 is denoted by a slurred small note with a slashed stem. The
1395 appoggiatura is a grace note that takes a fixed fraction of the
1396 main note, and is denoted as a slurred note in small print without
1397 a slash. They are entered with the commands @code{\acciaccatura}
1398 and @code{\appoggiatura}, as demonstrated in the following example
1400 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1401 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1402 \acciaccatura { g16[ f] } e4
1405 Both are special forms of the @code{\grace} command. By prefixing
1406 this keyword to a music expression, a new one is formed, which
1407 will be printed in a smaller font and takes up no logical time in
1410 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1412 \grace { c16[ d16] } c2 c4
1416 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1417 @code{\grace} command does not start a slur.
1419 @cindex timing, internal
1421 Internally, timing for grace notes is done using a second,
1422 @q{grace} timing. Every point in time consists of two rational
1423 numbers: one denotes the logical time, one denotes the grace
1424 timing. The above example is shown here with timing tuples
1426 @lilypond[quote,ragged-right]
1429 c4 \grace c16 c4 \grace {
1432 \new Lyrics \lyricmode {
1433 \override LyricText #'font-family = #'typewriter
1437 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1438 \markup { (\fraction 1 4 , 0 ) } 4
1440 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1441 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1443 \markup { ( \fraction 2 4 , 0 ) }
1448 The placement of grace notes is synchronized between different
1449 staves. In the following example, there are two sixteenth grace
1450 notes for every eighth grace note
1452 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1453 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1454 \new Staff { c4 \grace { g8[ b] } c4 } >>
1457 @funindex \afterGrace
1459 If you want to end a note with a grace, use the @code{\afterGrace}
1460 command. It takes two arguments: the main note, and the grace
1461 notes following the main note.
1463 @lilypond[ragged-right, verbatim,relative=2,fragment]
1464 c1 \afterGrace d1 { c16[ d] } c4
1467 This will put the grace notes after a @q{space} lasting 3/4 of the
1468 length of the main note. The fraction 3/4 can be changed by
1469 setting @code{afterGraceFraction}, ie.
1472 #(define afterGraceFraction (cons 7 8))
1476 will put the grace note at 7/8 of the main note.
1478 The same effect can be achieved manually by doing
1480 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1483 { s2 \grace { c16[ d] } } >>
1489 By adjusting the duration of the skip note (here it is a
1490 half-note), the space between the main-note and the grace is
1493 A @code{\grace} music expression will introduce special
1494 typesetting settings, for example, to produce smaller type, and
1495 set directions. Hence, when introducing layout tweaks, they
1496 should be inside the grace expression, for example,
1498 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1510 The overrides should also be reverted inside the grace expression.
1512 The layout of grace expressions can be changed throughout the
1513 music using the function @code{add-grace-property}. The following
1514 example undefines the @code{Stem} direction for this grace, so
1515 that stems do not always point up.
1519 #(add-grace-property 'Voice 'Stem 'direction '())
1525 Another option is to change the variables @code{startGraceMusic},
1526 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1527 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1528 @code{stopAppoggiaturaMusic}. More information is in the file
1529 @file{ly/@/grace@/-init@/.ly}.
1532 The slash through the stem in acciaccaturas can be obtained in
1533 other situations by @code{\override Stem #'stroke-style =
1539 Grace notes may be forced to use floating spacing,
1541 @lilypond[relative=2,ragged-right]
1543 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1552 c'16[ c'16 c'16 c'16]
1553 c'16[ c'16 c'16 c'16]
1562 Program reference: @internalsref{GraceMusic}.
1567 A score that starts with a @code{\grace} expression needs an
1568 explicit @code{\new Voice} declaration, otherwise the main note
1569 and the grace note end up on different staves.
1571 Grace note synchronization can also lead to surprises. Staff
1572 notation, such as key signatures, bar lines, etc., are also
1573 synchronized. Take care when you mix staves with grace notes and
1574 staves without, for example,
1576 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1577 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1578 \new Staff { c4 \bar "|:" d4 } >>
1582 This can be remedied by inserting grace skips of the corresponding
1583 durations in the other staves. For the above example
1585 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1586 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1587 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1590 Grace sections should only be used within sequential music
1591 expressions. Nesting or juxtaposing grace sections is not
1592 supported, and might produce crashes or other errors.
1595 @node Aligning to cadenzas
1596 @unnumberedsubsubsec Aligning to cadenzas
1598 In an orchestral context, cadenzas present a special problem: when
1599 constructing a score that includes a cadenza, all other
1600 instruments should skip just as many notes as the length of the
1601 cadenza, otherwise they will start too soon or too late.
1603 A solution to this problem are the functions
1604 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
1605 functions take a piece of music as argument, and generate a
1606 @code{\skip} or multi-rest, exactly as long as the piece. The use
1607 of @code{mmrest-of-length} is demonstrated in the following
1610 @lilypond[verbatim,ragged-right,quote]
1611 cadenza = \relative c' {
1612 c4 d8 << { e f g } \\ { d4. } >>
1617 \new Staff { \cadenza c'4 }
1619 #(ly:export (mmrest-of-length cadenza))
1626 @node Time administration
1627 @unnumberedsubsubsec Time administration
1629 @cindex Time administration
1631 Time is administered by the
1632 @internalsref{Time_signature_engraver}, which usually lives in the
1633 @internalsref{Score} context. The bookkeeping deals with the
1637 @item currentBarNumber
1641 The length of the measures in the current time signature. For a
1642 4/4 time this is@tie{}1, and for 6/8 it is 3/4.
1644 @item measurePosition
1645 The point within the measure where we currently are. This
1646 quantity is reset to@tie{}0 whenever it exceeds
1647 @code{measureLength}. When that happens, @code{currentBarNumber}
1651 If set to true, the above variables are updated for every time
1652 step. When set to false, the engraver stays in the current
1653 measure indefinitely.
1657 Timing can be changed by setting any of these variables
1658 explicitly. In the next example, the 4/4 time signature is
1659 printed, but @code{measureLength} is set to 5/4. After a while,
1660 the measure is shortened by 1/8, by setting @code{measurePosition}
1661 to 7/8 at 2/4 in the measure, so the next bar line will fall at
1662 2/4 + 3/8. The 3/8 arises because 5/4 normally has 10/8, but we
1663 have manually set the measure position to be 7/8 and 10/8 - 7/8 =
1666 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1667 \set Score.measureLength = #(ly:make-moment 5 4)
1671 \set Score.measurePosition = #(ly:make-moment 7 8)
1677 As the example illustrates, @code{ly:make-moment n m} constructs a
1678 duration of n/m of a whole note. For example,
1679 @code{ly:make-moment 1 8} is an eighth note duration and
1680 @code{ly:make-moment 7 16} is the duration of seven sixteenths
1684 @node Proportional notation (introduction)
1685 @unnumberedsubsubsec Proportional notation (introduction)
1686 @cindex Proportional notation
1688 See @ref{Proportional notation}.
1691 TODO: remove all this stuff?
1693 Notes can be spaced proportionally to their time-difference by
1694 assigning a duration to @code{proportionalNotationDuration}
1696 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1698 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1699 \new Staff { c8[ c c c c c] c4 c2 r2 }
1700 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1704 Setting this property only affects the ideal spacing between
1705 consecutive notes. For true proportional notation, the following
1706 settings are also required.
1710 @item True proportional notation requires that symbols are allowed
1711 to overstrike each other. That is achieved by removing the
1712 @internalsref{Separating_line_group_engraver} from
1713 @internalsref{Staff} context.
1715 @item Spacing influence of prefatory matter (clefs, bar lines,
1716 etc.) is removed by setting the @code{strict-note-spacing}
1717 property to @code{#t} in @internalsref{SpacingSpanner} grob.
1719 @item Optical spacing tweaks are switched by setting
1720 @code{uniform-stretching} in @internalsref{SpacingSpanner} to
1727 Examples: @lsr{spacing,proportional@/-spacing@/.ly},
1728 @lsr{spacing,proportional@/-strict@/-grace@/-notes@/.ly}, and
1729 @lsr{spacing,proportional@/-strict@/-notespacing@/.ly}
1731 An example of strict proportional notation is in the
1732 example file @file{input/proportional.ly}.