1 @c -*- coding: utf-8; mode: texinfo; -*-
6 This section discusses rhythms, durations, and bars.
11 * Displaying rhythms::
14 * Special rhythmic concerns::
19 @subsection Writing rhythms
29 @unnumberedsubsubsec Durations
36 In Note, Chord, and Lyrics mode, durations are designated by numbers and
37 dots: durations are entered as their reciprocal values. For example, a
38 quarter note is entered using a @code{4} (since it is a 1/4 note), while
39 a half note is entered using a @code{2} (since it is a 1/2 note). For
40 notes longer than a whole you must use the @code{\longa} and
41 @code{\breve} commands
45 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
47 r1 r2 r4 r8 r16 r32 r64 r64
53 a\breve*1/2 \autoBeamOff
54 a1 a2 a4 a8 a16 a32 a64 a64
57 r\longa*1/4 r\breve *1/2
58 r1 r2 r4 r8 r16 r32 r64 r64
65 \remove "Bar_number_engraver"
69 \remove "Clef_engraver"
70 \override StaffSymbol #'transparent = ##t
71 \override TimeSignature #'transparent = ##t
72 \override BarLine #'transparent = ##t
73 \consists "Pitch_squash_engraver"
79 If the duration is omitted then it is set to the previously entered
80 duration. The default for the first note is a quarter note.
82 @lilypond[quote,ragged-right,verbatim,fragment]
83 { a a a2 a a4 a a1 a }
87 @node Augmentation dots
88 @unnumberedsubsubsec Augmentation dots
92 To obtain dotted note lengths, simply add a dot (@samp{.}) to
93 the number. Double-dotted notes are produced in a similar way.
95 @lilypond[quote,ragged-right,fragment,verbatim]
96 a'4 b' c''4. b'8 a'4. b'4.. c''8.
101 Dots are normally moved up to avoid staff lines, except in polyphonic
102 situations. The following commands may be used to force a particular
109 @funindex \dotsNeutral
114 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
118 @unnumberedsubsubsec Tuplets
124 Tuplets are made out of a music expression by multiplying all durations
128 \times @var{fraction} @var{musicexpr}
132 The duration of @var{musicexpr} will be multiplied by the fraction.
133 The fraction's denominator will be printed over the notes, optionally
134 with a bracket. The most common tuplet is the triplet in which 3
135 notes have the length of 2, so the notes are 2/3 of their written
138 @lilypond[quote,ragged-right,fragment,verbatim]
139 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
142 Tuplets may be nested, for example,
144 @lilypond[fragment,ragged-right,verbatim,relative=2]
145 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
148 \times 3/5 { a a a a a }
156 @funindex \tupletDown
158 @funindex \tupletNeutral
159 @code{\tupletNeutral}.
164 @funindex tupletNumberFormatFunction
165 @cindex tuplet formatting
167 The property @code{tupletSpannerDuration} specifies how long each
168 bracket should last. With this, you can make lots of tuplets while
169 typing @code{\times} only once, thus saving lots of typing. In the next
170 example, there are two triplets shown, while @code{\times} was only
173 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
174 \set tupletSpannerDuration = #(ly:make-moment 1 4)
175 \times 2/3 { c8 c c c c c }
179 For more information about @code{make-moment}, see
180 @ref{Time administration}.
182 The format of the number is determined by the property @code{text} in
183 @code{TupletNumber}. The default prints only the denominator, but if
184 it is set to the function @code{tuplet-number::calc-fraction-text},
185 @var{num}:@var{den} will be printed instead.
187 To avoid printing tuplet numbers, use
189 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
190 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
191 \override TupletNumber #'transparent = ##t
192 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
195 Use the @code{\tweak} function to override nested tuplets beginning at the
196 same music moment. In this example, @code{\tweak} specifies fraction
198 outer @code{TupletNumber} and denominator text for the @code{TupletNumber}
199 of the first of the three inner tuplets.
201 @lilypond[quote,ragged-right,verbatim]
203 \tweak #'text #tuplet-number::calc-fraction-text
205 \tweak #'text #tuplet-number::calc-denominator-text
206 \times 2/3 { c'8[ c'8 c'8] }
207 \times 2/3 { c'8[ c'8 c'8] }
208 \times 2/3 { c'8[ c'8 c'8] }
213 Here @code{\tweak} and @code{\override} work together to specify
214 @code{TupletBracket} direction. The first @code{\tweak} positions
215 the @code{TupletBracket} of the outer
216 tuplet above the staff. The second @code{\tweak} positions the
217 @code{TupletBracket} of the first of the three inner tuplets below the
218 staff. Note that this pair of @code{\tweak} functions affects only
219 the outer tuplet and the first of the three inner tuplets because only
220 those two tuplets begin at the same music moment. We use @code{\override}
221 in the usual way to position the @code{TupletBrackets} of
222 the second and third of the inner tuplets below the staff.
224 @lilypond[quote,ragged-right,verbatim]
226 \tweak #'text #tuplet-number::calc-fraction-text
227 \tweak #'direction #up
229 \tweak #'direction #down
230 \times 2/3 { c'8[ c'8 c'8] }
231 \override TupletBracket #'direction = #down
232 \times 2/3 { c'8[ c'8 c'8] }
233 \times 2/3 { c'8[ c'8 c'8] }
238 Tuplet brackets can be made to run to prefatory matter or
241 @lilypond[ragged-right]
243 \set tupletFullLength = ##t
248 \set tupletFullLengthNote = ##t
261 Program reference: @internalsref{TupletBracket},
262 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
266 @node Scaling durations
267 @unnumberedsubsubsec Scaling durations
269 You can alter the length of duration by a fraction @var{N/M}
270 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}). This
271 will not affect the appearance of the notes or rests produced. These
272 may be combined such as @samp{*M*N}.
274 In the following example, the first three notes take up exactly two
275 beats, but no triplet bracket is printed.
277 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
279 a4*2/3 gis4*2/3 a4*2/3
287 This manual: @ref{Tuplets}.
291 @subsection Writing rests
296 * Multi measure rests::
300 @unnumberedsubsubsec Rests
306 Rests are entered like notes with the note name @code{r}
308 @lilypond[fragment,quote,ragged-right,verbatim]
312 Whole bar rests, centered in middle of the bar,
313 must be done with multi-measure rests. They can be used for a
314 single bar as well as many bars, and are discussed in
315 @ref{Multi measure rests}.
317 To explicitly specify a rest's vertical position, write a note
318 followed by @code{\rest}. A rest will be placed in the position
319 where the note would appear,
321 @lilypond[fragment,quote,ragged-right,verbatim]
326 This makes manual formatting of
327 polyphonic music much easier, since the automatic rest collision
328 formatter will leave these rests alone.
332 Program reference: @internalsref{Rest}.
336 @unnumberedsubsubsec Skips
339 @cindex Invisible rest
344 An invisible rest (also called a @q{skip}) can be entered like a note
345 with note name @samp{s} or with @code{\skip @var{duration}}
347 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
348 a4 a4 s4 a4 \skip 1 a4
351 The @code{s} syntax is only available in note mode and chord mode. In
352 other situations, for example, when entering lyrics, you should use
353 the @code{\skip} command
355 @lilypond[quote,ragged-right,verbatim]
358 \new Lyrics \lyricmode { \skip 2 bla2 }
362 The skip command is merely an empty musical placeholder. It does not
363 produce any output, not even transparent output.
365 The @code{s} skip command does create @internalsref{Staff} and
366 @internalsref{Voice} when necessary, similar to note and rest
367 commands. For example, the following results in an empty staff.
369 @lilypond[quote,ragged-right,verbatim]
373 The fragment @code{@{ \skip 4 @} } would produce an empty page.
377 Program reference: @internalsref{SkipMusic}.
380 @node Multi measure rests
381 @unnumberedsubsubsec Multi measure rests
383 @cindex multi measure rests
384 @cindex full measure rests
385 @cindex Rests, multi measure
386 @cindex Rests, full measure
387 @cindex whole rests for a full measure
390 Rests for one full measure (or many bars) are entered using @samp{R}. It
391 is specifically meant for full bar rests and for entering parts: the rest
392 can expand to fill a score with rests, or it can be printed as a single
393 multi-measure rest. This expansion is controlled by the property
394 @code{Score.skipBars}. If this is set to true, empty measures will not
395 be expanded, and the appropriate number is added automatically
397 @lilypond[quote,ragged-right,fragment,verbatim]
398 \time 4/4 r1 | R1 | R1*2 \time 3/4 R2. \time 2/4 R2 \time 4/4
399 \set Score.skipBars = ##t R1*17 R1*4
402 The @code{1} in @code{R1} is similar to the duration notation used for
403 notes. Hence, for time signatures other than 4/4, you must enter other
404 durations. This can be done with augmentation dots or fractions
406 @lilypond[quote,ragged-right,fragment,verbatim]
407 \set Score.skipBars = ##t
416 An @code{R} spanning a single measure is printed as either a whole rest
417 or a breve, centered in the measure regardless of the time signature.
419 If there are only a few measures of rest, LilyPond prints @q{church rests}
420 (a series of rectangles) in the staff. To replace that with a simple
421 rest, use @code{MultiMeasureRest.expand-limit}.
423 @lilypond[quote,ragged-right,fragment,verbatim]
424 \set Score.skipBars = ##t
426 \override MultiMeasureRest #'expand-limit = 1
430 @cindex text on multi-measure rest
431 @cindex script on multi-measure rest
432 @cindex fermata on multi-measure rest
434 Texts can be added to multi-measure rests by using the
435 @var{note}-@code{markup} syntax @ref{Text markup}.
436 A variable (@code{\fermataMarkup}) is provided for
439 @lilypond[quote,ragged-right,verbatim,fragment]
440 \set Score.skipBars = ##t
442 R2.*10^\markup { \italic "ad lib." }
446 Warning! This text is created by @code{MultiMeasureRestText}, not
449 @lilypond[quote,ragged-right,verbatim,fragment]
450 \override TextScript #'padding = #5
452 \override MultiMeasureRestText #'padding = #5
456 If you want to have text on the left end of a multi-measure rest,
457 attach the text to a zero-length skip note, i.e.,
467 Program reference: @internalsref{MultiMeasureRestMusicGroup},
468 @internalsref{MultiMeasureRest}.
470 The layout object @internalsref{MultiMeasureRestNumber} is for the
471 default number, and @internalsref{MultiMeasureRestText} for user
477 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
478 over multi-measure rests. And the pitch of multi-measure rests (or
479 staff-centered rests) can not be influenced.
481 @cindex condensing rests
483 There is no way to automatically condense multiple rests into a single
484 multi-measure rest. Multi-measure rests do not take part in rest
487 Be careful when entering multi-measure rests followed by whole
488 notes. The following will enter two notes lasting four measures each
492 When @code{skipBars} is set, the result will look OK, but the bar
493 numbering will be off.
497 @node Displaying rhythms
498 @subsection Displaying rhythms
504 * Polymetric notation::
505 * Automatic note splitting::
509 @unnumberedsubsubsec Time signature
511 @cindex Time signature
515 Time signature indicates the metrum of a piece: a regular pattern of
516 strong and weak beats. It is denoted by a fraction at the start of the
519 The time signature is set with the @code{\time} command
521 @lilypond[quote,ragged-right,fragment,verbatim]
522 \time 2/4 c'2 \time 3/4 c'2.
527 The symbol that is printed can be customized with the @code{style}
528 property. Setting it to @code{#'()} uses fraction style for 4/4 and
531 @lilypond[fragment,quote,ragged-right,verbatim]
534 \override Staff.TimeSignature #'style = #'()
539 There are many more options for its layout. See @ref{Ancient time
540 signatures}, for more examples.
542 @code{\time} sets the property @code{timeSignatureFraction},
543 @code{beatLength} and @code{measureLength} in the @code{Timing}
544 context, which is normally aliased to @internalsref{Score}. The
545 property @code{measureLength} determines where bar lines should be
546 inserted, and how automatic beams should be generated. Changing the
547 value of @code{timeSignatureFraction} also causes the symbol to be
550 More options are available through the Scheme function
551 @code{set-time-signature}. In combination with the
552 @internalsref{Measure_grouping_engraver}, it will create
553 @internalsref{MeasureGrouping} signs. Such signs ease reading
554 rhythmically complex modern music. In the following example, the 9/8
555 measure is subdivided in 2, 2, 2 and 3. This is passed to
556 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
558 @lilypond[quote,ragged-right,verbatim]
561 #(set-time-signature 9 8 '(2 2 2 3))
562 g8[ g] d[ d] g[ g] a8[( bes g]) |
563 #(set-time-signature 5 8 '(3 2))
569 \consists "Measure_grouping_engraver"
578 Program reference: @internalsref{TimeSignature}, and
579 @internalsref{Timing_translator}.
581 Examples: @lsr{contemporary,compound-time-signature.ly}.
586 Automatic beaming does not use the measure grouping specified with
587 @code{set-time-signature}.
591 @unnumberedsubsubsec Upbeats
595 @cindex partial measure
596 @cindex measure, partial
597 @cindex shorten measures
600 Partial measures, such as an anacrusis or upbeat, are entered using the
602 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
603 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
606 The syntax for this command is
609 \partial @var{duration}
612 where @code{duration} is the rhythmic length to be added before
615 This is internally translated into
618 \set Timing.measurePosition = -@var{length of duration}
621 The property @code{measurePosition} contains a rational number
622 indicating how much of the measure has passed at this point. Note
623 that this is a negative number; @code{\partial 4} is internally
624 translated to mean @qq{there is a quarter note left in the bar.}
629 This command does not take into account grace notes at the start of
630 the music. When a piece starts with graces notes in the pickup, then
631 the @code{\partial} should follow the grace notes
633 @lilypond[verbatim,quote,ragged-right,relative,fragment]
640 @code{\partial} is only intended to be used at the beginning of a
641 piece. If you use it after the beginning, some odd warnings may
645 @node Unmetered music
646 @unnumberedsubsubsec Unmetered music
650 @funindex \cadenzaOff
652 Bar lines and bar numbers are calculated automatically. For unmetered
653 music (cadenzas, for example), this is not desirable. To turn off
654 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
655 and @code{\cadenzaOff}.
657 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
669 LilyPond will only insert line breaks and page breaks at a
670 barline. Unless the unmetered music ends before the end of
671 the staff line, you will need to insert
679 to indicate where breaks can occur.
682 @node Polymetric notation
683 @unnumberedsubsubsec Polymetric notation
685 @cindex double time signatures
686 @cindex signatures, polymetric
687 @cindex polymetric signatures
688 @cindex meter, polymetric
690 Double time signatures are not supported explicitly, but they can be
691 faked. In the next example, the markup for the time signature is
692 created with a markup text. This markup text is inserted in the
693 @internalsref{TimeSignature} grob. See also
694 @lsr{contemporary,compound-time-signature}.
696 @lilypond[verbatim,ragged-right]
699 \override #'(baseline-skip . 2) \number {
702 \bracket \column { "5" "8" }
707 \override Staff.TimeSignature #'stencil = #ly:text-interface::print
708 \override Staff.TimeSignature #'text = #tsMarkup
710 c'2 \bar ":" c'4 c'4.
714 Each staff can also have its own time signature. This is done by
715 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
721 \remove "Timing_translator"
722 \remove "Default_bar_line_engraver"
726 \consists "Timing_translator"
727 \consists "Default_bar_line_engraver"
734 Now, each staff has its own time signature.
747 c4. c8 c c c4. c8 c c
752 @lilypond[quote,ragged-right]
756 \remove "Timing_translator"
757 \remove "Default_bar_line_engraver"
760 \consists "Timing_translator"
761 \consists "Default_bar_line_engraver"
776 c4. c8 c c c4. c8 c c
782 A different form of polymetric notation is where note lengths have
783 different values across staves.
785 This notation can be created by setting a common time signature for
786 each staff but replacing it manually using
787 @code{timeSignatureFraction} to the desired fraction. Then the printed
788 durations in each staff are scaled to the common time signature.
789 The latter is done with @code{\compressMusic}, which is used similar
790 to @code{\times}, but does not create a tuplet bracket. The syntax is
792 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
797 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
798 used in parallel. In the second staff, shown durations are multiplied by
799 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
800 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
802 @lilypond[quote,ragged-right,verbatim,fragment]
810 \set Staff.timeSignatureFraction = #'(9 . 8)
811 \compressMusic #'(2 . 3)
812 \repeat unfold 6 { c8[ c c] }
816 \set Staff.timeSignatureFraction = #'(10 . 8)
817 \compressMusic #'(3 . 5) {
818 \repeat unfold 2 { c8[ c c] }
819 \repeat unfold 2 { c8[ c] }
820 | c4. c4. \times 2/3 { c8 c c } c4
829 When using different time signatures in parallel, the spacing is
830 aligned vertically, but bar lines distort the regular spacing.
833 @node Automatic note splitting
834 @unnumberedsubsubsec Automatic note splitting
836 Long notes can be converted automatically to tied notes. This is done
837 by replacing the @internalsref{Note_heads_engraver} by the
838 @internalsref{Completion_heads_engraver}.
839 In the following examples, notes crossing the bar line are split and tied.
841 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
843 \remove "Note_heads_engraver"
844 \consists "Completion_heads_engraver"
846 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
850 This engraver splits all running notes at the bar line, and inserts
851 ties. One of its uses is to debug complex scores: if the measures are
852 not entirely filled, then the ties exactly show how much each measure
855 If you want to allow line breaking on the bar lines where
856 @internalsref{Completion_heads_engraver} splits notes, you must
857 also remove @internalsref{Forbid_line_break_engraver}.
862 Not all durations (especially those containing tuplets) can be
863 represented exactly with normal notes and dots, but the engraver will
866 @code{Completion_heads_engraver} only affects notes; it does not split
872 Program reference: @internalsref{Completion_heads_engraver}.
886 @node Automatic beams
887 @unnumberedsubsubsec Automatic beams
889 LilyPond inserts beams automatically
891 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
892 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
895 When these automatic decisions are not good enough, beaming can be
896 entered explicitly. It is also possible to define beaming patterns
897 that differ from the defaults. See @ref{Setting automatic beam behavior},
900 Individual notes may be marked with @code{\noBeam} to prevent them
903 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
904 \time 2/4 c8 c\noBeam c c
910 Program reference: @internalsref{Beam}.
914 @unnumberedsubsubsec Manual beams
916 @cindex beams, manual
920 In some cases it may be necessary to override the automatic beaming
921 algorithm. For example, the autobeamer will not put beams over rests
922 or bar lines. Such beams are specified manually by marking the begin
923 and end point with @code{[} and @code{]}
925 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
927 r4 r8[ g' a r8] r8 g[ | a] r8
934 @funindex stemLeftBeamCount
935 @funindex stemRightBeamCount
938 LilyPond can automatically determine beaming patterns within a beam,
939 but this automatic behavior can sometimes produce odd results;
940 therefore the @code{stemLeftBeamCount} and @code{stemRightBeamCount} properties can
941 be used to override the defaults. If
942 either property is set, its value will be used only once, and then it
945 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
950 \set stemLeftBeamCount = #1
955 The property @code{subdivideBeams} can be set in order to subdivide
956 all 16th or shorter beams at beat positions, as defined by the
957 @code{beatLength} property.
959 @lilypond[fragment,quote,relative=2,verbatim]
961 \set subdivideBeams = ##t
963 \set Score.beatLength = #(ly:make-moment 1 8)
966 @funindex subdivideBeams
969 For more information about @code{make-moment}, see
970 @ref{Time administration}.
972 Line breaks are normally forbidden when beams cross bar lines. This
973 behavior can be changed by setting @code{breakable}.
977 @cindex beams and line breaks
980 @cindex auto-knee-gap
982 Kneed beams are inserted automatically when a large gap is detected
983 between the note heads. This behavior can be tuned through the
984 @code{auto-knee-gap} object.
989 Automatically kneed cross-staff beams cannot be used together with
990 hidden staves. See @ref{Hiding staves}.
992 @c Is this still true with skyline spacing stuff? -J.Mandereau
993 Beams do not avoid collisions with symbols around the notes, such as
994 texts and accidentals.
997 @node Feathered beams
998 @unnumberedsubsubsec Feathered beams
1000 Feathered beams are printed by setting the @code{grow-direction}
1001 property of a @code{Beam}. The @code{\featherDurations} function
1002 can be used to adjust note durations.
1004 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1005 \override Beam #'grow-direction = #LEFT
1006 \featherDurations #(ly:make-moment 5 4)
1014 The @code{\featherDurations} command only works with very short
1031 @unnumberedsubsubsec Bar check
1034 @funindex barCheckSynchronize
1037 Bar checks help detect errors in the durations. A bar check is
1038 entered using the bar symbol, @samp{|}. Whenever it is encountered
1039 during interpretation, it should fall on a measure boundary. If it
1040 does not, a warning is printed. In the next example, the second bar
1041 check will signal an error
1043 \time 3/4 c2 e4 | g2 |
1046 Bar checks can also be used in lyrics, for example
1051 Twin -- kle | Twin -- kle
1055 Failed bar checks are caused by entering incorrect
1056 durations. Incorrect durations often completely garble up the score,
1057 especially if the score is polyphonic, so a good place to start correcting
1058 input is by scanning for failed bar checks and incorrect durations.
1061 @funindex pipeSymbol
1063 It is also possible to redefine the meaning of @code{|}. This is done
1064 by assigning a music expression to @code{pipeSymbol},
1066 @lilypond[quote,ragged-right,verbatim]
1067 pipeSymbol = \bar "||"
1074 @unnumberedsubsubsec Bar lines
1078 @cindex measure lines
1081 Bar lines delimit measures, but are also used to indicate
1082 repeats. Normally they are inserted automatically. Line
1083 breaks may only happen on bar lines.
1085 Special types of bar lines can be forced with the @code{\bar} command
1087 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1091 The following bar types are available
1093 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1095 In addition, you can specify @code{"||:"}, which is equivalent to
1096 @code{"|:"} except at line breaks, where it gives a double bar line at
1097 the end of the line and a start repeat at the beginning of the next
1100 To allow a line break where there is no visible bar line, use
1107 This will insert an invisible bar line and allow line breaks at this
1108 point (without increasing the bar number counter).
1110 In scores with many staves, a @code{\bar} command in one staff is
1111 automatically applied to all staves. The resulting bar lines are
1112 connected between different staves of a @code{StaffGroup},
1113 @code{PianoStaff}, or @code{GrandStaff}.
1115 @lilypond[quote,ragged-right,fragment,verbatim]
1123 \new Staff { \clef bass c4 g e g }
1125 \new Staff { \clef bass c2 c2 }
1133 @funindex repeatCommands
1134 @funindex defaultBarType
1136 The command @code{\bar }@var{bartype} is a short cut for doing
1137 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1138 is set to a string, a bar line of that type is created.
1140 A bar line is created whenever the @code{whichBar} property is set.
1141 At the start of a measure it is set to the contents of
1142 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are
1144 to override default measure bars.
1146 You are encouraged to use @code{\repeat} for repetitions. See
1152 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1154 Program reference: @internalsref{BarLine} (created at
1155 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1159 @unnumberedsubsubsec Bar numbers
1162 @cindex measure numbers
1163 @funindex currentBarNumber
1165 Bar numbers are printed by default at the start of the line. The
1166 number itself is stored in the @code{currentBarNumber} property, which
1167 is normally updated automatically for every measure.
1169 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1170 \repeat unfold 4 {c4 c c c} \break
1171 \set Score.currentBarNumber = #50
1172 \repeat unfold 4 {c4 c c c}
1175 Bar numbers may only be printed at bar lines; to print a bar
1176 number at the beginning of a piece, an empty bar line must
1179 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1180 \set Score.currentBarNumber = #50
1182 \repeat unfold 4 {c4 c c c} \break
1183 \repeat unfold 4 {c4 c c c}
1186 Bar numbers can be typeset at regular intervals instead of at the
1187 beginning of each line. This is illustrated in the following example,
1188 whose source is available as
1189 @lsr{staff,making-bar-numbers-appear-at-regular-intervals.ly}.
1191 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
1193 Bar numbers can be removed entirely by removing the Bar number
1194 engraver from the score.
1196 @lilypond[verbatim,ragged-right,quote]
1200 \remove "Bar_number_engraver"
1212 Program reference: @internalsref{BarNumber}.
1214 Examples: @lsrdir{staff}
1219 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
1220 there is one at the top. To solve this, the
1221 @code{padding} property of @internalsref{BarNumber} can be
1222 used to position the number correctly.
1225 @node Barnumber check
1226 @unnumberedsubsubsec Barnumber check
1228 When copying large pieces of music, it can be helpful to check that
1229 the LilyPond bar number corresponds to the original that you are
1230 entering from. This can be checked with @code{\barNumberCheck}, for
1234 \barNumberCheck #123
1238 will print a warning if the @code{currentBarNumber} is not 123 when it
1242 @node Rehearsal marks
1243 @unnumberedsubsubsec Rehearsal marks
1245 @cindex Rehearsal marks
1248 To print a rehearsal mark, use the @code{\mark} command
1250 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1259 The letter@tie{}@q{I} is skipped in accordance with engraving traditions.
1260 If you wish to include the letter @q{I}, then use
1263 \set Score.markFormatter = #format-mark-alphabet
1266 The mark is incremented automatically if you use @code{\mark
1267 \default}, but you can also use an integer argument to set the mark
1268 manually. The value to use is stored in the property
1269 @code{rehearsalMark}.
1271 The style is defined by the property @code{markFormatter}. It is a
1272 function taking the current mark (an integer) and the current context
1273 as argument. It should return a markup object. In the following
1274 example, @code{markFormatter} is set to a canned procedure. After a
1275 few measures, it is set to function that produces a boxed number.
1277 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1278 \set Score.markFormatter = #format-mark-numbers
1281 \set Score.markFormatter = #format-mark-box-numbers
1287 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
1288 of @code{format-mark-numbers} (the default format),
1289 @code{format-mark-box-numbers},
1290 @code{format-mark-letters} and @code{format-mark-box-letters}.
1291 These can be used as inspiration for other formatting functions.
1293 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
1294 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
1295 incremented numbers or letters.
1297 Other styles of rehearsal mark can be specified manually
1304 @code{Score.markFormatter} does not affect marks specified in this manner.
1305 However, it is possible to apply a @code{\markup} to the string.
1308 \mark \markup@{ \box A1 @}
1315 Music glyphs (such as the segno sign) may be printed inside
1318 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1319 c1 \mark \markup { \musicglyph #"scripts.segno" }
1320 c1 \mark \markup { \musicglyph #"scripts.coda" }
1321 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1326 See @ref{The Feta font}, for a list of symbols which may be
1327 printed with @code{\musicglyph}.
1329 For common tweaks to the positioning of rehearsal marks, see @ref{Text marks}.
1333 This manual: @ref{Text marks}.
1335 Program reference: @internalsref{RehearsalMark}.
1337 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
1338 definition of @code{format-mark-numbers} and
1339 @code{format-mark-letters}. They can be used as inspiration for other
1340 formatting functions.
1342 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1345 @node Special rhythmic concerns
1346 @subsection Special rhythmic concerns
1351 * Aligning to cadenzas::
1352 * Time administration::
1353 * Proportional notation (introduction)::
1357 @unnumberedsubsubsec Grace notes
1362 @cindex appoggiatura
1363 @cindex acciaccatura
1365 Grace notes are ornaments that are written out. The most common ones
1366 are acciaccatura, which should be played as very short. It is denoted
1367 by a slurred small note with a slashed stem. The appoggiatura is a
1368 grace note that takes a fixed fraction of the main note, and is
1369 denoted as a slurred note in small print without a slash. They
1370 are entered with the commands @code{\acciaccatura} and
1371 @code{\appoggiatura}, as demonstrated in the following example
1373 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1374 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1375 \acciaccatura { g16[ f] } e4
1378 Both are special forms of the @code{\grace} command. By prefixing this
1379 keyword to a music expression, a new one is formed, which will be
1380 printed in a smaller font and takes up no logical time in a measure.
1382 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1384 \grace { c16[ d16] } c2 c4
1388 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1389 @code{\grace} command does not start a slur.
1391 @cindex timing, internal
1393 Internally, timing for grace notes is done using a second, @q{grace}
1394 timing. Every point in time consists of two rational numbers: one
1395 denotes the logical time, one denotes the grace timing. The above
1396 example is shown here with timing tuples
1398 @lilypond[quote,ragged-right]
1401 c4 \grace c16 c4 \grace {
1404 \new Lyrics \lyricmode {
1405 \override LyricText #'font-family = #'typewriter
1409 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1410 \markup { (\fraction 1 4 , 0 ) } 4
1412 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1413 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1415 \markup { ( \fraction 2 4 , 0 ) }
1420 The placement of grace notes is synchronized between different staves.
1421 In the following example, there are two sixteenth grace notes for
1422 every eighth grace note
1424 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1425 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1426 \new Staff { c4 \grace { g8[ b] } c4 } >>
1429 @funindex \afterGrace
1431 If you want to end a note with a grace, use the @code{\afterGrace}
1432 command. It takes two arguments: the main note, and the grace notes
1433 following the main note.
1435 @lilypond[ragged-right, verbatim,relative=2,fragment]
1436 c1 \afterGrace d1 { c16[ d] } c4
1439 This will put the grace notes after a @q{space} lasting 3/4 of the
1440 length of the main note. The fraction 3/4 can be changed by setting
1441 @code{afterGraceFraction}, ie.
1444 #(define afterGraceFraction (cons 7 8))
1448 will put the grace note at 7/8 of the main note.
1450 The same effect can be achieved manually by doing
1452 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1455 { s2 \grace { c16[ d] } } >>
1461 By adjusting the duration of the skip note (here it is a half-note),
1462 the space between the main-note and the grace is adjusted.
1464 A @code{\grace} music expression will introduce special typesetting settings,
1465 for example, to produce smaller type, and set directions. Hence, when
1466 introducing layout tweaks, they should be inside the grace expression,
1469 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1481 The overrides should also be reverted inside the grace expression.
1483 The layout of grace expressions can be changed throughout the music
1484 using the function @code{add-grace-property}. The following example
1485 undefines the @code{Stem} direction for this grace, so that stems do not
1490 #(add-grace-property 'Voice 'Stem 'direction '())
1496 Another option is to change the variables @code{startGraceMusic},
1497 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1498 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1499 @code{stopAppoggiaturaMusic}. More information is in the file
1500 @file{ly/@/grace@/-init@/.ly}.
1503 The slash through the stem in acciaccaturas can be obtained
1504 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
1509 Grace notes may be forced to use floating spacing,
1511 @lilypond[relative=2,ragged-right]
1513 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1522 c'16[ c'16 c'16 c'16]
1523 c'16[ c'16 c'16 c'16]
1532 Program reference: @internalsref{GraceMusic}.
1537 A score that starts with a @code{\grace} expression needs an explicit
1538 @code{\new Voice} declaration, otherwise the main note and the grace
1539 note end up on different staves.
1541 Grace note synchronization can also lead to surprises. Staff notation,
1542 such as key signatures, bar lines, etc., are also synchronized. Take
1543 care when you mix staves with grace notes and staves without, for example,
1545 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1546 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1547 \new Staff { c4 \bar "|:" d4 } >>
1551 This can be remedied by inserting grace skips of the corresponding
1552 durations in the other staves. For the above example
1554 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1555 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1556 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1559 Grace sections should only be used within sequential music
1560 expressions. Nesting or juxtaposing grace sections is not supported,
1561 and might produce crashes or other errors.
1564 @node Aligning to cadenzas
1565 @unnumberedsubsubsec Aligning to cadenzas
1567 In an orchestral context, cadenzas present a special problem:
1568 when constructing a score that includes a cadenza, all other
1569 instruments should skip just as many notes as the length of the
1570 cadenza, otherwise they will start too soon or too late.
1572 A solution to this problem are the functions @code{mmrest-of-length}
1573 and @code{skip-of-length}. These Scheme functions take a piece of music
1574 as argument, and generate a @code{\skip} or multi-rest, exactly as
1575 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1576 in the following example.
1578 @lilypond[verbatim,ragged-right,quote]
1579 cadenza = \relative c' {
1580 c4 d8 << { e f g } \\ { d4. } >>
1585 \new Staff { \cadenza c'4 }
1587 #(ly:export (mmrest-of-length cadenza))
1594 @node Time administration
1595 @unnumberedsubsubsec Time administration
1597 @cindex Time administration
1599 Time is administered by the @internalsref{Time_signature_engraver},
1600 which usually lives in the @internalsref{Score} context. The
1601 bookkeeping deals with the following variables
1604 @item currentBarNumber
1608 The length of the measures in the current time signature. For a 4/4
1609 time this is@tie{}1, and for 6/8 it is 3/4.
1611 @item measurePosition
1612 The point within the measure where we currently are. This quantity
1613 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1614 happens, @code{currentBarNumber} is incremented.
1617 If set to true, the above variables are updated for every time
1618 step. When set to false, the engraver stays in the current measure
1622 Timing can be changed by setting any of these variables explicitly.
1623 In the next example, the 4/4 time signature is printed, but
1624 @code{measureLength} is set to 5/4. After a while, the measure is
1625 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1626 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1627 3/8 arises because 5/4 normally has 10/8, but we have manually
1628 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1630 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1631 \set Score.measureLength = #(ly:make-moment 5 4)
1635 \set Score.measurePosition = #(ly:make-moment 7 8)
1641 As the example illustrates, @code{ly:make-moment n m} constructs a
1642 duration of n/m of a whole note. For example, @code{ly:make-moment 1 8} is
1644 note duration and @code{ly:make-moment 7 16} is the duration of
1645 seven sixteenths notes.
1648 @node Proportional notation (introduction)
1649 @unnumberedsubsubsec Proportional notation (introduction)
1650 @cindex Proportional notation
1652 See @ref{Proportional notation}.
1655 TODO: remove all this stuff?
1657 Notes can be spaced proportionally to their time-difference by
1658 assigning a duration to @code{proportionalNotationDuration}
1660 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1662 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1663 \new Staff { c8[ c c c c c] c4 c2 r2 }
1664 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1668 Setting this property only affects the ideal spacing between
1669 consecutive notes. For true proportional notation, the following
1670 settings are also required.
1674 @item True proportional notation requires that symbols are allowed to
1675 overstrike each other. That is achieved by removing the
1676 @internalsref{Separating_line_group_engraver} from
1677 @internalsref{Staff} context.
1679 @item Spacing influence of prefatory matter (clefs, bar lines, etc.)
1680 is removed by setting the @code{strict-note-spacing} property to
1681 @code{#t} in @internalsref{SpacingSpanner} grob.
1683 @item Optical spacing tweaks are switched by setting
1684 @code{uniform-stretching} in @internalsref{SpacingSpanner} to true.
1691 Examples: @lsr{spacing,proportional@/-spacing@/.ly},
1692 @lsr{spacing,proportional@/-strict@/-grace@/-notes@/.ly}, and
1693 @lsr{spacing,proportional@/-strict@/-notespacing@/.ly}
1695 An example of strict proportional notation is in the
1696 example file @file{input/proportional.ly}.