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 from a music expression by multiplying all the
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 duration 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[quote,fragment,ragged-right,verbatim,relative=2]
180 c4 \times 4/5 { f8 e f \times 2/3 {e[ f g] } } f4 |
183 Modifying nested tuplets which begin at the same musical moment
184 must be done with @code{\tweak}.
185 @c TODO Add link to LM section which deals with this.
191 @funindex \tupletDown
193 @funindex \tupletNeutral
194 @code{\tupletNeutral}.
199 @cindex tuplet formatting
200 @cindex triplet formatting
202 @funindex tupletNumberFormatFunction
203 @funindex tupletSpannerDuration
205 @lilypondfile [verbatim,lilyquote,ragged-right,texidoc]
206 {entering-several-tuplets-using-only-one--times-command.ly}
209 For more information about @code{make-moment}, see
210 @ref{Time administration}.
212 @funindex TupletNumber
214 By default, only the numerator of the tuplet number
215 is printed over the tuplet bracket, i.e. the denominator
216 of the argument to the @code{\times} command. Alternatively,
217 @var{num}:@var{den} of the tuplet number may be printed, or
218 the tuplet number may be suppressed altogether.
221 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
222 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
223 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
224 \times 2/3 { c8 c c }
225 \override TupletNumber #'transparent = ##t
226 \times 2/3 { c8 c c }
229 @c TODO Add snippet to show this
230 Tuplets may extend over bar lines, but they will inhibit a
231 line break unless the @code{Forbid_line_break_engraver} is
232 removed from the @code{Voice context}.
236 @subheading Modifying nested tuplets
238 @cindex tuplets, nested
239 @cindex triplets, nested
240 @cindex bracket, tuplet
241 @cindex tuplet bracket
242 @cindex triplet bracket
243 @funindex TupletBracket
245 If nested tuplets do not begin at the same moment their
246 appearance may be modified in the usual way with
247 @code{\override} commands:
249 @c NOTE Tuplet brackets collide if notes are high on staff
251 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
252 \times 2/3 { c8[ c c]}
253 \once \override TupletNumber #'text = #tuplet-number::calc-fraction-text
257 \once \override TupletNumber #'transparent = ##t
258 \times 2/3 { c8[ c c] }
259 \times 2/3 { c8[ c c]}
263 However, if the nested tuplets begin at the same musical moment,
264 @code{\override} commands cannot be applied to just one of them
265 -- they apply to both. So to change the appearance of nested
266 tuplets beginning at the same musical moment individually, the
267 @code{\tweak} function must be used (see @ref{Objects connected
268 to the input}). The @code{\tweak} function is applied to the
269 following @code{\times} command as it appears in the input stream,
270 and so can distinguish between separate @code{\times} commands
271 even if their tuplets begin at the same musical moment.
273 In this example, the @code{\tweak} command is used to specify
274 fraction text for the outer @code{TupletNumber} and denominator
275 text for the @code{TupletNumber} of the first of the three
278 @c NOTE Tuplet brackets collide if notes are high on staff
279 @c so use relative=1 until this is fixed
281 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
282 \tweak #'text #tuplet-number::calc-fraction-text
284 \tweak #'text #tuplet-number::calc-denominator-text
285 \times 2/3 { c8[ c8 c8] }
286 \times 2/3 { c8[ c8 c8] }
287 \times 2/3 { c8[ c8 c8] }
291 In the next example, @code{\tweak} and @code{\override} work
292 together to specify @code{TupletBracket} direction. The first
293 @code{\tweak} positions the @code{TupletBracket} of the outer
294 tuplet above the staff. The second @code{\tweak} positions the
295 @code{TupletBracket} of the first of the three inner tuplets below
296 the staff. Note that the @code{\tweak} command needs to be used
297 only for events that begin at the same music moment: the outer
298 tuplet and the first of the three inner tuplets. To position the
299 @code{TupletBracket}s of the second and third of the inner tuplets
300 below the staff, we can use @code{\override} in the usual way.
302 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
303 \tweak #'text #tuplet-number::calc-fraction-text
304 \tweak #'direction #up
306 \tweak #'direction #down
307 \times 2/3 { c8[ c8 c8] }
308 \override TupletBracket #'direction = #down
309 \times 2/3 { c8[ c8 c8] }
310 \times 2/3 { c8[ c8 c8] }
316 @c Sent to Valentin for LSR (general list of Rhythm snippets) 22 Feb
317 @c Maybe try referencing with:
318 @c For example of modifying bracket length see @lsr{..}
319 @c Index entries could then be added above this.
320 @c Delete ignore block when available in LSR
323 @subheading Modifying tuplet bracket length
325 @cindex tuplet bracket length
326 @cindex triplet bracket length
327 @cindex bracket length, tuplets
328 @funindex tupletFullLength
329 @funindex tupletFullLengthNote
331 Tuplet brackets can be made to run to prefatory matter or the
333 Default tuplet brackets end at the right edge of the final note
334 of the tuplet; full-length tuplet brackets extend farther to the
335 right, either to cover all the non-rhythmic notation up to the
336 following note, or to cover only the whitespace before the next
337 item of notation, be that a clef, time signature, key signature,
338 or another note. The example shows how to switch tuplets to
339 full length mode and how to modify what material they cover.
342 @lilypond[ragged-right,verbatim,quote]
344 % Set tuplets to be extendable ..
345 \set tupletFullLength = ##t
346 % .. to cover all items up to the next note
347 \set tupletFullLengthNote = ##t
349 \times 2/3 { c4 c c }
350 % .. or to cover just whitespace
351 \set tupletFullLengthNote = ##f
362 @cindex compressing music
363 @funindex \compressMusic
365 @code{\compressMusic} works similarly to \times, but does not
366 create a tuplet bracket. One application is in polymetric
367 notation, see @ref{Polymetric notation}.
369 @lilypondfile [verbatim,lilyquote,ragged-right,texidoc]
370 {printing-music-with-different-time-signatures.ly}
375 Music Glossary: @rglos{triplet}, @rglos{tuplet},
378 Notation Reference: @ref{Time administration},
379 @ref{Objects connected to the input}, @ref{Polymetric notation}.
381 Snippets: @lsrdir{Rhythms,Rhythms}.
383 Internals Reference: @internalsref{TupletBracket},
384 @internalsref{TupletNumber}, @internalsref{TimeScaledMusic}.
388 Lines may be broken within a tuplet with @code{\bar "" \break},
389 but the tuplet bracket does not correctly carry over.
392 @node Scaling durations
393 @subsubsection Scaling durations
395 You can alter the length of a duration by a fraction @var{N/M}
396 by appending @code{*@var{N/M}} (or @code{*@var{N}} if @var{M=1}).
397 This will not affect the appearance of the notes or rests
398 produced, but the altered duration will be used in calculating the
399 position within the measure and setting the duration in the MIDI
400 output. Multiplying factors may be combined
403 In the following example, the first three notes take up exactly
404 two beats, but no triplet bracket is printed.
406 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
408 a4*2/3 gis4*2/3 a4*2/3
413 The duration of skip or spacing notes may also be modified by
414 a multiplier. This is useful for skipping many measures, e.g.,
419 Notation Reference: @ref{Tuplets}, @ref{Skips}, @ref{Polymetric notation}.
421 Snippets: @lsrdir{Rhythms,Rhythms}
429 A tie connects two adjacent note heads of the same pitch. The tie
430 in effect extends the length of a note.
432 @warning{Ties should not be confused with @emph{slurs}, which
433 indicate articulation, or @emph{phrasing slurs}, which indicate
434 musical phrasing. A tie is just a way of extending a note
435 duration, similar to the augmentation dot.}
437 A tie is entered using the tilde symbol @code{~}
439 @lilypond[quote,ragged-right,fragment,verbatim]
445 Ties are used either when the note crosses a bar line, or when
446 dots cannot be used to denote the rhythm. Ties should also be
447 used when note values cross larger subdivisions of the measure:
449 @lilypond[fragment,quote,ragged-right]
451 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
455 If you need to tie a lot of notes across bar lines, it may be
456 easier to use automatic note splitting (see @ref{Automatic note
457 splitting}). This mechanism automatically splits long notes, and
458 ties them across bar lines.
461 @cindex repeating ties
462 @cindex volta brackets and ties
464 When a tie is applied to a chord, all note heads whose pitches
465 match are connected. When no note heads match, no ties will be
466 created. Chords may be partially tied by placing the tie inside
469 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
471 <c~ e g~ b> <c e g b>
474 When a second alternative of a repeat starts with a tied note, you
475 have to repeat the tie. This can be achieved with
478 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
479 \repeat volta 2 { c g <c e>2 ~ }
480 \alternative {{ <c e>2. r4 } {<c e>2\repeatTie d4 c }}
483 @cindex laissez vibrer
484 @cindex ties, laissez vibrer
485 @funindex \laissezVibrer
488 @funindex \tieNeutral
490 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
491 notes must not be damped at the end. It is used in notation for
492 piano, harp and other string and percussion instruments. They can
493 be entered using @code{\laissezVibrer}:
495 @lilypond[fragment,ragged-right,verbatim,relative=1]
496 <c f g>\laissezVibrer
499 The vertical placement of ties may be controlled; see
500 @ref{Controlling direction and placement}.
504 @code{\tieDown} (see example below). @code{\tieNeutral} reverts
505 to the default behaviour again.
507 However, as with other music elements of this kind, there is a
508 convenient shorthand for forcing tie directions. By adding
509 @code{_} or @code{^} before the tilde, the direction is also set:
511 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
522 @funindex \tieNeutral
534 Ties are sometimes used to write out arpeggios. In this case, two
535 tied notes need not be consecutive. This can be achieved by
536 setting the @code{tieWaitForNote} property to true. The same
537 feature is also useful, for example, to tie a tremolo to a chord,
538 but in principle, it can also be used for ordinary, consecutive
541 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
542 \set tieWaitForNote = ##t
543 \grace { c16[~ e~ g]~ } <c, e g>2
544 \repeat tremolo 8 { c32~ c'~ } <c c,>1
545 e8~ c~ a~ f~ <e' c a f>2
546 \tieUp c8~ a \tieDown \tieDotted g~ c g2
549 Ties may be engraved manually by changing the
550 @code{tie-configuration} property of the @code{TieColumn} object.
551 The first number indicates the distance from the center of the
552 staff in staff-spaces, and the second number indicates the
553 direction (1=up, -1=down).
555 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
557 \override TieColumn #'tie-configuration =
558 #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
566 Music Glossary: @rglos{tie},
567 @c [TODO]add @rglos{laissez vibrer}. when there is a glossary entry.
569 Snippets: @lsrdir{Rhythms,Rhythms}
572 @internalsref{LaissezVibrerTie}
573 @internalsref{LaissezVibrerTieColumn}
576 @c @lsr{connecting,laissez-vibrer-ties.ly}
581 Notation Reference: @ref{Automatic note splitting}.
583 Snippets: @lsrdir{Rhythms,Rhythms}
585 Internals Reference: @internalsref{Tie}.
590 Switching staves when a tie is active will not produce a slanted
593 Changing clefs or octavations during a tie is not really
594 well-defined. In these cases, a slur may be preferable.
601 @subsection Writing rests
606 * Full measure rests::
622 Rests are entered like notes with the note name @code{r}:
624 @c \time 16/1 is used to avoid spurious bar lines
625 @c and long tracts of empty measures
626 @lilypond[fragment,quote,ragged-right,verbatim]
629 \override Staff.TimeSignature #'stencil = ##f
631 r\longa r\breve r1 r2
636 Whole measure rests, centered in middle of the measure, must be entered as
637 multi-measure rests. They can be used for a single measure as well as
638 many measures and are discussed in @ref{Full measure rests}.
640 To explicitly specify a rest's vertical position, write a note
641 followed by @code{\rest}. A rest will be placed in the position
642 where the note would appear. This allows for precise manual
643 formatting of polyphonic music, since the automatic rest collision
644 formatter will leave these rests alone.
646 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
653 Notation Reference: @ref{Full measure rests}.
655 Snippets: @lsrdir{Rhythms,Rhythms}.
657 Internals Reference: @internalsref{Rest}.
662 @c Deliberately duplicated in Durations and Rests. -gp
663 There is no fundamental limit to rest durations (both in terms of
664 longest and shortest), but the number of glyphs is limited: there
665 are rests from 128th to maxima (8 x whole).
671 @cindex invisible rest
676 An invisible rest (also called a @q{skip}) can be entered like a
677 note with note name @code{s} or with @code{\skip @var{duration}}
679 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
680 a4 a4 s4 a4 \skip 1 a4
685 The @code{s} syntax is only available in note mode and chord mode.
686 In other situations, for example, when entering lyrics, one must
687 use the @code{\skip} command:
689 @lilypond[quote,ragged-right,verbatim,relative=2]
692 \new Lyrics \lyricmode { \skip 2 bla2 }
696 The skip command is merely an empty musical placeholder. It does
697 not produce any output, not even transparent output.
699 The @code{s} skip command does create @internalsref{Staff} and
700 @internalsref{Voice} when necessary, similar to note and rest
701 commands. For example, the following results in an empty staff.
703 @lilypond[quote,verbatim]
706 @c with ragged-right, the staff lines are cut BEFORE the time
707 @c signature, which makes for a VERY empty staff
709 @c The fragment @code{@{ \skip 4 @} } would produce an empty page.
710 @c Misleading -- it doesn't produce anything, not even an empty page.
711 @c Ppl who want to make empty sheets will see this and wonder what's
716 Snippets: @lsrdir{Rhythms,Rhythms}
718 Internals Reference: @internalsref{SkipMusic}.
721 @node Full measure rests
722 @subsubsection Full measure rests
724 @cindex multi measure rests
725 @cindex full measure rests
726 @cindex rest, multi measure
727 @cindex rest, full measure
728 @cindex whole rest for a full measure
731 Rests for one or more full measures are entered using @code{R}
732 followed by a duration (see @ref{Durations}). The duration should
733 correspond to an integral number of measures, otherwise a barcheck
734 warning is printed. A @rglos{multi-measure rest} is used
735 principally to indicate that a part in a multi-part score should
738 @lilypond[quote,fragment,verbatim,relative=2]
739 \set Score.skipBars = ##t
746 A multi-measure rest can be expanded in the printed score
747 to show all the rest measures explicitly, or, as above, it can be
748 condensed to a single measure
749 containing a multi-measure rest symbol, with the number of
750 measures of rest printed above the measure. This expansion
751 is controlled by the property @code{Score.skipBars}. If this is
752 set to true, empty measures will be condensed to a single measure.
754 @lilypond[quote,ragged-right,fragment,verbatim]
755 \time 4/4 r1 | R1 | R1*2 |
758 \set Score.skipBars = ##t
762 The @code{1} in @code{R1} is similar to the duration notation
763 used for notes and is the length of a measure in 2/2 or 4/4 time.
764 The duration in a multi-measure rest must always be an integral
765 number of measure-lengths, so in other time signatures augmentation
766 dots or fractions must be used:
768 @lilypond[quote,ragged-right,fragment,verbatim]
769 \set Score.skipBars = ##t
773 R1*13/8 | R1*13/8*12 |
778 An @code{R} spanning a single measure is printed as either a whole
779 or breve rest, centered in the measure, regardless of the time
784 @cindex kirchenpausen
786 If there are 10 or fewer measures of rest, LilyPond prints
787 a series of longa and breve rests (called in German
788 Kirchenpausen - @q{church rests}) within the staff and
789 prints a simple line otherwise. This default number of 10
790 may be changed by overriding
791 @code{MultiMeasureRest.expand-limit}.
793 @lilypond[quote,ragged-right,fragment,verbatim]
794 \set Score.skipBars = ##t
796 \override MultiMeasureRest #'expand-limit = 3
800 Note that unlike ordinary rests, the vertical position on the
801 staff of the multi-measure rest symbol of either form cannot be
804 @cindex text on multi-measure rest
805 @cindex script on multi-measure rest
806 @cindex fermata on multi-measure rest
808 Text can be added to multi-measure rests by using the
809 @var{note}-@code{markup} syntax described in @ref{Text markup}.
810 The variable @code{\fermataMarkup} is provided for adding
813 @lilypond[quote,ragged-right,verbatim,fragment]
814 \set Score.skipBars = ##t
816 R2.*10^\markup { \italic "ad lib." }
820 @warning{Text attached to a multi-measure rest is created
821 by @code{MultiMeasureRestText}, not
822 @code{TextScript}. Overrides must be directed to the correct
823 object, or they will be ignored. See the following example.}
825 @lilypond[quote,ragged-right,verbatim,fragment]
826 \override TextScript #'padding = #5
828 \override MultiMeasureRestText #'padding = #5
832 Text attached to a multi-measure rest will be centered above or
833 below it. Long text attached in this way does not cause the
834 measure to expand, and may collide with text in adjacent measures.
835 Long text is better attached to a zero-length skip note preceding
836 the rest, preceded by @code{\textLengthOn} (turn off again with
837 @code{\textLengthOff}), since this will cause the measure to expand to
838 accommodate the length of the text:
840 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
841 \set Score.skipBars = ##t
843 s1*0^\markup {[MAJOR GENERAL]}
845 s1*0^\markup {[MABEL] }
846 s1*0_\markup {\italic {Cue: ... it is yours}}
849 c4^\markup {CHORUS} d f c
853 Text attached to a skip note in this way is left-aligned to the
854 position where the note would be placed in the bar, and placed
855 above the bar count numeral, but because the bar length is
856 determined by the length of the text, the text will appear to be
857 centered. If two (or more) texts are
858 attached to skip notes in a bar the bar length is determined by
859 the longer text, and the shorter text is then clearly
860 left-aligned, as shown in the second bar above. If the shorter
861 text of two marks is short enough to fit it will be placed
862 alongside and to the left of the bar count numeral.
866 Notation Reference: @ref{Durations}, @ref{Text},
867 @ref{Text markup}, @ref{Text scripts}.
869 Snippets: @lsrdir{Rhythms,Rhythms}
871 Internals Reference: @internalsref{MultiMeasureRest}.
873 The layout object @internalsref{MultiMeasureRestNumber} is for the
874 default number, and @internalsref{MultiMeasureRestText} for user
880 If an attempt is made to use fingerings (e.g.,
881 @code{R1*10-4}) to put numbers over multi-measure rests, the
882 fingering numeral (4) may collide with the bar counter
885 @cindex condensing rests
887 There is no way to automatically condense multiple rests into a
888 single multi-measure rest. Multi-measure rests do not take part
891 Be careful when entering multi-measure rests followed by whole
892 notes. The following will enter two notes lasting four measures
900 @node Displaying rhythms
901 @subsection Displaying rhythms
907 * Polymetric notation::
908 * Automatic note splitting::
912 @subsubsection Time signature
914 @cindex time signature
918 The time signature is set with the @code{\time} command:
920 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
921 \time 2/4 c2 \time 3/4 c2.
926 The symbol that is printed can be customized with the @code{style}
927 property. Setting it to @code{#'()} uses fraction style for 4/4
930 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
933 \override Staff.TimeSignature #'style = #'()
938 A time signature symbol is normally printed whenever the time
939 signature changes. If this takes place at the end of a line a
940 warning time signature sign is printed at the end of the line and
941 again at the start of a new line. This default behaviour can be
942 modified by setting the value of the @code{break-visibility}
943 property. This takes three values which may be set to @code{#t}
944 or @code{#f} to specify whether the corresponding time signature
945 is visible or not. The order of the three values is @code{end of
946 line visible}, @code{middle of line visible}, @code{beginning of
949 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
950 % Do not print any time signatures at end of line
951 \override Staff.TimeSignature #'break-visibility = ##(#f #t #t)
954 % Do not print the following 9/8 time signature
955 \once \override Staff.TimeSignature #'break-visibility = ##(#t #f #t)
963 There are many more options for its layout. See @ref{Ancient time
964 signatures}, for more examples.
966 @code{\time} sets the properties @code{timeSignatureFraction},
967 @code{beatLength}, and @code{measureLength} in the @code{Timing}
968 context, which is normally aliased to @internalsref{Score}. The
969 property @code{measureLength} determines where bar lines should be
970 inserted, and how automatic beams should be generated. Changing
971 the value of @code{timeSignatureFraction} also causes the symbol
974 @cindex measure groupings
976 More options are available through the Scheme function
977 @code{set-time-signature}, which takes three arguments: the number
978 of beats, the beat length, and the internal grouping of beats in
979 the measure. If the @internalsref{Measure_grouping_engraver} is
980 included, the function will also create
981 @internalsref{MeasureGrouping} signs. Such signs ease reading
982 rhythmically complex modern music. In the following example, the
983 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
984 @code{set-time-signature} as the third argument @code{(2 2 2 3)}:
986 @lilypond[quote,ragged-right,verbatim]
989 #(set-time-signature 9 8 '(2 2 2 3))
990 g8[ g] d[ d] g[ g] a8[( bes g]) |
991 #(set-time-signature 5 8 '(3 2))
997 \consists "Measure_grouping_engraver"
1006 Snippets: @lsrdir{Rhythms,Rhythms}
1008 Internals Reference: @internalsref{TimeSignature}, and
1009 @internalsref{Timing_translator}.
1011 Examples: @c @lsr{contemporary,compound-time-signature.ly}.
1016 Automatic beaming does not use the measure grouping specified with
1017 @code{set-time-signature}.
1021 @subsubsection Upbeats
1025 @cindex partial measure
1026 @cindex measure, partial
1027 @cindex pickup measure
1028 @cindex shorten measures
1031 Partial or pickup measures, such as an anacrusis or upbeat, are
1032 entered using the @code{\partial} command, with the syntax
1035 \partial @var{duration}
1038 where @code{duration} is the rhythmic length to be added before
1041 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1042 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1045 Internally, this is translated into
1048 \set Timing.measurePosition = -@var{length of duration}
1051 The property @code{measurePosition} contains a rational number
1052 indicating how much of the measure has passed at this point. Note
1053 that this is a negative number; @code{\partial 4} is internally
1054 translated to mean @qq{there is a quarter note left in the bar.}
1059 This command does not take into account grace notes at the start
1060 of the music. When a piece starts with grace notes in the
1061 pickup, then the @code{\partial} should follow the grace notes:
1063 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1070 @code{\partial} is only intended to be used at the beginning of a
1071 piece. If you use it after the beginning, some odd warnings may
1076 Snippets: @lsrdir{Rhythms,Rhythms}
1078 @node Unmetered music
1079 @subsubsection Unmetered music
1082 @funindex \cadenzaOn
1083 @funindex \cadenzaOff
1085 Bar lines and bar numbers are calculated automatically. For
1086 unmetered music (cadenzas, for example), this is not desirable.
1087 To turn off automatic bar lines and bar numbers, use the commands
1088 @code{\cadenzaOn} and @code{\cadenzaOff}.
1090 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1099 Bar numbering is resumed at the end of the cadenza as if the
1100 cadenza were not there:
1102 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1103 \override Score.BarNumber #'break-visibility = ##( #t #t #t )
1114 LilyPond will only insert line breaks and page breaks at a
1115 bar line. Unless the unmetered music ends before the end of the
1116 staff line, you will need to insert invisible bar lines with
1123 to indicate where breaks can occur.
1127 Snippets: @lsrdir{Rhythms,Rhythms}
1130 @node Polymetric notation
1131 @subsubsection Polymetric notation
1133 @cindex double time signatures
1134 @cindex signatures, polymetric
1135 @cindex polymetric signatures
1136 @cindex meter, polymetric
1140 @rglos{polymetric time signature}
1143 Double time signatures are not supported explicitly, but they can
1144 be faked. In the next example, the markup for the time signature
1145 is created with a markup text. This markup text is inserted in
1146 the @internalsref{TimeSignature} grob. See also
1147 @c @lsr{contemporary,compound-time-signature}.
1149 @lilypond[verbatim,ragged-right]
1151 tsMarkup = \markup {
1152 \override #'(baseline-skip . 2) \number {
1155 \bracket \column { "5" "8" }
1160 \override Staff.TimeSignature #'stencil =
1161 #ly:text-interface::print
1162 \override Staff.TimeSignature #'text = #tsMarkup
1164 c'2 \bar ":" c'4 c'4.
1168 Each staff can also have its own time signature. This is done by
1169 moving the @internalsref{Timing_translator} to the
1170 @internalsref{Staff} context.
1172 @lilypond[quote,verbatim,ragged-right]
1176 \remove "Timing_translator"
1177 \remove "Default_bar_line_engraver"
1181 \consists "Timing_translator"
1182 \consists "Default_bar_line_engraver"
1185 %Now, each staff has its own time signature.
1198 c4. c8 c c c4. c8 c c
1204 A different form of polymetric notation is where note lengths have
1205 different values across staves, but the measures are all the same
1208 This notation can be created by setting a common time signature
1209 for each staff but replacing it manually using
1210 @code{timeSignatureFraction} to the desired fraction. Then the
1211 printed durations in each staff are scaled to the common time
1212 signature. The latter is done with @code{\compressMusic}, which
1213 is used in a similar way to @code{\times}, but does not create
1214 a tuplet bracket. The syntax is
1216 @funindex \compressMusic
1220 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1225 In this example, music with the time signatures of 3/4, 9/8, and
1226 10/8 are used in parallel. In the second staff, shown durations
1227 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
1228 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
1231 @lilypond[quote,ragged-right,verbatim,fragment]
1239 \set Staff.timeSignatureFraction = #'(9 . 8)
1240 \compressMusic #'(2 . 3)
1241 \repeat unfold 6 { c8[ c c] }
1245 \set Staff.timeSignatureFraction = #'(10 . 8)
1246 \compressMusic #'(3 . 5) {
1247 \repeat unfold 2 { c8[ c c] }
1248 \repeat unfold 2 { c8[ c] }
1249 | c4. c4. \times 2/3 { c8 c c } c4
1258 When using different time signatures in parallel, the spacing is
1259 aligned vertically, but bar lines distort the regular spacing.
1263 Snippets: @lsrdir{Rhythms,Rhythms}, @c @lsr{contemporary,compound-time-signature}.
1265 Internals Reference: @internalsref{TimeSignature}, @internalsref{Timing-translator}, @internalsref{Staff}.
1268 @node Automatic note splitting
1269 @subsubsection Automatic note splitting
1271 Long notes which overrun bar lines can be converted automatically
1272 to tied notes. This is done by replacing the
1273 @internalsref{Note_heads_engraver} by the
1274 @internalsref{Completion_heads_engraver}. In the following
1275 examples, notes crossing the bar line are split and tied.
1277 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
1279 \remove "Note_heads_engraver"
1280 \consists "Completion_heads_engraver"
1282 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
1286 This engraver splits all running notes at the bar line, and
1287 inserts ties. One of its uses is to debug complex scores: if the
1288 measures are not entirely filled, then the ties exactly show how
1289 much each measure is off.
1291 If you want to allow line breaking on the bar lines where
1292 @internalsref{Completion_heads_engraver} splits notes, you must
1293 also remove @internalsref{Forbid_line_break_engraver}.
1298 Not all durations (especially those containing tuplets) can be
1299 represented exactly with normal notes and dots, but the engraver
1300 will not insert tuplets.
1302 @code{Completion_heads_engraver} only affects notes; it does not
1308 Snippets: @lsrdir{Rhythms,Rhythms}
1310 Internals Reference: @internalsref{Note_heads_engraver},
1311 @internalsref{Completion_heads_engraver},
1312 @internalsref{Forbid_line_break_engraver}.
1323 * Setting automatic beam behavior::
1328 @node Automatic beams
1329 @subsubsection Automatic beams
1331 By default, beams are inserted automatically:
1333 @cindex beams, manual
1334 @cindex manual beams
1336 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1338 \time 6/8 c c c c8. c16 c8
1341 If these automatic decisions are not satisfactory, beaming can be
1342 entered explicitly; see @ref{Manual beams}. It is also possible
1343 to define beaming patterns that differ from the defaults; see
1344 @ref{Setting automatic beam behavior}. The default beaming rules
1345 are defined in @file{scm/@/auto@/-beam@/.scm}.
1351 Automatic beaming may be turned off and on with
1352 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1354 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1355 c4 c8 c8. c16 c8. c16 c8
1365 Beaming patterns may be altered with the @code{beatGrouping} property,
1367 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1369 \set beatGrouping = #'(2 3)
1371 \set beatGrouping = #'(3 2)
1375 The beams of consecutive 16th (or shorter) notes are, by default,
1376 not sub-divided. That is, the three (or more) beams stretch
1377 unbroken over entire groups of notes. This behaviour can
1378 be modified to sub-divide the beams into sub-groups by setting
1379 the property @code{subdivideBeams}. When set, multiple beams
1380 will be sub-divided at intervals defined by the current value of
1381 @code{beatLength} by reducing the multiple beams to just one beam
1382 between the sub-groups. Note that @code{beatLength} lives in the
1383 @code{Score} context and defaults to a quarter note. It must be
1384 set to a fraction giving the duration of the beam sub-group
1385 using the @code{make-moment} function, as shown here:
1387 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1389 \set subdivideBeams = ##t
1391 % Set beam sub-group length to an eighth note
1392 \set Score.beatLength = #(ly:make-moment 1 8)
1394 % Set beam sub-group length to a sixteenth note
1395 \set Score.beatLength = #(ly:make-moment 1 16)
1398 @funindex subdivideBeams
1401 For more information about @code{make-moment}, see
1402 @ref{Time administration}.
1408 Line breaks are normally forbidden when beams cross bar lines.
1409 This behavior can be changed by setting the @code{breakable}
1410 property: @code{\override Beam #'breakable = ##t}.
1412 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1413 \override Beam #'breakable = ##t
1414 c8 \repeat unfold 15 {c[ c] } c
1417 @cindex beams and line breaks
1418 @cindex beams, kneed
1420 @cindex auto-knee-gap
1422 Kneed beams are inserted automatically when a large gap is
1423 detected between the note heads. This behavior can be tuned
1424 through the @code{auto-knee-gap} property. A kneed beam is
1425 drawn if the gap is larger than the value of
1426 @code{auto-knee-gap} plus the width of the beam object (which
1427 depends on the duration of the notes and the slope of the beam).
1428 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1430 @lilypond[fragment,ragged-right,quote,verbatim]
1432 \override Beam #'auto-knee-gap = #6
1439 Notation Reference: @ref{Manual beams}, @ref{Setting automatic beam behavior}.
1441 Snippets: @lsrdir{Rhythms,Rhythms}
1443 Internals Reference: @internalsref{Beam}.
1448 Automatically kneed cross-staff beams cannot be used together with
1449 hidden staves. See @ref{Hiding staves}.
1451 Beams can collide with note heads and accidentals in other voices
1454 @node Setting automatic beam behavior
1455 @subsubsection Setting automatic beam behavior
1457 @funindex autoBeamSettings
1458 @funindex (end * * * *)
1459 @funindex (begin * * * *)
1460 @cindex automatic beams, tuning
1461 @cindex tuning automatic beaming
1463 @c [TODO: use \applyContext]
1465 In normal time signatures, automatic beams can start on any note
1466 but can end in only a few positions within the measure: beams can
1467 end on a beat, or at durations specified by the properties in
1468 @code{autoBeamSettings}. The properties in
1469 @code{autoBeamSettings} consist of a list of rules for where beams
1470 can begin and end. The default @code{autoBeamSettings} rules are
1471 defined in @file{scm/@/auto@/-beam@/.scm}.
1473 In order to add a rule to the list, use
1475 #(override-auto-beam-setting '(be p q n m) a b [context])
1480 @item @code{be} is either @code{begin} or @code{end}.
1482 @item @code{p/q} is the duration of the note for which you want
1483 to add a rule. A beam is considered to have the duration of its
1484 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1485 have this apply to any beam.
1487 @item @code{n/m} is the time signature to which
1488 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1489 to have this apply in any time signature.
1491 @item @code{a/b} is the position in the bar at which the beam should
1494 @item @code{context} is optional, and it specifies the context at which
1495 the change should be made. The default is @code{'Voice}.
1497 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1498 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1502 For example, if automatic beams should always end on the first quarter
1506 #(override-auto-beam-setting '(end * * * *) 1 4)
1509 You can force the beam settings to only take effect on beams whose shortest
1510 note is a certain duration
1512 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1514 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1516 a32 a a a a16 a a a a a |
1517 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1518 a32 a a a a16 a a a a a |
1521 You can force the beam settings to only take effect in certain time
1524 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1526 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1534 You can also remove a previously set beam-ending rule by using
1537 #(revert-auto-beam-setting '(be p q n m) a b [context])
1541 be, p, q, n, m, a, b and context are the same as above. Note that the
1542 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1543 so you can revert rules that you did not explicitly create.
1545 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1547 a16 a a a a a a a a a a a a a a a
1548 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1549 a16 a a a a a a a a a a a a a a a
1552 The rule in a revert-auto-beam-setting statement must exactly match the
1553 original rule. That is, no wildcard expansion is taken into account.
1555 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1557 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1559 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1561 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1567 @c TODO: old material -- not covered by above stuff, I think.
1568 If automatic beams should end on every quarter in 5/4 time, specify
1571 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1572 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1573 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1574 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1578 The same syntax can be used to specify beam starting points. In this
1579 example, automatic beams can only end on a dotted quarter note
1581 #(override-auto-beam-setting '(end * * * *) 3 8)
1582 #(override-auto-beam-setting '(end * * * *) 1 2)
1583 #(override-auto-beam-setting '(end * * * *) 7 8)
1585 In 4/4 time signature, this means that automatic beams could end only on
1586 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1587 3/8, has passed within the measure).
1589 If any unexpected beam behaviour occurs, check the default automatic beam
1590 settings in @file{scm/@/auto@/-beam@/.scm}
1591 for possible interference, because the beam
1592 endings defined there will still apply on top of your own overrides. Any
1593 unwanted endings in the default vales must be reverted for your time
1596 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1600 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1601 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1602 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1603 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1606 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1607 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1608 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1611 @cindex automatic beam generation
1613 @funindex autoBeaming
1616 If beams are used to indicate melismata in songs, then automatic
1617 beaming should be switched off with @code{\autoBeamOff}.
1622 @funindex \autoBeamOff
1623 @code{\autoBeamOff},
1624 @funindex \autoBeamOn
1630 If a score ends while an automatic beam has not been ended and is
1631 still accepting notes, this last beam will not be typeset at all.
1632 The same holds for polyphonic voices, entered with @code{<<
1633 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1634 automatic beam is still accepting notes, it is not typeset.
1638 Snippets: @lsrdir{Rhythms,Rhythms}
1642 @subsubsection Manual beams
1644 @cindex beams, manual
1646 In some cases it may be necessary to override the automatic
1647 beaming algorithm. For example, the autobeamer will not put beams
1648 over rests or bar lines, and in choral scores the beaming is
1649 often set to follow the meter of the lyrics rather than the
1650 notes. Such beams can be specified manually by
1651 marking the begin and end point with @code{[} and @code{]}
1653 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1655 r4 r8[ g' a r8] r8 g[ | a] r8
1660 Individual notes may be marked with @code{\noBeam} to prevent them
1663 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1664 \time 2/4 c8 c\noBeam c c
1670 @funindex stemLeftBeamCount
1671 @funindex stemRightBeamCount
1673 Even more strict manual control with the beams can be achieved by
1674 setting the properties @code{stemLeftBeamCount} and
1675 @code{stemRightBeamCount}. They specify the number of beams to
1676 draw on the left and right side, respectively, of the next note.
1677 If either property is set, its value will be used only once, and
1678 then it is erased. In this example, the last @code{f} is printed
1679 with only one beam on the left side, i.e. the eigth-note beam of
1680 the group as a whole.
1682 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1686 \set stemLeftBeamCount = #1
1694 @node Feathered beams
1695 @subsubsection Feathered beams
1697 @cindex beams, feathered
1698 @funindex \featherDurations
1700 Feathered beams are used to indicate that a small group of notes
1701 should be played at an increasing (or decreasing) tempo, without
1702 changing the overall tempo of the piece. The extent of the
1703 feathered beam must be indicated manually using @code{[} and
1704 @code{]}, and the beam feathering is turned on by specifying a
1705 direction to the Beam property @code{grow-direction}.
1707 If the placement of the notes and the sound in the MIDI output
1708 is to reflect the ritardando or accelerando indicated by the
1709 feathered beam the notes must be grouped as a
1710 music expression delimited by braces and preceded by a
1711 @code{featheredDurations} command which specifies the ratio
1712 between the durations of the first and last notes in the group.
1715 show the extent of the beam and the braces show
1716 which notes are to have their durations modified. Normally
1717 these would delimit the same group of notes, but this is not
1718 required: the two commands are independent.
1720 In the following example the eight 16th notes occupy exactly the
1721 same time as a half note, but the first note is one half as long
1722 as the last one, with the intermediate notes gradually
1723 lengthening. The first four 32nd notes gradually speed up, while
1724 the last four 32nd notes are at a constant tempo.
1726 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1727 \override Beam #'grow-direction = #LEFT
1728 \featherDurations #(ly:make-moment 2 1)
1729 { c16[ c c c c c c c] }
1730 \override Beam #'grow-direction = #RIGHT
1731 \featherDurations #(ly:make-moment 2 3)
1733 % revert to non-feathered beams
1734 \override Beam #'grow-direction = #'()
1739 The spacing in the printed output represents the
1740 note durations only approximately, but the midi output is exact.
1744 The @code{\featherDurations} command only works with very short
1745 music snippets, and when numbers in the fraction are small.
1749 Snippets: @lsrdir{Rhythms,Rhythms}
1760 * Bar and bar number checks::
1765 @subsubsection Bar lines
1769 @cindex measure lines
1772 Bar lines delimit measures, and are also used to indicate
1773 repeats. Normally, simple bar lines are automatically inserted
1774 into the printed output at places based on the current time
1777 The simple bar lines inserted automatically can be changed to
1778 other types with the @code{\bar} command. For example, a closing
1779 double bar line is usually placed at the end of a piece:
1781 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1785 @warning{An incorrect duration can lead to poorly formatted
1788 It is not invalid if the final note in a bar does not
1789 end on the automatically entered bar line: the note is assumed
1790 to carry over into the next bar. But if a long sequence
1791 of such carry-over bars appears the music can appear compressed
1792 or even flowing off the page. This is because automatic line
1793 breaks happen only at the end of complete bars, i.e. where
1794 the end of a note coincides with the end of a bar.
1797 @cindex bar lines, invisible
1798 @cindex measure lines, invisible
1800 Line breaks are also permitted at manually inserted bar lines
1801 even within incomplete bars. To allow a line break without
1802 printing a bar line, use
1809 This will insert an invisible bar line and allow (but not
1810 force) a line break to occur at this point. The bar number
1811 counter is not increased. To force a line break see
1812 @ref{Line breaking}.
1814 This and other special bar lines may be inserted manually at any
1815 point. When they coincide with the end of a bar they replace
1816 the simple bar line which would have been inserted there
1817 automatically. When they do not coincide
1818 with the end of a bar the specified bar line is inserted at that
1819 point in the printed output. Such insertions do not affect
1820 the calculation and placement of subsequent automatic bar lines.
1822 The simple bar line and four types of double bar line are available
1823 for manual insertion:
1825 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1826 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1830 together with dotted and dashed bar lines:
1832 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1833 f1 \bar ":" g \bar "dashed" a
1837 and three types of repeat bar line:
1839 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1840 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1845 Although the bar line types signifying repeats may be inserted
1846 manually they do not in themselves cause LilyPond to recognise
1847 a repeated section. Such repeated sections are better entered
1848 using the various repeat commands (see @ref{Repeats}), which
1849 automatically print the appropriate bar lines.
1851 In addition, you can specify @code{"||:"}, which is equivalent to
1852 @code{"|:"} except at line breaks, where it gives a double bar
1853 line at the end of the line and a start repeat at the beginning of
1856 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1857 \override Score.RehearsalMark #'padding = #3
1865 In scores with many staves, a @code{\bar} command in one staff is
1866 automatically applied to all staves. The resulting bar lines are
1867 connected between different staves of a @code{StaffGroup},
1868 @code{PianoStaff}, or @code{GrandStaff}.
1870 @lilypond[quote,ragged-right,fragment,verbatim]
1878 \new Staff { \clef bass c4 g e g }
1880 \new Staff { \clef bass c2 c2 }
1888 @funindex defaultBarType
1890 The command @code{\bar }@var{bartype} is a shortcut for
1891 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1892 created whenever the @code{whichBar} property is
1895 The default bar type used for automatically inserted bar lines is
1896 @code{"|"}. This may be changed at any time
1897 with @code{\set Timing.defaultBarType = }@var{bartype}.
1901 Notation Reference: @ref{Line breaking}, @ref{Repeats},
1902 @ref{System start delimiters}.
1904 Snippets: @lsrdir{Rhythms,Rhythms}
1906 Internals Reference: @internalsref{BarLine} (created at
1907 @internalsref{Staff} level), @internalsref{SpanBar} (across
1908 staves), @internalsref{Timing_translator} (for Timing
1913 @subsubsection Bar numbers
1916 @cindex measure numbers
1917 @funindex currentBarNumber
1919 Bar numbers are typeset by default at the start of every line except
1920 the first line. The number itself is stored in the
1921 @code{currentBarNumber} property, which is normally updated
1922 automatically for every measure. It may also be set manually:
1924 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1927 \set Score.currentBarNumber = #50
1934 @funindex barNumberVisibility
1935 @cindex bar numbers, regular spacing
1937 Bar numbers can be typeset at regular intervals instead of just at
1938 the beginning of every line. To do this the default behaviour
1939 must be overridden to permit bar numbers to be printed at places
1940 other than the start of a line. This is controlled by the
1941 @code{break-visibility} property of @code{BarNumber}. This takes
1942 three values which may be set to @code{#t} or @code{#f} to specify
1943 whether the corresponding bar number is visible or not. The order
1944 of the three values is @code{end of line visible}, @code{middle of
1945 line visible}, @code{beginning of line visible}. In the following
1946 example bar numbers are printed at all possible places:
1948 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1949 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1950 \set Score.currentBarNumber = #11
1951 \bar "" % Permit first bar number to be printed
1957 @c All the rest of these examples will be added to LSR
1958 @c and moved into the Snippets. -gp
1961 and here the bar numbers are printed every two bars
1962 except at the end of the line:
1964 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1965 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1966 \set Score.currentBarNumber = #11
1967 \bar "" % Permit first bar number to be printed
1968 % Print a bar number every 2nd bar
1969 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1975 @cindex measure number, format
1976 @cindex bar number, format
1978 The size of the bar number may be changed. This is illustrated
1979 in the following example, which also shows how to enclose bar
1980 numbers in boxes and circles, and shows an alternative way
1981 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
1983 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1984 % Prevent bar numbers at the end of a line and permit them elsewhere
1985 \override Score.BarNumber #'break-visibility
1986 = #end-of-line-invisible
1988 % Increase the size of the bar number by 2
1989 \override Score.BarNumber #'font-size = #2
1990 \repeat unfold 3 { c1 } \bar "|"
1992 % Draw a box round the following bar number(s)
1993 \override Score.BarNumber #'stencil
1994 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1995 \repeat unfold 3 { c1 } \bar "|"
1997 % Draw a circle round the following bar number(s)
1998 \override Score.BarNumber #'stencil
1999 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2000 \repeat unfold 4 { c1 } \bar "|."
2003 @cindex bar number alignment
2005 Bar numbers by default are left-aligned to their parent object.
2006 This is usually the left edge of a line or, if numbers are printed
2007 within a line, the left bar line of the bar. The numbers may also
2008 be positioned directly on the bar line or right-aligned to the
2011 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2012 \set Score.currentBarNumber = #111
2013 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
2014 % Increase the size of the bar number by 2
2015 \override Score.BarNumber #'font-size = #2
2016 % Print a bar number every 2nd bar
2017 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2019 % Centre-align bar numbers
2020 \override Score.BarNumber #'self-alignment-X = #0
2022 % Right-align bar numbers
2023 \override Score.BarNumber #'self-alignment-X = #-1
2027 Bar numbers can be removed entirely by removing the Bar number
2028 engraver from the score context.
2030 @lilypond[verbatim,ragged-right,quote]
2034 \remove "Bar_number_engraver"
2046 Snippets: @lsrdir{Rhythms,Rhythms}
2048 Internals Reference: @internalsref{BarNumber}.
2053 Bar numbers may collide with the top of the
2054 @internalsref{StaffGroup} bracket, if there is one. To solve
2055 this, the @code{padding} property of @internalsref{BarNumber} can
2056 be used to position the number correctly.
2058 Bar numbers may only be printed at bar lines; to print a bar
2059 number at the beginning of a piece, an empty bar line must be
2060 inserted there, and a value other than @code{1} must be placed
2061 in @code{currentBarNumber}:
2063 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2064 \set Score.currentBarNumber = #50
2073 @node Bar and bar number checks
2074 @subsubsection Bar and bar number checks
2077 @funindex barCheckSynchronize
2080 Bar checks help detect errors in the entered durations.
2081 A bar check may be entered using the bar symbol, @code{|},
2082 at any place where a bar line is expected to fall.
2083 If bar check lines are encountered at other places,
2084 a list of warnings is printed in the log file,
2085 showing the line numbers and lines
2086 in which the bar checks failed. In the next
2087 example, the second bar check will signal an error.
2090 \time 3/4 c2 e4 | g2 |
2093 Bar checks can also be used in lyrics, for example
2098 Twin -- kle | Twin -- kle |
2102 An incorrect duration can result in a completely garbled score,
2103 especially if the score is polyphonic, so a good place to start
2104 correcting input is by scanning for failed bar checks and
2105 incorrect durations.
2108 @funindex pipeSymbol
2110 It is also possible to redefine the action taken when a bar check
2111 or pipe symbol, @code{|}, is encountered in the input, so that
2112 it does something other than a bar check. This is done by
2113 assigning a music expression to @code{pipeSymbol}.
2114 In the following example @code{|} is set to insert a double bar
2115 line wherever it appears in the input, rather than checking
2118 @lilypond[quote,ragged-right,verbatim]
2119 pipeSymbol = \bar "||"
2128 When copying large pieces of music, it can be helpful to check
2129 that the LilyPond bar number corresponds to the original that you
2130 are entering from. This can be checked with
2131 @code{\barNumberCheck}, for example,
2134 \barNumberCheck #123
2138 will print a warning if the @code{currentBarNumber} is not 123
2139 when it is processed.
2143 Snippets: @lsrdir{Rhythms,Rhythms}
2146 @node Rehearsal marks
2147 @subsubsection Rehearsal marks
2149 @cindex rehearsal marks
2150 @cindex mark, rehearsal
2153 To print a rehearsal mark, use the @code{\mark} command
2155 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2164 The letter@tie{}@q{I} is skipped in accordance with engraving
2165 traditions. If you wish to include the letter @q{I}, then use
2168 \set Score.markFormatter = #format-mark-alphabet
2171 The mark is incremented automatically if you use @code{\mark
2172 \default}, but you can also use an integer argument to set the
2173 mark manually. The value to use is stored in the property
2174 @code{rehearsalMark}.
2176 @cindex rehearsal mark format
2177 @cindex rehearsal mark style
2178 @cindex style, rehearsal mark
2179 @cindex format, rehearsal mark
2180 @cindex mark, rehearsal, style
2181 @cindex mark, rehearsal, format
2183 The style is defined by the property @code{markFormatter}. It is
2184 a function taking the current mark (an integer) and the current
2185 context as argument. It should return a markup object. In the
2186 following example, @code{markFormatter} is set to a pre-defined
2187 procedure. After a few measures, it is set to a procedure that
2188 produces a boxed number.
2190 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2191 \set Score.markFormatter = #format-mark-numbers
2194 \set Score.markFormatter = #format-mark-box-numbers
2200 The file @file{scm/@/translation@/-functions@/.scm} contains the
2201 definitions of @code{format-mark-numbers} (the default format),
2202 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2203 @code{format-mark-box-letters}. These can be used as inspiration
2204 for other formatting functions.
2206 You may use @code{format-mark-barnumbers},
2207 @code{format-mark-box-barnumbers}, and
2208 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2209 incremented numbers or letters.
2211 Other styles of rehearsal mark can be specified manually
2218 @code{Score.markFormatter} does not affect marks specified in this
2219 manner. However, it is possible to apply a @code{\markup} to the
2223 \mark \markup@{ \box A1 @}
2230 Music glyphs (such as the segno sign) may be printed inside a
2233 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2234 c1 \mark \markup { \musicglyph #"scripts.segno" }
2235 c1 \mark \markup { \musicglyph #"scripts.coda" }
2236 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2241 See @ref{The Feta font}, for a list of symbols which may be
2242 printed with @code{\musicglyph}.
2244 For common tweaks to the positioning of rehearsal marks, see
2249 Snippets: @lsrdir{Rhythms,Rhythms}
2251 This manual: @ref{The Feta font}, @ref{Text marks}.
2253 Internals Reference: @internalsref{RehearsalMark}.
2255 Init files: @file{scm/@/translation@/-functions@/.scm} contains
2256 the definition of @code{format-mark-numbers} and
2257 @code{format-mark-letters}. They can be used as inspiration for
2258 other formatting functions.
2260 Examples: @c @lsr{parts,rehearsal-mark-numbers.ly}
2263 @node Special rhythmic concerns
2264 @subsection Special rhythmic concerns
2269 * Aligning to cadenzas::
2270 * Time administration::
2274 @subsubsection Grace notes
2279 @cindex appoggiatura
2280 @cindex acciaccatura
2282 Grace notes are ornaments that are written out. They are made with
2283 the @code{\grace} command. By prefixing this keyword to a music
2284 expression, a new one is formed, which will be printed in a
2285 smaller font and takes up no logical time in a measure.
2287 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2289 \grace { c16[ d16] } c2 c4
2292 Two special forms of the @code{\grace} command exist.
2293 An @emph{acciaccatura}, which should be played as very short,
2294 is denoted by a slurred small note with a slashed stem. The
2295 @emph{appoggiatura}, a grace note that takes a fixed fraction of the
2296 main note, is denoted as a slurred note in small print without
2297 a slash. They are entered with the commands @code{\acciaccatura}
2298 and @code{\appoggiatura}, as demonstrated in the following
2301 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2302 b4 \acciaccatura d8 c4
2304 \acciaccatura { g16[ f] } e4
2308 @code{\acciaccatura} and @code{\appoggiatura} start a slur,
2309 @code{\grace} does not.
2311 The placement of grace notes is synchronized between different
2312 staves. In the following example, there are two sixteenth grace
2313 notes for every eighth grace note
2315 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2316 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2317 \new Staff { c4 \grace { g8[ b] } c4 } >>
2320 @funindex \afterGrace
2322 @cindex grace notes, following
2324 If you want to end a note with a grace, use the @code{\afterGrace}
2325 command. It takes two arguments: the main note, and the grace
2326 notes following the main note.
2328 @lilypond[ragged-right, verbatim,relative=2,fragment]
2329 c1 \afterGrace d1 { c16[ d] } c4
2332 This will put the grace notes after a @q{space} lasting 3/4 of the
2333 length of the main note. The fraction 3/4 can be changed by
2334 setting @code{afterGraceFraction}, ie.
2337 #(define afterGraceFraction (cons 7 8))
2341 will put the grace note at 7/8 of the main note.
2343 The same effect can be achieved manually by doing
2345 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2348 { s2 \grace { c16[ d] } } >>
2354 By adjusting the duration of the skip note (here it is a
2355 half-note), the space between the main-note and the grace
2358 A @code{\grace} music expression will introduce special
2359 typesetting settings, for example, to produce smaller type, and
2360 set directions. Hence, when introducing layout tweaks, they
2361 should be inside the grace expression, for example,
2363 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2375 The overrides should also be reverted inside the grace expression.
2377 The layout of grace expressions can be changed throughout the
2378 music using the function @code{add-grace-property}. The following
2379 example undefines the @code{Stem} direction for this grace, so
2380 that stems do not always point up.
2384 #(add-grace-property 'Voice 'Stem 'direction '())
2390 Another option is to change the variables @code{startGraceMusic},
2391 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2392 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2393 @code{stopAppoggiaturaMusic}. The default values of these can be
2394 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2395 them other effects may be obtained.
2397 @cindex stem, with slash
2400 The slash through the stem in @emph{acciaccatura}s can be obtained in
2401 other situations by @code{\override Stem #'stroke-style =
2407 Grace notes may be forced to use align with regular notes
2408 in other staves by setting @code{strict-grace-spacing} to
2411 @lilypond[relative=2,ragged-right]
2413 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2422 c'16[ c'16 c'16 c'16]
2423 c'16[ c'16 c'16 c'16]
2433 @rglos{grace notes},
2434 @rglos{acciaccatura},
2435 @rglos{appoggiatura}
2437 Snippets: @lsrdir{Rhythms,Rhythms}
2439 Internals Reference: @internalsref{GraceMusic}.
2444 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2445 and looks exactly the same as a multi-note beamed
2446 @emph{appoggiatura}.
2447 @c TODO Add link to LSR snippet to add slash when available
2449 Grace note synchronization can also lead to surprises. Staff
2450 notation, such as key signatures, bar lines, etc., are also
2451 synchronized. Take care when you mix staves with grace notes and
2452 staves without, for example,
2454 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2455 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2456 \new Staff { c4 \bar "|:" d4 } >>
2460 This can be remedied by inserting grace skips of the corresponding
2461 durations in the other staves. For the above example
2463 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2464 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2465 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2468 Grace sections should only be used within sequential music
2469 expressions. Nesting or juxtaposing grace sections is not
2470 supported, and might produce crashes or other errors.
2472 @node Aligning to cadenzas
2473 @subsubsection Aligning to cadenzas
2476 @cindex cadenza, aligning to
2477 @cindex aligning to cadenza
2479 In an orchestral context, cadenzas present a special problem: when
2480 constructing a score that includes a cadenza, all other
2481 instruments should skip just as many notes as the length of the
2482 cadenza, otherwise they will start too soon or too late.
2484 A solution to this problem is to use the functions
2485 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2486 functions take a piece of music as argument, and generate a multi-rest
2487 or @code{\skip}, exactly as long as the piece. The use of
2488 @code{mmrest-of-length} is demonstrated in the following example.
2490 @lilypond[verbatim,ragged-right,quote]
2491 cadenza = \relative c' {
2492 c4 d8 << { e f g } \\ { d4. } >>
2497 \new Staff { \cadenza c'4 }
2499 #(ly:export (mmrest-of-length cadenza))
2507 Snippets: @lsrdir{Rhythms,Rhythms}
2510 @node Time administration
2511 @subsubsection Time administration
2513 @cindex time administration
2514 @cindex timing (within the score)
2515 @cindex music, unmetered
2516 @cindex unmetered music
2518 @funindex currentBarNumber
2519 @funindex measurePosition
2520 @funindex measureLength
2522 Time is administered by the @code{Timing_translator}, which by
2523 default is to be found in the @code{Score} context. An alias,
2524 @code{Timing}, is added to the context in which the
2525 @code{Timing_translator} is placed.
2527 The following properties of @code{Timing} are used
2528 to keep track of timing within the score.
2531 @cindex measure number
2534 @item currentBarNumber
2535 The current measure number. For an example showing the
2536 use of this property see @ref{Bar numbers}.
2539 The length of the measures in the current time signature. For a
2540 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2541 determines when bar lines are inserted and how automatic beams
2542 should be generated.
2544 @item measurePosition
2545 The point within the measure where we currently are. This
2546 quantity is reset by subtracting @code{measureLength} whenever
2547 @code{measureLength} is reached or exceeded. When that happens,
2548 @code{currentBarNumber} is incremented.
2551 If set to true, the above variables are updated for every time
2552 step. When set to false, the engraver stays in the current
2553 measure indefinitely.
2557 Timing can be changed by setting any of these variables
2558 explicitly. In the next example, the default 4/4 time
2559 signature is printed, but @code{measureLength} is set to 5/4.
2560 At 4/8 through the third measure, the @code{measurePosition} is
2561 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2562 The next bar line then falls at 9/8 rather than 5/4.
2564 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2565 \set Score.measureLength = #(ly:make-moment 5 4)
2569 \set Score.measurePosition = #(ly:make-moment 5 8)
2575 As the example illustrates, @code{ly:make-moment n m} constructs a
2576 duration of n/m of a whole note. For example,
2577 @code{ly:make-moment 1 8} is an eighth note duration and
2578 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2584 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2586 Snippets: @lsrdir{Rhythms,Rhythms}
2588 Internals Reference: @internalsref{Timing_translator},
2589 @internalsref{Score}