1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
12 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
15 This section discusses rhythms, durations, and bars.
20 * Displaying rhythms::
23 * Special rhythmic concerns::
28 @subsection Writing rhythms
38 @unnumberedsubsubsec Durations
41 @cindex beams, automatic
46 When entering notes, durations are designated by numbers and dots:
47 durations are entered as their reciprocal values. For example, a
48 quarter note is entered using a @code{4} (since it is a 1/4 note),
49 while a half note is entered using a @code{2} (since it is a 1/2
50 note). For notes longer than a whole you must use the
51 @code{\longa} (a double breve) and @code{\breve} commands. Note
52 durations as short as 64th notes may be specified. Shorter values
53 are possible, but only as beamed notes.
55 @c Two 64th notes are needed to obtain beams
56 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
63 and the same durations with automatic beaming turned off
64 see @ref{Automatic beams}:
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 If the duration is omitted then it is set to the previously
76 entered duration. The default for the first note is a quarter
79 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
86 To obtain dotted note lengths, simply add a dot (@code{.}) to the
87 number. Double-dotted notes are produced in a similar way.
89 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
90 a4 b c4. b8 a4. b4.. c8.
93 Some durations cannot be entered using only binary durations
94 and dots, and can only be represented by tying two or more
95 notes together. Tied notes are covered in @ref{Ties}.
99 Dots are normally moved up to avoid staff lines, except in
100 polyphonic situations. The following commands may be used to
101 force a particular direction manually:
107 @funindex \dotsNeutral
110 For ways of specifying durations for the syllables of lyrics and
111 ways of aligning lyrics to notes see @ref{Vocal music}.
113 A note with the duration of a quadruple breve may be entered with
114 @code{\maxima}, but this is supported only within ancient music
115 notation; see @ref{Ancient notation}.
117 Optionally, notes can be spaced proportionately to their duration.
118 For details of this and other settings which control proportional
119 notation see @ref{Proportional notation}.
124 Music Glossary: @rglos{breve}, @rglos{longa}.
126 Notation Reference:@ref{Automatic beams}, @ref{Ties}, @ref{Writing rests}, @ref{Vocal music},
127 @ref{Ancient notation}, @ref{Proportional notation}.
129 Snippets: @lsrdir{rhythms}
131 Internals Reference: @internalsref{Dots},
132 @internalsref{DotColumn}.
137 @c duplicated in Durations and Rests. -gp
138 There is no fundamental limit to rest durations (both in terms of
139 longest and shortest), but the number of glyphs is limited: there
140 are rests from 128th to maxima (8 x whole).
144 @unnumberedsubsubsec Tuplets
150 Tuplets are made out of a music expression by multiplying all
151 durations with a fraction:
154 \times @var{fraction} @var{musicexpr}
158 The duration of @var{musicexpr} will be multiplied by the
159 fraction. The fraction's denominator will be printed over or
160 under the notes, optionally with a bracket. The most common
161 tuplet is the triplet in which 3 notes have the length of 2, so
162 the notes are 2/3 of their written length.
164 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
165 g4 \times 2/3 {c4 c c} d4 d4
168 Tuplets may be nested; for example,
170 @lilypond[fragment,ragged-right,verbatim,relative=2]
173 \times 3/5 { a a a a a }
181 @funindex \tupletDown
183 @funindex \tupletNeutral
184 @code{\tupletNeutral}.
189 @funindex tupletNumberFormatFunction
190 @funindex tupletSpannerDuration
191 @cindex tuplet formatting
193 The property @code{tupletSpannerDuration} specifies how long each
194 bracket should last. With this, you can make lots of tuplets
195 while typing @code{\times} only once, thus saving lots of typing.
196 In the next example, there are two triplets shown, while
197 @code{\times} was only used once.
199 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
200 \set tupletSpannerDuration = #(ly:make-moment 1 4)
201 \times 2/3 { c8 c c c c c }
205 For more information about @code{make-moment}, see
206 @ref{Time administration}.
208 @funindex TupletNumber
210 The format of the number is determined by the property @code{text}
211 in @code{TupletNumber}. The default prints only the denominator,
212 but if the property is set with @code{\override
213 TupletNumber #'text = #tuplet-number::calc-fraction-text},
214 @var{num}:@var{den} will be printed instead.
216 To print tuplets without tuplet numbers, use
217 @code{\override TupletNumber #'transparent = ##t}:
219 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
220 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
221 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
222 \times 2/3 { c8 c c }
223 \override TupletNumber #'transparent = ##t
224 \times 2/3 { c8 c c }
227 To change the appearance of nested tuplets beginning at the same
228 music moment individually, the @code{\tweak} function must be used
229 (see @ref{Objects connected to the input}). In the following
230 example, @code{\tweak} specifies fraction text for the outer
231 @code{TupletNumber} and denominator text for the
232 @code{TupletNumber} of the first of the three inner tuplets.
234 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
235 \tweak #'text #tuplet-number::calc-fraction-text
237 \tweak #'text #tuplet-number::calc-denominator-text
238 \times 2/3 { c8[ c8 c8] }
239 \times 2/3 { c8[ c8 c8] }
240 \times 2/3 { c8[ c8 c8] }
244 @cindex bracket, tuplet
245 @funindex TupletBracket
247 @c FIXME: after LM 6 Tweaks includes \tweak info, look at this.-gp
248 @c It *should* be explained why \tweak must be used here, and why
249 @c \override doesn't work. I've made an attempt, but I'm not sure
250 @c if it is factually correct to say that \tweak must be used.
251 In the next example, @code{\tweak} and @code{\override} work
252 together to specify @code{TupletBracket} direction. The first
253 @code{\tweak} positions the @code{TupletBracket} of the outer
254 tuplet above the staff. The second @code{\tweak} positions the
255 @code{TupletBracket} of the first of the three inner tuplets below
256 the staff. Note that the @code{\tweak} function affects only
257 events that begin at the same music moment: the outer tuplet and
258 the first of the three inner tuplets. To position the
259 @code{TupletBrackets} of the second and third of the inner tuplets
260 below the staff, we use @code{\override} in the usual way.
262 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
263 \tweak #'text #tuplet-number::calc-fraction-text
264 \tweak #'direction #up
266 \tweak #'direction #down
267 \times 2/3 { c8[ c8 c8] }
268 \override TupletBracket #'direction = #down
269 \times 2/3 { c8[ c8 c8] }
270 \times 2/3 { c8[ c8 c8] }
274 Tuplet brackets can be made to run to prefatory matter or the next
277 @lilypond[ragged-right,verbatim,quote]
279 \set tupletFullLength = ##t
280 \set tupletFullLengthNote = ##t
282 \times 2/3 { c4 c c }
283 \set tupletFullLengthNote = ##f
291 @funindex \compressMusic
294 @code{\compressMusic} works similarly to \times, but does not
295 create a tuplet bracket; see @ref{Polymetric notation}.
300 Tuplets which cross bar lines will prevent a line break at that
305 Music Glossary: @rglos{tuplet}.
307 Notation Reference: @ref{Time administration},
308 @ref{Objects connected to the input}, @ref{Polymetric notation}.
310 Snippets: @lsrdir{rhythms}.
312 Internals Reference: @internalsref{TupletBracket},
313 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
317 @node Scaling durations
318 @unnumberedsubsubsec Scaling durations
320 You can alter the length of a duration by a fraction @var{N/M}
321 by appending @code{*@var{N/M}} (or @code{*@var{N}} if @var{M=1}).
322 This will not affect the appearance of the notes or rests
323 produced, but the altered duration will be used in calculating the
324 position within the measure and setting the duration in the MIDI
325 output. Multiplying factors may be combined
328 In the following example, the first three notes take up exactly
329 two beats, but no triplet bracket is printed.
331 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
333 a4*2/3 gis4*2/3 a4*2/3
338 The duration of skip or spacing notes may also be modified by
339 a multiplier. This is useful for skipping many measures, e.g.,
344 Notation Reference: @ref{Tuplets}, @ref{Skips}, @ref{Polymetric notation}.
346 Snippets: @lsrdir{rhythms}
349 @unnumberedsubsubsec Ties
354 A tie connects two adjacent note heads of the same pitch. The tie
355 in effect extends the length of a note.
357 @warning{Ties should not be confused with @emph{slurs}, which
358 indicate articulation, or @emph{phrasing slurs}, which indicate
359 musical phrasing. A tie is just a way of extending a note
360 duration, similar to the augmentation dot.}
362 A tie is entered using the tilde symbol @code{~}
364 @lilypond[quote,ragged-right,fragment,verbatim]
370 Ties are used either when the note crosses a bar line, or when
371 dots cannot be used to denote the rhythm. Ties should also be
372 used when note values cross larger subdivisions of the measure:
374 @lilypond[fragment,quote,ragged-right]
376 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
380 If you need to tie a lot of notes across bar lines, it may be
381 easier to use automatic note splitting (see @ref{Automatic note
382 splitting}). This mechanism automatically splits long notes, and
383 ties them across bar lines.
386 @cindex repeating ties
387 @cindex volta brackets and ties
389 When a tie is applied to a chord, all note heads whose pitches
390 match are connected. When no note heads match, no ties will be
391 created. Chords may be partially tied by placing the tie inside
394 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
396 <c~ e g~ b> <c e g b>
399 When a second alternative of a repeat starts with a tied note, you
400 have to repeat the tie. This can be achieved with
403 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
404 \repeat volta 2 { c g <c e>2 ~ }
405 \alternative {{ <c e>2. r4 } {<c e>2\repeatTie d4 c }}
408 @cindex laissez vibrer
409 @cindex ties, laissez vibrer
410 @funindex \laissezVibrer
413 @funindex \tieNeutral
415 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
416 notes must not be damped at the end. It is used in notation for
417 piano, harp and other string and percussion instruments. They can
418 be entered using @code{\laissezVibrer}:
420 @lilypond[fragment,ragged-right,verbatim,relative=1]
421 <c f g>\laissezVibrer
424 The direction of a tie can be specified with @code{\tieUp} or
425 @code{\tieDown} (see example below). @code{\tieNeutral} reverts
426 to the default behaviour again.
428 However, as with other music elements of this kind, there is a
429 convenient shorthand for forcing tie directions. By adding
430 @code{_} or @code{^} before the tilde, the direction is also set:
432 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
439 Music Glossary: @rglos{tie},
440 @c [TODO]add @rglos{laissez vibrer}. when there is a glossary entry.
442 Snippets: @lsrdir{rhythms}
445 @internalsref{LaissezVibrerTie}
446 @internalsref{LaissezVibrerTieColumn}
449 @lsr{connecting,laissez-vibrer-ties.ly}
454 Ties are sometimes used to write out arpeggios. In this case, two
455 tied notes need not be consecutive. This can be achieved by
456 setting the @code{tieWaitForNote} property to true. The same
457 feature is also useful, for example, to tie a tremolo to a chord,
458 but in principle, it can also be used for ordinary, consecutive
461 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
462 \set tieWaitForNote = ##t
463 \grace { c16[~ e~ g]~ } <c, e g>2
464 \repeat tremolo 8 { c32~ c'~ } <c c,>1
465 e8~ c~ a~ f~ <e' c a f>2
466 \tieUp c8~ a \tieDown \tieDotted g~ c g2
469 Ties may be engraved manually by changing the
470 @code{tie-configuration} property of the @code{TieColumn} object.
471 The first number indicates the distance from the center of the
472 staff in staff-spaces, and the second number indicates the
473 direction (1=up, -1=down).
475 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
477 \override TieColumn #'tie-configuration =
478 #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
490 @funindex \tieNeutral
504 Notation Reference: @ref{Automatic note splitting}.
506 Snippets: @lsrdir{rhythms}
508 Internals Reference: @internalsref{Tie}.
513 Switching staves when a tie is active will not produce a slanted
516 Changing clefs or octavations during a tie is not really
517 well-defined. In these cases, a slur may be preferable.
524 @subsection Writing rests
529 * Full measure rests::
533 @unnumberedsubsubsec Rests
545 Rests are entered like notes with the note name @code{r}:
547 @c \time 16/1 is used to avoid spurious bar lines
548 @c and long tracts of empty measures
549 @lilypond[fragment,quote,ragged-right,verbatim]
552 \override Staff.TimeSignature #'stencil = ##f
554 r\longa r\breve r1 r2
559 Whole measure rests, centered in middle of the measure, must be entered as
560 multi-measure rests. They can be used for a single measure as well as
561 many measures and are discussed in @ref{Full measure rests}.
563 To explicitly specify a rest's vertical position, write a note
564 followed by @code{\rest}. A rest will be placed in the position
565 where the note would appear. This allows for precise manual
566 formatting of polyphonic music, since the automatic rest collision
567 formatter will leave these rests alone.
569 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
576 Notation Reference: @ref{Full measure rests}.
578 Snippets: @lsrdir{rhythms}.
580 Internals Reference: @internalsref{Rest}.
585 @c duplicated in Durations and Rests. -gp
586 There is no fundamental limit to rest durations (both in terms of
587 longest and shortest), but the number of glyphs is limited: there
588 are rests from 128th to maxima (8 x whole).
591 @unnumberedsubsubsec Skips
594 @cindex invisible rest
599 An invisible rest (also called a @q{skip}) can be entered like a
600 note with note name @code{s} or with @code{\skip @var{duration}}
602 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
603 a4 a4 s4 a4 \skip 1 a4
608 The @code{s} syntax is only available in note mode and chord mode.
609 In other situations, for example, when entering lyrics, one must
610 use the @code{\skip} command:
612 @lilypond[quote,ragged-right,verbatim,relative=2]
615 \new Lyrics \lyricmode { \skip 2 bla2 }
619 The skip command is merely an empty musical placeholder. It does
620 not produce any output, not even transparent output.
622 The @code{s} skip command does create @internalsref{Staff} and
623 @internalsref{Voice} when necessary, similar to note and rest
624 commands. For example, the following results in an empty staff.
626 @lilypond[quote,verbatim]
629 @c with ragged-right, the staff lines are cut BEFORE the time
630 @c signature, which makes for a VERY empty staff
632 @c The fragment @code{@{ \skip 4 @} } would produce an empty page.
633 @c Misleading -- it doesn't produce anything, not even an empty page.
634 @c Ppl who want to make empty sheets will see this and wonder what's
639 Snippets: @lsrdir{rhythms}
641 Internals Reference: @internalsref{SkipMusic}.
644 @node Full measure rests
645 @unnumberedsubsubsec Full measure rests
647 @cindex multi measure rests
648 @cindex full measure rests
649 @cindex rest, multi measure
650 @cindex rest, full measure
651 @cindex whole rest for a full measure
654 Rests for one or more full measures are entered using @code{R}
655 followed by a duration (see @ref{Durations}). The duration should
656 correspond to an integral number of measures, otherwise a barcheck
657 warning is printed. A @rglos{multi-measure rest} is used
658 principally to indicate that a part in a multi-part score should
661 @lilypond[quote,fragment,verbatim,relative=2]
662 \set Score.skipBars = ##t
669 A multi-measure rest can be expanded in the printed score
670 to show all the rest measures explicitly, or, as above, it can be
671 condensed to a single measure
672 containing a multi-measure rest symbol, with the number of
673 measures of rest printed above the measure. This expansion
674 is controlled by the property @code{Score.skipBars}. If this is
675 set to true, empty measures will be condensed to a single measure.
677 @lilypond[quote,ragged-right,fragment,verbatim]
678 \time 4/4 r1 | R1 | R1*2 |
681 \set Score.skipBars = ##t
685 The @code{1} in @code{R1} is similar to the duration notation
686 used for notes and is the length of a measure in 2/2 or 4/4 time.
687 The duration in a multi-measure rest must always be an integral
688 number of measure-lengths, so in other time signatures augmentation
689 dots or fractions must be used:
691 @lilypond[quote,ragged-right,fragment,verbatim]
692 \set Score.skipBars = ##t
696 R1*13/8 | R1*13/8*12 |
701 An @code{R} spanning a single measure is printed as either a whole
702 or breve rest, centered in the measure, regardless of the time
707 @cindex kirchenpausen
709 If there are 10 or fewer measures of rest, LilyPond prints
710 a series of longa and breve rests (called in German
711 Kirchenpausen - @q{church rests}) within the staff and
712 prints a simple line otherwise. This default number of 10
713 may be changed by overriding
714 @code{MultiMeasureRest.expand-limit}.
716 @lilypond[quote,ragged-right,fragment,verbatim]
717 \set Score.skipBars = ##t
719 \override MultiMeasureRest #'expand-limit = 3
723 Note that unlike ordinary rests, the vertical position on the
724 staff of the multi-measure rest symbol of either form cannot be
727 @cindex text on multi-measure rest
728 @cindex script on multi-measure rest
729 @cindex fermata on multi-measure rest
731 Text can be added to multi-measure rests by using the
732 @var{note}-@code{markup} syntax described in @ref{Text markup}.
733 The variable @code{\fermataMarkup} is provided for adding
736 @lilypond[quote,ragged-right,verbatim,fragment]
737 \set Score.skipBars = ##t
739 R2.*10^\markup { \italic "ad lib." }
743 @warning{Text attached to a multi-measure rest is created
744 by @code{MultiMeasureRestText}, not
745 @code{TextScript}. Overrides must be directed to the correct
746 object, or they will be ignored. See the following example.}
748 @lilypond[quote,ragged-right,verbatim,fragment]
749 \override TextScript #'padding = #5
751 \override MultiMeasureRestText #'padding = #5
755 Text attached to a multi-measure rest will be centered above or
756 below it. Long text attached in this way does not cause the
757 measure to expand, and may collide with text in adjacent measures.
758 Long text is better attached to a zero-length skip note preceding
759 the rest, preceded by @code{\fatText} (turn off again with
760 @code{\emptyText}), since this will cause the measure to expand to
761 accommodate the length of the text:
763 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
764 \set Score.skipBars = ##t
766 s1*0^\markup {[MAJOR GENERAL]}
768 s1*0^\markup {[MABEL] }
769 s1*0_\markup {\italic {Cue: ... it is yours}}
772 c4^\markup {CHORUS} d f c
776 Text attached to a skip note in this way is left-aligned to the
777 position where the note would be placed in the bar, and placed
778 above the bar count numeral, but because the bar length is
779 determined by the length of the text, the text will appear to be
780 centered. If two (or more) texts are
781 attached to skip notes in a bar the bar length is determined by
782 the longer text, and the shorter text is then clearly
783 left-aligned, as shown in the second bar above. If the shorter
784 text of two marks is short enough to fit it will be placed
785 alongside and to the left of the bar count numeral.
789 Notation Reference: @ref{Durations}, @ref{Text},
790 @ref{Text markup}, @ref{Text scripts}.
792 Snippets: @lsrdir{rhythms}
794 Internals Reference: @internalsref{MultiMeasureRest}.
796 The layout object @internalsref{MultiMeasureRestNumber} is for the
797 default number, and @internalsref{MultiMeasureRestText} for user
803 If an attempt is made to use fingerings (e.g.,
804 @code{R1*10-4}) to put numbers over multi-measure rests, the
805 fingering numeral (4) may collide with the bar counter
808 @cindex condensing rests
810 There is no way to automatically condense multiple rests into a
811 single multi-measure rest. Multi-measure rests do not take part
814 Be careful when entering multi-measure rests followed by whole
815 notes. The following will enter two notes lasting four measures
823 @node Displaying rhythms
824 @subsection Displaying rhythms
830 * Polymetric notation::
831 * Automatic note splitting::
835 @unnumberedsubsubsec Time signature
837 @cindex time signature
841 The time signature is set with the @code{\time} command:
843 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
844 \time 2/4 c2 \time 3/4 c2.
849 The symbol that is printed can be customized with the @code{style}
850 property. Setting it to @code{#'()} uses fraction style for 4/4
853 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
856 \override Staff.TimeSignature #'style = #'()
861 A time signature symbol is normally printed whenever the time
862 signature changes. If this takes place at the end of a line a
863 warning time signature sign is printed at the end of the line and
864 again at the start of a new line. This default behaviour can be
865 modified by setting the value of the @code{break-visibility}
866 property. This takes three values which may be set to @code{#t}
867 or @code{#f} to specify whether the corresponding time signature
868 is visible or not. The order of the three values is @code{end of
869 line visible}, @code{middle of line visible}, @code{beginning of
872 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
873 % Do not print any time signatures at end of line
874 \override Staff.TimeSignature #'break-visibility = ##(#f #t #t)
877 % Do not print the following 9/8 time signature
878 \once \override Staff.TimeSignature #'break-visibility = ##(#t #f #t)
886 There are many more options for its layout. See @ref{Ancient time
887 signatures}, for more examples.
889 @code{\time} sets the properties @code{timeSignatureFraction},
890 @code{beatLength}, and @code{measureLength} in the @code{Timing}
891 context, which is normally aliased to @internalsref{Score}. The
892 property @code{measureLength} determines where bar lines should be
893 inserted, and how automatic beams should be generated. Changing
894 the value of @code{timeSignatureFraction} also causes the symbol
897 @cindex measure groupings
899 More options are available through the Scheme function
900 @code{set-time-signature}, which takes three arguments: the number
901 of beats, the beat length, and the internal grouping of beats in
902 the measure. If the @internalsref{Measure_grouping_engraver} is
903 included, the function will also create
904 @internalsref{MeasureGrouping} signs. Such signs ease reading
905 rhythmically complex modern music. In the following example, the
906 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
907 @code{set-time-signature} as the third argument @code{(2 2 2 3)}:
909 @lilypond[quote,ragged-right,verbatim]
912 #(set-time-signature 9 8 '(2 2 2 3))
913 g8[ g] d[ d] g[ g] a8[( bes g]) |
914 #(set-time-signature 5 8 '(3 2))
920 \consists "Measure_grouping_engraver"
929 Snippets: @lsrdir{rhythms}
931 Internals Reference: @internalsref{TimeSignature}, and
932 @internalsref{Timing_translator}.
934 Examples: @lsr{contemporary,compound-time-signature.ly}.
939 Automatic beaming does not use the measure grouping specified with
940 @code{set-time-signature}.
944 @unnumberedsubsubsec Upbeats
948 @cindex partial measure
949 @cindex measure, partial
950 @cindex pickup measure
951 @cindex shorten measures
954 Partial or pickup measures, such as an anacrusis or upbeat, are
955 entered using the @code{\partial} command, with the syntax
958 \partial @var{duration}
961 where @code{duration} is the rhythmic length to be added before
964 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
965 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
968 Internally, this is translated into
971 \set Timing.measurePosition = -@var{length of duration}
974 The property @code{measurePosition} contains a rational number
975 indicating how much of the measure has passed at this point. Note
976 that this is a negative number; @code{\partial 4} is internally
977 translated to mean @qq{there is a quarter note left in the bar.}
982 This command does not take into account grace notes at the start
983 of the music. When a piece starts with grace notes in the
984 pickup, then the @code{\partial} should follow the grace notes:
986 @lilypond[verbatim,quote,ragged-right,relative,fragment]
993 @code{\partial} is only intended to be used at the beginning of a
994 piece. If you use it after the beginning, some odd warnings may
999 Snippets: @lsrdir{rhythms}
1001 @node Unmetered music
1002 @unnumberedsubsubsec Unmetered music
1005 @funindex \cadenzaOn
1006 @funindex \cadenzaOff
1008 Bar lines and bar numbers are calculated automatically. For
1009 unmetered music (cadenzas, for example), this is not desirable.
1010 To turn off automatic bar lines and bar numbers, use the commands
1011 @code{\cadenzaOn} and @code{\cadenzaOff}.
1013 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1025 LilyPond will only insert line breaks and page breaks at a
1026 bar line. Unless the unmetered music ends before the end of the
1027 staff line, you will need to insert invisible bar lines with
1034 to indicate where breaks can occur.
1038 Snippets: @lsrdir{rhythms}
1041 @node Polymetric notation
1042 @unnumberedsubsubsec Polymetric notation
1044 @cindex double time signatures
1045 @cindex signatures, polymetric
1046 @cindex polymetric signatures
1047 @cindex meter, polymetric
1049 @c TODO: add glossary entries for {signature, polymetric},
1050 @c {meter, polymetric}, {polymetric} (time signature, double}. rp
1052 Double time signatures are not supported explicitly, but they can
1053 be faked. In the next example, the markup for the time signature
1054 is created with a markup text. This markup text is inserted in
1055 the @internalsref{TimeSignature} grob. See also
1056 @lsr{contemporary,compound-time-signature}.
1058 @lilypond[verbatim,ragged-right]
1060 tsMarkup = \markup {
1061 \override #'(baseline-skip . 2) \number {
1064 \bracket \column { "5" "8" }
1069 \override Staff.TimeSignature #'stencil =
1070 #ly:text-interface::print
1071 \override Staff.TimeSignature #'text = #tsMarkup
1073 c'2 \bar ":" c'4 c'4.
1077 Each staff can also have its own time signature. This is done by
1078 moving the @internalsref{Timing_translator} to the
1079 @internalsref{Staff} context.
1081 @lilypond[quote,verbatim,ragged-right]
1085 \remove "Timing_translator"
1086 \remove "Default_bar_line_engraver"
1090 \consists "Timing_translator"
1091 \consists "Default_bar_line_engraver"
1094 %Now, each staff has its own time signature.
1107 c4. c8 c c c4. c8 c c
1113 A different form of polymetric notation is where note lengths have
1114 different values across staves, but the measures are all the same
1117 This notation can be created by setting a common time signature
1118 for each staff but replacing it manually using
1119 @code{timeSignatureFraction} to the desired fraction. Then the
1120 printed durations in each staff are scaled to the common time
1121 signature. The latter is done with @code{\compressMusic}, which
1122 is used in a similar way to @code{\times}, but does not create
1123 a tuplet bracket. The syntax is
1125 @funindex \compressMusic
1129 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1134 In this example, music with the time signatures of 3/4, 9/8, and
1135 10/8 are used in parallel. In the second staff, shown durations
1136 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
1137 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
1140 @lilypond[quote,ragged-right,verbatim,fragment]
1148 \set Staff.timeSignatureFraction = #'(9 . 8)
1149 \compressMusic #'(2 . 3)
1150 \repeat unfold 6 { c8[ c c] }
1154 \set Staff.timeSignatureFraction = #'(10 . 8)
1155 \compressMusic #'(3 . 5) {
1156 \repeat unfold 2 { c8[ c c] }
1157 \repeat unfold 2 { c8[ c] }
1158 | c4. c4. \times 2/3 { c8 c c } c4
1167 When using different time signatures in parallel, the spacing is
1168 aligned vertically, but bar lines distort the regular spacing.
1173 TODO: add @rglos{polymetric time signature}, {polymetric}, {double time
1174 signature}, and {polymetric meter}. when glossary entries
1178 Snippets: @lsrdir{rhythms}, @lsr{contemporary,compound-time-signature}.
1180 Internals Reference: @internalsref{TimeSignature}, @internalsref{Timing-translator}, @internalsref{Staff}.
1183 @node Automatic note splitting
1184 @unnumberedsubsubsec Automatic note splitting
1186 Long notes which overrun bar lines can be converted automatically
1187 to tied notes. This is done by replacing the
1188 @internalsref{Note_heads_engraver} by the
1189 @internalsref{Completion_heads_engraver}. In the following
1190 examples, notes crossing the bar line are split and tied.
1192 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
1194 \remove "Note_heads_engraver"
1195 \consists "Completion_heads_engraver"
1197 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
1201 This engraver splits all running notes at the bar line, and
1202 inserts ties. One of its uses is to debug complex scores: if the
1203 measures are not entirely filled, then the ties exactly show how
1204 much each measure is off.
1206 If you want to allow line breaking on the bar lines where
1207 @internalsref{Completion_heads_engraver} splits notes, you must
1208 also remove @internalsref{Forbid_line_break_engraver}.
1213 Not all durations (especially those containing tuplets) can be
1214 represented exactly with normal notes and dots, but the engraver
1215 will not insert tuplets.
1217 @code{Completion_heads_engraver} only affects notes; it does not
1223 Snippets: @lsrdir{rhythms}
1225 Internals Reference: @internalsref{Note_heads_engraver},
1226 @internalsref{Completion_heads_engraver},
1227 @internalsref{Forbid_line_break_engraver}.
1238 * Setting automatic beam behavior::
1242 @node Automatic beams
1243 @unnumberedsubsubsec Automatic beams
1245 By default, beams are inserted automatically:
1247 @cindex beams, manual
1248 @cindex manual beams
1250 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1252 \time 6/8 c c c c8. c16 c8
1255 If these automatic decisions are not satisfactory, beaming can be
1256 entered explicitly; see @ref{Manual beams}. It is also possible
1257 to define beaming patterns that differ from the defaults; see
1258 @ref{Setting automatic beam behavior}. The default beaming rules
1259 are defined in @file{scm/@/auto@/-beam@/.scm}.
1265 Automatic beaming may be turned off and on with
1266 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1268 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1269 c4 c8 c8. c16 c8. c16 c8
1279 Beaming patterns may be altered with the @code{beatGrouping} property,
1281 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1283 \set beatGrouping = #'(2 3)
1285 \set beatGrouping = #'(3 2)
1289 @c [TODO I think this could be worded more clearly, but I'm not sure how.] rp
1290 The property @code{subdivideBeams} can be set in order to
1291 subdivide all 16th or shorter beams. When set, multiple beams
1292 will be sub-divided at beat positions, defined by the current
1293 value of @code{beatLength} (defaults to a quarter note), by
1294 drawing only one beam over the connection between beats.
1296 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1298 \set subdivideBeams = ##t
1300 \set Score.beatLength = #(ly:make-moment 1 8)
1302 \set Score.beatLength = #(ly:make-moment 1 16)
1305 @funindex subdivideBeams
1308 For more information about @code{make-moment}, see
1309 @ref{Time administration}.
1315 Line breaks are normally forbidden when beams cross bar lines.
1316 This behavior can be changed by setting the @code{breakable}
1317 property: @code{\override Beam #'breakable = ##t}.
1319 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1320 \override Beam #'breakable = ##t
1321 c8 \repeat unfold 15 {c[ c] } c
1324 @cindex beams and line breaks
1325 @cindex beams, kneed
1327 @cindex auto-knee-gap
1329 Kneed beams are inserted automatically when a large gap is
1330 detected between the note heads. This behavior can be tuned
1331 through the @code{auto-knee-gap} property. A kneed beam is
1332 drawn if the gap is larger than the value of
1333 @code{auto-knee-gap} plus the width of the beam object (which
1334 depends on the duration of the notes and the slope of the beam).
1335 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1337 @lilypond[fragment,ragged-right,quote,verbatim]
1339 \override Beam #'auto-knee-gap = #6
1346 Notation Reference: @ref{Manual beams}, @ref{Setting automatic beam behavior}.
1348 Snippets: @lsrdir{rhythms}
1350 Internals Reference: @internalsref{Beam}.
1355 Automatically kneed cross-staff beams cannot be used together with
1356 hidden staves. See @ref{Hiding staves}.
1358 Beams can collide with noteheads and accidentals in other voices
1361 @node Setting automatic beam behavior
1362 @unnumberedsubsubsec Setting automatic beam behavior
1364 @funindex autoBeamSettings
1365 @funindex (end * * * *)
1366 @funindex (begin * * * *)
1367 @cindex automatic beams, tuning
1368 @cindex tuning automatic beaming
1370 @c [TODO: use \applyContext]
1372 In normal time signatures, automatic beams can start on any note
1373 but can only end in a few positions within the measure: beams can
1374 end on a beat, or at durations specified by the properties in
1375 @code{autoBeamSettings}. The properties in
1376 @code{autoBeamSettings} consist of a list of rules for where beams
1377 can begin and end. The default @code{autoBeamSettings} rules are
1378 defined in @file{scm/@/auto@/-beam@/.scm}.
1380 In order to add a rule to the list, use
1382 #(override-auto-beam-setting '(be p q n m) a b [context])
1387 @item @code{be} is either @code{begin} or @code{end}.
1389 @item @code{p/q} is the duration of the note for which you want
1390 to add a rule. A beam is considered to have the duration of its
1391 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1392 have this apply to any beam.
1394 @item @code{n/m} is the time signature to which
1395 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1396 to have this apply in any time signature.
1398 @item @code{a/b} is the position in the bar at which the beam should
1401 @item @code{context} is optional, and it specifies the context at which
1402 the change should be made. The default is @code{'Voice}.
1404 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1405 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1409 For example, if automatic beams should always end on the first quarter
1413 #(override-auto-beam-setting '(end * * * *) 1 4)
1416 You can force the beam settings to only take effect on beams whose shortest
1417 note is a certain duration
1419 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1421 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1423 a32 a a a a16 a a a a a |
1424 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1425 a32 a a a a16 a a a a a |
1428 You can force the beam settings to only take effect in certain time
1431 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1433 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1441 You can also remove a previously set beam-ending rule by using
1444 #(revert-auto-beam-setting '(be p q n m) a b [context])
1448 be, p, q, n, m, a, b and context are the same as above. Note that the
1449 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1450 so you can revert rules that you did not explicitly create.
1452 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1454 a16 a a a a a a a a a a a a a a a
1455 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1456 a16 a a a a a a a a a a a a a a a
1459 The rule in a revert-auto-beam-setting statement must exactly match the
1460 original rule. That is, no wildcard expansion is taken into account.
1462 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1464 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1466 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1468 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1474 @c TODO: old material -- not covered by above stuff, I think.
1475 If automatic beams should end on every quarter in 5/4 time, specify
1478 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1479 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1480 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1481 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1485 The same syntax can be used to specify beam starting points. In this
1486 example, automatic beams can only end on a dotted quarter note
1488 #(override-auto-beam-setting '(end * * * *) 3 8)
1489 #(override-auto-beam-setting '(end * * * *) 1 2)
1490 #(override-auto-beam-setting '(end * * * *) 7 8)
1492 In 4/4 time signature, this means that automatic beams could end only on
1493 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1494 3/8, has passed within the measure).
1496 If any unexpected beam behaviour occurs, check the default automatic beam
1497 settings in @file{scm/@/auto@/-beam@/.scm}
1498 for possible interference, because the beam
1499 endings defined there will still apply on top of your own overrides. Any
1500 unwanted endings in the default vales must be reverted for your time
1503 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1507 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1508 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1509 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1510 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1513 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1514 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1515 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1518 @cindex automatic beam generation
1520 @funindex autoBeaming
1523 If beams are used to indicate melismata in songs, then automatic
1524 beaming should be switched off with @code{\autoBeamOff}.
1529 @funindex \autoBeamOff
1530 @code{\autoBeamOff},
1531 @funindex \autoBeamOn
1537 If a score ends while an automatic beam has not been ended and is
1538 still accepting notes, this last beam will not be typeset at all.
1539 The same holds for polyphonic voices, entered with @code{<<
1540 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1541 automatic beam is still accepting notes, it is not typeset.
1545 Snippets: @lsrdir{rhythms}
1549 @unnumberedsubsubsec Manual beams
1551 @cindex beams, manual
1553 In some cases it may be necessary to override the automatic
1554 beaming algorithm. For example, the autobeamer will not put beams
1555 over rests or bar lines, and in choral scores the beaming is
1556 often set to follow the meter of the lyrics rather than the
1557 notes. Such beams can be specified manually by
1558 marking the begin and end point with @code{[} and @code{]}
1560 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1562 r4 r8[ g' a r8] r8 g[ | a] r8
1567 Individual notes may be marked with @code{\noBeam} to prevent them
1570 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1571 \time 2/4 c8 c\noBeam c c
1577 @funindex stemLeftBeamCount
1578 @funindex stemRightBeamCount
1580 Even more strict manual control with the beams can be achieved by
1581 setting the properties @code{stemLeftBeamCount} and
1582 @code{stemRightBeamCount}. They specify the number of beams to
1583 draw on the left and right side, respectively, of the next note.
1584 If either property is set, its value will be used only once, and
1585 then it is erased. In this example, the last @code{f} is printed
1586 with only one beam on the left side, i.e. the eigth-note beam of
1587 the group as a whole.
1589 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1593 \set stemLeftBeamCount = #1
1601 @cindex beams, feathered
1602 @funindex \featherDurations
1604 Feathered beams are used to indicate that a small group of notes
1605 should be played at an increasing (or decreasing) tempo, without
1606 changing the overall tempo of the piece. The extent of the
1607 feathered beam must be indicated manually using @code{[} and
1608 @code{]}, and the beam feathering is turned on by specifying a
1609 direction to the Beam property @code{grow-direction}.
1611 If the placement of the notes and the sound in the MIDI output
1612 is to reflect the ritardando or accelerando indicated by the
1613 feathered beam the notes must be grouped as a
1614 music expression delimited by braces and preceded by a
1615 @code{featheredDurations} command which specifies the ratio
1616 between the durations of the first and last notes in the group.
1619 show the extent of the beam and the braces show
1620 which notes are to have their durations modified. Normally
1621 these would delimit the same group of notes, but this is not
1622 required: the two commands are independent.
1624 In the following example the eight 16th notes occupy exactly the
1625 same time as a half note, but the first note is one half as long
1626 as the last one, with the intermediate notes gradually
1627 lengthening. The first four 32nd notes gradually speed up, while
1628 the last four 32nd notes are at a constant tempo.
1630 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1631 \override Beam #'grow-direction = #LEFT
1632 \featherDurations #(ly:make-moment 2 1)
1633 { c16[ c c c c c c c] }
1634 \override Beam #'grow-direction = #RIGHT
1635 \featherDurations #(ly:make-moment 2 3)
1637 % revert to non-feathered beams
1638 \override Beam #'grow-direction = #'()
1643 The spacing in the printed output represents the
1644 note durations only approximately, but the midi output is exact.
1648 The @code{\featherDurations} command only works with very short
1649 music snippets, and when numbers in the fraction are small.
1653 Snippets: @lsrdir{rhythms}
1664 * Bar and bar number checks::
1669 @unnumberedsubsubsec Bar lines
1673 @cindex measure lines
1676 Bar lines delimit measures, and are also used to indicate
1677 repeats. Normally, simple bar lines are automatically inserted
1678 into the printed output at places based on the current time
1681 The simple bar lines inserted automatically can be changed to
1682 other types with the @code{\bar} command. For example, a closing
1683 double bar line is usually placed at the end of a piece:
1685 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1689 @warning{An incorrect duration can lead to poorly formatted
1692 It is not invalid if the final note in a bar does not
1693 end on the automatically entered bar line: the note is assumed
1694 to carry over into the next bar. But if a long sequence
1695 of such carry-over bars appears the music can appear compressed
1696 or even flowing off the page. This is because automatic line
1697 breaks happen only at the end of complete bars, i.e. where
1698 the end of a note coincides with the end of a bar.
1701 @cindex bar lines, invisible
1702 @cindex measure lines, invisible
1704 Line breaks are also permitted at manually inserted bar lines
1705 even within incomplete bars. To allow a line break without
1706 printing a bar line, use
1713 This will insert an invisible bar line and allow (but not
1714 force) a line break to occur at this point. The bar number
1715 counter is not increased. To force a line break see
1716 @ref{Line breaking}.
1718 This and other special bar lines may be inserted manually at any
1719 point. When they coincide with the end of a bar they replace
1720 the simple bar line which would have been inserted there
1721 automatically. When they do not coincide
1722 with the end of a bar the specified bar line is inserted at that
1723 point in the printed output. Such insertions do not affect
1724 the calculation and placement of subsequent automatic bar lines.
1726 The simple bar line and four types of double bar line are available
1727 for manual insertion:
1729 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1730 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1734 together with dotted and dashed bar lines:
1736 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1737 f1 \bar ":" g \bar "dashed" a
1741 and three types of repeat bar line:
1743 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1744 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1749 Although the bar line types signifying repeats may be inserted
1750 manually they do not in themselves cause LilyPond to recognise
1751 a repeated section. Such repeated sections are better entered
1752 using the various repeat commands (see @ref{Repeats}), which
1753 automatically print the appropriate bar lines.
1755 In addition, you can specify @code{"||:"}, which is equivalent to
1756 @code{"|:"} except at line breaks, where it gives a double bar
1757 line at the end of the line and a start repeat at the beginning of
1760 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1761 \override Score.RehearsalMark #'padding = #3
1769 In scores with many staves, a @code{\bar} command in one staff is
1770 automatically applied to all staves. The resulting bar lines are
1771 connected between different staves of a @code{StaffGroup},
1772 @code{PianoStaff}, or @code{GrandStaff}.
1774 @lilypond[quote,ragged-right,fragment,verbatim]
1782 \new Staff { \clef bass c4 g e g }
1784 \new Staff { \clef bass c2 c2 }
1792 @funindex defaultBarType
1794 The command @code{\bar }@var{bartype} is a shortcut for
1795 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1796 created whenever the @code{whichBar} property is
1799 The default bar type used for automatically inserted bar lines is
1800 @code{"|"}. This may be changed at any time
1801 with @code{\set Timing.defaultBarType = }@var{bartype}.
1805 Notation Reference: @ref{Line breaking}, @ref{Repeats},
1806 @ref{System start delimiters}.
1808 Snippets: @lsrdir{rhythms}
1810 Internals Reference: @internalsref{BarLine} (created at
1811 @internalsref{Staff} level), @internalsref{SpanBar} (across
1812 staves), @internalsref{Timing_translator} (for Timing
1817 @unnumberedsubsubsec Bar numbers
1820 @cindex measure numbers
1821 @funindex currentBarNumber
1823 Bar numbers are typeset by default at the start of every line except
1824 the first line. The number itself is stored in the
1825 @code{currentBarNumber} property, which is normally updated
1826 automatically for every measure. It may also be set manually:
1828 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1831 \set Score.currentBarNumber = #50
1838 @funindex barNumberVisibility
1839 @cindex bar numbers, regular spacing
1841 Bar numbers can be typeset at regular intervals instead of just at
1842 the beginning of every line. To do this the default behaviour
1843 must be overridden to permit bar numbers to be printed at places
1844 other than the start of a line. This is controlled by the
1845 @code{break-visibility} property of @code{BarNumber}. This takes
1846 three values which may be set to @code{#t} or @code{#f} to specify
1847 whether the corresponding bar number is visible or not. The order
1848 of the three values is @code{end of line visible}, @code{middle of
1849 line visible}, @code{beginning of line visible}. In the following
1850 example bar numbers are printed at all possible places:
1852 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1853 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1854 \set Score.currentBarNumber = #11
1855 \bar "" % Permit first bar number to be printed
1861 @c All the rest of these examples will be added to LSR
1862 @c and moved into the Snippets. -gp
1865 and here the bar numbers are printed every two bars
1866 except at the end of the line:
1868 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1869 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1870 \set Score.currentBarNumber = #11
1871 \bar "" % Permit first bar number to be printed
1872 % Print a bar number every 2nd bar
1873 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1879 @cindex measure number, format
1880 @cindex bar number, format
1882 The size of the bar number may be changed. This is illustrated
1883 in the following example, which also shows how to enclose bar
1884 numbers in boxes and circles, and shows an alternative way
1885 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
1887 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1888 % Prevent bar numbers at the end of a line and permit them elsewhere
1889 \override Score.BarNumber #'break-visibility
1890 = #end-of-line-invisible
1892 % Increase the size of the bar number by 2
1893 \override Score.BarNumber #'font-size = #2
1894 \repeat unfold 3 { c1 } \bar "|"
1896 % Draw a box round the following bar number(s)
1897 \override Score.BarNumber #'stencil
1898 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1899 \repeat unfold 3 { c1 } \bar "|"
1901 % Draw a circle round the following bar number(s)
1902 \override Score.BarNumber #'stencil
1903 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1904 \repeat unfold 4 { c1 } \bar "|."
1907 @cindex bar number alignment
1909 Bar numbers by default are left-aligned to their parent object.
1910 This is usually the left edge of a line or, if numbers are printed
1911 within a line, the left bar line of the bar. The numbers may also
1912 be positioned directly on the bar line or right-aligned to the
1915 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1916 \set Score.currentBarNumber = #111
1917 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1918 % Increase the size of the bar number by 2
1919 \override Score.BarNumber #'font-size = #2
1920 % Print a bar number every 2nd bar
1921 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1923 % Centre-align bar numbers
1924 \override Score.BarNumber #'self-alignment-X = #0
1926 % Right-align bar numbers
1927 \override Score.BarNumber #'self-alignment-X = #-1
1931 Bar numbers can be removed entirely by removing the Bar number
1932 engraver from the score context.
1934 @lilypond[verbatim,ragged-right,quote]
1938 \remove "Bar_number_engraver"
1950 Snippets: @lsrdir{rhythms}
1952 Internals Reference: @internalsref{BarNumber}.
1954 Examples: @lsrdir{bar number}
1959 Bar numbers may collide with the top of the
1960 @internalsref{StaffGroup} bracket, if there is one. To solve
1961 this, the @code{padding} property of @internalsref{BarNumber} can
1962 be used to position the number correctly.
1964 Bar numbers may only be printed at bar lines; to print a bar
1965 number at the beginning of a piece, an empty bar line must be
1966 inserted there, and a value other than @code{1} must be placed
1967 in @code{currentBarNumber}:
1969 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1970 \set Score.currentBarNumber = #50
1979 @node Bar and bar number checks
1980 @unnumberedsubsubsec Bar and bar number checks
1983 @funindex barCheckSynchronize
1986 Bar checks help detect errors in the entered durations.
1987 A bar check may be entered using the bar symbol, @code{|},
1988 at any place where a bar line is expected to fall.
1989 If bar check lines are encountered at other places,
1990 a list of warnings is printed in the log file,
1991 showing the line numbers and lines
1992 in which the bar checks failed. In the next
1993 example, the second bar check will signal an error.
1996 \time 3/4 c2 e4 | g2 |
1999 Bar checks can also be used in lyrics, for example
2004 Twin -- kle | Twin -- kle |
2008 An incorrect duration can result in a completely garbled score,
2009 especially if the score is polyphonic, so a good place to start
2010 correcting input is by scanning for failed bar checks and
2011 incorrect durations.
2014 @funindex pipeSymbol
2016 It is also possible to redefine the action taken when a bar check
2017 or pipe symbol, @code{|}, is encountered in the input, so that
2018 it does something other than a bar check. This is done by
2019 assigning a music expression to @code{pipeSymbol}.
2020 In the following example @code{|} is set to insert a double bar
2021 line wherever it appears in the input, rather than checking
2024 @lilypond[quote,ragged-right,verbatim]
2025 pipeSymbol = \bar "||"
2034 When copying large pieces of music, it can be helpful to check
2035 that the LilyPond bar number corresponds to the original that you
2036 are entering from. This can be checked with
2037 @code{\barNumberCheck}, for example,
2040 \barNumberCheck #123
2044 will print a warning if the @code{currentBarNumber} is not 123
2045 when it is processed.
2049 Snippets: @lsrdir{rhythms}
2052 @node Rehearsal marks
2053 @unnumberedsubsubsec Rehearsal marks
2055 @cindex rehearsal marks
2056 @cindex mark, rehearsal
2059 To print a rehearsal mark, use the @code{\mark} command
2061 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2070 The letter@tie{}@q{I} is skipped in accordance with engraving
2071 traditions. If you wish to include the letter @q{I}, then use
2074 \set Score.markFormatter = #format-mark-alphabet
2077 The mark is incremented automatically if you use @code{\mark
2078 \default}, but you can also use an integer argument to set the
2079 mark manually. The value to use is stored in the property
2080 @code{rehearsalMark}.
2082 @cindex rehearsal mark format
2083 @cindex rehearsal mark style
2084 @cindex style, rehearsal mark
2085 @cindex format, rehearsal mark
2086 @cindex mark, rehearsal, style
2087 @cindex mark, rehearsal, format
2089 The style is defined by the property @code{markFormatter}. It is
2090 a function taking the current mark (an integer) and the current
2091 context as argument. It should return a markup object. In the
2092 following example, @code{markFormatter} is set to a pre-defined
2093 procedure. After a few measures, it is set to a procedure that
2094 produces a boxed number.
2096 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2097 \set Score.markFormatter = #format-mark-numbers
2100 \set Score.markFormatter = #format-mark-box-numbers
2106 The file @file{scm/@/translation@/-functions@/.scm} contains the
2107 definitions of @code{format-mark-numbers} (the default format),
2108 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2109 @code{format-mark-box-letters}. These can be used as inspiration
2110 for other formatting functions.
2112 You may use @code{format-mark-barnumbers},
2113 @code{format-mark-box-barnumbers}, and
2114 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2115 incremented numbers or letters.
2117 Other styles of rehearsal mark can be specified manually
2124 @code{Score.markFormatter} does not affect marks specified in this
2125 manner. However, it is possible to apply a @code{\markup} to the
2129 \mark \markup@{ \box A1 @}
2136 Music glyphs (such as the segno sign) may be printed inside a
2139 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2140 c1 \mark \markup { \musicglyph #"scripts.segno" }
2141 c1 \mark \markup { \musicglyph #"scripts.coda" }
2142 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2147 See @ref{The Feta font}, for a list of symbols which may be
2148 printed with @code{\musicglyph}.
2150 For common tweaks to the positioning of rehearsal marks, see
2155 Snippets: @lsrdir{rhythms}
2157 This manual: @ref{The Feta font}, @ref{Text marks}.
2159 Internals Reference: @internalsref{RehearsalMark}.
2161 Init files: @file{scm/@/translation@/-functions@/.scm} contains
2162 the definition of @code{format-mark-numbers} and
2163 @code{format-mark-letters}. They can be used as inspiration for
2164 other formatting functions.
2166 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
2169 @node Special rhythmic concerns
2170 @subsection Special rhythmic concerns
2175 * Aligning to cadenzas::
2176 * Time administration::
2180 @unnumberedsubsubsec Grace notes
2185 @cindex appoggiatura
2186 @cindex acciaccatura
2188 Grace notes are ornaments that are written out. They are made with
2189 the @code{\grace} command. By prefixing this keyword to a music
2190 expression, a new one is formed, which will be printed in a
2191 smaller font and takes up no logical time in a measure.
2193 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2195 \grace { c16[ d16] } c2 c4
2198 Two special forms of the @code{\grace} command exist.
2199 An @emph{acciaccatura}, which should be played as very short,
2200 is denoted by a slurred small note with a slashed stem. The
2201 @emph{appoggiatura}, a grace note that takes a fixed fraction of the
2202 main note, is denoted as a slurred note in small print without
2203 a slash. They are entered with the commands @code{\acciaccatura}
2204 and @code{\appoggiatura}, as demonstrated in the following
2207 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2208 b4 \acciaccatura d8 c4
2210 \acciaccatura { g16[ f] } e4
2214 @code{\acciaccatura} and @code{\appoggiatura} start a slur,
2215 @code{\grace} does not.
2217 The placement of grace notes is synchronized between different
2218 staves. In the following example, there are two sixteenth grace
2219 notes for every eighth grace note
2221 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2222 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2223 \new Staff { c4 \grace { g8[ b] } c4 } >>
2226 @funindex \afterGrace
2228 @cindex grace notes, following
2230 If you want to end a note with a grace, use the @code{\afterGrace}
2231 command. It takes two arguments: the main note, and the grace
2232 notes following the main note.
2234 @lilypond[ragged-right, verbatim,relative=2,fragment]
2235 c1 \afterGrace d1 { c16[ d] } c4
2238 This will put the grace notes after a @q{space} lasting 3/4 of the
2239 length of the main note. The fraction 3/4 can be changed by
2240 setting @code{afterGraceFraction}, ie.
2243 #(define afterGraceFraction (cons 7 8))
2247 will put the grace note at 7/8 of the main note.
2249 The same effect can be achieved manually by doing
2251 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2254 { s2 \grace { c16[ d] } } >>
2260 By adjusting the duration of the skip note (here it is a
2261 half-note), the space between the main-note and the grace
2264 A @code{\grace} music expression will introduce special
2265 typesetting settings, for example, to produce smaller type, and
2266 set directions. Hence, when introducing layout tweaks, they
2267 should be inside the grace expression, for example,
2269 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2281 The overrides should also be reverted inside the grace expression.
2283 The layout of grace expressions can be changed throughout the
2284 music using the function @code{add-grace-property}. The following
2285 example undefines the @code{Stem} direction for this grace, so
2286 that stems do not always point up.
2290 #(add-grace-property 'Voice 'Stem 'direction '())
2296 Another option is to change the variables @code{startGraceMusic},
2297 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2298 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2299 @code{stopAppoggiaturaMusic}. The default values of these can be
2300 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2301 them other effects may be obtained.
2303 @cindex stem, with slash
2306 The slash through the stem in @emph{acciaccatura}s can be obtained in
2307 other situations by @code{\override Stem #'stroke-style =
2313 Grace notes may be forced to use align with regular notes
2314 in other staves by setting @code{strict-grace-spacing} to
2317 @lilypond[relative=2,ragged-right]
2319 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2328 c'16[ c'16 c'16 c'16]
2329 c'16[ c'16 c'16 c'16]
2338 Music Glossary: @rglos{grace notes}, @rglos{acciaccatura},
2339 @c [TODO add appoggiatura]
2341 Snippets: @lsrdir{rhythms}
2343 Internals Reference: @internalsref{GraceMusic}.
2348 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2349 and looks exactly the same as a multi-note beamed
2350 @emph{appoggiatura}.
2351 @c TODO Add link to LSR snippet to add slash when available
2353 Grace note synchronization can also lead to surprises. Staff
2354 notation, such as key signatures, bar lines, etc., are also
2355 synchronized. Take care when you mix staves with grace notes and
2356 staves without, for example,
2358 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2359 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2360 \new Staff { c4 \bar "|:" d4 } >>
2364 This can be remedied by inserting grace skips of the corresponding
2365 durations in the other staves. For the above example
2367 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2368 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2369 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2372 Grace sections should only be used within sequential music
2373 expressions. Nesting or juxtaposing grace sections is not
2374 supported, and might produce crashes or other errors.
2376 @node Aligning to cadenzas
2377 @unnumberedsubsubsec Aligning to cadenzas
2380 @cindex cadenza, aligning to
2381 @cindex aligning to cadenza
2383 In an orchestral context, cadenzas present a special problem: when
2384 constructing a score that includes a cadenza, all other
2385 instruments should skip just as many notes as the length of the
2386 cadenza, otherwise they will start too soon or too late.
2388 A solution to this problem is to use the functions
2389 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2390 functions take a piece of music as argument, and generate a multi-rest
2391 or @code{\skip}, exactly as long as the piece. The use of
2392 @code{mmrest-of-length} is demonstrated in the following example.
2394 @lilypond[verbatim,ragged-right,quote]
2395 cadenza = \relative c' {
2396 c4 d8 << { e f g } \\ { d4. } >>
2401 \new Staff { \cadenza c'4 }
2403 #(ly:export (mmrest-of-length cadenza))
2411 Snippets: @lsrdir{rhythms}
2414 @node Time administration
2415 @unnumberedsubsubsec Time administration
2417 @cindex time administration
2418 @cindex timing (within the score)
2419 @cindex music, unmetered
2420 @cindex unmetered music
2422 @funindex currentBarNumber
2423 @funindex measurePosition
2424 @funindex measureLength
2426 Time is administered by the @code{Timing_translator}, which by
2427 default is to be found in the @code{Score} context. An alias,
2428 @code{Timing}, is added to the context in which the
2429 @code{Timing_translator} is placed.
2431 The following properties of @code{Timing} are used
2432 to keep track of timing within the score.
2435 @cindex measure number
2438 @item currentBarNumber
2439 The current measure number. For an example showing the
2440 use of this property see @ref{Bar numbers}.
2443 The length of the measures in the current time signature. For a
2444 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2445 determines when bar lines are inserted and how automatic beams
2446 should be generated.
2448 @item measurePosition
2449 The point within the measure where we currently are. This
2450 quantity is reset by subtracting @code{measureLength} whenever
2451 @code{measureLength} is reached or exceeded. When that happens,
2452 @code{currentBarNumber} is incremented.
2455 If set to true, the above variables are updated for every time
2456 step. When set to false, the engraver stays in the current
2457 measure indefinitely.
2461 Timing can be changed by setting any of these variables
2462 explicitly. In the next example, the default 4/4 time
2463 signature is printed, but @code{measureLength} is set to 5/4.
2464 At 4/8 through the third measure, the @code{measurePosition} is
2465 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2466 The next bar line then falls at 9/8 rather than 5/4.
2468 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2469 \set Score.measureLength = #(ly:make-moment 5 4)
2473 \set Score.measurePosition = #(ly:make-moment 5 8)
2479 As the example illustrates, @code{ly:make-moment n m} constructs a
2480 duration of n/m of a whole note. For example,
2481 @code{ly:make-moment 1 8} is an eighth note duration and
2482 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2488 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2490 Snippets: @lsrdir{rhythms}
2492 Internals Reference: @internalsref{Timing_translator},
2493 @internalsref{Score}