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.
14 @lilypondfile[quote]{rhythms-headword.ly}
16 This section discusses rhythms, rests, durations, beaming and bars.
21 * Displaying rhythms::
24 * Special rhythmic concerns::
29 @subsection Writing rhythms
39 @subsubsection Durations
41 @cindex durations, of notes
42 @cindex note durations
48 Durations are designated by numbers and dots.
49 Durations are entered as their reciprocal values. For example, a
50 quarter note is entered using a @code{4} (since it is a 1/4 note),
51 and a half note is entered using a @code{2} (since it is a 1/2
52 note). For notes longer than a whole you must use the
53 @code{\longa} (a double breve) and @code{\breve} commands.
54 Durations as short as 64th notes may be specified. Shorter values
55 are possible, but only as beamed notes.
57 @c Two 64th notes are needed to obtain beams
58 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
65 Here are the same durations with automatic beaming turned off.
67 @c not strictly "writing rhythms"; more of a "displaying" thing,
68 @c but it's ok here. -gp
69 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
76 A note with the duration of a quadruple breve may be entered with
77 @code{\maxima}, but this is supported only within ancient music
78 notation. For details, see @ref{Ancient notation}.
80 If the duration is omitted, it is set to the previously
81 entered duration. The default for the first note is a quarter
84 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
93 To obtain dotted note lengths, place a dot (@code{.}) after the
94 duration. Double-dotted notes are specified by appending two
97 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
98 a4 b c4. b8 a4. b4.. c8.
101 Some durations cannot be represented with just binary durations
102 and dots; they can be represented only by tying two or more
103 notes together. For details, see @ref{Ties}.
105 For ways of specifying durations for the syllables of lyrics and
106 ways of aligning lyrics to notes, see @ref{Vocal music}.
108 Optionally, notes can be spaced strictly proportionately to their
109 duration. For details of this and other settings which control
110 proportional notation, see @ref{Proportional notation}.
114 @funindex \dotsNeutral
116 Dots are normally moved up to avoid staff lines, except in
117 polyphonic situations. Predefined commands are available to
118 force a particular direction manually, for details
119 see @ref{Controlling direction and placement}.
135 @rglos{Duration names notes and rests}.
138 @ref{Automatic beams},
140 @ref{Writing rhythms},
143 @ref{Ancient notation},
144 @ref{Proportional notation}.
146 Snippets: @lsrdir{Rhythms,Rhythms}.
150 @internalsref{DotColumn}.
155 @c Deliberately duplicated in Durations and Rests. -gp
156 There is no fundamental limit to rest durations (both in terms of
157 longest and shortest), but the number of glyphs is limited:
158 rests from 128th to maxima (8 x whole) may be printed.
162 @subsubsection Tuplets
168 Tuplets are made from a music expression by multiplying all the
169 durations with a fraction:
172 \times @var{fraction} @{ @var{music} @}
176 The duration of @var{music} will be multiplied by the
177 fraction. The fraction's denominator will be printed over or
178 under the notes, optionally with a bracket. The most common
179 tuplet is the triplet in which 3 notes have the duration of 2, so
180 the notes are 2/3 of their written length.
182 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
183 a2 \times 2/3 { b4 b b }
184 c4 c \times 2/3 { b4 a g }
189 @funindex \tupletDown
190 @funindex \tupletNeutral
192 The automatic placement of the tuplet bracket above or below the
193 notes may be overridden manually with predefined commands, for
194 details see @ref{Controlling direction and placement}.
196 Tuplets may be nested:
198 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
200 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
203 Modifying nested tuplets which begin at the same musical moment
204 must be done with @code{\tweak}.
206 To modify the duration of notes without printing a tuplet bracket,
207 see @ref{Scaling durations}.
213 @code{\tupletNeutral}.
218 @cindex tuplet formatting
219 @cindex triplet formatting
221 @funindex tupletNumberFormatFunction
222 @funindex tupletSpannerDuration
224 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
225 {entering-several-tuplets-using-only-one--times-command.ly}
227 @funindex TupletNumber
229 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
230 {changing-the-tuplet-number.ly}
232 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
233 {permitting-line-breaks-within-beamed-tuplets.ly}
242 Learning Manual: @rlearning{Tweaking methods}.
245 @ref{Time administration},
246 @ref{Scaling durations},
247 @ref{Objects connected to the input},
248 @ref{Polymetric notation}.
250 Snippets: @lsrdir{Rhythms,Rhythms}.
253 @internalsref{TupletBracket},
254 @internalsref{TupletNumber},
255 @internalsref{TimeScaledMusic}.
258 @cindex grace notes within tuplet brackets
259 When the very first note on a staff is a grace note followed by a
260 tuplet the grace note must be placed before the @code{\times}
261 command to avoid errors. Anywhere else, grace notes may be
262 placed within tuplet brackets.
265 @node Scaling durations
266 @subsubsection Scaling durations
268 @cindex scaling durations
269 @cindex durations, scaling
271 TODO Change \compressMusic to \scaleDurations when implemented.
273 You can alter the duration of single notes, rests or chords by a
274 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if
275 @code{M} is 1) to the duration.
276 This will not affect the appearance of the notes or rests
277 produced, but the altered duration will be used in calculating the
278 position within the measure and setting the duration in the MIDI
279 output. Multiplying factors may be combined such as @code{*L*M/N}.
281 In the following example, the first three notes take up exactly
282 two beats, but no triplet bracket is printed.
284 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
286 % Alter durations to triplets
287 a4*2/3 gis4*2/3 a4*2/3
290 % Double the duration of chord
292 % Duration of quarter, appears like sixteenth
296 The duration of skip or spacing notes may also be modified by
297 a multiplier. This is useful for skipping many measures, e.g.,
300 @cindex compressing music
301 @funindex \compressMusic
303 Longer stretches of music may be compressed by a fraction in
304 the same way, as if every note, chord or rest had the fraction
305 as a multiplier. The general syntax of the command to do this
309 \compressMusic #'(@emph{num} . @emph{den}) @{ @emph{music} @}
313 This will leave the appearance of @emph{music} unchanged but
314 the internal duration of the notes will be multiplied by the
315 fraction @emph{num}/@emph{den}. The spaces around the dot
316 are required. Here is an example showing how music can be
317 compressed and expanded:
319 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
323 % Scale music by *2/3
324 \compressMusic #'(2 . 3) {
328 \compressMusic #'(2 . 1) {
334 One application of this command is in polymetric
335 notation, see @ref{Polymetric notation}.
343 @ref{Polymetric notation}.
345 Snippets: @lsrdir{Rhythms,Rhythms}
354 A tie connects two adjacent note heads of the same pitch. The tie
355 in effect extends the duration 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]
381 If you need to tie many notes across bar lines, it may be
382 easier to use automatic note splitting, see @ref{Automatic note
383 splitting}. This mechanism automatically splits long notes, and
384 ties them across bar lines.
386 @cindex ties and chords
387 @cindex chords 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>
400 @cindex repeating ties
401 @cindex ties, repeating
402 @cindex volta brackets and ties
403 @cindex ties and volta brackets
405 When a second alternative of a repeat starts with a tied note, you
406 have to specify the repeated tie as follows:
408 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
409 \repeat volta 2 { c g <c e>2 ~ }
411 % First alternative: following note is tied normally
413 % Second alternative: following note has a repeated tie
414 { <c e>2\repeatTie d4 c } }
417 @cindex laissez vibrer
418 @cindex ties, laissez vibrer
419 @funindex \laissezVibrer
421 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
422 notes must not be damped at the end. It is used in notation for
423 piano, harp and other string and percussion instruments. They can
424 be entered as follows:
426 @lilypond[fragment,quote,ragged-right,verbatim,relative=1]
427 <c f g>\laissezVibrer
430 @cindex ties, placement
433 @funindex \tieNeutral
435 The vertical placement of ties may be controlled, see
436 Predefined commands, or for details, see
437 @ref{Controlling direction and placement}.
439 @cindex ties, appearance
444 Solid, dotted or dashed ties may be specified, see Predefined
460 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
461 {using-ties-with-arpeggios.ly}
463 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
464 {engraving-ties-manually.ly}
471 @rglos{laissez vibrer}.
473 Notation Reference: @ref{Automatic note splitting}.
475 Snippets: @lsrdir{Rhythms,Rhythms}
478 @internalsref{LaissezVibrerTie},
479 @internalsref{LaissezVibrerTieColumn},
480 @internalsref{TieColumn},
486 Switching staves when a tie is active will not produce a slanted
489 Changing clefs or octavations during a tie is not really
490 well-defined. In these cases, a slur may be preferable.
497 @subsection Writing rests
502 * Full measure rests::
518 Rests are entered like notes with the note name @code{r};
519 longer rests with the predefined commands shown:
521 @c \time 16/1 is used to avoid spurious bar lines
522 @c and long tracts of empty measures
523 @lilypond[fragment,quote,ragged-right,verbatim]
525 % These two lines are just to prettify this example
527 \override Staff.TimeSignature #'stencil = ##f
528 % Print a maxima rest, equal to four breves
530 % Print a longa rest, equal to two breves
534 r1 r2 r4 r8 r16 r32 r64
538 Whole measure rests, centered in the middle of the measure, must
539 be entered as multi-measure rests. They can be used for a single
540 measure as well as many measures and are discussed in
541 @ref{Full measure rests}.
543 To explicitly specify a rest's vertical position, write a note
544 followed by @code{\rest}. A rest will be placed in the position
545 where the note would appear. This allows for precise manual
546 formatting of polyphonic music, since the automatic rest collision
547 formatter will leave these rests alone.
549 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
555 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
561 Notation Reference: @ref{Full measure rests}
563 Snippets: @lsrdir{Rhythms,Rhythms}
565 Internals Reference: @internalsref{Rest}
570 @c Deliberately duplicated in Durations and Rests. -gp
571 There is no fundamental limit to rest durations (both in terms of
572 longest and shortest), but the number of glyphs is limited: there
573 are rests from 128th to maxima (8 x whole).
579 @cindex invisible rest
580 @cindex rest, invisible
586 An invisible rest (also called a @q{skip rest}) can be entered like a
587 note with note name @code{s} or with the predefined skip command
588 followed by the required duration, as shown here:
590 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
591 % Skip the third beat in the first measure
593 % Use skip command to skip a whole note (measure)
600 The @code{s} syntax is only available in note mode and chord mode.
601 In other situations, for example, when entering lyrics, one must
602 use the predefined skip command:
604 @lilypond[quote,ragged-right,verbatim,relative=2]
607 \new Lyrics \lyricmode { \skip 2 bla2 }
611 The @code{s} skip rest implicitly causes @code{Staff} and
612 @code{Voice} contexts to be created if none exist, just
613 like notes and rests do. These in turn cause a staff with default
614 clef and time signature to be printed, with bar lines if necessary.
615 For example, the following results in a complete staff with three
616 short empty measures:
618 @lilypond[quote,verbatim,fragment,ragged-right]
622 However, the predefined skip command behaves differently: it is
623 merely an empty musical placeholder. It does not create any
624 contexts and does not cause anything to be printed, not even
625 transparently. On its own it does not even print an
629 % This is valid input, but does nothing
635 Snippets: @lsrdir{Rhythms,Rhythms}
637 Internals Reference: @internalsref{SkipMusic}
640 @node Full measure rests
641 @subsubsection Full measure rests
643 @cindex multi-measure rests
644 @cindex full-measure rests
645 @cindex rest, multi-measure
646 @cindex rest, full-measure
647 @cindex whole rest for a full measure
650 Rests for one or more full measures are entered like notes with
651 the note name uppercase @code{R}:
653 @lilypond[quote,fragment,verbatim,relative=2]
654 % Rest bars contracted to single bar
655 \compressFullBarRests
662 @funindex \expandFullBarRests
663 @funindex \compressFullBarRests
664 @cindex multi-measure rest, expanding
665 @cindex multi-measure rest, contracting
667 By default a multi-measure rest is expanded in the printed score
668 to show all the rest measures explicitly or (as in the example
669 above) it can be contracted to a single measure containing a
670 multi-measure rest symbol, with the number of measures of rest
671 printed above the measure:
673 @lilypond[quote,ragged-right,fragment,verbatim]
675 \time 3/4 r2. | R2.*2 |
678 % Rest measures contracted to single measure
679 \compressFullBarRests
681 % Rest measures expanded
687 The @code{1} in @code{R1} is similar to the duration notation
688 used for notes and is the length of a measure in 2/2 or 4/4 time.
689 The duration in a multi-measure rest must always be an integral
690 number of measure-lengths, so in other time signatures augmentation
691 dots or fractions must be used:
693 @lilypond[quote,ragged-right,fragment,verbatim]
694 \compressFullBarRests
698 R1*13/8 | R1*13/8*12 |
703 An @code{R} spanning a single measure is printed as either a whole
704 or breve rest, centered in the measure, regardless of the time
708 @cindex text on multi-measure rest
709 @cindex multi-measure rest, attaching text
710 @cindex script on multi-measure rest
711 @cindex multi-measure rest, script
712 @cindex fermata on multi-measure rest
713 @cindex multi-measure rest, attaching fermata
715 Text can be added to multi-measure rests by using the
716 @var{note} - @code{\markup} syntax described in
717 @ref{Formatting text}. The predefined command @code{\fermataMarkup}
718 is provided for adding fermatas.
720 @lilypond[quote,ragged-right,verbatim,fragment]
721 \compressFullBarRests
723 R2.*10^\markup { \italic "ad lib." }
727 @warning{Text attached to a multi-measure rest is created
728 by @code{MultiMeasureRestText}, not
729 @code{TextScript}. Overrides must be directed to the correct
730 object, or they will be ignored. See the following example.}
732 @lilypond[quote,ragged-right,verbatim,fragment]
733 % This fails, as the wrong object name is specified
734 \override TextScript #'padding = #5
736 % This is correct and works
737 \override MultiMeasureRestText #'padding = #5
741 Text attached to a multi-measure rest will be centered above or
742 below it. Long text attached in this way does not cause the
743 measure to expand, and may collide with text in adjacent measures.
744 This behavior may be changed with the predefined command
745 @code{\textLengthOn}, which will cause following bars to expand
746 as necessary to accommodate text. @code{\textLengthOff} returns
747 to the default behavior. To left-align text within a bar attach
748 it to a zero-length skip note preceding the rest.
750 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
751 \compressFullBarRests
753 s1*0^\markup { [MAJOR GENERAL] }
755 s1*0^\markup { [MABEL] }
756 s1*0_\markup { \italic { Cue: ... it is yours } }
759 c4^\markup { CHORUS } d f c
763 Text attached to a skip note in this way is left-aligned to the
764 position where the note would be placed in the measure, and placed
765 above the measure count numeral, but if the measure length is
766 determined by the length of the text, the text will appear to be
767 centered. If two (or more) texts are
768 attached to skip notes in a measure the measure length is determined by
769 the longer text, and the shorter text is then clearly
770 left-aligned, as shown in the second measure above. If the shorter
771 text of two marks is short enough to fit it will be placed
772 alongside and to the left of the measure count numeral.
775 @code{\textLengthOn},
776 @code{\textLengthOff},
777 @code{\fermataMarkup},
778 @code{\compressFullBarRests},
779 @code{\expandFullBarRests}.
785 @cindex kirchenpausen
787 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
788 {changing-form-of-multi--measure-rests.ly}
790 @cindex multi-measure rests, positioning
791 @cindex positioning multi-measure rests
793 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
794 {positioning-multi--measure-rests.ly}
799 @rglos{multi-measure rest},
800 @rglos{church rests}.
805 @ref{Formatting text},
808 Snippets: @lsrdir{Rhythms,Rhythms}
811 @internalsref{MultiMeasureRest},
812 @internalsref{MultiMeasureRestNumber},
813 @internalsref{MultiMeasureRestText}.
818 If an attempt is made to use fingerings (e.g.,
819 @code{R1*10-4}) to put numbers over multi-measure rests, the
820 fingering numeral (4) may collide with the bar counter
823 @cindex condensing rests
824 @cindex rests, condensing ordinary
826 There is no way to automatically condense multiple ordinary rests
827 into a single multi-measure rest.
829 @cindex rests, collisions of
831 Multi-measure rests do not take part in rest collisions.
833 Be careful when entering multi-measure rests followed by whole
834 notes. The following will enter two notes lasting four measures
842 @node Displaying rhythms
843 @subsection Displaying rhythms
849 * Polymetric notation::
850 * Automatic note splitting::
854 @subsubsection Time signature
856 @cindex time signature
860 The time signature is set as follows:
862 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
867 @cindex Time signature, visibility of
869 Time signatures by default are printed at the start of every line
870 and whenever the time signature changes. If a change takes place
871 at the end of a line a warning time signature sign is printed
872 there. This default behavior may be changed, see
873 @ref{Controlling visibility of objects}.
875 @funindex \numericTimeSignature
876 @funindex \defaultTimeSignature
877 @cindex time signature style
879 The symbol that is printed in 2/2 and 4/4 time can be customized
880 to use a numeric style:
882 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
886 % Change to numeric style
887 \numericTimeSignature
890 % Revert to default style
891 \defaultTimeSignature
897 Ancient time signatures are covered in
898 @ref{Ancient time signatures}.
902 @code{\numericTimeSignature},
903 @code{\defaultTimeSignature}.
907 @c TODO Send as snippet called "setting measure and beat lengths"
908 @c when example is added
909 @code{\time} sets the properties @code{timeSignatureFraction},
910 @code{beatLength}, and @code{measureLength} in the @code{Timing}
911 context, which is normally aliased to @code{Score}. Changing the
912 value of @code{timeSignatureFraction} causes the new time
913 signature symbol to be printed without changing the other
914 properties. The property @code{measureLength} determines where
915 bar lines should be inserted and, with @code{beatLength}, how
916 automatic beams should be generated.
918 TODO Add example of using beatLength.
919 @c beatLength is broken - see bug 511
923 @cindex measure groupings
924 @cindex beats, grouping
925 @cindex grouping beats
926 @cindex measure sub-grouping
928 @c TODO Sent as snippet called "grouping beats" 25 Mar 08
929 Options to group beats within a bar are available through the
930 Scheme function @code{set-time-signature}, which takes three
931 arguments: the number of beats, the beat length, and the internal
932 grouping of beats in the measure. If the
933 @internalsref{Measure_grouping_engraver} is included, the function
934 will also create @internalsref{MeasureGrouping} signs. Such signs
935 ease reading rhythmically complex modern music. In the example,
936 the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
937 @code{set-time-signature} as the third argument: @code{'(2 2 2 3)}:
939 @lilypond[quote,ragged-right,verbatim]
942 #(set-time-signature 9 8 '(2 2 2 3))
943 g8[ g] d[ d] g[ g] a8[( bes g]) |
944 #(set-time-signature 5 8 '(3 2))
950 \consists "Measure_grouping_engraver"
955 @c TODO End of snippet called "grouping beats"
957 @cindex compound time signatures
958 @cindex time signature, compound
960 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
961 {compound-time-signatures.ly}
967 @rglos{time signature}
970 @ruser{Ancient time signatures},
971 @ruser{Time administration}.
974 @lsrdir{Rhythms,Rhythms}
977 @internalsref{TimeSignature},
978 @internalsref{Timing_translator}.
983 Automatic beaming does not use the measure grouping specified with
984 @code{set-time-signature}.
988 @subsubsection Upbeats
992 @cindex partial measure
993 @cindex measure, partial
994 @cindex pickup measure
995 @cindex measure, change length
996 @cindex measurePosition
999 Partial or pick-up measures, such as an anacrusis or upbeat, are
1000 entered using the @code{\partial} command, with the syntax
1003 \partial @var{duration} @emph{notes}
1006 where @code{duration} is the rhythmic length of the @emph{notes}
1007 which are to be placed before the first complete measure:
1009 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1010 \partial 16*5 c16 cis d dis e |
1015 Internally, this is translated into
1018 \set Timing.measurePosition = -@var{duration}
1021 The property @code{measurePosition} contains a rational number
1022 indicating how much of the measure has passed at this point. Note
1023 that this is set to a negative number by the @code{\partial}
1024 command: i.e., @code{\partial 4} is internally translated to
1025 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1030 Music Glossary: @rglos{anacrusis}
1032 Notation Reference: @ref{Grace notes}
1034 Snippets: @lsrdir{Rhythms,Rhythms}
1036 Internal Reference: @internalsref{Timing_translator}
1040 @cindex grace notes, in anacruses
1042 This command does not take into account grace notes at the start
1043 of the music. If the pick-up starts with one or more grace
1044 notes, then the @code{\partial} should follow the grace note(s):
1046 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1053 The @code{\partial} command is intended to be used only at the
1054 beginning of a piece. If you use it after the beginning, some
1055 odd warnings may occur.
1057 @node Unmetered music
1058 @subsubsection Unmetered music
1060 @funindex \cadenzaOn
1061 @funindex \cadenzaOff
1062 @cindex bar lines, turning off
1063 @cindex bar numbering, turning off
1065 @cindex unmetered music
1067 Bar lines and bar numbers are calculated automatically. For
1068 unmetered music (cadenzas, for example), this is not desirable.
1069 To turn off automatic bar lines and bar numbers, use the command
1070 @code{\cadenzaOn}, and use @code{\cadenzaOff} to turn them on
1073 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1082 Bar numbering is resumed at the end of the cadenza as if the
1083 cadenza were not there:
1085 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1086 % Show all bar numbers
1087 \override Score.BarNumber #'break-visibility = #all-visible
1103 Music Glossary: @rglos{cadenza}
1105 Notation Reference: @ref{Controlling visibility of objects}
1107 Snippets: @lsrdir{Rhythms,Rhythms}
1111 LilyPond will insert line breaks and page breaks only at a
1112 bar line. Unless the unmetered music ends before the end of the
1113 staff line, you will need to insert invisible bar lines with
1120 to indicate where breaks can occur.
1123 @node Polymetric notation
1124 @subsubsection Polymetric notation
1126 @cindex double time signatures
1127 @cindex signatures, polymetric
1128 @cindex polymetric signatures
1129 @cindex meter, polymetric
1131 @strong{Alternating time signatures}
1133 Regularly alternating double time signatures are not supported
1134 explicitly, but they can be faked. In the next example, the
1135 double time signature is created with markup text, while the
1136 real time signature is set in the usual way with @code{\time}.
1138 @lilypond[verbatim,ragged-right]
1139 % Create 9/8 split into 2/4 + 5/8
1140 tsMarkup = \markup {
1141 \override #'(baseline-skip . 2) \number {
1144 \bracket \column { "5" "8" }
1149 \override Staff.TimeSignature #'stencil =
1150 #ly:text-interface::print
1151 \override Staff.TimeSignature #'text = #tsMarkup
1153 c'2 \bar ":" c'4 c'4.
1154 c'2 \bar ":" c'4 c'4.
1158 @strong{Staves with different time signatures, equal measure lengths}
1160 This notation can be created by setting a common time signature
1161 for each staff but replacing the symbol manually by setting
1162 @code{timeSignatureFraction} to the desired fraction and scaling
1163 the printed durations in each staff to the common time
1164 signature. This done with @code{\compressMusic}, which
1165 is used in a similar way to @code{\times}, but does not create
1166 a tuplet bracket, see @ref{Scaling durations}.
1168 In this example, music with the time signatures of 3/4, 9/8, and
1169 10/8 are used in parallel. In the second staff, shown durations
1170 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1171 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1173 @lilypond[quote,ragged-right,verbatim,fragment]
1182 \set Staff.timeSignatureFraction = #'(9 . 8)
1183 \compressMusic #'(2 . 3)
1184 \repeat unfold 6 { c8[ c c] }
1188 \set Staff.timeSignatureFraction = #'(10 . 8)
1189 \compressMusic #'(3 . 5) {
1190 \repeat unfold 2 { c8[ c c] }
1191 \repeat unfold 2 { c8[ c] } |
1192 c4. c4. \times 2/3 { c8 c c } c4
1198 @strong{Staves with different time signatures, unequal bar lengths}
1200 Each staff can be given its own independent time signature by
1201 moving the @code{Timing_translator} to the @code{Staff} context.
1203 @lilypond[quote,verbatim,ragged-right]
1207 \remove "Timing_translator"
1208 \remove "Default_bar_line_engraver"
1212 \consists "Timing_translator"
1213 \consists "Default_bar_line_engraver"
1217 % Now each staff has its own time signature.
1246 @rglos{polymetric time signature},
1249 Notation Reference: @ref{Scaling durations}
1252 @lsrdir{Rhythms,Rhythms}
1253 @c Is this still permitted?
1254 @c @lsr{contemporary,compound-time-signature}
1256 Internals Reference:
1257 @internalsref{TimeSignature},
1258 @internalsref{Timing-translator},
1259 @internalsref{Staff}.
1263 When using different time signatures in parallel, the spacing is
1264 aligned vertically, but bar lines distort the regular spacing.
1267 @node Automatic note splitting
1268 @subsubsection Automatic note splitting
1270 @cindex notes, splitting
1271 @cindex splitting notes
1273 Long notes which overrun bar lines can be converted automatically
1274 to tied notes. This is done by replacing the
1275 @code{Note_heads_engraver} by the
1276 @code{Completion_heads_engraver}. In the following
1277 example, notes crossing the bar lines are split and tied.
1279 @lilypond[quote,fragment,verbatim,relative=1,ragged-right]
1281 \remove "Note_heads_engraver"
1282 \consists "Completion_heads_engraver"
1285 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1288 This engraver splits all running notes at the bar line, and
1289 inserts ties. One of its uses is to debug complex scores: if the
1290 measures are not entirely filled, then the ties show exactly how
1291 much each measure is off.
1293 To allow line breaking on the bar lines where the
1294 @code{Completion_heads_engraver} has inserted a split note, remove
1295 the @code{Forbid_line_break_engraver} too.
1300 Music Glossary: @rglos{tie}
1303 @rlearning{Engravers explained},
1304 @rlearning{Adding and removing engravers}.
1306 Snippets: @lsrdir{Rhythms,Rhythms}
1308 Internals Reference:
1309 @internalsref{Note_heads_engraver},
1310 @internalsref{Completion_heads_engraver},
1311 @internalsref{Forbid_line_break_engraver}.
1316 Not all durations (especially those containing tuplets) can be
1317 represented exactly with normal notes and dots, but the engraver
1318 will not insert tuplets.
1320 The @code{Completion_heads_engraver} only affects notes; it does not
1329 * Setting automatic beam behavior::
1334 @node Automatic beams
1335 @subsubsection Automatic beams
1337 By default, beams are inserted automatically:
1339 @cindex beams, manual
1340 @cindex manual beams
1342 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1344 \time 6/8 c c c c8. c16 c8
1347 If these automatic decisions are not satisfactory, beaming can be
1348 entered explicitly; see @ref{Manual beams}. It is also possible
1349 to define beaming patterns that differ from the defaults; see
1350 @ref{Setting automatic beam behavior}. The default beaming rules
1351 are defined in @file{scm/@/auto@/-beam@/.scm}.
1357 Automatic beaming may be turned off and on with
1358 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1360 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1361 c4 c8 c8. c16 c8. c16 c8
1371 Beaming patterns may be altered with the @code{beatGrouping} property,
1373 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1375 \set beatGrouping = #'(2 3)
1377 \set beatGrouping = #'(3 2)
1381 The beams of consecutive 16th (or shorter) notes are, by default,
1382 not sub-divided. That is, the three (or more) beams stretch
1383 unbroken over entire groups of notes. This behavior can
1384 be modified to sub-divide the beams into sub-groups by setting
1385 the property @code{subdivideBeams}. When set, multiple beams
1386 will be sub-divided at intervals defined by the current value of
1387 @code{beatLength} by reducing the multiple beams to just one beam
1388 between the sub-groups. Note that @code{beatLength} lives in the
1389 @code{Score} context and defaults to a quarter note. It must be
1390 set to a fraction giving the duration of the beam sub-group
1391 using the @code{make-moment} function, as shown here:
1393 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1395 \set subdivideBeams = ##t
1397 % Set beam sub-group length to an eighth note
1398 \set Score.beatLength = #(ly:make-moment 1 8)
1400 % Set beam sub-group length to a sixteenth note
1401 \set Score.beatLength = #(ly:make-moment 1 16)
1404 @funindex subdivideBeams
1407 For more information about @code{make-moment}, see
1408 @ref{Time administration}.
1414 Line breaks are normally forbidden when beams cross bar lines.
1415 This behavior can be changed by setting the @code{breakable}
1416 property: @code{\override Beam #'breakable = ##t}.
1418 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1419 \override Beam #'breakable = ##t
1420 c8 \repeat unfold 15 { c[ c] } c
1423 @cindex beams and line breaks
1424 @cindex beams, kneed
1426 @cindex auto-knee-gap
1428 Kneed beams are inserted automatically when a large gap is
1429 detected between the note heads. This behavior can be tuned
1430 through the @code{auto-knee-gap} property. A kneed beam is
1431 drawn if the gap is larger than the value of
1432 @code{auto-knee-gap} plus the width of the beam object (which
1433 depends on the duration of the notes and the slope of the beam).
1434 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1436 @lilypond[fragment,ragged-right,quote,verbatim]
1438 \override Beam #'auto-knee-gap = #6
1445 Notation Reference: @ref{Manual beams}, @ref{Setting automatic beam behavior}.
1447 Snippets: @lsrdir{Rhythms,Rhythms}
1449 Internals Reference: @internalsref{Beam}.
1454 Automatically kneed cross-staff beams cannot be used together with
1455 hidden staves. See @ref{Hiding staves}.
1457 Beams can collide with note heads and accidentals in other voices
1460 @node Setting automatic beam behavior
1461 @subsubsection Setting automatic beam behavior
1463 @funindex autoBeamSettings
1464 @funindex (end * * * *)
1465 @funindex (begin * * * *)
1466 @cindex automatic beams, tuning
1467 @cindex tuning automatic beaming
1469 @c [TODO: use \applyContext]
1471 In normal time signatures, automatic beams can start on any note
1472 but can end in only a few positions within the measure: beams can
1473 end on a beat, or at durations specified by the properties in
1474 @code{autoBeamSettings}. The properties in
1475 @code{autoBeamSettings} consist of a list of rules for where beams
1476 can begin and end. The default @code{autoBeamSettings} rules are
1477 defined in @file{scm/@/auto@/-beam@/.scm}.
1479 In order to add a rule to the list, use
1481 #(override-auto-beam-setting '(be p q n m) a b [context])
1486 @item @code{be} is either @code{begin} or @code{end}.
1488 @item @code{p/q} is the duration of the note for which you want
1489 to add a rule. A beam is considered to have the duration of its
1490 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1491 have this apply to any beam.
1493 @item @code{n/m} is the time signature to which
1494 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1495 to have this apply in any time signature.
1497 @item @code{a/b} is the position in the bar at which the beam should
1500 @item @code{context} is optional, and it specifies the context at which
1501 the change should be made. The default is @code{'Voice}.
1503 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1504 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1508 For example, if automatic beams should always end on the first quarter
1512 #(override-auto-beam-setting '(end * * * *) 1 4)
1515 You can force the beam settings to only take effect on beams whose shortest
1516 note is a certain duration
1518 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1520 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1522 a32 a a a a16 a a a a a |
1523 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1524 a32 a a a a16 a a a a a |
1527 You can force the beam settings to only take effect in certain time
1530 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1532 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1540 You can also remove a previously set beam-ending rule by using
1543 #(revert-auto-beam-setting '(be p q n m) a b [context])
1547 @code{be}, @code{p}, @code{q}, @code{n}, @code{m}, @code{a},
1548 @code{b} and @code{context} are the same as above. Note that the
1549 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1550 so you can revert rules that you did not explicitly create.
1552 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1554 a16 a a a a a a a a a a a a a a a
1555 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1556 a16 a a a a a a a a a a a a a a a
1559 The rule in a @code{revert-auto-beam-setting} statement must exactly
1560 match the original rule. That is, no wildcard expansion is taken into
1563 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1565 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1567 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1569 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1575 @c TODO: old material -- not covered by above stuff, I think.
1576 If automatic beams should end on every quarter in 5/4 time, specify
1579 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1580 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1581 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1582 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1586 The same syntax can be used to specify beam starting points. In this
1587 example, automatic beams can only end on a dotted quarter note
1589 #(override-auto-beam-setting '(end * * * *) 3 8)
1590 #(override-auto-beam-setting '(end * * * *) 1 2)
1591 #(override-auto-beam-setting '(end * * * *) 7 8)
1593 In 4/4 time signature, this means that automatic beams could end only on
1594 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1595 3/8, has passed within the measure).
1597 If any unexpected beam behavior occurs, check the default automatic beam
1598 settings in @file{scm/@/auto@/-beam@/.scm}
1599 for possible interference, because the beam
1600 endings defined there will still apply on top of your own overrides. Any
1601 unwanted endings in the default vales must be reverted for your time
1604 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1608 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1609 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1610 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1611 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1614 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1615 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1616 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1619 @cindex automatic beam generation
1621 @funindex autoBeaming
1624 If beams are used to indicate melismata in songs, then automatic
1625 beaming should be switched off with @code{\autoBeamOff}.
1630 @funindex \autoBeamOff
1631 @code{\autoBeamOff},
1632 @funindex \autoBeamOn
1638 If a score ends while an automatic beam has not been ended and is
1639 still accepting notes, this last beam will not be typeset at all.
1640 The same holds for polyphonic voices, entered with @code{<<
1641 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1642 automatic beam is still accepting notes, it is not typeset.
1646 Snippets: @lsrdir{Rhythms,Rhythms}
1650 @subsubsection Manual beams
1652 @cindex beams, manual
1654 In some cases it may be necessary to override the automatic
1655 beaming algorithm. For example, the autobeamer will not put beams
1656 over rests or bar lines, and in choral scores the beaming is
1657 often set to follow the meter of the lyrics rather than the
1658 notes. Such beams can be specified manually by
1659 marking the begin and end point with @code{[} and @code{]}
1661 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1663 r4 r8[ g' a r8] r8 g[ | a] r8
1668 Individual notes may be marked with @code{\noBeam} to prevent them
1671 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1672 \time 2/4 c8 c\noBeam c c
1678 @funindex stemLeftBeamCount
1679 @funindex stemRightBeamCount
1681 Even more strict manual control with the beams can be achieved by
1682 setting the properties @code{stemLeftBeamCount} and
1683 @code{stemRightBeamCount}. They specify the number of beams to
1684 draw on the left and right side, respectively, of the next note.
1685 If either property is set, its value will be used only once, and
1686 then it is erased. In this example, the last @code{f} is printed
1687 with only one beam on the left side, i.e., the eighth-note beam of
1688 the group as a whole.
1690 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1694 \set stemLeftBeamCount = #1
1702 @node Feathered beams
1703 @subsubsection Feathered beams
1705 @cindex beams, feathered
1706 @funindex \featherDurations
1708 Feathered beams are used to indicate that a small group of notes
1709 should be played at an increasing (or decreasing) tempo, without
1710 changing the overall tempo of the piece. The extent of the
1711 feathered beam must be indicated manually using @code{[} and
1712 @code{]}, and the beam feathering is turned on by specifying a
1713 direction to the @code{Beam} property @code{grow-direction}.
1715 If the placement of the notes and the sound in the MIDI output
1716 is to reflect the ritardando or accelerando indicated by the
1717 feathered beam the notes must be grouped as a
1718 music expression delimited by braces and preceded by a
1719 @code{featheredDurations} command which specifies the ratio
1720 between the durations of the first and last notes in the group.
1723 show the extent of the beam and the braces show
1724 which notes are to have their durations modified. Normally
1725 these would delimit the same group of notes, but this is not
1726 required: the two commands are independent.
1728 In the following example the eight 16th notes occupy exactly the
1729 same time as a half note, but the first note is one half as long
1730 as the last one, with the intermediate notes gradually
1731 lengthening. The first four 32nd notes gradually speed up, while
1732 the last four 32nd notes are at a constant tempo.
1734 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1735 \override Beam #'grow-direction = #LEFT
1736 \featherDurations #(ly:make-moment 2 1)
1737 { c16[ c c c c c c c] }
1738 \override Beam #'grow-direction = #RIGHT
1739 \featherDurations #(ly:make-moment 2 3)
1741 % revert to non-feathered beams
1742 \override Beam #'grow-direction = #'()
1747 The spacing in the printed output represents the
1748 note durations only approximately, but the midi output is exact.
1752 The @code{\featherDurations} command only works with very short
1753 music snippets, and when numbers in the fraction are small.
1757 Snippets: @lsrdir{Rhythms,Rhythms}
1768 * Bar and bar number checks::
1773 @subsubsection Bar lines
1777 @cindex measure lines
1780 Bar lines delimit measures, and are also used to indicate
1781 repeats. Normally, simple bar lines are automatically inserted
1782 into the printed output at places based on the current time
1785 The simple bar lines inserted automatically can be changed to
1786 other types with the @code{\bar} command. For example, a closing
1787 double bar line is usually placed at the end of a piece:
1789 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1793 @warning{An incorrect duration can lead to poorly formatted
1796 It is not invalid if the final note in a measure does not
1797 end on the automatically entered bar line: the note is assumed
1798 to carry over into the next measure. But if a long sequence
1799 of such carry-over measures appears the music can appear compressed
1800 or even flowing off the page. This is because automatic line
1801 breaks happen only at the end of complete measures, i.e., where
1802 the end of a note coincides with the end of a measure.
1805 @cindex bar lines, invisible
1806 @cindex measure lines, invisible
1808 Line breaks are also permitted at manually inserted bar lines
1809 even within incomplete measures. To allow a line break without
1810 printing a bar line, use
1817 This will insert an invisible bar line and allow (but not
1818 force) a line break to occur at this point. The bar number
1819 counter is not increased. To force a line break see
1820 @ref{Line breaking}.
1822 This and other special bar lines may be inserted manually at any
1823 point. When they coincide with the end of a measure they replace
1824 the simple bar line which would have been inserted there
1825 automatically. When they do not coincide
1826 with the end of a measure the specified bar line is inserted at that
1827 point in the printed output. Such insertions do not affect
1828 the calculation and placement of subsequent automatic bar lines.
1830 The simple bar line and four types of double bar line are available
1831 for manual insertion:
1833 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1834 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1838 together with dotted and dashed bar lines:
1840 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1841 f1 \bar ":" g \bar "dashed" a
1845 and three types of repeat bar line:
1847 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1848 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1853 Although the bar line types signifying repeats may be inserted
1854 manually they do not in themselves cause LilyPond to recognize
1855 a repeated section. Such repeated sections are better entered
1856 using the various repeat commands (see @ref{Repeats}), which
1857 automatically print the appropriate bar lines.
1859 In addition, you can specify @code{"||:"}, which is equivalent to
1860 @code{"|:"} except at line breaks, where it gives a double bar
1861 line at the end of the line and a start repeat at the beginning of
1864 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1865 \override Score.RehearsalMark #'padding = #3
1873 In scores with many staves, a @code{\bar} command in one staff is
1874 automatically applied to all staves. The resulting bar lines are
1875 connected between different staves of a @code{StaffGroup},
1876 @code{PianoStaff}, or @code{GrandStaff}.
1878 @lilypond[quote,ragged-right,fragment,verbatim]
1886 \new Staff { \clef bass c4 g e g }
1888 \new Staff { \clef bass c2 c2 }
1896 @funindex defaultBarType
1898 The command @code{\bar }@var{bartype} is a shortcut for
1899 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1900 created whenever the @code{whichBar} property is
1903 The default bar type used for automatically inserted bar lines is
1904 @code{"|"}. This may be changed at any time
1905 with @code{\set Timing.defaultBarType = }@var{bartype}.
1909 Notation Reference: @ref{Line breaking}, @ref{Repeats},
1910 @c FIXME: node name changed, but is subject to further changes.
1911 @c @ref{System start delimiters}.
1913 Snippets: @lsrdir{Rhythms,Rhythms}
1915 Internals Reference: @internalsref{BarLine} (created at
1916 @internalsref{Staff} level), @internalsref{SpanBar} (across
1917 staves), @internalsref{Timing_translator} (for Timing
1922 @subsubsection Bar numbers
1925 @cindex measure numbers
1926 @funindex currentBarNumber
1928 Bar numbers are typeset by default at the start of every line except
1929 the first line. The number itself is stored in the
1930 @code{currentBarNumber} property, which is normally updated
1931 automatically for every measure. It may also be set manually:
1933 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1936 \set Score.currentBarNumber = #50
1943 @funindex barNumberVisibility
1944 @cindex bar numbers, regular spacing
1946 Bar numbers can be typeset at regular intervals instead of just at
1947 the beginning of every line. To do this the default behavior
1948 must be overridden to permit bar numbers to be printed at places
1949 other than the start of a line. This is controlled by the
1950 @code{break-visibility} property of @code{BarNumber}. This takes
1951 three values which may be set to @code{#t} or @code{#f} to specify
1952 whether the corresponding bar number is visible or not. The order
1953 of the three values is @code{end of line visible}, @code{middle of
1954 line visible}, @code{beginning of line visible}. In the following
1955 example bar numbers are printed at all possible places:
1957 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1958 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1959 \set Score.currentBarNumber = #11
1960 \bar "" % Permit first bar number to be printed
1966 @c All the rest of these examples will be added to LSR
1967 @c and moved into the Snippets. -gp
1970 and here the bar numbers are printed every two measures
1971 except at the end of the line:
1973 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1974 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1975 \set Score.currentBarNumber = #11
1976 \bar "" % Permit first bar number to be printed
1977 % Print a bar number every second measure
1978 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1984 @cindex measure number, format
1985 @cindex bar number, format
1987 The size of the bar number may be changed. This is illustrated
1988 in the following example, which also shows how to enclose bar
1989 numbers in boxes and circles, and shows an alternative way
1990 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
1992 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1993 % Prevent bar numbers at the end of a line and permit them elsewhere
1994 \override Score.BarNumber #'break-visibility
1995 = #end-of-line-invisible
1997 % Increase the size of the bar number by 2
1998 \override Score.BarNumber #'font-size = #2
1999 \repeat unfold 3 { c1 } \bar "|"
2001 % Draw a box round the following bar number(s)
2002 \override Score.BarNumber #'stencil
2003 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
2004 \repeat unfold 3 { c1 } \bar "|"
2006 % Draw a circle round the following bar number(s)
2007 \override Score.BarNumber #'stencil
2008 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2009 \repeat unfold 4 { c1 } \bar "|."
2012 @cindex bar number alignment
2014 Bar numbers by default are left-aligned to their parent object.
2015 This is usually the left edge of a line or, if numbers are printed
2016 within a line, the left bar line of the measure. The numbers may also
2017 be positioned directly on the bar line or right-aligned to the
2020 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2021 \set Score.currentBarNumber = #111
2022 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
2023 % Increase the size of the bar number by 2
2024 \override Score.BarNumber #'font-size = #2
2025 % Print a bar number every second measure
2026 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2028 % Center-align bar numbers
2029 \override Score.BarNumber #'self-alignment-X = #0
2031 % Right-align bar numbers
2032 \override Score.BarNumber #'self-alignment-X = #-1
2036 Bar numbers can be removed entirely by removing the
2037 @code{Bar_number_engraver} from the @code{Score} context.
2039 @lilypond[verbatim,ragged-right,quote]
2043 \remove "Bar_number_engraver"
2055 Snippets: @lsrdir{Rhythms,Rhythms}
2057 Internals Reference: @internalsref{BarNumber}.
2062 Bar numbers may collide with the top of the
2063 @internalsref{StaffGroup} bracket, if there is one. To solve
2064 this, the @code{padding} property of @internalsref{BarNumber} can
2065 be used to position the number correctly.
2067 Bar numbers may only be printed at bar lines; to print a bar
2068 number at the beginning of a piece, an empty bar line must be
2069 inserted there, and a value other than @code{1} must be placed
2070 in @code{currentBarNumber}:
2072 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2073 \set Score.currentBarNumber = #50
2082 @node Bar and bar number checks
2083 @subsubsection Bar and bar number checks
2086 @funindex barCheckSynchronize
2089 Bar checks help detect errors in the entered durations.
2090 A bar check may be entered using the bar symbol, @code{|},
2091 at any place where a bar line is expected to fall.
2092 If bar check lines are encountered at other places,
2093 a list of warnings is printed in the log file,
2094 showing the line numbers and lines
2095 in which the bar checks failed. In the next
2096 example, the second bar check will signal an error.
2099 \time 3/4 c2 e4 | g2 |
2102 Bar checks can also be used in lyrics, for example
2107 Twin -- kle | Twin -- kle |
2111 An incorrect duration can result in a completely garbled score,
2112 especially if the score is polyphonic, so a good place to start
2113 correcting input is by scanning for failed bar checks and
2114 incorrect durations.
2117 @funindex pipeSymbol
2119 It is also possible to redefine the action taken when a bar check
2120 or pipe symbol, @code{|}, is encountered in the input, so that
2121 it does something other than a bar check. This is done by
2122 assigning a music expression to @code{pipeSymbol}.
2123 In the following example @code{|} is set to insert a double bar
2124 line wherever it appears in the input, rather than checking
2127 @lilypond[quote,ragged-right,verbatim]
2128 pipeSymbol = \bar "||"
2137 When copying large pieces of music, it can be helpful to check
2138 that the LilyPond bar number corresponds to the original that you
2139 are entering from. This can be checked with
2140 @code{\barNumberCheck}, for example,
2143 \barNumberCheck #123
2147 will print a warning if the @code{currentBarNumber} is not 123
2148 when it is processed.
2152 Snippets: @lsrdir{Rhythms,Rhythms}
2155 @node Rehearsal marks
2156 @subsubsection Rehearsal marks
2158 @cindex rehearsal marks
2159 @cindex mark, rehearsal
2162 To print a rehearsal mark, use the @code{\mark} command
2164 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2173 The letter@tie{}@q{I} is skipped in accordance with engraving
2174 traditions. If you wish to include the letter @q{I}, then use
2177 \set Score.markFormatter = #format-mark-alphabet
2180 The mark is incremented automatically if you use @code{\mark
2181 \default}, but you can also use an integer argument to set the
2182 mark manually. The value to use is stored in the property
2183 @code{rehearsalMark}.
2185 @cindex rehearsal mark format
2186 @cindex rehearsal mark style
2187 @cindex style, rehearsal mark
2188 @cindex format, rehearsal mark
2189 @cindex mark, rehearsal, style
2190 @cindex mark, rehearsal, format
2192 The style is defined by the property @code{markFormatter}. It is
2193 a function taking the current mark (an integer) and the current
2194 context as argument. It should return a markup object. In the
2195 following example, @code{markFormatter} is set to a pre-defined
2196 procedure. After a few measures, it is set to a procedure that
2197 produces a boxed number.
2199 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2200 \set Score.markFormatter = #format-mark-numbers
2203 \set Score.markFormatter = #format-mark-box-numbers
2209 The file @file{scm/@/translation@/-functions@/.scm} contains the
2210 definitions of @code{format-mark-numbers} (the default format),
2211 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2212 @code{format-mark-box-letters}. These can be used as inspiration
2213 for other formatting functions.
2215 You may use @code{format-mark-barnumbers},
2216 @code{format-mark-box-barnumbers}, and
2217 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2218 incremented numbers or letters.
2220 Other styles of rehearsal mark can be specified manually
2227 @code{Score.markFormatter} does not affect marks specified in this
2228 manner. However, it is possible to apply a @code{\markup} to the
2232 \mark \markup@{ \box A1 @}
2239 Music glyphs (such as the segno sign) may be printed inside a
2242 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2243 c1 \mark \markup { \musicglyph #"scripts.segno" }
2244 c1 \mark \markup { \musicglyph #"scripts.coda" }
2245 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2250 See @ref{The Feta font}, for a list of symbols which may be
2251 printed with @code{\musicglyph}.
2253 For common tweaks to the positioning of rehearsal marks, see
2254 @ref{Formatting text}.
2258 Snippets: @lsrdir{Rhythms,Rhythms}
2260 This manual: @ref{The Feta font}, @ref{Formatting text}.
2262 Internals Reference: @internalsref{RehearsalMark}.
2264 Init files: @file{scm/@/translation@/-functions@/.scm} contains
2265 the definition of @code{format-mark-numbers} and
2266 @code{format-mark-letters}. They can be used as inspiration for
2267 other formatting functions.
2269 Examples: @c @lsr{parts,rehearsal-mark-numbers.ly}
2272 @node Special rhythmic concerns
2273 @subsection Special rhythmic concerns
2278 * Aligning to cadenzas::
2279 * Time administration::
2283 @subsubsection Grace notes
2288 @cindex appoggiatura
2289 @cindex acciaccatura
2291 Grace notes are ornaments that are written out. They are made with
2292 the @code{\grace} command. By prefixing this keyword to a music
2293 expression, a new one is formed, which will be printed in a
2294 smaller font and takes up no logical time in a measure.
2296 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2298 \grace { c16[ d16] } c2 c4
2301 Two special forms of the @code{\grace} command exist.
2302 An @emph{acciaccatura}, which should be played as very short,
2303 is denoted by a slurred small note with a slashed stem. The
2304 @emph{appoggiatura}, a grace note that takes a fixed fraction of the
2305 main note, is denoted as a slurred note in small print without
2306 a slash. They are entered with the commands @code{\acciaccatura}
2307 and @code{\appoggiatura}, as demonstrated in the following
2310 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2311 b4 \acciaccatura d8 c4
2313 \acciaccatura { g16[ f] } e4
2317 @code{\acciaccatura} and @code{\appoggiatura} start a slur,
2318 @code{\grace} does not.
2320 The placement of grace notes is synchronized between different
2321 staves. In the following example, there are two sixteenth grace
2322 notes for every eighth grace note
2324 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2325 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2326 \new Staff { c4 \grace { g8[ b] } c4 } >>
2329 @funindex \afterGrace
2331 @cindex grace notes, following
2333 If you want to end a note with a grace, use the @code{\afterGrace}
2334 command. It takes two arguments: the main note, and the grace
2335 notes following the main note.
2337 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2338 c1 \afterGrace d1 { c16[ d] } c4
2341 This will put the grace notes after a @q{space} lasting 3/4 of the
2342 length of the main note. The fraction 3/4 can be changed by
2343 setting @code{afterGraceFraction}, i.e.,
2346 #(define afterGraceFraction (cons 7 8))
2350 will put the grace note at 7/8 of the main note.
2352 The same effect can be achieved manually by doing
2354 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2357 { s2 \grace { c16[ d] } } >>
2363 By adjusting the duration of the skip note (here it is a
2364 half-note), the space between the main note and the grace
2367 A @code{\grace} music expression will introduce special
2368 typesetting settings, for example, to produce smaller type, and
2369 set directions. Hence, when introducing layout tweaks, they
2370 should be inside the grace expression, for example,
2372 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2384 The overrides should also be reverted inside the grace expression.
2386 The layout of grace expressions can be changed throughout the
2387 music using the function @code{add-grace-property}. The following
2388 example undefines the @code{Stem} direction for this grace, so
2389 that stems do not always point up.
2393 #(add-grace-property 'Voice 'Stem 'direction '())
2399 Another option is to change the variables @code{startGraceMusic},
2400 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2401 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2402 @code{stopAppoggiaturaMusic}. The default values of these can be
2403 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2404 them other effects may be obtained.
2406 @cindex stem, with slash
2409 The slash through the stem in @emph{acciaccatura}s can be obtained in
2410 other situations by @code{\override Stem #'stroke-style =
2416 Grace notes may be forced to use align with regular notes
2417 in other staves by setting @code{strict-grace-spacing} to
2420 @lilypond[relative=2,ragged-right]
2422 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2431 c'16[ c'16 c'16 c'16]
2432 c'16[ c'16 c'16 c'16]
2442 @rglos{grace notes},
2443 @rglos{acciaccatura},
2444 @rglos{appoggiatura}
2446 Snippets: @lsrdir{Rhythms,Rhythms}
2448 Internals Reference: @internalsref{GraceMusic}.
2453 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2454 and looks exactly the same as a multi-note beamed
2455 @emph{appoggiatura}.
2456 @c TODO Add link to LSR snippet to add slash when available
2458 Grace note synchronization can also lead to surprises. Staff
2459 notation, such as key signatures, bar lines, etc., are also
2460 synchronized. Take care when you mix staves with grace notes and
2461 staves without, for example,
2463 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2464 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2465 \new Staff { c4 \bar "|:" d4 } >>
2469 This can be remedied by inserting grace skips of the corresponding
2470 durations in the other staves. For the above example
2472 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2473 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2474 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2477 Grace sections should only be used within sequential music
2478 expressions. Nesting or juxtaposing grace sections is not
2479 supported, and might produce crashes or other errors.
2481 @node Aligning to cadenzas
2482 @subsubsection Aligning to cadenzas
2485 @cindex cadenza, aligning to
2486 @cindex aligning to cadenza
2488 In an orchestral context, cadenzas present a special problem: when
2489 constructing a score that includes a cadenza, all other
2490 instruments should skip just as many notes as the length of the
2491 cadenza, otherwise they will start too soon or too late.
2493 A solution to this problem is to use the functions
2494 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2495 functions take a piece of music as argument, and generate a multi-measure
2496 rest or @code{\skip}, exactly as long as the piece. The use of
2497 @code{mmrest-of-length} is demonstrated in the following example.
2499 @lilypond[verbatim,ragged-right,quote]
2500 cadenza = \relative c' {
2501 c4 d8 << { e f g } \\ { d4. } >>
2506 \new Staff { \cadenza c'4 }
2508 #(ly:export (mmrest-of-length cadenza))
2516 Snippets: @lsrdir{Rhythms,Rhythms}
2519 @node Time administration
2520 @subsubsection Time administration
2522 @cindex time administration
2523 @cindex timing (within the score)
2524 @cindex music, unmetered
2525 @cindex unmetered music
2527 @funindex currentBarNumber
2528 @funindex measurePosition
2529 @funindex measureLength
2531 Time is administered by the @code{Timing_translator}, which by
2532 default is to be found in the @code{Score} context. An alias,
2533 @code{Timing}, is added to the context in which the
2534 @code{Timing_translator} is placed.
2536 The following properties of @code{Timing} are used
2537 to keep track of timing within the score.
2540 @cindex measure number
2543 @item currentBarNumber
2544 The current measure number. For an example showing the
2545 use of this property see @ref{Bar numbers}.
2548 The length of the measures in the current time signature. For a
2549 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2550 determines when bar lines are inserted and how automatic beams
2551 should be generated.
2553 @item measurePosition
2554 The point within the measure where we currently are. This
2555 quantity is reset by subtracting @code{measureLength} whenever
2556 @code{measureLength} is reached or exceeded. When that happens,
2557 @code{currentBarNumber} is incremented.
2560 If set to true, the above variables are updated for every time
2561 step. When set to false, the engraver stays in the current
2562 measure indefinitely.
2566 Timing can be changed by setting any of these variables
2567 explicitly. In the next example, the default 4/4 time
2568 signature is printed, but @code{measureLength} is set to 5/4.
2569 At 4/8 through the third measure, the @code{measurePosition} is
2570 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2571 The next bar line then falls at 9/8 rather than 5/4.
2573 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2574 \set Score.measureLength = #(ly:make-moment 5 4)
2578 \set Score.measurePosition = #(ly:make-moment 5 8)
2584 As the example illustrates, @code{ly:make-moment n m} constructs a
2585 duration of n/m of a whole note. For example,
2586 @code{ly:make-moment 1 8} is an eighth note duration and
2587 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2593 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2595 Snippets: @lsrdir{Rhythms,Rhythms}
2597 Internals Reference: @internalsref{Timing_translator},
2598 @internalsref{Score}