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 @unnumberedsubsubsec 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,verbatim,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,verbatim,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,verbatim,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,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{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}.
151 @rinternals{DotColumn}.
156 @c Deliberately duplicated in Durations and Rests. -gp
157 There is no fundamental limit to rest durations (both in terms of
158 longest and shortest), but the number of glyphs is limited:
159 rests from 128th to maxima (8 x whole) may be printed.
163 @unnumberedsubsubsec Tuplets
169 Tuplets are made from a music expression by multiplying all the
170 durations with a fraction:
173 \times @var{fraction} @{ @var{music} @}
177 The duration of @var{music} will be multiplied by the
178 fraction. The fraction's denominator will be printed over or
179 under the notes, optionally with a bracket. The most common
180 tuplet is the triplet in which 3 notes have the duration of 2, so
181 the notes are 2/3 of their written length.
183 @lilypond[quote,verbatim,relative=2]
184 a2 \times 2/3 { b4 b b }
185 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{Direction and placement}.
196 Tuplets may be nested:
198 @lilypond[quote,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,doctitle]
225 {entering-several-tuplets-using-only-one--times-command.ly}
227 @funindex TupletNumber
229 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
230 {changing-the-tuplet-number.ly}
232 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
233 {permitting-line-breaks-within-beamed-tuplets.ly}
242 Learning Manual: @rlearning{Tweaking methods}.
245 @ref{Time administration},
246 @ref{Scaling durations},
247 @ref{The tweak command},
248 @ref{Polymetric notation}.
254 @rinternals{TupletBracket},
255 @rinternals{TupletNumber},
256 @rinternals{TimeScaledMusic}.
259 @cindex grace notes within tuplet brackets
260 When the first note on a staff is a grace note followed by a
261 tuplet the grace note must be placed before the @code{\times}
262 command to avoid errors. Anywhere else, grace notes may be
263 placed within tuplet brackets.
266 @node Scaling durations
267 @unnumberedsubsubsec Scaling durations
269 @cindex scaling durations
270 @cindex durations, scaling
272 You can alter the duration of single notes, rests or chords by a
273 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if
274 @code{M} is 1) to the duration.
275 This will not affect the appearance of the notes or rests
276 produced, but the altered duration will be used in calculating the
277 position within the measure and setting the duration in the MIDI
278 output. Multiplying factors may be combined such as @code{*L*M/N}.
280 In the following example, the first three notes take up exactly
281 two beats, but no triplet bracket is printed.
283 @lilypond[quote,relative=2,verbatim]
285 % Alter durations to triplets
286 a4*2/3 gis4*2/3 a4*2/3
289 % Double the duration of chord
291 % Duration of quarter, appears like sixteenth
295 The duration of skip or spacing notes may also be modified by
296 a multiplier. This is useful for skipping many measures, e.g.,
299 @cindex compressing music
300 @funindex \scaleDurations
302 Longer stretches of music may be compressed by a fraction in the
303 same way, as if every note, chord or rest had the fraction as a
304 multiplier. This leaves the appearance of the music unchanged but
305 the internal duration of the notes will be multiplied by the
306 fraction @emph{num}/@emph{den}. The spaces around the dot are
307 required. Here is an example showing how music can be compressed
310 @lilypond[quote,relative=2,verbatim]
314 % Scale music by *2/3
315 \scaleDurations #'(2 . 3) {
319 \scaleDurations #'(2 . 1) {
325 One application of this command is in polymetric
326 notation, see @ref{Polymetric notation}.
333 @ref{Invisible rests},
334 @ref{Polymetric notation}.
341 @unnumberedsubsubsec Ties
346 A tie connects two adjacent note heads of the same pitch. The tie
347 in effect extends the duration of a note.
349 @warning{Ties should not be confused with @emph{slurs}, which
350 indicate articulation, or @emph{phrasing slurs}, which indicate
351 musical phrasing. A tie is just a way of extending a note
352 duration, similar to the augmentation dot.}
354 A tie is entered using the tilde symbol @code{~}
356 @lilypond[quote,verbatim,relative=2]
362 Ties are used either when the note crosses a bar line, or when
363 dots cannot be used to denote the rhythm. Ties should also be
364 used when note values cross larger subdivisions of the measure:
366 @lilypond[verbatim,quote]
373 If you need to tie many notes across bar lines, it may be
374 easier to use automatic note splitting, see @ref{Automatic note
375 splitting}. This mechanism automatically splits long notes, and
376 ties them across bar lines.
378 @cindex ties and chords
379 @cindex chords and ties
381 When a tie is applied to a chord, all note heads whose pitches
382 match are connected. When no note heads match, no ties will be
383 created. Chords may be partially tied by placing the tie inside
386 @lilypond[quote,verbatim,relative=1]
388 <c~ e g~ b> <c e g b>
392 @cindex repeating ties
393 @cindex ties, repeating
394 @cindex volta brackets and ties
395 @cindex ties and volta brackets
397 When a second alternative of a repeat starts with a tied note, you
398 have to specify the repeated tie as follows:
400 @lilypond[quote,relative=2,verbatim]
401 \repeat volta 2 { c g <c e>2 ~ }
403 % First alternative: following note is tied normally
405 % Second alternative: following note has a repeated tie
406 { <c e>2\repeatTie d4 c } }
409 @cindex laissez vibrer
410 @cindex ties, laissez vibrer
411 @funindex \laissezVibrer
413 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
414 notes must not be damped at the end. It is used in notation for
415 piano, harp and other string and percussion instruments. They can
416 be entered as follows:
418 @lilypond[quote,verbatim,relative=1]
419 <c f g>1\laissezVibrer
422 @cindex ties, placement
425 @funindex \tieNeutral
427 The vertical placement of ties may be controlled, see
428 Predefined commands, or for details, see
429 @ref{Direction and placement}.
431 @cindex ties, appearance
436 Solid, dotted or dashed ties may be specified, see Predefined
452 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
453 {using-ties-with-arpeggios.ly}
455 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
456 {engraving-ties-manually.ly}
463 @rglos{laissez vibrer}.
465 Notation Reference: @ref{Automatic note splitting}.
471 @rinternals{LaissezVibrerTie},
472 @rinternals{LaissezVibrerTieColumn},
473 @rinternals{TieColumn},
479 Switching staves when a tie is active will not produce a slanted
482 Changing clefs or octavations during a tie is not really
483 well-defined. In these cases, a slur may be preferable.
490 @subsection Writing rests
492 Rests are entered as part of the music in music expressions.
497 * Full measure rests::
501 @unnumberedsubsubsec Rests
503 @cindex rest, entering durations
514 Rests are entered like notes with the note name @code{r}.
515 Durations longer than a whole rest use the predefined
518 @c \time 16/1 is used to avoid spurious bar lines
519 @c and long tracts of empty measures
520 @lilypond[fragment,quote,verbatim]
522 % These two lines are just to prettify this example
524 \override Staff.TimeSignature #'stencil = ##f
525 % Print a maxima rest, equal to four breves
527 % Print a longa rest, equal to two breves
531 r1 r2 r4 r8 r16 r32 r64 r128
535 @cindex rest, multi-measure
536 @cindex rest, whole-measure
538 Whole measure rests, centered in the middle of the measure, must be
539 entered as multi-measure rests. They can be used for a single
540 measure as well as many measures and are discussed in @ref{Full
543 @cindex rest, specifying vertical position
545 To explicitly specify a rest's vertical position, write a note
546 followed by @code{\rest}. A rest of the duration of the note will
547 be placed at the staff position where the note would appear. This
548 allows for precise manual formatting of polyphonic music, since the
549 automatic rest collision formatter will not move these rests.
551 @lilypond[quote,verbatim,relative=2]
557 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
564 @ref{Full measure rests}.
575 @c Deliberately duplicated in Durations and Rests. -gp
576 There is no fundamental limit to rest durations (both in terms of
577 longest and shortest), but the number of glyphs is limited: there
578 are rests from 128th to maxima (8 x whole).
581 @node Invisible rests
582 @unnumberedsubsubsec Invisible rests
585 @cindex invisible rest
586 @cindex rest, invisible
591 An invisible rest (also called a @q{spacer rest}) can be entered
592 like a note with the note name@tie{}@code{s}:
594 @lilypond[verbatim,quote,relative=2]
601 Spacer rests are available only in note mode and chord mode. In
602 other situations, for example, when entering lyrics, @code{\skip}
603 is used to skip a musical moment. @code{\skip} requires an
606 @lilypond[quote,verbatim,relative=2]
619 A spacer rest implicitly causes @code{Staff} and @code{Voice}
620 contexts to be created if none exist, just like notes and rests
623 @lilypond[quote,verbatim,fragment]
627 @code{\skip} simply skips musical time; it creates no output of
630 @lilypond[quote,verbatim,fragment]
631 % This is valid input, but does nothing
632 \skip 1 \skip1 \skip 1
640 Internals Reference: @rinternals{SkipMusic}
643 @node Full measure rests
644 @unnumberedsubsubsec Full measure rests
646 @cindex multi-measure rests
647 @cindex full-measure rests
648 @cindex rest, multi-measure
649 @cindex rest, full-measure
650 @cindex whole rest for a full measure
653 Rests for one or more full measures are entered like notes with
654 the note name uppercase @code{R}:
656 @lilypond[quote,verbatim,relative=2]
657 % Rest measures contracted to single measure
658 \compressFullBarRests
665 The duration of full-measure rests is identical to the duration notation
666 used for notes. The duration in a multi-measure rest must always be an
667 integral number of measure-lengths, so augmentation
668 dots or fractions must often be used:
670 @lilypond[quote,fragment,verbatim]
671 \compressFullBarRests
677 R1*13/8 | R1*13/8*12 |
682 A full-measure rest is printed as either a whole
683 or breve rest, centered in the measure, depending on the time
686 @lilypond[quote,verbatim,fragment]
694 @funindex \expandFullBarRests
695 @funindex \compressFullBarRests
696 @cindex multi-measure rest, expanding
697 @cindex multi-measure rest, contracting
699 By default a multi-measure rest is expanded in the printed score
700 to show all the rest measures explicitly.
701 Alternatively, a mult-measure rest can be shown as a single measure
702 containing a multi-measure rest symbol, with the number of measures of rest
703 printed above the measure:
705 @lilypond[quote,fragment,verbatim]
707 \time 3/4 r2. | R2.*2 |
710 % Rest measures contracted to single measure
711 \compressFullBarRests
713 % Rest measures expanded
720 @cindex text on multi-measure rest
721 @cindex multi-measure rest, attaching text
722 @cindex script on multi-measure rest
723 @cindex multi-measure rest, script
724 @cindex fermata on multi-measure rest
725 @cindex multi-measure rest, attaching fermata
727 Markups can be added to multi-measure rests.
728 The predefined command @code{\fermataMarkup}
729 is provided for adding fermatas.
731 @lilypond[quote,verbatim,fragment]
732 \compressFullBarRests
734 R2.*10^\markup { \italic "ad lib." }
739 Markups attached to a multi-measure rest are
740 objects of type @code{MultiMeasureRestText}, not
741 @code{TextScript}. Overrides must be directed to the correct
742 object, or they will be ignored. See the following example.
745 @lilypond[quote,verbatim,fragment]
746 % This fails, as the wrong object name is specified
747 \override TextScript #'padding = #5
749 % This is correct and works
750 \override MultiMeasureRestText #'padding = #5
754 When a multi-measure rest immediately follows a @code{\partial}
755 setting, resulting bar-check warnings may not be displayed.
758 @code{\textLengthOn},
759 @code{\textLengthOff},
760 @code{\fermataMarkup},
761 @code{\compressFullBarRests},
762 @code{\expandFullBarRests}.
768 @cindex kirchenpausen
770 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
771 {changing-form-of-multi--measure-rests.ly}
773 @cindex multi-measure rests, positioning
774 @cindex positioning multi-measure rests
776 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
777 {positioning-multi--measure-rests.ly}
779 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
780 {multi--measure-rest-markup.ly}
785 @rglos{multi-measure rest}.
790 @ref{Formatting text},
797 @rinternals{MultiMeasureRest},
798 @rinternals{MultiMeasureRestNumber},
799 @rinternals{MultiMeasureRestText}.
804 If an attempt is made to use fingerings (e.g.,
805 @code{R1*10-4}) to put numbers over multi-measure rests, the
806 fingering numeral (4) may collide with the bar counter
809 @cindex condensing rests
810 @cindex rest, condensing ordinary
812 There is no way to automatically condense multiple ordinary rests
813 into a single multi-measure rest.
815 @cindex rest, collisions of
817 Multi-measure rests do not take part in rest collisions.
819 @node Displaying rhythms
820 @subsection Displaying rhythms
826 * Polymetric notation::
827 * Automatic note splitting::
828 * Showing melody rhythms::
832 @unnumberedsubsubsec Time signature
834 @cindex time signature
838 The time signature is set as follows:
840 @lilypond[quote,verbatim,relative=2]
845 @cindex Time signature, visibility of
847 Time signatures are printed at the beginning of a piece
848 and whenever the time signature changes. If a change takes place
849 at the end of a line a warning time signature sign is printed
850 there. This default behavior may be changed, see
851 @ref{Visibility of objects}.
853 @lilypond[quote,verbatim,relative=2]
863 @funindex \numericTimeSignature
864 @funindex \defaultTimeSignature
865 @cindex time signature style
867 The time signature symbol that is used in 2/2 and 4/4 time can be
868 changed to a numeric style:
870 @lilypond[quote,verbatim,relative=2]
874 % Change to numeric style
875 \numericTimeSignature
878 % Revert to default style
879 \defaultTimeSignature
885 Mensural time signatures are covered in
886 @ref{Mensural time signatures}.
890 @code{\numericTimeSignature},
891 @code{\defaultTimeSignature}.
895 @c TODO Replace by snippet called "Changing the time signature without affecting the beaming"
896 @c Submitted to LSR 2 Nov 08
898 The @code{\time} command sets the properties
899 @code{timeSignatureFraction}, @code{beatLength}, @code{beatGrouping}
900 and @code{measureLength} in the @code{Timing} context, which is
901 normally aliased to @code{Score}. Changing the value of
902 @code{timeSignatureFraction} causes the new time signature symbol
903 to be printed without changing any of the other properties:
905 @lilypond[quote,verbatim,relative=2]
907 a16 a a a a a a a a a a a
908 % Change time signature symbol but keep 3/4 beaming
909 % due to unchanged underlying time signature
910 \set Score.timeSignatureFraction = #'(12 . 16)
911 a16 a a a a a a a a a a a
913 % Lose 3/4 beaming now \time has been changed
914 a16 a a a a a a a a a a a
917 @cindex compound time signatures
918 @cindex time signature, compound
920 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
921 {compound-time-signatures.ly}
927 @rglos{time signature}
930 @ref{Mensural time signatures},
931 @ref{Time administration}.
937 @rinternals{TimeSignature},
938 @rinternals{Timing_translator}.
942 @unnumberedsubsubsec Upbeats
946 @cindex partial measure
947 @cindex measure, partial
948 @cindex pickup measure
949 @cindex measure, change length
950 @cindex measurePosition
953 Partial or pick-up measures, such as an anacrusis or upbeat, are
954 entered using the @code{\partial} command, with the syntax
957 \partial @var{duration}
960 where @code{duration} is the rhythmic length of the interval
961 before the start of the first complete measure:
963 @lilypond[quote,verbatim,relative=2]
968 The partial measure can be any duration less than a full measure:
970 @lilypond[quote,verbatim,relative=2]
971 \partial 8*3 c8 d e |
975 Internally, this is translated into
978 \set Timing.measurePosition = -@var{duration}
981 The property @code{measurePosition} contains a rational number
982 indicating how much of the measure has passed at this point. Note
983 that this is set to a negative number by the @code{\partial}
984 command: i.e., @code{\partial 4} is internally translated to
985 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
999 @rinternals{Timing_translator}.
1003 The @code{\partial} command is intended to be used only at the
1004 beginning of a piece. If you use it after the beginning, some
1005 odd warnings may occur.
1007 @node Unmetered music
1008 @unnumberedsubsubsec Unmetered music
1010 @funindex \cadenzaOn
1011 @funindex \cadenzaOff
1012 @cindex bar lines, turning off
1013 @cindex bar numbering, turning off
1015 @cindex unmetered music
1017 Bar lines and bar numbers are calculated automatically. For
1018 unmetered music (some cadenzas, for example), this is not desirable.
1019 To turn off automatic calculation of bar lines and bar numbers,
1020 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1021 to turn them on again.
1023 @lilypond[verbatim,relative=2,fragment]
1032 Bar numbering is resumed at the end of the cadenza as if the
1033 cadenza were not there:
1035 @lilypond[verbatim,relative=2,fragment]
1036 % Show all bar numbers
1037 \override Score.BarNumber #'break-visibility = #all-visible
1057 @c ref{Controlling visibility of objects}.
1064 LilyPond will insert line breaks and page breaks only at a
1065 bar line. Unless the unmetered music ends before the end of the
1066 staff line, you will need to insert invisible bar lines with
1073 to indicate where breaks can occur.
1076 @node Polymetric notation
1077 @unnumberedsubsubsec Polymetric notation
1079 @c This section necessarily uses \set
1080 @c This is acceptable -td
1082 @cindex double time signatures
1083 @cindex signatures, polymetric
1084 @cindex polymetric signatures
1085 @cindex meter, polymetric
1087 Polymetric notation is supported, either explicitly or by modifying
1088 the visible time signature symbol and scaling the note durations.
1090 @strong{@i{Staves with different time signatures, equal measure lengths}}
1092 This notation can be created by setting a common time signature
1093 for each staff but replacing the symbol manually by setting
1094 @code{timeSignatureFraction} to the desired fraction and scaling
1095 the printed durations in each staff to the common time
1096 signature; see @ref{Time signature}. The scaling is done with
1097 @code{\scaleDurations}, which is used in a similar way to
1098 @code{\times}, but does not create a tuplet bracket; see
1099 @ref{Scaling durations}.
1101 In this example, music with the time signatures of 3/4, 9/8, and
1102 10/8 are used in parallel. In the second staff, shown durations
1103 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1104 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1105 It will often be necessary to insert beams manually, as the
1106 duration scaling affects the autobeaming rules.
1108 @lilypond[quote,verbatim,fragment]
1117 \set Staff.timeSignatureFraction = #'(9 . 8)
1118 \scaleDurations #'(2 . 3)
1119 \repeat unfold 6 { c8[ c c] }
1123 \set Staff.timeSignatureFraction = #'(10 . 8)
1124 \scaleDurations #'(3 . 5) {
1125 \repeat unfold 2 { c8[ c c] }
1126 \repeat unfold 2 { c8[ c] } |
1127 c4. c4. \times 2/3 { c8[ c c] } c4
1133 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1135 Each staff can be given its own independent time signature by
1136 moving the @code{Timing_translator} and the
1137 @code{Default_bar_line_engraver} to the @code{Staff} context.
1139 @lilypond[quote,verbatim]
1143 \remove "Timing_translator"
1144 \remove "Default_bar_line_engraver"
1148 \consists "Timing_translator"
1149 \consists "Default_bar_line_engraver"
1153 % Now each staff has its own time signature.
1179 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1180 {compound-time-signatures.ly}
1187 @rglos{polymetric time signature},
1191 @ref{Time signature},
1192 @ref{Scaling durations}.
1197 Internals Reference:
1198 @rinternals{TimeSignature},
1199 @rinternals{Timing_translator},
1200 @rinternals{Default_bar_line_engraver},
1205 When using different time signatures in parallel, notes
1206 at the same moment will be be placed at the same horizontal
1207 location. However, the bar lines in the different staves
1208 will cause the note spacing to be less regular in each of the
1209 individual staves than would be normal without the different
1212 @node Automatic note splitting
1213 @unnumberedsubsubsec Automatic note splitting
1215 @cindex notes, splitting
1216 @cindex splitting notes
1218 Long notes which overrun bar lines can be converted automatically
1219 to tied notes. This is done by replacing the
1220 @code{Note_heads_engraver} with the
1221 @code{Completion_heads_engraver}. In the following
1222 example, notes crossing the bar lines are split and tied.
1224 @lilypond[quote,verbatim,relative=1]
1226 \remove "Note_heads_engraver"
1227 \consists "Completion_heads_engraver"
1230 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1233 This engraver splits all running notes at the bar line, and
1234 inserts ties. One of its uses is to debug complex scores: if the
1235 measures are not entirely filled, then the ties show exactly how
1236 much each measure is off.
1240 Music Glossary: @rglos{tie}
1243 @rlearning{Engravers explained},
1244 @rlearning{Adding and removing engravers}.
1249 Internals Reference:
1250 @rinternals{Note_heads_engraver},
1251 @rinternals{Completion_heads_engraver},
1252 @rinternals{Forbid_line_break_engraver}.
1257 Not all durations (especially those containing tuplets) can be
1258 represented exactly with normal notes and dots, but the
1259 @code{Completion_heads_engraver} will not insert tuplets.
1261 The @code{Completion_heads_engraver} only affects notes; it does not
1265 @node Showing melody rhythms
1266 @unnumberedsubsubsec Showing melody rhythms
1268 Sometimes you might want to show only the rhythm of a melody. This
1269 can be done with the rhythmic staff. All pitches of notes on such a
1270 staff are squashed, and the staff itself has a single line
1272 @lilypond[quote,relative=1,verbatim]
1274 \new RhythmicStaff {
1275 \new Voice = "myRhythm" {
1283 \lyricsto "myRhythm" {
1291 Guitar chord charts often show the strumming rhythms. This can
1292 be done with the @code{Pitch_squash_engraver} and
1293 @code{\improvisationOn}.
1296 @lilypond[quote,verbatim]
1305 \consists Pitch_squash_engraver
1317 @code{\improvisationOn},
1318 @code{\improvisationOff}.
1322 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1323 {guitar-strum-rhythms.ly}
1330 Internals Reference:
1331 @rinternals{RhythmicStaff},
1332 @rinternals{Pitch_squash_engraver}.
1339 * Setting automatic beam behavior::
1344 @node Automatic beams
1345 @unnumberedsubsubsec Automatic beams
1347 By default, beams are inserted automatically:
1349 @cindex beams, manual
1350 @cindex manual beams
1352 @lilypond[quote,verbatim,relative=2]
1354 \time 6/8 c c c c8. c16 c8
1357 If these automatic decisions are not satisfactory, beaming can be
1358 entered explicitly; see @ref{Manual beams}. It is also possible
1359 to define beaming patterns that differ from the defaults. The
1360 default beaming rules for most common time signatures are defined
1361 in @file{scm/@/auto@/-beam@/.scm}. If there are no beaming rules
1362 defined for the time signature being used the beaming is controlled
1363 by the values of three context properties, @code{measureLength},
1364 @code{beatLength} and @code{beatGrouping}. Both the beaming rules
1365 and the context properties can be overridden, see
1366 @ref{Setting automatic beam behavior}.
1371 @warning{If beams are used to indicate melismata in songs, then automatic
1372 beaming should be switched off with @code{\autoBeamOff} and the beams
1373 indicated manually.}
1377 Automatic beaming may be turned off and on with
1378 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1380 @lilypond[quote,relative=1,verbatim]
1381 c4 c8 c8. c16 c8. c16 c8
1389 @code{\autoBeamOff},
1398 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1399 {beams-across-line-breaks.ly}
1401 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1402 {changing-beam-knee-gap.ly}
1408 @ref{Setting automatic beam behavior}.
1411 @file{scm/@/auto@/-beam@/.scm}.
1416 Internals Reference: @rinternals{Beam}.
1421 Automatically kneed cross-staff beams cannot be used together with
1422 hidden staves. See @ref{Hiding staves}.
1424 Beams can collide with note heads and accidentals in other voices
1427 @node Setting automatic beam behavior
1428 @unnumberedsubsubsec Setting automatic beam behavior
1430 @funindex autoBeaming
1431 @funindex autoBeamSettings
1432 @funindex (end * * * *)
1433 @funindex (begin * * * *)
1435 @cindex automatic beams, tuning
1436 @cindex tuning automatic beaming
1437 @cindex automatic beam generation
1439 @cindex lyrics and beaming
1442 The placement of automatic beams is determined by the rules
1443 described in @ref{Automatic beams}. There are two mutually
1444 exclusive ways in which these rules may be modified. The
1445 first, modifying the grouping of beats, applies to uncommon time
1446 signatures, i.e. those for which there are no predefined rules
1447 defining the beam end points. The second method, modifying the
1448 specification of the beam end points, can be used for any time
1449 signature. This second method @strong{must} be used for those time
1450 signatures for which beam ending rules are pre-defined, unless
1451 these have all been reverted. There are predefined rules for time
1452 signatures of 3/2, 3/4, 4/4, 2/4, 4/8, 4/16, 6/8, 9/8 and 12/8.
1454 @i{@strong{Modifying the grouping of beats}}
1456 If there are no beam-ending rules defined for the time signature
1457 in use the beaming is controlled by three context properties:
1458 @code{measureLength}, @code{beatLength} and @code{beatGrouping}.
1459 These properties may be set in the @code{Score}, @code{Staff} or
1460 @code{Voice} contexts to delimit their scope.
1462 These determine the beaming as follows:
1464 Beams may begin anywhere (unless a beam is already active). Beams
1465 end at a time determined by the values of @code{beatGrouping} and
1466 @code{beatLength}, as follows:
1470 @item If @code{beatGrouping} and @code{beatLength} are consistent
1471 with @code{measureLength}, @code{beatGrouping} is used to determine
1472 the end points of beams.
1474 @item If @code{beatGrouping} and @code{beatLength} are inconsistent
1475 with @code{measureLength}, @code{beatLength} is used to determine
1476 the end points of beams.
1480 @warning{These three properties are effective @strong{only} if
1481 there are no beam-ending rules defined for the time signature in
1482 force, or if these beam-ending rules have all been reverted.}
1484 By default the @code{measureLength} and @code{beatLength} are
1485 derived from the time signature set by the @code{\time} command.
1486 The @code{measureLength} is set to be exactly the same length as
1487 the measure length given by the time signature, and the
1488 @code{beatLength} is set to be the same as one over the denominator
1489 of the time signature.
1491 The default value of @code{beatGrouping} is taken from a table in
1492 @file{scm/@/music@/-functions@/.scm}. To find this, see
1493 @rlearning{Other sources of information}. It defines the beat
1494 grouping for 5/8, 6/8, 8/8, 9/8 and 12/8 time signatures.
1496 Both @code{measureLength} and @code{beatLength} are @i{moments},
1497 units of musical duration. A quantity of type @i{moment} is
1498 created by the scheme function @code{ly:make-moment}. For more
1499 information about this function, see @ref{Time administration}.
1501 @code{beatGrouping} is a list of integers giving the number of
1502 beats in each group.
1506 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1509 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1510 {specifying-context-with-beatgrouping.ly}
1513 @c TODO Send as snippet?
1515 The property @code{measureLength} determines where bar lines
1516 should be inserted and, with @code{beatLength} and
1517 @code{beatGrouping}, how automatic beams should be generated
1518 for time signatures for which no beam-ending rules are defined.
1520 @lilypond[quote,verbatim,relative=2]
1521 \time 3/4 % auto beam on 1/4 note groups
1522 a16 a a a a a a a a a a a a a a a
1523 \time 12/16 % no defined auto-beaming for this time sig
1524 a16 a a a a a a a a a a a a a a a
1526 a16 a a a a a a a a a a a a a a a
1527 \set Score.timeSignatureFraction = #'(12 . 16) %keep 3/4 beaming
1529 a16 a a a a a a a a a a a a a a a
1530 \set Score.beatLength = #(ly:make-moment 1 8) %beam on 1/8 notes
1531 a16 a a a a a a a a a a a a a a a
1532 \set Score.beatLength = #(ly:make-moment 1 16)
1533 \set Score.beatGrouping = #'(3 4 2 3) %beam on 3/16, 7/16, 9/16, 12/16
1534 a16 a a a a a a a a a a a a a a a
1540 @funindex subdivideBeams
1542 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1543 {sub-dividing-beams.ly}
1545 @cindex measure groupings
1546 @cindex beats, grouping
1547 @cindex grouping beats
1548 @cindex measure sub-grouping
1550 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1551 {conducting-signs,-measure-grouping-signs.ly}
1554 @strong{@i{Modifying the beam end points}}
1556 In common time signatures, automatic beams can start on any note
1557 but can end at only a few positions within the measure, namely at
1558 durations specified by the properties in @code{autoBeamSettings}.
1559 These properties consist of a list of rules defining where beams can
1560 end. The default @code{autoBeamSettings} rules are defined in
1561 @file{scm/@/auto@/-beam@/.scm}. To find this, see
1562 @rlearning{Other sources of information}.
1564 This method @strong{must} be used for the time signatures for which
1565 beam-ending rules are defined by default, unless these have all
1566 been reverted. It is also particularly suitable for many other time
1567 signatures if the time signature of the measures changes frequently,
1568 or if the beaming should be different for different beam durations.
1570 In order to add a rule to the list, use
1573 #(override-auto-beam-setting
1575 beam-numerator beam-denominator
1576 time-signature-numerator time-signature-denominator)
1577 moment-numerator moment-denominator [context])
1585 @item @code{beam-limit} is the type of automatic beam limit
1586 defined. This can be either @code{begin} or @code{end} but
1587 only @code{end} is effective.
1589 @item @code{beam-numerator/beam-denominator} is the beam duration
1590 to which the rule is to apply. A beam is considered to have
1591 the duration of its shortest note. Set @code{beam-numerator}
1592 and @code{beam-denominator} to @code{'*'} to have this rule apply
1593 to beams of any duration.
1595 @item @code{time-signature-numerator/time-signature-denominator}
1596 specifies the time signature to which this rule should apply.
1597 If @code{time-signature-numerator} and
1598 @code{time-signature-denominator} are set to @code{'*'} this rule
1599 will apply in any time signature.
1601 @item @code{monent-numerator/moment-denominator} is the position
1602 in the bar at which the beam should end.
1604 @item @code{context} is optional, and it specifies the context at which
1605 the change should be made. The default is @code{'Voice}.
1607 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1608 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1612 For example, if automatic beams should always end on the first quarter
1613 note, whatever the time signature or beam duration, use
1615 @lilypond[quote,verbatim,relative=2]
1617 #(override-auto-beam-setting '(end * * * *) 1 4)
1621 You can force the beam settings to take effect only on beams whose shortest
1622 note is a certain duration
1624 @lilypond[quote,verbatim,relative=2]
1626 % end 1/16 beams for all time signatures at the 1/16 moment
1627 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1629 a32 a a a a16 a a a a a |
1630 % end 1/32 beams for all time signatures at the 1/16 moment
1631 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1632 a32 a a a a16 a a a a a |
1635 You can force the beam settings to take effect only in certain time
1638 @lilypond[quote,verbatim,relative=2]
1640 % end beams of all durations in 5/8 time signature at the 2/8 moment
1641 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1649 When multiple voices are used the @code{Staff} context must be
1650 specified if the beaming is to be applied to all voices in the
1653 @lilypond[quote,verbatim,relative=2]
1656 % Context not specified - does not work correctly
1657 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1658 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1659 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1660 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1662 % Works correctly with context specified
1663 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1664 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1665 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1666 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1669 @c TODO Add example using Score for multiple staves?
1670 @c Hmm. Not sure it works correctly. Needs more investigation.
1672 @warning{If any unexpected beam behavior occurs, check the default
1673 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1674 possible interference, because the beam endings defined there will
1675 still apply in addition to your own.}
1677 Any unwanted or conflicting default endings must be reverted for
1678 your time signature(s). Existing auto-beam rules are removed by
1682 #(revert-auto-beam-setting
1684 beam-numerator beam-denominator
1685 time-signature-numerator time-signature-denominator)
1686 moment-numerator moment-denominator [context])
1690 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1691 @code{time-signature-numerator}, @code{time-signature-denominator},
1692 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1693 are the same as above.
1695 @lilypond[quote,verbatim,relative=2]
1697 a16 a a a a a a a a a a a a a a a
1698 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1699 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1700 a16 a a a a a a a a a a a a a a a
1703 The rule in a @code{revert-auto-beam-setting} statement must exactly
1704 match the original rule. That is, no wildcard expansion is taken into
1707 @lilypond[quote,verbatim,relative=2]
1709 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1711 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1713 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1719 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1720 {beam-grouping-in-7-8-time.ly}
1724 @c TODO Does this example add anything?
1727 example, automatic beams can only end on a dotted quarter note
1729 #(override-auto-beam-setting '(end * * * *) 3 8)
1730 #(override-auto-beam-setting '(end * * * *) 1 2)
1731 #(override-auto-beam-setting '(end * * * *) 7 8)
1734 In 4/4 time signature, this means that automatic beams could end only on
1735 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1736 3/8, has passed within the measure).
1740 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1741 {reverting-default-beam-endings.ly}
1746 @funindex \autoBeamOff
1747 @code{\autoBeamOff},
1748 @funindex \autoBeamOn
1754 If a score ends while an automatic beam has not been ended and is
1755 still accepting notes, this last beam will not be typeset at all.
1756 The same holds for polyphonic voices, entered with @code{<<
1757 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1758 automatic beam is still accepting notes, it is not typeset.
1767 @unnumberedsubsubsec Manual beams
1769 @cindex beams, manual
1773 In some cases it may be necessary to override the automatic
1774 beaming algorithm. For example, the autobeamer will not put beams
1775 over rests or bar lines, and in choral scores the beaming is
1776 often set to follow the meter of the lyrics rather than the
1777 notes. Such beams can be specified manually by
1778 marking the begin and end point with @code{[} and @code{]}
1780 @lilypond[quote,relative=1,verbatim]
1782 r4 r8[ g' a r8] r8 g[ | a] r8
1787 Individual notes may be marked with @code{\noBeam} to prevent them
1790 @lilypond[quote,verbatim,relative=2]
1791 \time 2/4 c8 c\noBeam c c
1794 @funindex stemLeftBeamCount
1795 @funindex stemRightBeamCount
1797 Even more strict manual control with the beams can be achieved by
1798 setting the properties @code{stemLeftBeamCount} and
1799 @code{stemRightBeamCount}. They specify the number of beams to
1800 draw on the left and right side, respectively, of the next note.
1801 If either property is set, its value will be used only once, and
1802 then it is erased. In this example, the last @code{f} is printed
1803 with only one beam on the left side, i.e., the eighth-note beam of
1804 the group as a whole.
1806 @lilypond[quote,relative=2,verbatim]
1809 \set stemLeftBeamCount = #2
1810 \set stemRightBeamCount = #1
1812 \set stemLeftBeamCount = #1
1819 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1820 {flat-flags-and-beam-nibs.ly}
1822 @node Feathered beams
1823 @unnumberedsubsubsec Feathered beams
1825 @cindex beams, feathered
1826 @funindex \featherDurations
1828 Feathered beams are used to indicate that a small group of notes
1829 should be played at an increasing (or decreasing) tempo, without
1830 changing the overall tempo of the piece. The extent of the
1831 feathered beam must be indicated manually using @code{[} and
1832 @code{]}, and the beam feathering is turned on by specifying a
1833 direction to the @code{Beam} property @code{grow-direction}.
1835 If the placement of the notes and the sound in the MIDI output
1836 is to reflect the ritardando or accelerando indicated by the
1837 feathered beam the notes must be grouped as a
1838 music expression delimited by braces and preceded by a
1839 @code{featheredDurations} command which specifies the ratio
1840 between the durations of the first and last notes in the group.
1843 show the extent of the beam and the braces show
1844 which notes are to have their durations modified. Normally
1845 these would delimit the same group of notes, but this is not
1846 required: the two commands are independent.
1848 In the following example the eight 16th notes occupy exactly the
1849 same time as a half note, but the first note is one half as long
1850 as the last one, with the intermediate notes gradually
1851 lengthening. The first four 32nd notes gradually speed up, while
1852 the last four 32nd notes are at a constant tempo.
1854 @lilypond[relative=1,verbatim,quote]
1855 \override Beam #'grow-direction = #LEFT
1856 \featherDurations #(ly:make-moment 2 1)
1857 { c16[ c c c c c c c] }
1858 \override Beam #'grow-direction = #RIGHT
1859 \featherDurations #(ly:make-moment 2 3)
1861 % revert to non-feathered beams
1862 \override Beam #'grow-direction = #'()
1867 The spacing in the printed output represents the
1868 note durations only approximately, but the MIDI output is exact.
1872 The @code{\featherDurations} command only works with very short
1873 music snippets, and when numbers in the fraction are small.
1889 * Bar and bar number checks::
1894 @unnumberedsubsubsec Bar lines
1898 @cindex measure lines
1901 Bar lines delimit measures, and are also used to indicate
1902 repeats. Normally, simple bar lines are automatically inserted
1903 into the printed output at places based on the current time
1906 The simple bar lines inserted automatically can be changed to
1907 other types with the @code{\bar} command. For example, a closing
1908 double bar line is usually placed at the end of a piece:
1910 @lilypond[quote,relative=1,verbatim]
1914 It is not invalid if the final note in a measure does not
1915 end on the automatically entered bar line: the note is assumed
1916 to carry over into the next measure. But if a long sequence
1917 of such carry-over measures appears the music can appear compressed
1918 or even flowing off the page. This is because automatic line
1919 breaks happen only at the end of complete measures, i.e., where
1920 all notes end before the end of a measure.
1922 @warning{An incorrect duration can cause line breaks to be
1923 inhibited, leading to a line of highly compressed music or
1924 music which flows off the page.}
1927 @cindex bar lines, invisible
1928 @cindex measure lines, invisible
1930 Line breaks are also permitted at manually inserted bar lines
1931 even within incomplete measures. To allow a line break without
1932 printing a bar line, use
1939 This will insert an invisible bar line and allow (but not
1940 force) a line break to occur at this point. The bar number
1941 counter is not increased. To force a line break see
1942 @ref{Line breaking}.
1944 This and other special bar lines may be inserted manually at any
1945 point. When they coincide with the end of a measure they replace
1946 the simple bar line which would have been inserted there
1947 automatically. When they do not coincide
1948 with the end of a measure the specified bar line is inserted at that
1949 point in the printed output. Such insertions do not affect
1950 the calculation and placement of subsequent automatic bar lines.
1952 The simple bar line and five types of double bar line are available
1953 for manual insertion:
1955 @lilypond[quote,relative=1,verbatim]
1956 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
1960 together with dotted and dashed bar lines:
1962 @lilypond[quote,relative=1,verbatim]
1963 f1 \bar ":" g \bar "dashed" a
1967 and five types of repeat bar line:
1969 @lilypond[quote,relative=1,verbatim]
1970 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
1975 Although the bar line types signifying repeats may be inserted
1976 manually they do not in themselves cause LilyPond to recognize
1977 a repeated section. Such repeated sections are better entered
1978 using the various repeat commands (see @ref{Repeats}), which
1979 automatically print the appropriate bar lines.
1981 In addition, you can specify @code{"||:"}, which is equivalent to
1982 @code{"|:"} except at line breaks, where it gives a double bar
1983 line at the end of the line and a start repeat at the beginning of
1986 @lilypond[quote,relative=2,verbatim]
1987 \override Score.RehearsalMark #'padding = #3
1995 In scores with many staves, a @code{\bar} command in one staff is
1996 automatically applied to all staves. The resulting bar lines are
1997 connected between different staves of a @code{StaffGroup},
1998 @code{InnerStaffGroup}, @code{PianoStaff}, or @code{GrandStaff}.
2000 @lilypond[quote,fragment,verbatim]
2008 \new Staff { \clef bass c4 g e g }
2010 \new Staff { \clef bass c2 c2 }
2018 @funindex defaultBarType
2020 The command @code{\bar }@var{bartype} is a shortcut for
2021 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2022 created whenever the @code{whichBar} property is
2025 The default bar type used for automatically inserted bar lines is
2026 @code{"|"}. This may be changed at any time
2027 with @code{\set Timing.defaultBarType = }@var{bartype}.
2032 @ref{Line breaking},
2034 @ref{Grouping staves}.
2039 Internals Reference: @rinternals{BarLine} (created at
2040 @rinternals{Staff} level), @rinternals{SpanBar} (across
2041 staves), @rinternals{Timing_translator} (for Timing
2046 @unnumberedsubsubsec Bar numbers
2049 @cindex measure numbers
2050 @funindex currentBarNumber
2052 Bar numbers are typeset by default at the start of every line except
2053 the first line. The number itself is stored in the
2054 @code{currentBarNumber} property, which is normally updated
2055 automatically for every measure. It may also be set manually:
2057 @lilypond[verbatim,quote,fragment,relative=1]
2060 \set Score.currentBarNumber = #50
2067 @funindex barNumberVisibility
2068 @cindex bar numbers, regular spacing
2070 Bar numbers can be typeset at regular intervals instead of just at
2071 the beginning of every line. To do this the default behavior
2072 must be overridden to permit bar numbers to be printed at places
2073 other than the start of a line. This is controlled by the
2074 @code{break-visibility} property of @code{BarNumber}. This takes
2075 three values which may be set to @code{#t} or @code{#f} to specify
2076 whether the corresponding bar number is visible or not. The order
2077 of the three values is @code{end of line visible}, @code{middle of
2078 line visible}, @code{beginning of line visible}. In the following
2079 example bar numbers are printed at all possible places:
2081 @lilypond[verbatim,quote,relative=1]
2082 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2083 \set Score.currentBarNumber = #11
2084 \bar "" % Permit first bar number to be printed
2090 @c All the rest of these examples will be added to LSR
2091 @c and moved into the Snippets. -gp
2094 and here the bar numbers are printed every two measures
2095 except at the end of the line:
2097 @lilypond[verbatim,quote,relative=1]
2098 \override Score.BarNumber #'break-visibility = #'#(#f #t #t)
2099 \set Score.currentBarNumber = #11
2100 \bar "" % Permit first bar number to be printed
2101 % Print a bar number every second measure
2102 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2108 @cindex measure number, format
2109 @cindex bar number, format
2111 The size of the bar number may be changed. This is illustrated
2112 in the following example, which also shows how to enclose bar
2113 numbers in boxes and circles, and shows an alternative way
2114 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
2116 @lilypond[verbatim,quote,relative=1]
2117 % Prevent bar numbers at the end of a line and permit them elsewhere
2118 \override Score.BarNumber #'break-visibility
2119 = #end-of-line-invisible
2121 % Increase the size of the bar number by 2
2122 \override Score.BarNumber #'font-size = #2
2123 \repeat unfold 3 { c1 } \bar "|"
2125 % Draw a box round the following bar number(s)
2126 \override Score.BarNumber #'stencil
2127 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
2128 \repeat unfold 3 { c1 } \bar "|"
2130 % Draw a circle round the following bar number(s)
2131 \override Score.BarNumber #'stencil
2132 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2133 \repeat unfold 4 { c1 } \bar "|."
2136 @cindex bar number alignment
2138 Bar numbers by default are left-aligned to their parent object.
2139 This is usually the left edge of a line or, if numbers are printed
2140 within a line, the left bar line of the measure. The numbers may also
2141 be positioned directly on the bar line or right-aligned to the
2144 @lilypond[verbatim,quote,relative=1]
2145 \set Score.currentBarNumber = #111
2146 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2147 % Increase the size of the bar number by 2
2148 \override Score.BarNumber #'font-size = #2
2149 % Print a bar number every second measure
2150 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2152 % Center-align bar numbers
2153 \override Score.BarNumber #'self-alignment-X = #0
2155 % Right-align bar numbers
2156 \override Score.BarNumber #'self-alignment-X = #-1
2160 Bar numbers can be removed entirely by removing the
2161 @code{Bar_number_engraver} from the @code{Score} context.
2163 @lilypond[verbatim,quote]
2167 \remove "Bar_number_engraver"
2182 Internals Reference: @rinternals{BarNumber}.
2187 Bar numbers may collide with the top of the
2188 @rinternals{StaffGroup} bracket, if there is one. To solve
2189 this, the @code{padding} property of @rinternals{BarNumber} can
2190 be used to position the number correctly.
2192 Bar numbers may only be printed at bar lines; to print a bar
2193 number at the beginning of a piece, an empty bar line must be
2194 inserted there, and a value other than @code{1} must be placed
2195 in @code{currentBarNumber}:
2197 @lilypond[verbatim,quote,relative=1]
2198 \set Score.currentBarNumber = #50
2207 @node Bar and bar number checks
2208 @unnumberedsubsubsec Bar and bar number checks
2211 @funindex barCheckSynchronize
2214 Bar checks help detect errors in the entered durations.
2215 A bar check may be entered using the bar symbol, @code{|},
2216 at any place where a bar line is expected to fall.
2217 If bar check lines are encountered at other places,
2218 a list of warnings is printed in the log file,
2219 showing the line numbers and lines
2220 in which the bar checks failed. In the next
2221 example, the second bar check will signal an error.
2224 \time 3/4 c2 e4 | g2 |
2227 Bar checks can also be used in lyrics, for example
2232 Twin -- kle | Twin -- kle |
2236 An incorrect duration can result in a completely garbled score,
2237 especially if the score is polyphonic, so a good place to start
2238 correcting input is by scanning for failed bar checks and
2239 incorrect durations.
2241 If successive bar checks are off by the same musical interval,
2242 only the first warning message is displayed. This allows the
2243 warning to focus on the source of the timing error.
2247 @funindex pipeSymbol
2249 It is also possible to redefine the action taken when a bar check
2250 or pipe symbol, @code{|}, is encountered in the input, so that
2251 it does something other than a bar check. This is done by
2252 assigning a music expression to @code{pipeSymbol}.
2253 In the following example @code{|} is set to insert a double bar
2254 line wherever it appears in the input, rather than checking
2257 @lilypond[quote,verbatim]
2258 pipeSymbol = \bar "||"
2267 When copying large pieces of music, it can be helpful to check
2268 that the LilyPond bar number corresponds to the original that you
2269 are entering from. This can be checked with
2270 @code{\barNumberCheck}, for example,
2273 \barNumberCheck #123
2277 will print a warning if the @code{currentBarNumber} is not 123
2278 when it is processed.
2286 @node Rehearsal marks
2287 @unnumberedsubsubsec Rehearsal marks
2289 @cindex rehearsal marks
2290 @cindex mark, rehearsal
2293 To print a rehearsal mark, use the @code{\mark} command
2295 @lilypond[quote,verbatim,relative=2]
2304 The letter@tie{}@q{I} is skipped in accordance with engraving
2305 traditions. If you wish to include the letter @q{I}, then use
2308 \set Score.markFormatter = #format-mark-alphabet
2311 The mark is incremented automatically if you use @code{\mark
2312 \default}, but you can also use an integer argument to set the
2313 mark manually. The value to use is stored in the property
2314 @code{rehearsalMark}.
2316 @cindex rehearsal mark format
2317 @cindex rehearsal mark style
2318 @cindex style, rehearsal mark
2319 @cindex format, rehearsal mark
2320 @cindex mark, rehearsal, style
2321 @cindex mark, rehearsal, format
2323 The style is defined by the property @code{markFormatter}. It is
2324 a function taking the current mark (an integer) and the current
2325 context as argument. It should return a markup object. In the
2326 following example, @code{markFormatter} is set to a pre-defined
2327 procedure. After a few measures, it is set to a procedure that
2328 produces a boxed number.
2330 @lilypond[quote,verbatim,relative=2]
2331 \set Score.markFormatter = #format-mark-numbers
2334 \set Score.markFormatter = #format-mark-box-numbers
2336 \set Score.markFormatter = #format-mark-circle-numbers
2338 \set Score.markFormatter = #format-mark-circle-letters
2342 The file @file{scm/@/translation@/-functions@/.scm} contains the
2343 definitions of @code{format-mark-numbers} (the default format),
2344 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2345 @code{format-mark-box-letters}. These can be used as inspiration
2346 for other formatting functions.
2348 You may use @code{format-mark-barnumbers},
2349 @code{format-mark-box-barnumbers}, and
2350 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2351 incremented numbers or letters.
2353 Other styles of rehearsal mark can be specified manually
2360 @code{Score.markFormatter} does not affect marks specified in this
2361 manner. However, it is possible to apply a @code{\markup} to the
2365 \mark \markup@{ \box A1 @}
2372 Music glyphs (such as the segno sign) may be printed inside a
2375 @lilypond[quote,verbatim,relative=1]
2376 c1 \mark \markup { \musicglyph #"scripts.segno" }
2377 c1 \mark \markup { \musicglyph #"scripts.coda" }
2378 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2383 See @ref{The Feta font}, for a list of symbols which may be
2384 printed with @code{\musicglyph}.
2386 For common tweaks to the positioning of rehearsal marks, see
2387 @ref{Formatting text}.
2392 @ref{The Feta font},
2393 @ref{Formatting text}.
2396 @file{scm/@/translation@/-functions@/.scm} contains
2397 the definition of @code{format-mark-numbers} and
2398 @code{format-mark-letters}. They can be used as inspiration for
2399 other formatting functions.
2404 Internals Reference: @rinternals{RehearsalMark}.
2406 @node Special rhythmic concerns
2407 @subsection Special rhythmic concerns
2412 * Aligning to cadenzas::
2413 * Time administration::
2417 @unnumberedsubsubsec Grace notes
2422 @cindex appoggiatura
2423 @cindex acciaccatura
2425 Grace notes are ornaments that are written out. Grace notes
2426 are printed in a smaller font and take up no logical time
2429 @lilypond[quote,relative=2,verbatim]
2431 \grace { c16[ d16] } c2
2434 Lilypond also supports two special types of grace notes, the
2435 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2436 small note with a slashed stem--and the @emph{appoggiatura}, which
2437 takes a fixed fraction of the main note and appears in small print
2440 @lilypond[quote,relative=2,verbatim]
2444 \acciaccatura { g16[ f] } e4
2447 The placement of grace notes is synchronized between different
2448 staves. In the following example, there are two sixteenth grace
2449 notes for every eighth grace note
2451 @lilypond[quote,relative=2,verbatim]
2452 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2453 \new Staff { c2 \grace { g8[ b] } c2 } >>
2456 @funindex \afterGrace
2458 @cindex grace notes, following
2460 If you want to end a note with a grace, use the @code{\afterGrace}
2461 command. It takes two arguments: the main note, and the grace
2462 notes following the main note.
2464 @lilypond[quote,verbatim,relative=2]
2465 c1 \afterGrace d1 { c16[ d] } c1
2468 This will put the grace notes after a space lasting 3/4 of the
2469 length of the main note. The default fraction 3/4 can be changed by
2470 setting @code{afterGraceFraction}. The following example shows
2471 the results from setting the space at the default, at 15/16, and
2472 finally at 1/2 of the main note.
2474 @lilypond[quote,verbatim,relative=2]
2477 c1 \afterGrace d1 { c16[ d] } c1
2480 #(define afterGraceFraction (cons 15 16))
2481 c1 \afterGrace d1 { c16[ d] } c1
2484 #(define afterGraceFraction (cons 1 2))
2485 c1 \afterGrace d1 { c16[ d] } c1
2490 The space between the main note and the grace note may also be
2491 specified using spacers. The following example places the grace
2492 note after a space lasting 7/8 of the main note.
2494 @lilypond[quote,verbatim,relative=2]
2497 { s2 s4. \grace { c16[ d] } } >>
2502 A @code{\grace} music expression will introduce special
2503 typesetting settings, for example, to produce smaller type, and
2504 set directions. Hence, when introducing layout tweaks to
2505 override the special settings, they should be placed inside
2506 the grace expression. The overrides should also be reverted
2507 inside the grace expression. Here, the grace note's default stem
2508 direction is overriden and then reverted.
2510 @lilypond[quote,verbatim,relative=2]
2522 @cindex stem, with slash
2527 The slash through the stem found in @emph{acciaccatura}s can be applied
2528 in other situations:
2530 @lilypond[quote,verbatim,relative=2]
2532 \override Stem #'stroke-style = #"grace"
2537 The layout of grace expressions can be changed throughout the
2538 music using the function @code{add-grace-property}. The following
2539 example undefines the @code{Stem} direction for this grace, so
2540 that stems do not always point up.
2542 @lilypond[quote,verbatim,relative=2]
2545 #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
2546 #(remove-grace-property 'Voice 'Stem 'direction)
2548 \acciaccatura { f16 } g4
2549 \grace { d16[ e] } f4
2550 \appoggiatura { a,32[ b c d] } e2
2556 Another option is to change the variables @code{startGraceMusic},
2557 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2558 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2559 @code{stopAppoggiaturaMusic}. The default values of these can be
2560 seen in the file @code{ly/@/grace@/-init@/.ly}. By redefining
2561 them other effects may be obtained.
2563 Grace notes may be forced to align with regular notes
2566 @lilypond[verbatim,quote]
2569 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2572 \afterGrace c4 { c16[ c8 c16] }
2576 c16 c c c c c c c c4 r
2586 @rglos{grace notes},
2587 @rglos{acciaccatura},
2588 @rglos{appoggiatura}.
2590 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2592 Snippets: @rlsr{Rhythms}.
2594 Internals Reference: @rinternals{GraceMusic}.
2599 A multi-note beamed @i{acciaccatura} is printed without a slash,
2600 and looks exactly the same as a multi-note beamed
2603 @c TODO Add link to LSR snippet to add slash when available
2605 Grace note synchronization can also lead to surprises. Staff
2606 notation, such as key signatures, bar lines, etc., are also
2607 synchronized. Take care when you mix staves with grace notes and
2608 staves without, for example,
2610 @lilypond[quote,relative=2,verbatim]
2611 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2612 \new Staff { c4 \bar "|:" d2. } >>
2616 This can be remedied by inserting grace skips of the corresponding
2617 durations in the other staves. For the above example
2619 @lilypond[quote,relative=2,verbatim]
2620 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2621 \new Staff { c4 \bar "|:" \grace s16 d2. } >>
2624 Grace sections should only be used within sequential music
2625 expressions. Nesting or juxtaposing grace sections is not
2626 supported, and might produce crashes or other errors.
2628 @node Aligning to cadenzas
2629 @unnumberedsubsubsec Aligning to cadenzas
2632 @cindex cadenza, aligning to
2633 @cindex aligning to cadenza
2635 In an orchestral context, cadenzas present a special problem: when
2636 constructing a score that includes a measured cadenza or other solo
2637 passage, all other instruments should skip just as many notes as the
2638 length of the cadenza, otherwise they will start too soon or too late.
2640 One solution to this problem is to use the functions
2641 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2642 functions take a defined piece of music as an argument and generate a
2643 multi-measure rest or @code{\skip} exactly as long as the piece.
2645 @lilypond[verbatim,quote]
2646 MyCadenza = \relative c' {
2657 #(ly:export (mmrest-of-length MyCadenza))
2659 #(ly:export (skip-of-length MyCadenza))
2674 @node Time administration
2675 @unnumberedsubsubsec Time administration
2677 @cindex time administration
2678 @cindex timing (within the score)
2679 @cindex music, unmetered
2680 @cindex unmetered music
2682 @funindex currentBarNumber
2683 @funindex measurePosition
2684 @funindex measureLength
2686 Time is administered by the @code{Timing_translator}, which by
2687 default is to be found in the @code{Score} context. An alias,
2688 @code{Timing}, is added to the context in which the
2689 @code{Timing_translator} is placed.
2691 The following properties of @code{Timing} are used
2692 to keep track of timing within the score.
2695 @cindex measure number
2698 @item currentBarNumber
2699 The current measure number. For an example showing the
2700 use of this property see @ref{Bar numbers}.
2703 The length of the measures in the current time signature. For a
2704 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2705 determines when bar lines are inserted and how automatic beams
2706 should be generated.
2708 @item measurePosition
2709 The point within the measure where we currently are. This
2710 quantity is reset by subtracting @code{measureLength} whenever
2711 @code{measureLength} is reached or exceeded. When that happens,
2712 @code{currentBarNumber} is incremented.
2715 If set to true, the above variables are updated for every time
2716 step. When set to false, the engraver stays in the current
2717 measure indefinitely.
2721 Timing can be changed by setting any of these variables
2722 explicitly. In the next example, the default 4/4 time
2723 signature is printed, but @code{measureLength} is set to 5/4.
2724 At 4/8 through the third measure, the @code{measurePosition} is
2725 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2726 The next bar line then falls at 9/8 rather than 5/4.
2728 @lilypond[quote,verbatim,relative=1]
2729 \set Score.measureLength = #(ly:make-moment 5 4)
2733 \set Score.measurePosition = #(ly:make-moment 5 8)
2739 As the example illustrates, @code{ly:make-moment n m} constructs a
2740 duration of n/m of a whole note. For example,
2741 @code{ly:make-moment 1 8} is an eighth note duration and
2742 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2748 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2753 Internals Reference: @rinternals{Timing_translator},