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=14,quote]
15 This section discusses rhythms, rests, durations, beaming and bars.
20 * Displaying rhythms::
23 * Special rhythmic concerns::
28 @subsection Writing rhythms
38 @subsubsection Durations
40 @cindex durations, of notes
41 @cindex note durations
47 Durations are designated by numbers and dots.
48 Durations are entered as their reciprocal values. For example, a
49 quarter note is entered using a @code{4} (since it is a 1/4 note),
50 and a half note is entered using a @code{2} (since it is a 1/2
51 note). For notes longer than a whole you must use the
52 @code{\longa} (a double breve) and @code{\breve} commands.
53 Durations as short as 64th notes may be specified. Shorter values
54 are possible, but only as beamed notes.
56 @c Two 64th notes are needed to obtain beams
57 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
64 Here are the same durations with automatic beaming turned off.
66 @c not strictly "writing rhythms"; more of a "displaying" thing,
67 @c but it's ok here. -gp
68 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
75 A note with the duration of a quadruple breve may be entered with
76 @code{\maxima}, but this is supported only within ancient music
77 notation. For details, see @ref{Ancient notation}.
79 If the duration is omitted, it is set to the previously
80 entered duration. The default for the first note is a quarter
83 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
92 To obtain dotted note lengths, place a dot (@code{.}) after the
93 duration. Double-dotted notes are specified by appending two
96 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
97 a4 b c4. b8 a4. b4.. c8.
100 Some durations cannot be represented with just binary durations
101 and dots; they can be represented only by tying two or more
102 notes together. For details, see @ref{Ties}.
104 For ways of specifying durations for the syllables of lyrics and
105 ways of aligning lyrics to notes, see @ref{Vocal music}.
107 Optionally, notes can be spaced strictly proportionately to their
108 duration. For details of this and other settings which control
109 proportional notation, see @ref{Proportional notation}.
113 Dots are normally moved up to avoid staff lines, except in
114 polyphonic situations. The following commands may be used to
115 force a particular direction manually, and to return to the
122 @funindex \dotsNeutral
128 Music Glossary: @rglos{breve}, @rglos{longa}, @rglos{note value}
129 @rglos{Duration names notes and rests}.
131 Notation Reference: @ref{Automatic beams}, @ref{Ties},
132 @ref{Writing rhythms}, @ref{Writing rests}, @ref{Vocal music},
133 @ref{Ancient notation}, @ref{Proportional notation}.
135 Snippets: @lsrdir{Rhythms,Rhythms}
137 Internals Reference: @internalsref{Dots},
138 @internalsref{DotColumn}.
143 @c Deliberately duplicated in Durations and Rests. -gp
144 There is no fundamental limit to rest durations (both in terms of
145 longest and shortest), but the number of glyphs is limited:
146 rests from 128th to maxima (8 x whole) may be printed.
150 @subsubsection Tuplets
156 Tuplets are made out of a music expression by multiplying all
157 durations with a fraction:
160 \times @var{fraction} @var{musicexpr}
164 The duration of @var{musicexpr} will be multiplied by the
165 fraction. The fraction's denominator will be printed over or
166 under the notes, optionally with a bracket. The most common
167 tuplet is the triplet in which 3 notes have the length of 2, so
168 the notes are 2/3 of their written length.
170 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
171 a2 \times 2/3 {b4 b b}
172 c4 c \times 2/3 {b4 a g}
176 Tuplets may be nested:
178 @lilypond[fragment,ragged-right,verbatim,relative=2]
181 c4 \times 4/5 { f8 e f \times 2/3 {e[ f g] } } f4 |
189 @funindex \tupletDown
191 @funindex \tupletNeutral
192 @code{\tupletNeutral}.
197 @cindex tuplet formatting
198 @cindex triplet formatting
200 @funindex tupletNumberFormatFunction
201 @funindex tupletSpannerDuration
204 @c @lilypondfile [ragged-right,line-width=16\cm,staffsize=14,quote]
205 @c {Entering-several-tuplets-using-only-one-\times-command.ly}
208 @c TODO Remove when snippet works ok
209 @c Sent to Snippet 5 Feb 08
210 The property @code{tupletSpannerDuration} specifies how long each
211 bracket should last. With this, you can make lots of tuplets
212 while typing @code{\times} only once, thus saving lots of typing.
213 In the next example, there are two triplets shown, while
214 @code{\times} was only used once.
216 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
217 \set tupletSpannerDuration = #(ly:make-moment 1 4)
218 \times 2/3 { c8 c c c c c }
223 For more information about @code{make-moment}, see
224 @ref{Time administration}.
226 @funindex TupletNumber
228 By default, only the numerator of the tuplet number
229 is printed over the tuplet bracket, i.e. the denominator
230 of the argument to the @code{\times} command. Alternatively,
231 @var{num}:@var{den} of the tuplet number may be printed, or
232 the tuplet number may be suppressed altogether.
235 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
236 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
237 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
238 \times 2/3 { c8 c c }
239 \override TupletNumber #'transparent = ##t
240 \times 2/3 { c8 c c }
243 @c TODO Add snippet to show this
244 Tuplets may extend over bar lines, but they will inhibit a
245 line break unless the @code{Forbid_line_break_engraver} is
246 removed from the @code{Voice context}.
248 @subheading Modifying nested tuplets
250 @cindex tuplets, nested
251 @cindex triplets, nested
252 @cindex bracket, tuplet
253 @cindex tuplet bracket
254 @cindex triplet bracket
255 @funindex TupletBracket
257 If nested tuplets do not begin at the same moment their
258 appearance may be modified in the usual way with
259 @code{\override} commands:
261 @c NOTE Tuplet brackets collide if notes are high on staff
263 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
264 \times 2/3 { c8[ c c]}
265 \once \override TupletNumber #'text = #tuplet-number::calc-fraction-text
269 \once \override TupletNumber #'transparent = ##t
270 \times 2/3 { c8[ c c] }
271 \times 2/3 { c8[ c c]}
275 However, if the nested tuplets begin at the same musical moment,
276 @code{\override} commands cannot be applied to just one of them
277 -- they apply to both. So to change the appearance of nested
278 tuplets beginning at the same musical moment individually, the
279 @code{\tweak} function must be used (see @ref{Objects connected
280 to the input}). The @code{\tweak} function is applied to the
281 following @code{\times} command as it appears in the input stream,
282 and so can distinguish between separate @code{\times} commands
283 even if their tuplets begin at the same musical moment.
285 In this example, the @code{\tweak} command is used to specify
286 fraction text for the outer @code{TupletNumber} and denominator
287 text for the @code{TupletNumber} of the first of the three
290 @c NOTE Tuplet brackets collide if notes are high on staff
291 @c so use relative=1 until this is fixed
293 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
294 \tweak #'text #tuplet-number::calc-fraction-text
296 \tweak #'text #tuplet-number::calc-denominator-text
297 \times 2/3 { c8[ c8 c8] }
298 \times 2/3 { c8[ c8 c8] }
299 \times 2/3 { c8[ c8 c8] }
303 In the next example, @code{\tweak} and @code{\override} work
304 together to specify @code{TupletBracket} direction. The first
305 @code{\tweak} positions the @code{TupletBracket} of the outer
306 tuplet above the staff. The second @code{\tweak} positions the
307 @code{TupletBracket} of the first of the three inner tuplets below
308 the staff. Note that the @code{\tweak} command needs to be used
309 only for events that begin at the same music moment: the outer
310 tuplet and the first of the three inner tuplets. To position the
311 @code{TupletBracket}s of the second and third of the inner tuplets
312 below the staff, we can use @code{\override} in the usual way.
314 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
315 \tweak #'text #tuplet-number::calc-fraction-text
316 \tweak #'direction #up
318 \tweak #'direction #down
319 \times 2/3 { c8[ c8 c8] }
320 \override TupletBracket #'direction = #down
321 \times 2/3 { c8[ c8 c8] }
322 \times 2/3 { c8[ c8 c8] }
326 @subheading Modifying tuplet bracket length
328 @cindex tuplet bracket length
329 @cindex triplet bracket length
330 @cindex bracket length, tuplets
331 @funindex tupletFullLength
332 @funindex tupletFullLengthNote
334 Tuplet brackets can be made to run to prefatory matter or the
336 Default tuplet brackets end at the right edge of the final note
337 of the tuplet; full-length tuplet brackets extend farther to the
338 right, either to cover all the non-rhythmic notation up to the
339 following note, or to cover only the whitespace before the next
340 item of notation, be that a clef, time signature, key signature,
341 or another note. The example shows how to switch tuplets to
342 full length mode and how to modify what material they cover.
345 @lilypond[ragged-right,verbatim,quote]
347 % Set tuplets to be extendable ..
348 \set tupletFullLength = ##t
349 % .. to cover all items up to the next note
350 \set tupletFullLengthNote = ##t
352 \times 2/3 { c4 c c }
353 % .. or to cover just whitespace
354 \set tupletFullLengthNote = ##f
362 @subheading Compressing music
364 @cindex compressing music
365 @funindex \compressMusic
367 @code{\compressMusic} works similarly to \times, but does not
368 create a tuplet bracket. One application is in polymetric
369 notation, as shown in the following example. See
370 @ref{Polymetric notation}.
373 @c @lilypondfile [ragged-right,line-width=16\cm,staffsize=14,quote]
374 @c {printing-music-with-different-time-signatures.ly}
379 Music Glossary: @rglos{triplet}, @rglos{tuplet},
382 Notation Reference: @ref{Time administration},
383 @ref{Objects connected to the input}, @ref{Polymetric notation}.
385 Snippets: @lsrdir{Rhythms,Rhythms}.
387 Internals Reference: @internalsref{TupletBracket},
388 @internalsref{TupletNumber}, @internalsref{TimeScaledMusic}.
392 Lines may be broken within a tuplet with @code{\bar "" \break},
393 but the tuplet bracket does not correctly carry over.
396 @node Scaling durations
397 @subsubsection Scaling durations
399 You can alter the length of a duration by a fraction @var{N/M}
400 by appending @code{*@var{N/M}} (or @code{*@var{N}} if @var{M=1}).
401 This will not affect the appearance of the notes or rests
402 produced, but the altered duration will be used in calculating the
403 position within the measure and setting the duration in the MIDI
404 output. Multiplying factors may be combined
407 In the following example, the first three notes take up exactly
408 two beats, but no triplet bracket is printed.
410 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
412 a4*2/3 gis4*2/3 a4*2/3
417 The duration of skip or spacing notes may also be modified by
418 a multiplier. This is useful for skipping many measures, e.g.,
423 Notation Reference: @ref{Tuplets}, @ref{Skips}, @ref{Polymetric notation}.
425 Snippets: @lsrdir{Rhythms,Rhythms}
433 A tie connects two adjacent note heads of the same pitch. The tie
434 in effect extends the length of a note.
436 @warning{Ties should not be confused with @emph{slurs}, which
437 indicate articulation, or @emph{phrasing slurs}, which indicate
438 musical phrasing. A tie is just a way of extending a note
439 duration, similar to the augmentation dot.}
441 A tie is entered using the tilde symbol @code{~}
443 @lilypond[quote,ragged-right,fragment,verbatim]
449 Ties are used either when the note crosses a bar line, or when
450 dots cannot be used to denote the rhythm. Ties should also be
451 used when note values cross larger subdivisions of the measure:
453 @lilypond[fragment,quote,ragged-right]
455 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
459 If you need to tie a lot of notes across bar lines, it may be
460 easier to use automatic note splitting (see @ref{Automatic note
461 splitting}). This mechanism automatically splits long notes, and
462 ties them across bar lines.
465 @cindex repeating ties
466 @cindex volta brackets and ties
468 When a tie is applied to a chord, all note heads whose pitches
469 match are connected. When no note heads match, no ties will be
470 created. Chords may be partially tied by placing the tie inside
473 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
475 <c~ e g~ b> <c e g b>
478 When a second alternative of a repeat starts with a tied note, you
479 have to repeat the tie. This can be achieved with
482 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
483 \repeat volta 2 { c g <c e>2 ~ }
484 \alternative {{ <c e>2. r4 } {<c e>2\repeatTie d4 c }}
487 @cindex laissez vibrer
488 @cindex ties, laissez vibrer
489 @funindex \laissezVibrer
492 @funindex \tieNeutral
494 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
495 notes must not be damped at the end. It is used in notation for
496 piano, harp and other string and percussion instruments. They can
497 be entered using @code{\laissezVibrer}:
499 @lilypond[fragment,ragged-right,verbatim,relative=1]
500 <c f g>\laissezVibrer
503 The vertical placement of ties may be controlled; see
504 @ref{Controlling direction}.
508 @code{\tieDown} (see example below). @code{\tieNeutral} reverts
509 to the default behaviour again.
511 However, as with other music elements of this kind, there is a
512 convenient shorthand for forcing tie directions. By adding
513 @code{_} or @code{^} before the tilde, the direction is also set:
515 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
526 @funindex \tieNeutral
538 Ties are sometimes used to write out arpeggios. In this case, two
539 tied notes need not be consecutive. This can be achieved by
540 setting the @code{tieWaitForNote} property to true. The same
541 feature is also useful, for example, to tie a tremolo to a chord,
542 but in principle, it can also be used for ordinary, consecutive
545 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
546 \set tieWaitForNote = ##t
547 \grace { c16[~ e~ g]~ } <c, e g>2
548 \repeat tremolo 8 { c32~ c'~ } <c c,>1
549 e8~ c~ a~ f~ <e' c a f>2
550 \tieUp c8~ a \tieDown \tieDotted g~ c g2
553 Ties may be engraved manually by changing the
554 @code{tie-configuration} property of the @code{TieColumn} object.
555 The first number indicates the distance from the center of the
556 staff in staff-spaces, and the second number indicates the
557 direction (1=up, -1=down).
559 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
561 \override TieColumn #'tie-configuration =
562 #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
570 Music Glossary: @rglos{tie},
571 @c [TODO]add @rglos{laissez vibrer}. when there is a glossary entry.
573 Snippets: @lsrdir{Rhythms,Rhythms}
576 @internalsref{LaissezVibrerTie}
577 @internalsref{LaissezVibrerTieColumn}
580 @c @lsr{connecting,laissez-vibrer-ties.ly}
585 Notation Reference: @ref{Automatic note splitting}.
587 Snippets: @lsrdir{Rhythms,Rhythms}
589 Internals Reference: @internalsref{Tie}.
594 Switching staves when a tie is active will not produce a slanted
597 Changing clefs or octavations during a tie is not really
598 well-defined. In these cases, a slur may be preferable.
605 @subsection Writing rests
610 * Full measure rests::
626 Rests are entered like notes with the note name @code{r}:
628 @c \time 16/1 is used to avoid spurious bar lines
629 @c and long tracts of empty measures
630 @lilypond[fragment,quote,ragged-right,verbatim]
633 \override Staff.TimeSignature #'stencil = ##f
635 r\longa r\breve r1 r2
640 Whole measure rests, centered in middle of the measure, must be entered as
641 multi-measure rests. They can be used for a single measure as well as
642 many measures and are discussed in @ref{Full measure rests}.
644 To explicitly specify a rest's vertical position, write a note
645 followed by @code{\rest}. A rest will be placed in the position
646 where the note would appear. This allows for precise manual
647 formatting of polyphonic music, since the automatic rest collision
648 formatter will leave these rests alone.
650 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
657 Notation Reference: @ref{Full measure rests}.
659 Snippets: @lsrdir{Rhythms,Rhythms}.
661 Internals Reference: @internalsref{Rest}.
666 @c Deliberately duplicated in Durations and Rests. -gp
667 There is no fundamental limit to rest durations (both in terms of
668 longest and shortest), but the number of glyphs is limited: there
669 are rests from 128th to maxima (8 x whole).
675 @cindex invisible rest
680 An invisible rest (also called a @q{skip}) can be entered like a
681 note with note name @code{s} or with @code{\skip @var{duration}}
683 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
684 a4 a4 s4 a4 \skip 1 a4
689 The @code{s} syntax is only available in note mode and chord mode.
690 In other situations, for example, when entering lyrics, one must
691 use the @code{\skip} command:
693 @lilypond[quote,ragged-right,verbatim,relative=2]
696 \new Lyrics \lyricmode { \skip 2 bla2 }
700 The skip command is merely an empty musical placeholder. It does
701 not produce any output, not even transparent output.
703 The @code{s} skip command does create @internalsref{Staff} and
704 @internalsref{Voice} when necessary, similar to note and rest
705 commands. For example, the following results in an empty staff.
707 @lilypond[quote,verbatim]
710 @c with ragged-right, the staff lines are cut BEFORE the time
711 @c signature, which makes for a VERY empty staff
713 @c The fragment @code{@{ \skip 4 @} } would produce an empty page.
714 @c Misleading -- it doesn't produce anything, not even an empty page.
715 @c Ppl who want to make empty sheets will see this and wonder what's
720 Snippets: @lsrdir{Rhythms,Rhythms}
722 Internals Reference: @internalsref{SkipMusic}.
725 @node Full measure rests
726 @subsubsection Full measure rests
728 @cindex multi measure rests
729 @cindex full measure rests
730 @cindex rest, multi measure
731 @cindex rest, full measure
732 @cindex whole rest for a full measure
735 Rests for one or more full measures are entered using @code{R}
736 followed by a duration (see @ref{Durations}). The duration should
737 correspond to an integral number of measures, otherwise a barcheck
738 warning is printed. A @rglos{multi-measure rest} is used
739 principally to indicate that a part in a multi-part score should
742 @lilypond[quote,fragment,verbatim,relative=2]
743 \set Score.skipBars = ##t
750 A multi-measure rest can be expanded in the printed score
751 to show all the rest measures explicitly, or, as above, it can be
752 condensed to a single measure
753 containing a multi-measure rest symbol, with the number of
754 measures of rest printed above the measure. This expansion
755 is controlled by the property @code{Score.skipBars}. If this is
756 set to true, empty measures will be condensed to a single measure.
758 @lilypond[quote,ragged-right,fragment,verbatim]
759 \time 4/4 r1 | R1 | R1*2 |
762 \set Score.skipBars = ##t
766 The @code{1} in @code{R1} is similar to the duration notation
767 used for notes and is the length of a measure in 2/2 or 4/4 time.
768 The duration in a multi-measure rest must always be an integral
769 number of measure-lengths, so in other time signatures augmentation
770 dots or fractions must be used:
772 @lilypond[quote,ragged-right,fragment,verbatim]
773 \set Score.skipBars = ##t
777 R1*13/8 | R1*13/8*12 |
782 An @code{R} spanning a single measure is printed as either a whole
783 or breve rest, centered in the measure, regardless of the time
788 @cindex kirchenpausen
790 If there are 10 or fewer measures of rest, LilyPond prints
791 a series of longa and breve rests (called in German
792 Kirchenpausen - @q{church rests}) within the staff and
793 prints a simple line otherwise. This default number of 10
794 may be changed by overriding
795 @code{MultiMeasureRest.expand-limit}.
797 @lilypond[quote,ragged-right,fragment,verbatim]
798 \set Score.skipBars = ##t
800 \override MultiMeasureRest #'expand-limit = 3
804 Note that unlike ordinary rests, the vertical position on the
805 staff of the multi-measure rest symbol of either form cannot be
808 @cindex text on multi-measure rest
809 @cindex script on multi-measure rest
810 @cindex fermata on multi-measure rest
812 Text can be added to multi-measure rests by using the
813 @var{note}-@code{markup} syntax described in @ref{Text markup}.
814 The variable @code{\fermataMarkup} is provided for adding
817 @lilypond[quote,ragged-right,verbatim,fragment]
818 \set Score.skipBars = ##t
820 R2.*10^\markup { \italic "ad lib." }
824 @warning{Text attached to a multi-measure rest is created
825 by @code{MultiMeasureRestText}, not
826 @code{TextScript}. Overrides must be directed to the correct
827 object, or they will be ignored. See the following example.}
829 @lilypond[quote,ragged-right,verbatim,fragment]
830 \override TextScript #'padding = #5
832 \override MultiMeasureRestText #'padding = #5
836 Text attached to a multi-measure rest will be centered above or
837 below it. Long text attached in this way does not cause the
838 measure to expand, and may collide with text in adjacent measures.
839 Long text is better attached to a zero-length skip note preceding
840 the rest, preceded by @code{\textLengthOn} (turn off again with
841 @code{\textLengthOff}), since this will cause the measure to expand to
842 accommodate the length of the text:
844 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
845 \set Score.skipBars = ##t
847 s1*0^\markup {[MAJOR GENERAL]}
849 s1*0^\markup {[MABEL] }
850 s1*0_\markup {\italic {Cue: ... it is yours}}
853 c4^\markup {CHORUS} d f c
857 Text attached to a skip note in this way is left-aligned to the
858 position where the note would be placed in the bar, and placed
859 above the bar count numeral, but because the bar length is
860 determined by the length of the text, the text will appear to be
861 centered. If two (or more) texts are
862 attached to skip notes in a bar the bar length is determined by
863 the longer text, and the shorter text is then clearly
864 left-aligned, as shown in the second bar above. If the shorter
865 text of two marks is short enough to fit it will be placed
866 alongside and to the left of the bar count numeral.
870 Notation Reference: @ref{Durations}, @ref{Text},
871 @ref{Text markup}, @ref{Text scripts}.
873 Snippets: @lsrdir{Rhythms,Rhythms}
875 Internals Reference: @internalsref{MultiMeasureRest}.
877 The layout object @internalsref{MultiMeasureRestNumber} is for the
878 default number, and @internalsref{MultiMeasureRestText} for user
884 If an attempt is made to use fingerings (e.g.,
885 @code{R1*10-4}) to put numbers over multi-measure rests, the
886 fingering numeral (4) may collide with the bar counter
889 @cindex condensing rests
891 There is no way to automatically condense multiple rests into a
892 single multi-measure rest. Multi-measure rests do not take part
895 Be careful when entering multi-measure rests followed by whole
896 notes. The following will enter two notes lasting four measures
904 @node Displaying rhythms
905 @subsection Displaying rhythms
911 * Polymetric notation::
912 * Automatic note splitting::
916 @subsubsection Time signature
918 @cindex time signature
922 The time signature is set with the @code{\time} command:
924 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
925 \time 2/4 c2 \time 3/4 c2.
930 The symbol that is printed can be customized with the @code{style}
931 property. Setting it to @code{#'()} uses fraction style for 4/4
934 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
937 \override Staff.TimeSignature #'style = #'()
942 A time signature symbol is normally printed whenever the time
943 signature changes. If this takes place at the end of a line a
944 warning time signature sign is printed at the end of the line and
945 again at the start of a new line. This default behaviour can be
946 modified by setting the value of the @code{break-visibility}
947 property. This takes three values which may be set to @code{#t}
948 or @code{#f} to specify whether the corresponding time signature
949 is visible or not. The order of the three values is @code{end of
950 line visible}, @code{middle of line visible}, @code{beginning of
953 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
954 % Do not print any time signatures at end of line
955 \override Staff.TimeSignature #'break-visibility = ##(#f #t #t)
958 % Do not print the following 9/8 time signature
959 \once \override Staff.TimeSignature #'break-visibility = ##(#t #f #t)
967 There are many more options for its layout. See @ref{Ancient time
968 signatures}, for more examples.
970 @code{\time} sets the properties @code{timeSignatureFraction},
971 @code{beatLength}, and @code{measureLength} in the @code{Timing}
972 context, which is normally aliased to @internalsref{Score}. The
973 property @code{measureLength} determines where bar lines should be
974 inserted, and how automatic beams should be generated. Changing
975 the value of @code{timeSignatureFraction} also causes the symbol
978 @cindex measure groupings
980 More options are available through the Scheme function
981 @code{set-time-signature}, which takes three arguments: the number
982 of beats, the beat length, and the internal grouping of beats in
983 the measure. If the @internalsref{Measure_grouping_engraver} is
984 included, the function will also create
985 @internalsref{MeasureGrouping} signs. Such signs ease reading
986 rhythmically complex modern music. In the following example, the
987 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
988 @code{set-time-signature} as the third argument @code{(2 2 2 3)}:
990 @lilypond[quote,ragged-right,verbatim]
993 #(set-time-signature 9 8 '(2 2 2 3))
994 g8[ g] d[ d] g[ g] a8[( bes g]) |
995 #(set-time-signature 5 8 '(3 2))
1001 \consists "Measure_grouping_engraver"
1010 Snippets: @lsrdir{Rhythms,Rhythms}
1012 Internals Reference: @internalsref{TimeSignature}, and
1013 @internalsref{Timing_translator}.
1015 Examples: @c @lsr{contemporary,compound-time-signature.ly}.
1020 Automatic beaming does not use the measure grouping specified with
1021 @code{set-time-signature}.
1025 @subsubsection Upbeats
1029 @cindex partial measure
1030 @cindex measure, partial
1031 @cindex pickup measure
1032 @cindex shorten measures
1035 Partial or pickup measures, such as an anacrusis or upbeat, are
1036 entered using the @code{\partial} command, with the syntax
1039 \partial @var{duration}
1042 where @code{duration} is the rhythmic length to be added before
1045 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1046 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1049 Internally, this is translated into
1052 \set Timing.measurePosition = -@var{length of duration}
1055 The property @code{measurePosition} contains a rational number
1056 indicating how much of the measure has passed at this point. Note
1057 that this is a negative number; @code{\partial 4} is internally
1058 translated to mean @qq{there is a quarter note left in the bar.}
1063 This command does not take into account grace notes at the start
1064 of the music. When a piece starts with grace notes in the
1065 pickup, then the @code{\partial} should follow the grace notes:
1067 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1074 @code{\partial} is only intended to be used at the beginning of a
1075 piece. If you use it after the beginning, some odd warnings may
1080 Snippets: @lsrdir{Rhythms,Rhythms}
1082 @node Unmetered music
1083 @subsubsection Unmetered music
1086 @funindex \cadenzaOn
1087 @funindex \cadenzaOff
1089 Bar lines and bar numbers are calculated automatically. For
1090 unmetered music (cadenzas, for example), this is not desirable.
1091 To turn off automatic bar lines and bar numbers, use the commands
1092 @code{\cadenzaOn} and @code{\cadenzaOff}.
1094 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1103 Bar numbering is resumed at the end of the cadenza as if the
1104 cadenza were not there:
1106 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1107 \override Score.BarNumber #'break-visibility = ##( #t #t #t )
1118 LilyPond will only insert line breaks and page breaks at a
1119 bar line. Unless the unmetered music ends before the end of the
1120 staff line, you will need to insert invisible bar lines with
1127 to indicate where breaks can occur.
1131 Snippets: @lsrdir{Rhythms,Rhythms}
1134 @node Polymetric notation
1135 @subsubsection Polymetric notation
1137 @cindex double time signatures
1138 @cindex signatures, polymetric
1139 @cindex polymetric signatures
1140 @cindex meter, polymetric
1144 @rglos{polymetric time signature}
1147 Double time signatures are not supported explicitly, but they can
1148 be faked. In the next example, the markup for the time signature
1149 is created with a markup text. This markup text is inserted in
1150 the @internalsref{TimeSignature} grob. See also
1151 @c @lsr{contemporary,compound-time-signature}.
1153 @lilypond[verbatim,ragged-right]
1155 tsMarkup = \markup {
1156 \override #'(baseline-skip . 2) \number {
1159 \bracket \column { "5" "8" }
1164 \override Staff.TimeSignature #'stencil =
1165 #ly:text-interface::print
1166 \override Staff.TimeSignature #'text = #tsMarkup
1168 c'2 \bar ":" c'4 c'4.
1172 Each staff can also have its own time signature. This is done by
1173 moving the @internalsref{Timing_translator} to the
1174 @internalsref{Staff} context.
1176 @lilypond[quote,verbatim,ragged-right]
1180 \remove "Timing_translator"
1181 \remove "Default_bar_line_engraver"
1185 \consists "Timing_translator"
1186 \consists "Default_bar_line_engraver"
1189 %Now, each staff has its own time signature.
1202 c4. c8 c c c4. c8 c c
1208 A different form of polymetric notation is where note lengths have
1209 different values across staves, but the measures are all the same
1212 This notation can be created by setting a common time signature
1213 for each staff but replacing it manually using
1214 @code{timeSignatureFraction} to the desired fraction. Then the
1215 printed durations in each staff are scaled to the common time
1216 signature. The latter is done with @code{\compressMusic}, which
1217 is used in a similar way to @code{\times}, but does not create
1218 a tuplet bracket. The syntax is
1220 @funindex \compressMusic
1224 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1229 In this example, music with the time signatures of 3/4, 9/8, and
1230 10/8 are used in parallel. In the second staff, shown durations
1231 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
1232 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
1235 @lilypond[quote,ragged-right,verbatim,fragment]
1243 \set Staff.timeSignatureFraction = #'(9 . 8)
1244 \compressMusic #'(2 . 3)
1245 \repeat unfold 6 { c8[ c c] }
1249 \set Staff.timeSignatureFraction = #'(10 . 8)
1250 \compressMusic #'(3 . 5) {
1251 \repeat unfold 2 { c8[ c c] }
1252 \repeat unfold 2 { c8[ c] }
1253 | c4. c4. \times 2/3 { c8 c c } c4
1262 When using different time signatures in parallel, the spacing is
1263 aligned vertically, but bar lines distort the regular spacing.
1267 Snippets: @lsrdir{Rhythms,Rhythms}, @c @lsr{contemporary,compound-time-signature}.
1269 Internals Reference: @internalsref{TimeSignature}, @internalsref{Timing-translator}, @internalsref{Staff}.
1272 @node Automatic note splitting
1273 @subsubsection Automatic note splitting
1275 Long notes which overrun bar lines can be converted automatically
1276 to tied notes. This is done by replacing the
1277 @internalsref{Note_heads_engraver} by the
1278 @internalsref{Completion_heads_engraver}. In the following
1279 examples, notes crossing the bar line are split and tied.
1281 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
1283 \remove "Note_heads_engraver"
1284 \consists "Completion_heads_engraver"
1286 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
1290 This engraver splits all running notes at the bar line, and
1291 inserts ties. One of its uses is to debug complex scores: if the
1292 measures are not entirely filled, then the ties exactly show how
1293 much each measure is off.
1295 If you want to allow line breaking on the bar lines where
1296 @internalsref{Completion_heads_engraver} splits notes, you must
1297 also remove @internalsref{Forbid_line_break_engraver}.
1302 Not all durations (especially those containing tuplets) can be
1303 represented exactly with normal notes and dots, but the engraver
1304 will not insert tuplets.
1306 @code{Completion_heads_engraver} only affects notes; it does not
1312 Snippets: @lsrdir{Rhythms,Rhythms}
1314 Internals Reference: @internalsref{Note_heads_engraver},
1315 @internalsref{Completion_heads_engraver},
1316 @internalsref{Forbid_line_break_engraver}.
1327 * Setting automatic beam behavior::
1332 @node Automatic beams
1333 @subsubsection Automatic beams
1335 By default, beams are inserted automatically:
1337 @cindex beams, manual
1338 @cindex manual beams
1340 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1342 \time 6/8 c c c c8. c16 c8
1345 If these automatic decisions are not satisfactory, beaming can be
1346 entered explicitly; see @ref{Manual beams}. It is also possible
1347 to define beaming patterns that differ from the defaults; see
1348 @ref{Setting automatic beam behavior}. The default beaming rules
1349 are defined in @file{scm/@/auto@/-beam@/.scm}.
1355 Automatic beaming may be turned off and on with
1356 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1358 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1359 c4 c8 c8. c16 c8. c16 c8
1369 Beaming patterns may be altered with the @code{beatGrouping} property,
1371 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1373 \set beatGrouping = #'(2 3)
1375 \set beatGrouping = #'(3 2)
1379 The beams of consecutive 16th (or shorter) notes are, by default,
1380 not sub-divided. That is, the three (or more) beams stretch
1381 unbroken over entire groups of notes. This behaviour can
1382 be modified to sub-divide the beams into sub-groups by setting
1383 the property @code{subdivideBeams}. When set, multiple beams
1384 will be sub-divided at intervals defined by the current value of
1385 @code{beatLength} by reducing the multiple beams to just one beam
1386 between the sub-groups. Note that @code{beatLength} lives in the
1387 @code{Score} context and defaults to a quarter note. It must be
1388 set to a fraction giving the duration of the beam sub-group
1389 using the @code{make-moment} function, as shown here:
1391 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1393 \set subdivideBeams = ##t
1395 % Set beam sub-group length to an eighth note
1396 \set Score.beatLength = #(ly:make-moment 1 8)
1398 % Set beam sub-group length to a sixteenth note
1399 \set Score.beatLength = #(ly:make-moment 1 16)
1402 @funindex subdivideBeams
1405 For more information about @code{make-moment}, see
1406 @ref{Time administration}.
1412 Line breaks are normally forbidden when beams cross bar lines.
1413 This behavior can be changed by setting the @code{breakable}
1414 property: @code{\override Beam #'breakable = ##t}.
1416 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1417 \override Beam #'breakable = ##t
1418 c8 \repeat unfold 15 {c[ c] } c
1421 @cindex beams and line breaks
1422 @cindex beams, kneed
1424 @cindex auto-knee-gap
1426 Kneed beams are inserted automatically when a large gap is
1427 detected between the note heads. This behavior can be tuned
1428 through the @code{auto-knee-gap} property. A kneed beam is
1429 drawn if the gap is larger than the value of
1430 @code{auto-knee-gap} plus the width of the beam object (which
1431 depends on the duration of the notes and the slope of the beam).
1432 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1434 @lilypond[fragment,ragged-right,quote,verbatim]
1436 \override Beam #'auto-knee-gap = #6
1443 Notation Reference: @ref{Manual beams}, @ref{Setting automatic beam behavior}.
1445 Snippets: @lsrdir{Rhythms,Rhythms}
1447 Internals Reference: @internalsref{Beam}.
1452 Automatically kneed cross-staff beams cannot be used together with
1453 hidden staves. See @ref{Hiding staves}.
1455 Beams can collide with note heads and accidentals in other voices
1458 @node Setting automatic beam behavior
1459 @subsubsection Setting automatic beam behavior
1461 @funindex autoBeamSettings
1462 @funindex (end * * * *)
1463 @funindex (begin * * * *)
1464 @cindex automatic beams, tuning
1465 @cindex tuning automatic beaming
1467 @c [TODO: use \applyContext]
1469 In normal time signatures, automatic beams can start on any note
1470 but can end in only a few positions within the measure: beams can
1471 end on a beat, or at durations specified by the properties in
1472 @code{autoBeamSettings}. The properties in
1473 @code{autoBeamSettings} consist of a list of rules for where beams
1474 can begin and end. The default @code{autoBeamSettings} rules are
1475 defined in @file{scm/@/auto@/-beam@/.scm}.
1477 In order to add a rule to the list, use
1479 #(override-auto-beam-setting '(be p q n m) a b [context])
1484 @item @code{be} is either @code{begin} or @code{end}.
1486 @item @code{p/q} is the duration of the note for which you want
1487 to add a rule. A beam is considered to have the duration of its
1488 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1489 have this apply to any beam.
1491 @item @code{n/m} is the time signature to which
1492 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1493 to have this apply in any time signature.
1495 @item @code{a/b} is the position in the bar at which the beam should
1498 @item @code{context} is optional, and it specifies the context at which
1499 the change should be made. The default is @code{'Voice}.
1501 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1502 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1506 For example, if automatic beams should always end on the first quarter
1510 #(override-auto-beam-setting '(end * * * *) 1 4)
1513 You can force the beam settings to only take effect on beams whose shortest
1514 note is a certain duration
1516 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1518 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1520 a32 a a a a16 a a a a a |
1521 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1522 a32 a a a a16 a a a a a |
1525 You can force the beam settings to only take effect in certain time
1528 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1530 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1538 You can also remove a previously set beam-ending rule by using
1541 #(revert-auto-beam-setting '(be p q n m) a b [context])
1545 be, p, q, n, m, a, b and context are the same as above. Note that the
1546 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1547 so you can revert rules that you did not explicitly create.
1549 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1551 a16 a a a a a a a a a a a a a a a
1552 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1553 a16 a a a a a a a a a a a a a a a
1556 The rule in a revert-auto-beam-setting statement must exactly match the
1557 original rule. That is, no wildcard expansion is taken into account.
1559 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1561 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1563 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1565 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1571 @c TODO: old material -- not covered by above stuff, I think.
1572 If automatic beams should end on every quarter in 5/4 time, specify
1575 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1576 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1577 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1578 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1582 The same syntax can be used to specify beam starting points. In this
1583 example, automatic beams can only end on a dotted quarter note
1585 #(override-auto-beam-setting '(end * * * *) 3 8)
1586 #(override-auto-beam-setting '(end * * * *) 1 2)
1587 #(override-auto-beam-setting '(end * * * *) 7 8)
1589 In 4/4 time signature, this means that automatic beams could end only on
1590 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1591 3/8, has passed within the measure).
1593 If any unexpected beam behaviour occurs, check the default automatic beam
1594 settings in @file{scm/@/auto@/-beam@/.scm}
1595 for possible interference, because the beam
1596 endings defined there will still apply on top of your own overrides. Any
1597 unwanted endings in the default vales must be reverted for your time
1600 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1604 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1605 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1606 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1607 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1610 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1611 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1612 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1615 @cindex automatic beam generation
1617 @funindex autoBeaming
1620 If beams are used to indicate melismata in songs, then automatic
1621 beaming should be switched off with @code{\autoBeamOff}.
1626 @funindex \autoBeamOff
1627 @code{\autoBeamOff},
1628 @funindex \autoBeamOn
1634 If a score ends while an automatic beam has not been ended and is
1635 still accepting notes, this last beam will not be typeset at all.
1636 The same holds for polyphonic voices, entered with @code{<<
1637 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1638 automatic beam is still accepting notes, it is not typeset.
1642 Snippets: @lsrdir{Rhythms,Rhythms}
1646 @subsubsection Manual beams
1648 @cindex beams, manual
1650 In some cases it may be necessary to override the automatic
1651 beaming algorithm. For example, the autobeamer will not put beams
1652 over rests or bar lines, and in choral scores the beaming is
1653 often set to follow the meter of the lyrics rather than the
1654 notes. Such beams can be specified manually by
1655 marking the begin and end point with @code{[} and @code{]}
1657 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1659 r4 r8[ g' a r8] r8 g[ | a] r8
1664 Individual notes may be marked with @code{\noBeam} to prevent them
1667 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1668 \time 2/4 c8 c\noBeam c c
1674 @funindex stemLeftBeamCount
1675 @funindex stemRightBeamCount
1677 Even more strict manual control with the beams can be achieved by
1678 setting the properties @code{stemLeftBeamCount} and
1679 @code{stemRightBeamCount}. They specify the number of beams to
1680 draw on the left and right side, respectively, of the next note.
1681 If either property is set, its value will be used only once, and
1682 then it is erased. In this example, the last @code{f} is printed
1683 with only one beam on the left side, i.e. the eigth-note beam of
1684 the group as a whole.
1686 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1690 \set stemLeftBeamCount = #1
1698 @node Feathered beams
1699 @subsubsection Feathered beams
1701 @cindex beams, feathered
1702 @funindex \featherDurations
1704 Feathered beams are used to indicate that a small group of notes
1705 should be played at an increasing (or decreasing) tempo, without
1706 changing the overall tempo of the piece. The extent of the
1707 feathered beam must be indicated manually using @code{[} and
1708 @code{]}, and the beam feathering is turned on by specifying a
1709 direction to the Beam property @code{grow-direction}.
1711 If the placement of the notes and the sound in the MIDI output
1712 is to reflect the ritardando or accelerando indicated by the
1713 feathered beam the notes must be grouped as a
1714 music expression delimited by braces and preceded by a
1715 @code{featheredDurations} command which specifies the ratio
1716 between the durations of the first and last notes in the group.
1719 show the extent of the beam and the braces show
1720 which notes are to have their durations modified. Normally
1721 these would delimit the same group of notes, but this is not
1722 required: the two commands are independent.
1724 In the following example the eight 16th notes occupy exactly the
1725 same time as a half note, but the first note is one half as long
1726 as the last one, with the intermediate notes gradually
1727 lengthening. The first four 32nd notes gradually speed up, while
1728 the last four 32nd notes are at a constant tempo.
1730 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1731 \override Beam #'grow-direction = #LEFT
1732 \featherDurations #(ly:make-moment 2 1)
1733 { c16[ c c c c c c c] }
1734 \override Beam #'grow-direction = #RIGHT
1735 \featherDurations #(ly:make-moment 2 3)
1737 % revert to non-feathered beams
1738 \override Beam #'grow-direction = #'()
1743 The spacing in the printed output represents the
1744 note durations only approximately, but the midi output is exact.
1748 The @code{\featherDurations} command only works with very short
1749 music snippets, and when numbers in the fraction are small.
1753 Snippets: @lsrdir{Rhythms,Rhythms}
1764 * Bar and bar number checks::
1769 @subsubsection Bar lines
1773 @cindex measure lines
1776 Bar lines delimit measures, and are also used to indicate
1777 repeats. Normally, simple bar lines are automatically inserted
1778 into the printed output at places based on the current time
1781 The simple bar lines inserted automatically can be changed to
1782 other types with the @code{\bar} command. For example, a closing
1783 double bar line is usually placed at the end of a piece:
1785 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1789 @warning{An incorrect duration can lead to poorly formatted
1792 It is not invalid if the final note in a bar does not
1793 end on the automatically entered bar line: the note is assumed
1794 to carry over into the next bar. But if a long sequence
1795 of such carry-over bars appears the music can appear compressed
1796 or even flowing off the page. This is because automatic line
1797 breaks happen only at the end of complete bars, i.e. where
1798 the end of a note coincides with the end of a bar.
1801 @cindex bar lines, invisible
1802 @cindex measure lines, invisible
1804 Line breaks are also permitted at manually inserted bar lines
1805 even within incomplete bars. To allow a line break without
1806 printing a bar line, use
1813 This will insert an invisible bar line and allow (but not
1814 force) a line break to occur at this point. The bar number
1815 counter is not increased. To force a line break see
1816 @ref{Line breaking}.
1818 This and other special bar lines may be inserted manually at any
1819 point. When they coincide with the end of a bar they replace
1820 the simple bar line which would have been inserted there
1821 automatically. When they do not coincide
1822 with the end of a bar the specified bar line is inserted at that
1823 point in the printed output. Such insertions do not affect
1824 the calculation and placement of subsequent automatic bar lines.
1826 The simple bar line and four types of double bar line are available
1827 for manual insertion:
1829 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1830 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1834 together with dotted and dashed bar lines:
1836 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1837 f1 \bar ":" g \bar "dashed" a
1841 and three types of repeat bar line:
1843 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1844 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1849 Although the bar line types signifying repeats may be inserted
1850 manually they do not in themselves cause LilyPond to recognise
1851 a repeated section. Such repeated sections are better entered
1852 using the various repeat commands (see @ref{Repeats}), which
1853 automatically print the appropriate bar lines.
1855 In addition, you can specify @code{"||:"}, which is equivalent to
1856 @code{"|:"} except at line breaks, where it gives a double bar
1857 line at the end of the line and a start repeat at the beginning of
1860 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1861 \override Score.RehearsalMark #'padding = #3
1869 In scores with many staves, a @code{\bar} command in one staff is
1870 automatically applied to all staves. The resulting bar lines are
1871 connected between different staves of a @code{StaffGroup},
1872 @code{PianoStaff}, or @code{GrandStaff}.
1874 @lilypond[quote,ragged-right,fragment,verbatim]
1882 \new Staff { \clef bass c4 g e g }
1884 \new Staff { \clef bass c2 c2 }
1892 @funindex defaultBarType
1894 The command @code{\bar }@var{bartype} is a shortcut for
1895 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1896 created whenever the @code{whichBar} property is
1899 The default bar type used for automatically inserted bar lines is
1900 @code{"|"}. This may be changed at any time
1901 with @code{\set Timing.defaultBarType = }@var{bartype}.
1905 Notation Reference: @ref{Line breaking}, @ref{Repeats},
1906 @ref{System start delimiters}.
1908 Snippets: @lsrdir{Rhythms,Rhythms}
1910 Internals Reference: @internalsref{BarLine} (created at
1911 @internalsref{Staff} level), @internalsref{SpanBar} (across
1912 staves), @internalsref{Timing_translator} (for Timing
1917 @subsubsection Bar numbers
1920 @cindex measure numbers
1921 @funindex currentBarNumber
1923 Bar numbers are typeset by default at the start of every line except
1924 the first line. The number itself is stored in the
1925 @code{currentBarNumber} property, which is normally updated
1926 automatically for every measure. It may also be set manually:
1928 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1931 \set Score.currentBarNumber = #50
1938 @funindex barNumberVisibility
1939 @cindex bar numbers, regular spacing
1941 Bar numbers can be typeset at regular intervals instead of just at
1942 the beginning of every line. To do this the default behaviour
1943 must be overridden to permit bar numbers to be printed at places
1944 other than the start of a line. This is controlled by the
1945 @code{break-visibility} property of @code{BarNumber}. This takes
1946 three values which may be set to @code{#t} or @code{#f} to specify
1947 whether the corresponding bar number is visible or not. The order
1948 of the three values is @code{end of line visible}, @code{middle of
1949 line visible}, @code{beginning of line visible}. In the following
1950 example bar numbers are printed at all possible places:
1952 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1953 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1954 \set Score.currentBarNumber = #11
1955 \bar "" % Permit first bar number to be printed
1961 @c All the rest of these examples will be added to LSR
1962 @c and moved into the Snippets. -gp
1965 and here the bar numbers are printed every two bars
1966 except at the end of the line:
1968 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1969 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1970 \set Score.currentBarNumber = #11
1971 \bar "" % Permit first bar number to be printed
1972 % Print a bar number every 2nd bar
1973 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1979 @cindex measure number, format
1980 @cindex bar number, format
1982 The size of the bar number may be changed. This is illustrated
1983 in the following example, which also shows how to enclose bar
1984 numbers in boxes and circles, and shows an alternative way
1985 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
1987 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1988 % Prevent bar numbers at the end of a line and permit them elsewhere
1989 \override Score.BarNumber #'break-visibility
1990 = #end-of-line-invisible
1992 % Increase the size of the bar number by 2
1993 \override Score.BarNumber #'font-size = #2
1994 \repeat unfold 3 { c1 } \bar "|"
1996 % Draw a box round the following bar number(s)
1997 \override Score.BarNumber #'stencil
1998 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1999 \repeat unfold 3 { c1 } \bar "|"
2001 % Draw a circle round the following bar number(s)
2002 \override Score.BarNumber #'stencil
2003 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2004 \repeat unfold 4 { c1 } \bar "|."
2007 @cindex bar number alignment
2009 Bar numbers by default are left-aligned to their parent object.
2010 This is usually the left edge of a line or, if numbers are printed
2011 within a line, the left bar line of the bar. The numbers may also
2012 be positioned directly on the bar line or right-aligned to the
2015 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2016 \set Score.currentBarNumber = #111
2017 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
2018 % Increase the size of the bar number by 2
2019 \override Score.BarNumber #'font-size = #2
2020 % Print a bar number every 2nd bar
2021 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2023 % Centre-align bar numbers
2024 \override Score.BarNumber #'self-alignment-X = #0
2026 % Right-align bar numbers
2027 \override Score.BarNumber #'self-alignment-X = #-1
2031 Bar numbers can be removed entirely by removing the Bar number
2032 engraver from the score context.
2034 @lilypond[verbatim,ragged-right,quote]
2038 \remove "Bar_number_engraver"
2050 Snippets: @lsrdir{Rhythms,Rhythms}
2052 Internals Reference: @internalsref{BarNumber}.
2057 Bar numbers may collide with the top of the
2058 @internalsref{StaffGroup} bracket, if there is one. To solve
2059 this, the @code{padding} property of @internalsref{BarNumber} can
2060 be used to position the number correctly.
2062 Bar numbers may only be printed at bar lines; to print a bar
2063 number at the beginning of a piece, an empty bar line must be
2064 inserted there, and a value other than @code{1} must be placed
2065 in @code{currentBarNumber}:
2067 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2068 \set Score.currentBarNumber = #50
2077 @node Bar and bar number checks
2078 @subsubsection Bar and bar number checks
2081 @funindex barCheckSynchronize
2084 Bar checks help detect errors in the entered durations.
2085 A bar check may be entered using the bar symbol, @code{|},
2086 at any place where a bar line is expected to fall.
2087 If bar check lines are encountered at other places,
2088 a list of warnings is printed in the log file,
2089 showing the line numbers and lines
2090 in which the bar checks failed. In the next
2091 example, the second bar check will signal an error.
2094 \time 3/4 c2 e4 | g2 |
2097 Bar checks can also be used in lyrics, for example
2102 Twin -- kle | Twin -- kle |
2106 An incorrect duration can result in a completely garbled score,
2107 especially if the score is polyphonic, so a good place to start
2108 correcting input is by scanning for failed bar checks and
2109 incorrect durations.
2112 @funindex pipeSymbol
2114 It is also possible to redefine the action taken when a bar check
2115 or pipe symbol, @code{|}, is encountered in the input, so that
2116 it does something other than a bar check. This is done by
2117 assigning a music expression to @code{pipeSymbol}.
2118 In the following example @code{|} is set to insert a double bar
2119 line wherever it appears in the input, rather than checking
2122 @lilypond[quote,ragged-right,verbatim]
2123 pipeSymbol = \bar "||"
2132 When copying large pieces of music, it can be helpful to check
2133 that the LilyPond bar number corresponds to the original that you
2134 are entering from. This can be checked with
2135 @code{\barNumberCheck}, for example,
2138 \barNumberCheck #123
2142 will print a warning if the @code{currentBarNumber} is not 123
2143 when it is processed.
2147 Snippets: @lsrdir{Rhythms,Rhythms}
2150 @node Rehearsal marks
2151 @subsubsection Rehearsal marks
2153 @cindex rehearsal marks
2154 @cindex mark, rehearsal
2157 To print a rehearsal mark, use the @code{\mark} command
2159 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2168 The letter@tie{}@q{I} is skipped in accordance with engraving
2169 traditions. If you wish to include the letter @q{I}, then use
2172 \set Score.markFormatter = #format-mark-alphabet
2175 The mark is incremented automatically if you use @code{\mark
2176 \default}, but you can also use an integer argument to set the
2177 mark manually. The value to use is stored in the property
2178 @code{rehearsalMark}.
2180 @cindex rehearsal mark format
2181 @cindex rehearsal mark style
2182 @cindex style, rehearsal mark
2183 @cindex format, rehearsal mark
2184 @cindex mark, rehearsal, style
2185 @cindex mark, rehearsal, format
2187 The style is defined by the property @code{markFormatter}. It is
2188 a function taking the current mark (an integer) and the current
2189 context as argument. It should return a markup object. In the
2190 following example, @code{markFormatter} is set to a pre-defined
2191 procedure. After a few measures, it is set to a procedure that
2192 produces a boxed number.
2194 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2195 \set Score.markFormatter = #format-mark-numbers
2198 \set Score.markFormatter = #format-mark-box-numbers
2204 The file @file{scm/@/translation@/-functions@/.scm} contains the
2205 definitions of @code{format-mark-numbers} (the default format),
2206 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2207 @code{format-mark-box-letters}. These can be used as inspiration
2208 for other formatting functions.
2210 You may use @code{format-mark-barnumbers},
2211 @code{format-mark-box-barnumbers}, and
2212 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2213 incremented numbers or letters.
2215 Other styles of rehearsal mark can be specified manually
2222 @code{Score.markFormatter} does not affect marks specified in this
2223 manner. However, it is possible to apply a @code{\markup} to the
2227 \mark \markup@{ \box A1 @}
2234 Music glyphs (such as the segno sign) may be printed inside a
2237 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2238 c1 \mark \markup { \musicglyph #"scripts.segno" }
2239 c1 \mark \markup { \musicglyph #"scripts.coda" }
2240 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2245 See @ref{The Feta font}, for a list of symbols which may be
2246 printed with @code{\musicglyph}.
2248 For common tweaks to the positioning of rehearsal marks, see
2253 Snippets: @lsrdir{Rhythms,Rhythms}
2255 This manual: @ref{The Feta font}, @ref{Text marks}.
2257 Internals Reference: @internalsref{RehearsalMark}.
2259 Init files: @file{scm/@/translation@/-functions@/.scm} contains
2260 the definition of @code{format-mark-numbers} and
2261 @code{format-mark-letters}. They can be used as inspiration for
2262 other formatting functions.
2264 Examples: @c @lsr{parts,rehearsal-mark-numbers.ly}
2267 @node Special rhythmic concerns
2268 @subsection Special rhythmic concerns
2273 * Aligning to cadenzas::
2274 * Time administration::
2278 @subsubsection Grace notes
2283 @cindex appoggiatura
2284 @cindex acciaccatura
2286 Grace notes are ornaments that are written out. They are made with
2287 the @code{\grace} command. By prefixing this keyword to a music
2288 expression, a new one is formed, which will be printed in a
2289 smaller font and takes up no logical time in a measure.
2291 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2293 \grace { c16[ d16] } c2 c4
2296 Two special forms of the @code{\grace} command exist.
2297 An @emph{acciaccatura}, which should be played as very short,
2298 is denoted by a slurred small note with a slashed stem. The
2299 @emph{appoggiatura}, a grace note that takes a fixed fraction of the
2300 main note, is denoted as a slurred note in small print without
2301 a slash. They are entered with the commands @code{\acciaccatura}
2302 and @code{\appoggiatura}, as demonstrated in the following
2305 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2306 b4 \acciaccatura d8 c4
2308 \acciaccatura { g16[ f] } e4
2312 @code{\acciaccatura} and @code{\appoggiatura} start a slur,
2313 @code{\grace} does not.
2315 The placement of grace notes is synchronized between different
2316 staves. In the following example, there are two sixteenth grace
2317 notes for every eighth grace note
2319 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2320 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2321 \new Staff { c4 \grace { g8[ b] } c4 } >>
2324 @funindex \afterGrace
2326 @cindex grace notes, following
2328 If you want to end a note with a grace, use the @code{\afterGrace}
2329 command. It takes two arguments: the main note, and the grace
2330 notes following the main note.
2332 @lilypond[ragged-right, verbatim,relative=2,fragment]
2333 c1 \afterGrace d1 { c16[ d] } c4
2336 This will put the grace notes after a @q{space} lasting 3/4 of the
2337 length of the main note. The fraction 3/4 can be changed by
2338 setting @code{afterGraceFraction}, ie.
2341 #(define afterGraceFraction (cons 7 8))
2345 will put the grace note at 7/8 of the main note.
2347 The same effect can be achieved manually by doing
2349 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2352 { s2 \grace { c16[ d] } } >>
2358 By adjusting the duration of the skip note (here it is a
2359 half-note), the space between the main-note and the grace
2362 A @code{\grace} music expression will introduce special
2363 typesetting settings, for example, to produce smaller type, and
2364 set directions. Hence, when introducing layout tweaks, they
2365 should be inside the grace expression, for example,
2367 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2379 The overrides should also be reverted inside the grace expression.
2381 The layout of grace expressions can be changed throughout the
2382 music using the function @code{add-grace-property}. The following
2383 example undefines the @code{Stem} direction for this grace, so
2384 that stems do not always point up.
2388 #(add-grace-property 'Voice 'Stem 'direction '())
2394 Another option is to change the variables @code{startGraceMusic},
2395 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2396 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2397 @code{stopAppoggiaturaMusic}. The default values of these can be
2398 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2399 them other effects may be obtained.
2401 @cindex stem, with slash
2404 The slash through the stem in @emph{acciaccatura}s can be obtained in
2405 other situations by @code{\override Stem #'stroke-style =
2411 Grace notes may be forced to use align with regular notes
2412 in other staves by setting @code{strict-grace-spacing} to
2415 @lilypond[relative=2,ragged-right]
2417 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2426 c'16[ c'16 c'16 c'16]
2427 c'16[ c'16 c'16 c'16]
2437 @rglos{grace notes},
2438 @rglos{acciaccatura},
2439 @rglos{appoggiatura}
2441 Snippets: @lsrdir{Rhythms,Rhythms}
2443 Internals Reference: @internalsref{GraceMusic}.
2448 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2449 and looks exactly the same as a multi-note beamed
2450 @emph{appoggiatura}.
2451 @c TODO Add link to LSR snippet to add slash when available
2453 Grace note synchronization can also lead to surprises. Staff
2454 notation, such as key signatures, bar lines, etc., are also
2455 synchronized. Take care when you mix staves with grace notes and
2456 staves without, for example,
2458 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2459 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2460 \new Staff { c4 \bar "|:" d4 } >>
2464 This can be remedied by inserting grace skips of the corresponding
2465 durations in the other staves. For the above example
2467 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2468 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2469 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2472 Grace sections should only be used within sequential music
2473 expressions. Nesting or juxtaposing grace sections is not
2474 supported, and might produce crashes or other errors.
2476 @node Aligning to cadenzas
2477 @subsubsection Aligning to cadenzas
2480 @cindex cadenza, aligning to
2481 @cindex aligning to cadenza
2483 In an orchestral context, cadenzas present a special problem: when
2484 constructing a score that includes a cadenza, all other
2485 instruments should skip just as many notes as the length of the
2486 cadenza, otherwise they will start too soon or too late.
2488 A solution to this problem is to use the functions
2489 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2490 functions take a piece of music as argument, and generate a multi-rest
2491 or @code{\skip}, exactly as long as the piece. The use of
2492 @code{mmrest-of-length} is demonstrated in the following example.
2494 @lilypond[verbatim,ragged-right,quote]
2495 cadenza = \relative c' {
2496 c4 d8 << { e f g } \\ { d4. } >>
2501 \new Staff { \cadenza c'4 }
2503 #(ly:export (mmrest-of-length cadenza))
2511 Snippets: @lsrdir{Rhythms,Rhythms}
2514 @node Time administration
2515 @subsubsection Time administration
2517 @cindex time administration
2518 @cindex timing (within the score)
2519 @cindex music, unmetered
2520 @cindex unmetered music
2522 @funindex currentBarNumber
2523 @funindex measurePosition
2524 @funindex measureLength
2526 Time is administered by the @code{Timing_translator}, which by
2527 default is to be found in the @code{Score} context. An alias,
2528 @code{Timing}, is added to the context in which the
2529 @code{Timing_translator} is placed.
2531 The following properties of @code{Timing} are used
2532 to keep track of timing within the score.
2535 @cindex measure number
2538 @item currentBarNumber
2539 The current measure number. For an example showing the
2540 use of this property see @ref{Bar numbers}.
2543 The length of the measures in the current time signature. For a
2544 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2545 determines when bar lines are inserted and how automatic beams
2546 should be generated.
2548 @item measurePosition
2549 The point within the measure where we currently are. This
2550 quantity is reset by subtracting @code{measureLength} whenever
2551 @code{measureLength} is reached or exceeded. When that happens,
2552 @code{currentBarNumber} is incremented.
2555 If set to true, the above variables are updated for every time
2556 step. When set to false, the engraver stays in the current
2557 measure indefinitely.
2561 Timing can be changed by setting any of these variables
2562 explicitly. In the next example, the default 4/4 time
2563 signature is printed, but @code{measureLength} is set to 5/4.
2564 At 4/8 through the third measure, the @code{measurePosition} is
2565 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2566 The next bar line then falls at 9/8 rather than 5/4.
2568 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2569 \set Score.measureLength = #(ly:make-moment 5 4)
2573 \set Score.measurePosition = #(ly:make-moment 5 8)
2579 As the example illustrates, @code{ly:make-moment n m} constructs a
2580 duration of n/m of a whole note. For example,
2581 @code{ly:make-moment 1 8} is an eighth note duration and
2582 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2588 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2590 Snippets: @lsrdir{Rhythms,Rhythms}
2592 Internals Reference: @internalsref{Timing_translator},
2593 @internalsref{Score}