1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
12 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
15 This section discusses rhythms, durations, and bars.
20 * Displaying rhythms::
23 * Special rhythmic concerns::
28 @subsection Writing rhythms
37 @unnumberedsubsubsec Durations
44 When entering notes, durations are designated by numbers and dots:
45 durations are entered as their reciprocal values. For example, a
46 quarter note is entered using a @code{4} (since it is a 1/4 note),
47 while a half note is entered using a @code{2} (since it is a 1/2
48 note). For notes longer than a whole you must use the
49 @code{\longa} (a double breve) and @code{\breve} commands. Note
50 durations as short as 64th notes may be specified.
52 @c Two 64th notes are needed to obtain beams
53 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
60 and the same durations with automatic beaming turned off
61 see @ref{Automatic beams}:
63 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
70 If the duration is omitted then it is set to the previously
71 entered duration. The default for the first note is a quarter
74 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
81 To obtain dotted note lengths, simply add a dot (@samp{.}) to the
82 number. Double-dotted notes are produced in a similar way.
84 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
85 a4 b c4. b8 a4. b4.. c8.
88 Some durations cannot be entered using only binary durations
89 and dots, and can only be represented by tying two or more
90 notes together. Tied notes are covered in @ref{Ties}.
94 Dots are normally moved up to avoid staff lines, except in
95 polyphonic situations. The following commands may be used to
96 force a particular direction manually
102 @funindex \dotsNeutral
105 @c TODO: after deciding the link question, fix these. -gp
106 Durations are entered in the same way in @code{drummode},
107 @code{chordmode}, @code{figuremode} and (optionally)
112 For ways of specifying durations for the syllables of lyrics
113 and ways of aligning lyrics to notes see @ref{Vocal music}
115 For a description of how to enter rests see @ref{Writing rests}
117 A note with the duration of a quadruple breve may be
118 entered with \maxima, but this is supported only within
119 ancient music notation. See @ref{Ancient notation}
121 Optionally, notes can be spaced proportionately to their duration.
122 For details of this and other settings which control
123 proportional notation see @ref{Proportional notation}.
125 Program reference: @internalsref{Dots}, and
126 @internalsref{DotColumn}.
130 @unnumberedsubsubsec Tuplets
136 @c TODO Add Tuplet to glossary
138 Tuplets are made out of a music expression by multiplying all
139 durations with a fraction
142 \times @var{fraction} @var{musicexpr}
146 The duration of @var{musicexpr} will be multiplied by the
147 fraction. The fraction's denominator will be printed over or
148 under the notes, optionally with a bracket. The most common
149 tuplet is the triplet in which 3 notes have the length of 2, so
150 the notes are 2/3 of their written length.
152 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
153 g4 \times 2/3 {c4 c c} d4 d4
156 Tuplets may be nested, for example,
158 @lilypond[fragment,ragged-right,verbatim,relative=2]
159 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
162 \times 3/5 { a a a a a }
170 @funindex \tupletDown
172 @funindex \tupletNeutral
173 @code{\tupletNeutral}.
178 @funindex tupletNumberFormatFunction
179 @cindex tuplet formatting
181 The property @code{tupletSpannerDuration} specifies how long each
182 bracket should last. With this, you can make lots of tuplets
183 while typing @code{\times} only once, thus saving lots of typing.
184 In the next example, there are two triplets shown, while
185 @code{\times} was only used once
187 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
188 \set tupletSpannerDuration = #(ly:make-moment 1 4)
189 \times 2/3 { c8 c c c c c }
193 For more information about @code{make-moment}, see
194 @ref{Time administration}.
196 The format of the number is determined by the property @code{text}
197 in @code{TupletNumber}. The default prints only the denominator,
198 but if it is set to the function
199 @code{tuplet-number::calc-fraction-text}, @var{num}:@var{den} will
202 To avoid printing tuplet numbers, use
204 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
205 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
206 \override TupletNumber #'transparent = ##t
207 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
210 Use the @code{\tweak} function to override nested tuplets
211 beginning at the same music moment. In this example,
212 @code{\tweak} specifies fraction text for the outer
213 @code{TupletNumber} and denominator text for the
214 @code{TupletNumber} of the first of the three inner tuplets.
216 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
217 \tweak #'text #tuplet-number::calc-fraction-text
219 \tweak #'text #tuplet-number::calc-denominator-text
220 \times 2/3 { c8[ c8 c8] }
221 \times 2/3 { c8[ c8 c8] }
222 \times 2/3 { c8[ c8 c8] }
226 Here @code{\tweak} and @code{\override} work together to specify
227 @code{TupletBracket} direction. The first @code{\tweak} positions
228 the @code{TupletBracket} of the outer tuplet above the staff. The
229 second @code{\tweak} positions the @code{TupletBracket} of the
230 first of the three inner tuplets below the staff. Note that this
231 pair of @code{\tweak} functions affects only the outer tuplet and
232 the first of the three inner tuplets because only those two
233 tuplets begin at the same music moment. We use @code{\override}
234 in the usual way to position the @code{TupletBrackets} of the
235 second and third of the inner tuplets below the staff.
237 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
238 \tweak #'text #tuplet-number::calc-fraction-text
239 \tweak #'direction #up
241 \tweak #'direction #down
242 \times 2/3 { c8[ c8 c8] }
243 \override TupletBracket #'direction = #down
244 \times 2/3 { c8[ c8 c8] }
245 \times 2/3 { c8[ c8 c8] }
249 Tuplet brackets can be made to run to prefatory matter or the next
252 @lilypond[ragged-right]
254 \set tupletFullLength = ##t
259 \set tupletFullLengthNote = ##t
269 Tuplets which cross barlines will prevent a line break at that
274 Program reference: @internalsref{TupletBracket},
275 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
279 @node Scaling durations
280 @unnumberedsubsubsec Scaling durations
282 You can alter the length of a duration by a fraction @var{N/M}
283 by appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).
284 This will not affect the appearance of the notes or rests
285 produced, but the altered duration will be used in calculating the
286 position within the bar and setting the duration in the MIDI
287 output. Multiplying factors may be combined
290 In the following example, the first three notes take up exactly
291 two beats, but no triplet bracket is printed.
293 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
295 a4*2/3 gis4*2/3 a4*2/3
300 The duration of skip or spacing notes may also be modified by
301 a multiplier. This is useful for skipping many bars, e.g.,
306 This manual: @ref{Tuplets}, @ref{Skips}.
312 @subsection Writing rests
317 * Multi measure rests::
321 @unnumberedsubsubsec Rests
328 Rests are entered like notes with the note name @code{r}
330 @c \time 16/1 is used to avoid spurious barlines
331 @c and long tracts of empty bars
332 @lilypond[fragment,quote,ragged-right,verbatim]
335 \override Staff.TimeSignature #'stencil = ##f
337 r\longa r\breve r1 r2
342 Whole bar rests, centered in middle of the bar, must be entered as
343 multi-measure rests. They can be used for a single bar as well as
344 many bars, and are discussed in @ref{Multi measure rests}.
346 To explicitly specify a rest's vertical position, write a note
347 followed by @code{\rest}. A rest will be placed in the position
348 where the note would appear,
350 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
355 This makes manual formatting of polyphonic music much easier,
356 since the automatic rest collision formatter will leave these
361 Program reference: @internalsref{Rest}.
365 @unnumberedsubsubsec Skips
368 @cindex Invisible rest
373 An invisible rest (also called a @q{skip}) can be entered like a
374 note with note name @samp{s} or with @code{\skip @var{duration}}
376 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
377 a4 a4 s4 a4 \skip 1 a4
380 The @code{s} syntax is only available in note mode and chord mode.
381 In other situations, for example, when entering lyrics, you should
382 use the @code{\skip} command
384 @lilypond[quote,ragged-right,verbatim,relative=2]
387 \new Lyrics \lyricmode { \skip 2 bla2 }
391 The skip command is merely an empty musical placeholder. It does
392 not produce any output, not even transparent output.
394 The @code{s} skip command does create @internalsref{Staff} and
395 @internalsref{Voice} when necessary, similar to note and rest
396 commands. For example, the following results in an empty staff.
398 @lilypond[quote,ragged-right,verbatim]
402 The fragment @code{@{ \skip 4 @} } would produce an empty page.
406 Program reference: @internalsref{SkipMusic}.
409 @node Multi measure rests
410 @unnumberedsubsubsec Multi measure rests
412 @cindex multi measure rests
413 @cindex full measure rests
414 @cindex Rests, multi measure
415 @cindex Rests, full measure
416 @cindex whole rests for a full measure
419 Rests for one or more full measures are entered using
420 @code{R} followed by a duration (see @ref{Durations}).
421 The duration should correspond to an integral number
422 of bars, otherwise a barcheck warning is printed.
423 Multi-measure rests are principally used to indicate
424 that a part in a multi-part score should be silent:
426 @lilypond[quote,fragment,verbatim,relative=2]
427 \set Score.skipBars = ##t
434 A multi-measure rest can be expanded in the printed score
435 to show all the rest bars explicitly, or, as above, it can be
436 condensed to a single bar
437 containing a multi-measure rest symbol, with the number of
438 bars of rest printed above the bar. This expansion
439 is controlled by the property @code{Score.skipBars}. If this is
440 set to true, empty measures will condensed to a single bar.
442 @lilypond[quote,ragged-right,fragment,verbatim]
443 \time 4/4 r1 | R1 | R1*2 |
446 \set Score.skipBars = ##t
450 The @code{1} in @code{R1} is similar to the duration notation
451 used for notes and is the length of a bar in 2/2 or 4/4 time.
452 The duration in a multi-measure rest must always be an integral
453 number of bar-lengths, so in other time signatures augmentation
454 dots or fractions must be used:
456 @lilypond[quote,ragged-right,fragment,verbatim]
457 \set Score.skipBars = ##t
461 R1*13/8 | R1*13/8*12 |
466 An @code{R} spanning a single measure is printed as either a whole
467 or breve rest, centered in the measure, regardless of the time
470 If there are 10 or fewer measures of rest, LilyPond prints
471 @rglos{church rests} (a series of longa and breve rests)
473 prints a simple line otherwise. This default number of 10
474 may be changed by overriding
475 @code{MultiMeasureRest.expand-limit}.
477 @lilypond[quote,ragged-right,fragment,verbatim]
478 \set Score.skipBars = ##t
480 \override MultiMeasureRest #'expand-limit = 3
484 Note that the vertical position on the staff of the multi-measure
485 rest symbol of either form cannot be changed.
487 @cindex text on multi-measure rest
488 @cindex script on multi-measure rest
489 @cindex fermata on multi-measure rest
491 Text can be added to multi-measure rests by using the
492 @var{note}-@code{markup} syntax @ref{Text markup}. A variable
493 (@code{\fermataMarkup}) is provided for adding fermatas
495 @lilypond[quote,ragged-right,verbatim,fragment]
496 \set Score.skipBars = ##t
498 R2.*10^\markup { \italic "ad lib." }
502 @warning{Text attached to a multi-measure rest is created
503 by @code{MultiMeasureRestText}, not
504 @code{TextScript}. Overrides must be directed to the correct
505 object, or they will be ignored. See the following example.}
507 @lilypond[quote,ragged-right,verbatim,fragment]
508 \override TextScript #'padding = #5
510 \override MultiMeasureRestText #'padding = #5
514 Text attached to a multi-measure rest will be centered above
515 (or below) it. Long text attached in this way does not cause
516 the bar to expand, and may collide with text in adjacent bars.
517 Long text is better attached to a zero-length skip note preceding
518 the rest, preceded by @code{\fatText}, since this will cause the
519 bar to expand to accommodate the length of the text:
521 @lilypond[quote,ragged-right,verbatim,fragment]
522 \set Score.skipBars = ##t
524 s1*0^\markup {[MAJOR GENERAL]}
526 s1*0^\markup {[MABEL] }
527 s1*0_\markup {\italic {Cue: ... it is yours}}
529 s1^\markup {CHORUS} % Chorus notes would go here
535 This manual: @ref{Text}
539 @internalsref{MultiMeasureRest}.
541 The layout object @internalsref{MultiMeasureRestNumber} is for the
542 default number, and @internalsref{MultiMeasureRestText} for user
548 If an attempt is made to use fingerings (e.g.,
549 @code{R1*10-4}) to put numbers over multi-measure rests, the
550 fingering numeral (4) may collide with the bar counter
553 @cindex condensing rests
555 There is no way to automatically condense multiple rests into a
556 single multi-measure rest. Multi-measure rests do not take part
559 Be careful when entering multi-measure rests followed by whole
560 notes. The following will enter two notes lasting four measures
568 @node Displaying rhythms
569 @subsection Displaying rhythms
575 * Polymetric notation::
576 * Automatic note splitting::
577 * Setting automatic beam behavior::
581 @unnumberedsubsubsec Time signature
583 @cindex Time signature
587 Time signature indicates the meter of a piece: a regular pattern
588 of strong and weak beats. It is denoted by a fraction at the
591 The time signature is set with the @code{\time} command
593 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
594 \time 2/4 c2 \time 3/4 c2.
599 The symbol that is printed can be customized with the @code{style}
600 property. Setting it to @code{#'()} uses fraction style for 4/4
603 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
606 \override Staff.TimeSignature #'style = #'()
611 A time signature is normally printed whenever the time signature
612 changes. If this takes place at the end of a line a warning time
613 signature sign is printed at the end of the line and again at the
614 start of a new line. This default behaviour can be modified by
615 setting the value of the @code{break-visibility} property. This
616 takes three values which may be set to @code{#t} or @code{#f} to
617 specify whether the corresponding time signature is visible or not.
618 The order of the three values is @code{end of line visible},
619 @code{middle of line visible}, @code{beginning of line visible}.
621 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
622 % Do not print any time signatures at end of line
623 \override Staff.TimeSignature #'break-visibility = ##(#f #t #t)
626 % Do not print the following 9/8 time signature
627 \once \override Staff.TimeSignature #'break-visibility = ##(#t #f #t)
635 There are many more options for its layout. See @ref{Ancient time
636 signatures}, for more examples.
638 @code{\time} sets the property @code{timeSignatureFraction},
639 @code{beatLength} and @code{measureLength} in the @code{Timing}
640 context, which is normally aliased to @internalsref{Score}. The
641 property @code{measureLength} determines where barlines should be
642 inserted, and how automatic beams should be generated. Changing
643 the value of @code{timeSignatureFraction} also causes the symbol
646 @cindex Measure groupings
648 More options are available through the Scheme function
649 @code{set-time-signature}. In combination with the
650 @internalsref{Measure_grouping_engraver}, it will create
651 @internalsref{MeasureGrouping} signs. Such signs ease reading
652 rhythmically complex modern music. In the following example, the
653 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
654 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
656 @lilypond[quote,ragged-right,verbatim]
659 #(set-time-signature 9 8 '(2 2 2 3))
660 g8[ g] d[ d] g[ g] a8[( bes g]) |
661 #(set-time-signature 5 8 '(3 2))
667 \consists "Measure_grouping_engraver"
676 Program reference: @internalsref{TimeSignature}, and
677 @internalsref{Timing_translator}.
679 Examples: @lsr{contemporary,compound-time-signature.ly}.
684 Automatic beaming does not use the measure grouping specified with
685 @code{set-time-signature}.
689 @unnumberedsubsubsec Upbeats
693 @cindex partial measure
694 @cindex measure, partial
695 @cindex shorten measures
698 Partial measures, such as an anacrusis or upbeat, are entered
701 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
702 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
705 The syntax for this command is
708 \partial @var{duration}
711 where @code{duration} is the rhythmic length to be added before
714 This is internally translated into
717 \set Timing.measurePosition = -@var{length of duration}
720 The property @code{measurePosition} contains a rational number
721 indicating how much of the measure has passed at this point. Note
722 that this is a negative number; @code{\partial 4} is internally
723 translated to mean @qq{there is a quarter note left in the bar.}
728 This command does not take into account grace notes at the start
729 of the music. When a piece starts with graces notes in the
730 pickup, then the @code{\partial} should follow the grace notes
732 @lilypond[verbatim,quote,ragged-right,relative,fragment]
739 @code{\partial} is only intended to be used at the beginning of a
740 piece. If you use it after the beginning, some odd warnings may
744 @node Unmetered music
745 @unnumberedsubsubsec Unmetered music
749 @funindex \cadenzaOff
751 Barlines and bar numbers are calculated automatically. For
752 unmetered music (cadenzas, for example), this is not desirable.
753 To turn off automatic barlines and bar numbers, use the commands
754 @code{\cadenzaOn} and @code{\cadenzaOff}.
756 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
768 LilyPond will only insert line breaks and page breaks at a
769 barline. Unless the unmetered music ends before the end of the
770 staff line, you will need to insert invisible barlines
777 to indicate where breaks can occur.
780 @node Polymetric notation
781 @unnumberedsubsubsec Polymetric notation
783 @cindex double time signatures
784 @cindex signatures, polymetric
785 @cindex polymetric signatures
786 @cindex meter, polymetric
788 Double time signatures are not supported explicitly, but they can
789 be faked. In the next example, the markup for the time signature
790 is created with a markup text. This markup text is inserted in
791 the @internalsref{TimeSignature} grob. See also
792 @lsr{contemporary,compound-time-signature}.
794 @lilypond[verbatim,ragged-right]
797 \override #'(baseline-skip . 2) \number {
800 \bracket \column { "5" "8" }
805 \override Staff.TimeSignature #'stencil =
806 #ly:text-interface::print
807 \override Staff.TimeSignature #'text = #tsMarkup
809 c'2 \bar ":" c'4 c'4.
813 Each staff can also have its own time signature. This is done by
814 moving the @internalsref{Timing_translator} to the
815 @internalsref{Staff} context.
820 \remove "Timing_translator"
821 \remove "Default_bar_line_engraver"
825 \consists "Timing_translator"
826 \consists "Default_bar_line_engraver"
833 Now, each staff has its own time signature.
847 c4. c8 c c c4. c8 c c
852 @lilypond[quote,ragged-right]
856 \remove "Timing_translator"
857 \remove "Default_bar_line_engraver"
860 \consists "Timing_translator"
861 \consists "Default_bar_line_engraver"
876 c4. c8 c c c4. c8 c c
882 A different form of polymetric notation is where note lengths have
883 different values across staves, but the bars are all the same
886 This notation can be created by setting a common time signature
887 for each staff but replacing it manually using
888 @code{timeSignatureFraction} to the desired fraction. Then the
889 printed durations in each staff are scaled to the common time
890 signature. The latter is done with @code{\compressMusic}, which
891 is used in a similar way to @code{\times}, but does not create
892 a tuplet bracket. The syntax is
896 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
901 In this example, music with the time signatures of 3/4, 9/8, and
902 10/8 are used in parallel. In the second staff, shown durations
903 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
904 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
907 @lilypond[quote,ragged-right,verbatim,fragment]
915 \set Staff.timeSignatureFraction = #'(9 . 8)
916 \compressMusic #'(2 . 3)
917 \repeat unfold 6 { c8[ c c] }
921 \set Staff.timeSignatureFraction = #'(10 . 8)
922 \compressMusic #'(3 . 5) {
923 \repeat unfold 2 { c8[ c c] }
924 \repeat unfold 2 { c8[ c] }
925 | c4. c4. \times 2/3 { c8 c c } c4
934 When using different time signatures in parallel, the spacing is
935 aligned vertically, but barlines distort the regular spacing.
938 @node Automatic note splitting
939 @unnumberedsubsubsec Automatic note splitting
941 Long notes which overrun barlines can be converted
942 automatically to tied notes. This is
943 done by replacing the @internalsref{Note_heads_engraver} by the
944 @internalsref{Completion_heads_engraver}. In the following
945 examples, notes crossing the barline are split and tied.
947 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
949 \remove "Note_heads_engraver"
950 \consists "Completion_heads_engraver"
952 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
956 This engraver splits all running notes at the barline, and
957 inserts ties. One of its uses is to debug complex scores: if the
958 measures are not entirely filled, then the ties exactly show how
959 much each measure is off.
961 If you want to allow line breaking on the barlines where
962 @internalsref{Completion_heads_engraver} splits notes, you must
963 also remove @internalsref{Forbid_line_break_engraver}.
968 Not all durations (especially those containing tuplets) can be
969 represented exactly with normal notes and dots, but the engraver
970 will not insert tuplets.
972 @code{Completion_heads_engraver} only affects notes; it does not
978 Program reference: @internalsref{Completion_heads_engraver}.
981 @node Setting automatic beam behavior
982 @unnumberedsubsubsec Setting automatic beam behavior
984 @funindex autoBeamSettings
985 @funindex (end * * * *)
986 @funindex (begin * * * *)
987 @cindex automatic beams, tuning
988 @cindex tuning automatic beaming
990 @c [TODO: use \applyContext]
992 In normal time signatures, automatic beams can start on any note but can
993 only end in a few positions within the measure: beams can end on a beat,
994 or at durations specified by the properties in
995 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
996 consist of a list of rules for where beams can begin and end. The
997 default @code{autoBeamSettings} rules are defined in
998 @file{scm/@/auto@/-beam@/.scm}.
1000 In order to add a rule to the list, use
1002 #(override-auto-beam-setting '(be p q n m) a b [context])
1007 @item @code{be} is either "begin" or "end".
1009 @item @code{p/q} is the duration of the note for which you want
1010 to add a rule. A beam is considered to have the duration of its
1011 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1012 have this apply to any beam.
1014 @item @code{n/m} is the time signature to which
1015 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1016 to have this apply in any time signature.
1018 @item @code{a/b} is the position in the bar at which the beam should
1021 @item @code{context} is optional, and it specifies the context at which
1022 the change should be made. The default is @code{'Voice}.
1023 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1024 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1028 For example, if automatic beams should always end on the first quarter
1032 #(override-auto-beam-setting '(end * * * *) 1 4)
1035 You can force the beam settings to only take effect on beams whose shortest
1036 note is a certain duration
1038 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1040 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1042 a32 a a a a16 a a a a a |
1043 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1044 a32 a a a a16 a a a a a |
1047 You can force the beam settings to only take effect in certain time
1050 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1052 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1060 You can also remove a previously set beam-ending rule by using
1063 #(revert-auto-beam-setting '(be p q n m) a b [context])
1067 be, p, q, n, m, a, b and context are the same as above. Note that the
1068 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1069 so you can revert rules that you did not explicitly create.
1071 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1073 a16 a a a a a a a a a a a a a a a
1074 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1075 a16 a a a a a a a a a a a a a a a
1078 The rule in a revert-auto-beam-setting statement must exactly match the
1079 original rule. That is, no wildcard expansion is taken into account.
1081 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1083 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1085 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1087 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1093 @c TODO: old material -- not covered by above stuff, I think.
1094 If automatic beams should end on every quarter in 5/4 time, specify
1097 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1098 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1099 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1100 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1104 The same syntax can be used to specify beam starting points. In this
1105 example, automatic beams can only end on a dotted quarter note
1107 #(override-auto-beam-setting '(end * * * *) 3 8)
1108 #(override-auto-beam-setting '(end * * * *) 1 2)
1109 #(override-auto-beam-setting '(end * * * *) 7 8)
1111 In 4/4 time signature, this means that automatic beams could end only on
1112 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1113 3/8, has passed within the measure).
1115 If any unexpected beam behaviour occurs, check the default automatic beam
1116 settings in @file{scm/@/auto@/-beam@/.scm}
1117 for possible interference, because the beam
1118 endings defined there will still apply on top of your own overrides. Any
1119 unwanted endings in the default vales must be reverted for your time
1122 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1126 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1127 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1128 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1129 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1132 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1133 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1134 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1137 @cindex automatic beam generation
1139 @funindex autoBeaming
1142 If beams are used to indicate melismata in songs, then automatic
1143 beaming should be switched off with @code{\autoBeamOff}.
1148 @funindex \autoBeamOff
1149 @code{\autoBeamOff},
1150 @funindex \autoBeamOn
1155 Beaming patterns may be altered with the @code{beatGrouping} property,
1157 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1159 \set beatGrouping = #'(2 3)
1161 \set beatGrouping = #'(3 2)
1168 If a score ends while an automatic beam has not been ended and is
1169 still accepting notes, this last beam will not be typeset at all. The
1170 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
1171 >>}. If a polyphonic voice ends while an automatic beam is still
1172 accepting notes, it is not typeset.
1185 @node Automatic beams
1186 @unnumberedsubsubsec Automatic beams
1188 By default beams are inserted automatically
1190 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1192 \time 6/8 c c c c8. c16 c8
1195 When these automatic decisions are not good enough, beaming
1196 can be entered explicitly. It is also possible to define beaming
1197 patterns that differ from the defaults. See @ref{Manual beams}
1198 and @ref{Setting automatic beam behavior}.
1204 Automatic beaming may be turned off and on with
1205 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1207 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1208 c4 c8 c8. c16 c8. c16 c8
1218 @funindex stemLeftBeamCount
1219 @funindex stemRightBeamCount
1221 LilyPond can automatically determine beaming patterns within a
1222 beam, but this automatic behavior can sometimes produce odd
1223 results; therefore the @code{stemLeftBeamCount} and
1224 @code{stemRightBeamCount} properties can be used to override the
1225 defaults. If either property is set, its value will be used only
1226 once, and then it is erased.
1228 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1233 \set stemLeftBeamCount = #1
1238 The property @code{subdivideBeams} can be set in order to
1239 subdivide all 16th or shorter beams.
1240 When set, multiple beams will be sub-divided at beat
1241 positions, defined by the current value of @code{beatLength},
1242 by drawing only one beam over the beat.
1244 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1246 \set subdivideBeams = ##t
1248 \set Score.beatLength = #(ly:make-moment 1 8)
1251 @funindex subdivideBeams
1254 For more information about @code{make-moment}, see
1255 @ref{Time administration}.
1257 @c TODO Consider whether the section Setting automatic
1258 @c beam behavior should all be moved here. For now
1259 @c here's a link to it.
1261 For details about modifying the automatic beam behaviour
1262 see @ref{Setting automatic beam behavior}
1266 Line breaks are normally forbidden when beams cross barlines.
1267 This behavior can be changed by setting the @code{breakable}
1268 property: @code{\override Beam #'breakable = ##t}.
1270 @cindex beams and line breaks
1271 @cindex beams, kneed
1273 @cindex auto-knee-gap
1275 Kneed beams are inserted automatically when a large gap is
1276 detected between the note heads. This behavior can be tuned
1277 through the @code{auto-knee-gap} property. A kneed beam is
1278 drawn if the gap is larger than the value of
1279 @code{auto-knee-gap} plus the width of the beam object (which
1280 depends on the duration of the notes and the slope of the beam).
1281 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1283 @lilypond[fragment,ragged-right,quote,verbatim]
1285 \override Beam #'auto-knee-gap = #6
1292 Program reference: @internalsref{Beam}.
1297 Automatically kneed cross-staff beams cannot be used together with
1298 hidden staves. See @ref{Hiding staves}.
1300 Beams can collide with noteheads and accidentals in other voices
1303 @unnumberedsubsubsec Manual beams
1305 @cindex beams, manual
1307 Individual notes may be marked with @code{\noBeam} to prevent them
1310 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1311 \time 2/4 c8 c\noBeam c c
1317 In some cases it may be necessary to override the automatic
1318 beaming algorithm. For example, the autobeamer will not put beams
1319 over rests or barlines, and in choral scores the beaming is
1320 often set to follow the meter of the lyrics rather than the
1321 notes. Such beams can be specified manually by
1322 marking the begin and end point with @code{[} and @code{]}
1324 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1326 r4 r8[ g' a r8] r8 g[ | a] r8
1330 @cindex beams, feathered
1331 @funindex \featherDurations
1333 Feathered beams are used to indicate that a small group of notes
1334 should be played at an increasing (or decreasing) tempo, without
1335 changing the overall tempo of the piece. The extent of the
1336 feathered beam must be indicated manually using @code{[} and
1337 @code{]}, and the beam feathering is turned on by specifying a
1338 direction to the Beam property @code{grow-direction}.
1340 If the placement of the notes and the sound in the MIDI output
1341 is to reflect the ritardando or accelerando indicated by the
1342 feathered beam the notes must be grouped as a
1343 music expression delimited by braces and preceded by a
1344 @code{featheredDurations} command which specifies the ratio
1345 between the durations of the first and last notes in the group.
1348 show the extent of the beam and the braces show
1349 which notes are to have their durations modified. Normally
1350 these would delimit the same group of notes, but this is not
1351 required: the two commands are independent.
1353 In the following example the eight 16th notes occupy exactly
1354 the same time as a half note, but the first note is twice
1355 as short as the last one, with the intermediate notes gradually
1356 lengthening. The first four 32nd notes gradually speed up,
1357 while the last four 32nd notes are at a constant tempo.
1359 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1360 \override Beam #'grow-direction = #LEFT
1361 \featherDurations #(ly:make-moment 2 1)
1362 { c16[ c c c c c c c] }
1363 \override Beam #'grow-direction = #RIGHT
1364 \featherDurations #(ly:make-moment 2 3)
1366 % revert to non-feathered beams
1367 \override Beam #'grow-direction = #'()
1372 The spacing in the printed output represents the
1373 note durations only approximately, but the midi output is exact.
1378 Line breaking is prevented by beams which straddle barlines. The
1379 @samp{breakable} property of @code{Beam} allows this behaviour
1382 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1383 \override Beam #'breakable = ##t
1384 c8 \repeat unfold 15 {c[ c] } c
1390 The @code{\featherDurations} command only works with very short
1391 music snippets, and when numbers in the fraction are small.
1401 * Bar and bar number checks::
1406 @unnumberedsubsubsec Bar lines
1411 @cindex measure lines
1414 Barlines delimit measures, and are also used to indicate
1415 repeats. Normally, simple barlines are automatically inserted
1416 into the printed output at places based on the current time
1419 The simple barlines inserted automatically can be changed to
1420 other types with the @code{\bar} command. For example, a closing
1421 double barline is usually placed at the end of a piece:
1423 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1427 @warning{An incorrect duration can lead to poorly formatted
1430 It is not invalid if the final note in a bar does not
1431 end on the automatically entered barline: the note is assumed
1432 to carry over into the next bar. But if a long sequence
1433 of such carry-over bars appears the music can appear compressed
1434 or even flowing off the page. This is because automatic line
1435 breaks happen only at the end of complete bars, i.e. where
1436 the end of a note coincides with the end of a bar.
1438 Line breaks are also permitted at manually inserted barlines
1439 even within incomplete bars. To allow a line break without
1440 printing a barline, use
1447 This will insert an invisible barline and allow (but not
1448 force) a line break to occur at this point. The bar number
1449 counter is not increased. To force a line break see
1450 @ref{Line breaking}.
1452 This and other special barlines may be inserted manually at any
1453 point. When they coincide with the end of a bar they replace
1454 the simple barline which would have been inserted there
1455 automatically. When they do not coincide
1456 with the end of a bar the specified barline is inserted at that
1457 point in the printed output. Such insertions do not affect
1458 the calculation and placement of subsequent automatic barlines.
1460 The simple barline and four types of double barline are available
1461 for manual insertion:
1463 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1464 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1468 together with dotted and dashed barlines:
1470 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1471 f1 \bar ":" g \bar "dashed" a
1475 and three types of repeat barline:
1477 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1478 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1481 Although the barline types signifying repeats may be inserted
1482 manually they do not in themselves cause LilyPond to recognise
1483 a repeated section. Such repeated sections are better entered
1484 using the various repeat commands (see @ref{Repeats}), which
1485 automatically print the appropriate barlines.
1487 In addition, you can specify @code{"||:"}, which is equivalent to
1488 @code{"|:"} except at line breaks, where it gives a double bar
1489 line at the end of the line and a start repeat at the beginning of
1492 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1493 \override Score.RehearsalMark #'padding = #3
1501 In scores with many staves, a @code{\bar} command in one staff is
1502 automatically applied to all staves. The resulting barlines are
1503 connected between different staves of a @code{StaffGroup},
1504 @code{PianoStaff}, or @code{GrandStaff}.
1506 @lilypond[quote,ragged-right,fragment,verbatim]
1514 \new Staff { \clef bass c4 g e g }
1516 \new Staff { \clef bass c2 c2 }
1524 @funindex defaultBarType
1526 The command @code{\bar }@var{bartype} is a short cut for
1527 @code{\set Timing.whichBar = }@var{bartype}. A barline is
1528 created whenever the @code{whichBar} property is
1531 The default bar type used for automatically inserted barlines is
1532 @code{"|"}. This may be changed at any time
1533 with @code{\set Timing.defaultBarType = }@var{bartype}.
1537 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1539 Program reference: @internalsref{BarLine} (created at
1540 @internalsref{Staff} level), @internalsref{SpanBar} (across
1541 staves), @internalsref{Timing_translator} (for Timing
1546 @unnumberedsubsubsec Bar numbers
1549 @cindex measure numbers
1550 @funindex currentBarNumber
1552 Bar numbers are typeset by default at the start of every line
1553 except the first line. The
1554 number itself is stored in the @code{currentBarNumber} property,
1555 which is normally updated automatically for every measure. It
1556 may also be set manually:
1558 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1559 \repeat unfold 4 {c4 c c c} \break
1560 \set Score.currentBarNumber = #50
1561 \repeat unfold 4 {c4 c c c}
1564 Bar numbers may only be printed at barlines; to print a bar
1565 number at the beginning of a piece, an empty barline must be
1566 inserted there, and a value other than @code{1} must be placed
1567 in @code{currentBarNumber}:
1569 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1570 \set Score.currentBarNumber = #50
1572 \repeat unfold 4 {c4 c c c} \break
1573 \repeat unfold 4 {c4 c c c}
1578 @funindex barNumberVisibility
1579 @cindex bar numbers, regular spacing
1581 Bar numbers can be typeset at regular intervals instead of just
1582 at the beginning of every line. To do this the default
1583 behaviour must be overridden to permit bar numbers to be
1584 printed at places other than the start of a line.
1585 This is controlled by the
1586 @code{break-visibility} property of @code{BarNumber}. This
1587 takes three values which may be set to @samp{#t} or @samp{#f} to
1588 specify whether the corresponding bar number is visible or not.
1589 The order of the three values is @samp{end of line visible, middle
1590 of line visible, beginning of line visible}. In the following
1591 example bar numbers are printed at all possible places:
1593 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1594 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1595 \set Score.currentBarNumber = #11
1596 \bar "" % Permit first bar number to be printed
1603 and here the bar numbers are printed every two bars
1604 except at the end of the line:
1606 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1607 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1608 \set Score.currentBarNumber = #11
1609 \bar "" % Permit first bar number to be printed
1610 % Print a bar number every 2nd bar
1611 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1617 The size of the bar number may be changed. This is illustrated
1618 in the following example, which also shows how to enclose bar
1619 numbers in boxes and circles, and shows an alternative way
1620 of specifying @samp{#(#f #t #t)} for @code{break-visibility}.
1622 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1623 % Prevent bar numbers at the end of a line and permit them elsewhere
1624 \override Score.BarNumber #'break-visibility
1625 = #end-of-line-invisible
1627 % Increase the size of the bar number by 2
1628 \override Score.BarNumber #'font-size = #2
1629 \repeat unfold 3 { c1 } \bar "|"
1631 % Draw a box round the following bar number(s)
1632 \override Score.BarNumber #'stencil
1633 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1634 \repeat unfold 3 { c1 } \bar "|"
1636 % Draw a circle round the following bar number(s)
1637 \override Score.BarNumber #'stencil
1638 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1639 \repeat unfold 4 { c1 } \bar "|."
1642 @cindex Bar number alignment
1644 Bar numbers by default are left-aligned to their parent object.
1645 This is usually the left edge of a line or, if numbers are printed
1646 within a line, the left barline of the bar. The numbers may also
1647 be positioned directly on the barline or right-aligned to the
1650 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1651 \set Score.currentBarNumber = #111
1652 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1653 % Increase the size of the bar number by 2
1654 \override Score.BarNumber #'font-size = #2
1655 % Print a bar number every 2nd bar
1656 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1658 % Centre-align bar numbers
1659 \override Score.BarNumber #'self-alignment-X = #0
1661 % Right-align bar numbers
1662 \override Score.BarNumber #'self-alignment-X = #-1
1666 Bar numbers can be removed entirely by removing the Bar number
1667 engraver from the score context.
1669 @lilypond[verbatim,ragged-right,quote]
1673 \remove "Bar_number_engraver"
1685 Program reference: @internalsref{BarNumber}.
1687 Examples: @lsrdir{bar number}
1692 Bar numbers can collide with the top of the
1693 @internalsref{StaffGroup} bracket, if there is one.
1694 To solve this, the @code{padding} property of
1695 @internalsref{BarNumber} can be used to
1696 position the number correctly.
1699 @node Bar and bar number checks
1700 @unnumberedsubsubsec Bar and bar number checks
1703 @funindex barCheckSynchronize
1706 Bar checks help detect errors in the entered durations.
1707 A bar check may be entered using the bar symbol, @samp{|},
1708 at any place where a barline is expected to fall.
1709 If bar check lines are encountered at other places,
1710 a list of warnings is printed in the log file,
1711 showing the line numbers and lines
1712 in which the bar checks failed. In the next
1713 example, the second bar check will signal an error
1716 \time 3/4 c2 e4 | g2 |
1719 Bar checks can also be used in lyrics, for example
1724 Twin -- kle | Twin -- kle |
1728 An incorrect duration can result in a completely garbled score,
1729 especially if the score is polyphonic, so a good place to start
1730 correcting input is by scanning for failed bar checks and
1731 incorrect durations.
1734 @funindex pipeSymbol
1736 It is also possible to redefine the action taken when a bar check
1737 or pipe symbol, @samp{|}, is encountered in the input, so that
1738 it does something other than a bar check. This is done by
1739 assigning a music expression to @code{pipeSymbol}.
1740 In the following example @samp{|} is set to insert a double bar
1741 line wherever it appears in the input, rather than checking
1744 @lilypond[quote,ragged-right,verbatim]
1745 pipeSymbol = \bar "||"
1754 When copying large pieces of music, it can be helpful to check
1755 that the LilyPond bar number corresponds to the original that you
1756 are entering from. This can be checked with
1757 @code{\barNumberCheck}, for example,
1760 \barNumberCheck #123
1764 will print a warning if the @code{currentBarNumber} is not 123
1765 when it is processed.
1768 @node Rehearsal marks
1769 @unnumberedsubsubsec Rehearsal marks
1771 @cindex Rehearsal marks
1774 To print a rehearsal mark, use the @code{\mark} command
1776 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1785 The letter@tie{}@q{I} is skipped in accordance with engraving
1786 traditions. If you wish to include the letter @q{I}, then use
1789 \set Score.markFormatter = #format-mark-alphabet
1792 The mark is incremented automatically if you use @code{\mark
1793 \default}, but you can also use an integer argument to set the
1794 mark manually. The value to use is stored in the property
1795 @code{rehearsalMark}.
1797 The style is defined by the property @code{markFormatter}. It is
1798 a function taking the current mark (an integer) and the current
1799 context as argument. It should return a markup object. In the
1800 following example, @code{markFormatter} is set to a pre-defined
1801 procedure. After a few measures, it is set to a procedure that
1802 produces a boxed number.
1804 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1805 \set Score.markFormatter = #format-mark-numbers
1808 \set Score.markFormatter = #format-mark-box-numbers
1814 The file @file{scm/@/translation@/-functions@/.scm} contains the
1815 definitions of @code{format-mark-numbers} (the default format),
1816 @code{format-mark-box-numbers}, @code{format-mark-letters} and
1817 @code{format-mark-box-letters}. These can be used as inspiration
1818 for other formatting functions.
1820 You may use @code{format-mark-barnumbers},
1821 @code{format-mark-box-barnumbers}, and
1822 @code{format-mark-circle-barnumbers} to get bar numbers instead of
1823 incremented numbers or letters.
1825 Other styles of rehearsal mark can be specified manually
1832 @code{Score.markFormatter} does not affect marks specified in this
1833 manner. However, it is possible to apply a @code{\markup} to the
1837 \mark \markup@{ \box A1 @}
1844 Music glyphs (such as the segno sign) may be printed inside a
1847 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1848 c1 \mark \markup { \musicglyph #"scripts.segno" }
1849 c1 \mark \markup { \musicglyph #"scripts.coda" }
1850 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1855 See @ref{The Feta font}, for a list of symbols which may be
1856 printed with @code{\musicglyph}.
1858 For common tweaks to the positioning of rehearsal marks, see
1863 This manual: @ref{Text marks}.
1865 Program reference: @internalsref{RehearsalMark}.
1867 Init files: @file{scm/@/translation@/-functions@/.scm} contains
1868 the definition of @code{format-mark-numbers} and
1869 @code{format-mark-letters}. They can be used as inspiration for
1870 other formatting functions.
1872 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1875 @node Special rhythmic concerns
1876 @subsection Special rhythmic concerns
1881 * Aligning to cadenzas::
1882 * Time administration::
1886 @unnumberedsubsubsec Grace notes
1891 @cindex appoggiatura
1892 @cindex acciaccatura
1894 Grace notes are ornaments that are written out. The most common
1895 ones are acciaccatura, which should be played as very short. It
1896 is denoted by a slurred small note with a slashed stem. The
1897 appoggiatura is a grace note that takes a fixed fraction of the
1898 main note, and is denoted as a slurred note in small print without
1899 a slash. They are entered with the commands @code{\acciaccatura}
1900 and @code{\appoggiatura}, as demonstrated in the following example
1902 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1903 b4 \acciaccatura d8 c4
1905 \acciaccatura { g16[ f] } e4
1908 Both are special forms of the @code{\grace} command. By prefixing
1909 this keyword to a music expression, a new one is formed, which
1910 will be printed in a smaller font and takes up no logical time in
1913 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1915 \grace { c16[ d16] } c2 c4
1919 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1920 @code{\grace} command does not start a slur.
1922 The placement of grace notes is synchronized between different
1923 staves. In the following example, there are two sixteenth grace
1924 notes for every eighth grace note
1926 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1927 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1928 \new Staff { c4 \grace { g8[ b] } c4 } >>
1931 @funindex \afterGrace
1933 If you want to end a note with a grace, use the @code{\afterGrace}
1934 command. It takes two arguments: the main note, and the grace
1935 notes following the main note.
1937 @lilypond[ragged-right, verbatim,relative=2,fragment]
1938 c1 \afterGrace d1 { c16[ d] } c4
1941 This will put the grace notes after a @q{space} lasting 3/4 of the
1942 length of the main note. The fraction 3/4 can be changed by
1943 setting @code{afterGraceFraction}, ie.
1946 #(define afterGraceFraction (cons 7 8))
1950 will put the grace note at 7/8 of the main note.
1952 The same effect can be achieved manually by doing
1954 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1957 { s2 \grace { c16[ d] } } >>
1963 By adjusting the duration of the skip note (here it is a
1964 half-note), the space between the main-note and the grace
1967 A @code{\grace} music expression will introduce special
1968 typesetting settings, for example, to produce smaller type, and
1969 set directions. Hence, when introducing layout tweaks, they
1970 should be inside the grace expression, for example,
1972 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1984 The overrides should also be reverted inside the grace expression.
1986 The layout of grace expressions can be changed throughout the
1987 music using the function @code{add-grace-property}. The following
1988 example undefines the @code{Stem} direction for this grace, so
1989 that stems do not always point up.
1993 #(add-grace-property 'Voice 'Stem 'direction '())
1999 Another option is to change the variables @code{startGraceMusic},
2000 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2001 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2002 @code{stopAppoggiaturaMusic}. The default values of these can be
2003 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2004 them other effects may be obtained.
2007 The slash through the stem in acciaccaturas can be obtained in
2008 other situations by @code{\override Stem #'stroke-style =
2014 Grace notes may be forced to use align with regular notes
2015 in other staves by setting @code{strict-grace-spacing} to
2018 @lilypond[relative=2,ragged-right]
2020 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2029 c'16[ c'16 c'16 c'16]
2030 c'16[ c'16 c'16 c'16]
2039 Program reference: @internalsref{GraceMusic}.
2044 A multi-note beamed acciaccatura is printed without a slash,
2045 and looks exactly the same as a multi-note beamed appoggiatura.
2046 @c TODO Add link to LSR snippet to add slash when available
2048 Grace note synchronization can also lead to surprises. Staff
2049 notation, such as key signatures, barlines, etc., are also
2050 synchronized. Take care when you mix staves with grace notes and
2051 staves without, for example,
2053 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2054 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2055 \new Staff { c4 \bar "|:" d4 } >>
2059 This can be remedied by inserting grace skips of the corresponding
2060 durations in the other staves. For the above example
2062 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2063 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2064 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2067 Grace sections should only be used within sequential music
2068 expressions. Nesting or juxtaposing grace sections is not
2069 supported, and might produce crashes or other errors.
2071 @node Aligning to cadenzas
2072 @unnumberedsubsubsec Aligning to cadenzas
2074 In an orchestral context, cadenzas present a special problem: when
2075 constructing a score that includes a cadenza, all other
2076 instruments should skip just as many notes as the length of the
2077 cadenza, otherwise they will start too soon or too late.
2079 A solution to this problem are the functions
2080 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2081 functions take a piece of music as argument, and generate a
2082 multi-rest or @code{\skip}, exactly as long as the piece. The use
2083 of @code{mmrest-of-length} is demonstrated in the following
2086 @lilypond[verbatim,ragged-right,quote]
2087 cadenza = \relative c' {
2088 c4 d8 << { e f g } \\ { d4. } >>
2093 \new Staff { \cadenza c'4 }
2095 #(ly:export (mmrest-of-length cadenza))
2102 @node Time administration
2103 @unnumberedsubsubsec Time administration
2105 @cindex Time administration
2107 @funindex currentBarNumber
2108 @funindex measurePosition
2109 @funindex measureLength
2111 Time is administered by the
2112 @code{Timing_translator}, which by default is
2113 to be found in the @code{Score} context. An
2114 alias, @code{Timing}, is added to the context in which
2115 the @code{Timing_translator} is placed.
2117 The following properties of @code{Timing} are used
2118 to keep track of timing within the score.
2121 @item currentBarNumber
2122 The current measure number. For an example showing the
2123 use of this property see @ref{Bar numbers}.
2126 The length of the measures in the current time signature. For a
2127 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2128 determines when barlines are inserted and how automatic beams
2129 should be generated.
2131 @item measurePosition
2132 The point within the measure where we currently are. This
2133 quantity is reset by subtracting @code{measureLength} whenever
2134 @code{measureLength} is reached or exceeded. When that happens,
2135 @code{currentBarNumber} is incremented.
2138 If set to true, the above variables are updated for every time
2139 step. When set to false, the engraver stays in the current
2140 measure indefinitely.
2144 Timing can be changed by setting any of these variables
2145 explicitly. In the next example, the default 4/4 time
2146 signature is printed, but @code{measureLength} is set to 5/4.
2147 At 4/8 though the third bar, the @code{measurePosition} is
2148 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2149 The next barline then falls at 9/8 rather than 5/4.
2151 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2152 \set Score.measureLength = #(ly:make-moment 5 4)
2156 \set Score.measurePosition = #(ly:make-moment 5 8)
2162 As the example illustrates, @code{ly:make-moment n m} constructs a
2163 duration of n/m of a whole note. For example,
2164 @code{ly:make-moment 1 8} is an eighth note duration and
2165 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2170 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2172 Program Reference: @internalsref{Timing_translator},
2173 @internalsref{Score}