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
43 @cindex length of notes
53 Durations are designated by numbers and dots. Durations are entered
54 as their reciprocal values. For example, a quarter note is entered
55 using a @code{4} (since it is a 1/4 note), and a half note is entered
56 using a @code{2} (since it is a 1/2 note). For notes longer than a
57 whole you must use the @code{\longa} (a double breve) and
58 @code{\breve} commands. Durations as short as 128th notes may be
59 specified. Shorter values are possible, but only as beamed notes.
61 @c Two 64th notes are needed to obtain beams
62 @lilypond[quote,verbatim,relative=2]
69 Here are the same durations with automatic beaming turned off.
71 @c not strictly "writing rhythms"; more of a "displaying" thing,
72 @c but it's ok here. -gp
73 @lilypond[quote,verbatim,relative=2]
80 A note with the duration of a quadruple breve may be entered with
81 @code{\maxima}, but this is supported only within ancient music
82 notation. For details, see @ref{Ancient notation}.
84 If the duration is omitted, it is set to the previously
85 entered duration. The default for the first note is a quarter
88 @lilypond[quote,verbatim,relative=2]
94 @cindex notes, double-dotted
95 @cindex double-dotted notes
99 To obtain dotted note lengths, place a dot (@code{.}) after the
100 duration. Double-dotted notes are specified by appending two
103 @lilypond[quote,verbatim,relative=2]
104 a4 b c4. b8 a4. b4.. c8.
107 Some durations cannot be represented with just binary durations
108 and dots; they can be represented only by tying two or more
109 notes together. For details, see @ref{Ties}.
111 For ways of specifying durations for the syllables of lyrics and
112 ways of aligning lyrics to notes, see @ref{Vocal music}.
114 Optionally, notes can be spaced strictly proportionately to their
115 duration. For details of this and other settings which control
116 proportional notation, see @ref{Proportional notation}.
122 @funindex \dotsNeutral
123 @funindex dotsNeutral
125 Dots are normally moved up to avoid staff lines, except in
126 polyphonic situations. Predefined commands are available to
127 force a particular direction manually, for details
128 see @ref{Direction and placement}.
145 @rglos{Duration names notes and rests}.
148 @ref{Automatic beams},
151 @ref{Writing rhythms},
154 @ref{Ancient notation},
155 @ref{Proportional notation}.
162 @rinternals{DotColumn}.
167 @c Deliberately duplicated in Durations and Rests. -gp
168 There is no fundamental limit to rest durations (both in terms of
169 longest and shortest), but the number of glyphs is limited:
170 rests from 128th to maxima (8 x whole) may be printed.
174 @unnumberedsubsubsec Tuplets
182 Tuplets are made from a music expression by multiplying all the
183 durations with a fraction:
186 \times @var{fraction} @{ @var{music} @}
190 The duration of @var{music} will be multiplied by the
191 fraction. The fraction's denominator will be printed over or
192 under the notes, optionally with a bracket. The most common
193 tuplet is the triplet in which 3 notes have the duration of 2, so
194 the notes are 2/3 of their written length.
196 @lilypond[quote,verbatim,relative=2]
197 a2 \times 2/3 { b4 b b }
198 c4 c \times 2/3 { b4 a g }
203 @funindex \tupletDown
205 @funindex \tupletNeutral
206 @funindex tupletNeutral
208 The automatic placement of the tuplet bracket above or below the
209 notes may be overridden manually with predefined commands, for
210 details see @ref{Direction and placement}.
212 Tuplets may be nested:
214 @lilypond[quote,verbatim,relative=2]
216 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
219 Modifying nested tuplets which begin at the same musical moment
220 must be done with @code{\tweak}.
222 To modify the duration of notes without printing a tuplet bracket,
223 see @ref{Scaling durations}.
229 @code{\tupletNeutral}.
235 @cindex tuplet formatting
236 @cindex triplet formatting
238 @funindex tupletNumberFormatFunction
239 @funindex tupletSpannerDuration
241 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
242 {entering-several-tuplets-using-only-one--times-command.ly}
244 @funindex TupletNumber
246 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
247 {changing-the-tuplet-number.ly}
249 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
250 {non-default-tuplet-numbers.ly}
252 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
253 {permitting-line-breaks-within-beamed-tuplets.ly}
262 Learning Manual: @rlearning{Tweaking methods}.
265 @ref{Time administration},
266 @ref{Scaling durations},
267 @ref{The tweak command},
268 @ref{Polymetric notation}.
274 @rinternals{TupletBracket},
275 @rinternals{TupletNumber},
276 @rinternals{TimeScaledMusic}.
280 @cindex grace notes within tuplet brackets
281 When the first note on a staff is a grace note followed by a
282 tuplet the grace note must be placed before the @code{\times}
283 command to avoid errors. Anywhere else, grace notes may be
284 placed within tuplet brackets.
287 @node Scaling durations
288 @unnumberedsubsubsec Scaling durations
290 @cindex scaling durations
291 @cindex durations, scaling
293 You can alter the duration of single notes, rests or chords by a
294 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
295 is 1) to the duration. This will not affect the appearance of the
296 notes or rests produced, but the altered duration will be used in
297 calculating the position within the measure and setting the duration
298 in the MIDI output. Multiplying factors may be combined such as
301 In the following example, the first three notes take up exactly
302 two beats, but no triplet bracket is printed.
304 @lilypond[quote,relative=2,verbatim]
306 % Alter durations to triplets
307 a4*2/3 gis4*2/3 a4*2/3
310 % Double the duration of chord
312 % Duration of quarter, appears like sixteenth
316 The duration of skip or spacing notes may also be modified by
317 a multiplier. This is useful for skipping many measures, e.g.,
320 @cindex compressing music
322 @funindex \scaleDurations
323 @funindex scaleDurations
325 Longer stretches of music may be compressed by a fraction in the
326 same way, as if every note, chord or rest had the fraction as a
327 multiplier. This leaves the appearance of the music unchanged but
328 the internal duration of the notes will be multiplied by the
329 fraction @emph{num}/@emph{den}. The spaces around the dot are
330 required. Here is an example showing how music can be compressed
333 @lilypond[quote,relative=2,verbatim]
337 % Scale music by *2/3
338 \scaleDurations #'(2 . 3) {
342 \scaleDurations #'(2 . 1) {
348 One application of this command is in polymetric
349 notation, see @ref{Polymetric notation}.
355 @ref{Invisible rests},
356 @ref{Polymetric notation}.
363 @unnumberedsubsubsec Ties
369 A tie connects two adjacent note heads of the same pitch. The tie
370 in effect extends the duration of a note.
372 @warning{Ties should not be confused with @emph{slurs}, which
373 indicate articulation, or @emph{phrasing slurs}, which indicate
374 musical phrasing. A tie is just a way of extending a note
375 duration, similar to the augmentation dot.}
377 A tie is entered using the tilde symbol @code{~}
379 @lilypond[quote,verbatim,relative=2]
385 Ties are used either when the note crosses a bar line, or when
386 dots cannot be used to denote the rhythm. Ties should also be
387 used when note values cross larger subdivisions of the measure:
389 @lilypond[verbatim,quote]
396 If you need to tie many notes across bar lines, it may be
397 easier to use automatic note splitting, see @ref{Automatic note
398 splitting}. This mechanism automatically splits long notes, and
399 ties them across bar lines.
401 @cindex ties and chords
402 @cindex chords and ties
404 When a tie is applied to a chord, all note heads whose pitches
405 match are connected. When no note heads match, no ties will be
406 created. Chords may be partially tied by placing the tie inside
409 @lilypond[quote,verbatim,relative=1]
411 <c~ e g~ b> <c e g b>
414 @cindex repeating ties
415 @cindex ties, repeating
416 @cindex volta brackets and ties
417 @cindex ties and volta brackets
422 When a second alternative of a repeat starts with a tied note, you
423 have to specify the repeated tie as follows:
425 @lilypond[quote,relative=2,verbatim]
426 \repeat volta 2 { c g <c e>2 ~ }
428 % First alternative: following note is tied normally
430 % Second alternative: following note has a repeated tie
431 { <c e>2\repeatTie d4 c } }
434 @cindex laissez vibrer
435 @cindex ties, laissez vibrer
437 @funindex \laissezVibrer
438 @funindex laissezVibrer
440 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
441 notes must not be damped at the end. It is used in notation for
442 piano, harp and other string and percussion instruments. They can
443 be entered as follows:
445 @lilypond[quote,verbatim,relative=1]
446 <c f g>1\laissezVibrer
449 @cindex ties, placement
455 @funindex \tieNeutral
458 The vertical placement of ties may be controlled, see
459 Predefined commands, or for details, see
460 @ref{Direction and placement}.
462 @cindex ties, appearance
475 Solid, dotted or dashed ties may be specified, see Predefined
491 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
492 {using-ties-with-arpeggios.ly}
494 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
495 {engraving-ties-manually.ly}
501 @rglos{laissez vibrer}.
503 Notation Reference: @ref{Automatic note splitting}.
509 @rinternals{LaissezVibrerTie},
510 @rinternals{LaissezVibrerTieColumn},
511 @rinternals{TieColumn},
517 Switching staves when a tie is active will not produce a slanted
520 Changing clefs or octavations during a tie is not really
521 well-defined. In these cases, a slur may be preferable.
526 @subsection Writing rests
528 Rests are entered as part of the music in music expressions.
533 * Full measure rests::
537 @unnumberedsubsubsec Rests
539 @cindex rest, entering durations
554 Rests are entered like notes with the note name @code{r}.
555 Durations longer than a whole rest use the predefined
558 @c \time 16/1 is used to avoid spurious bar lines
559 @c and long tracts of empty measures
560 @lilypond[fragment,quote,verbatim]
562 % These two lines are just to prettify this example
564 \override Staff.TimeSignature #'stencil = ##f
565 % Print a maxima rest, equal to four breves
567 % Print a longa rest, equal to two breves
571 r1 r2 r4 r8 r16 r32 r64 r128
575 @cindex rest, multi-measure
576 @cindex rest, whole-measure
578 Whole measure rests, centered in the middle of the measure, must be
579 entered as multi-measure rests. They can be used for a single
580 measure as well as many measures and are discussed in @ref{Full
583 @cindex rest, specifying vertical position
585 To explicitly specify a rest's vertical position, write a note
586 followed by @code{\rest}. A rest of the duration of the note will
587 be placed at the staff position where the note would appear. This
588 allows for precise manual formatting of polyphonic music, since the
589 automatic rest collision formatter will not move these rests.
591 @lilypond[quote,verbatim,relative=2]
597 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
608 @ref{Full measure rests}.
619 @c Deliberately duplicated in Durations and Rests. -gp
620 There is no fundamental limit to rest durations (both in terms of
621 longest and shortest), but the number of glyphs is limited: there
622 are rests from 128th to maxima (8 x whole).
625 @node Invisible rests
626 @unnumberedsubsubsec Invisible rests
629 @cindex invisible rest
630 @cindex rest, invisible
638 An invisible rest (also called a @q{spacer rest}) can be entered
639 like a note with the note name@tie{}@code{s}:
641 @lilypond[verbatim,quote,relative=2]
648 Spacer rests are available only in note mode and chord mode. In
649 other situations, for example, when entering lyrics, @code{\skip}
650 is used to skip a musical moment. @code{\skip} requires an
653 @lilypond[quote,verbatim,relative=2]
666 A spacer rest implicitly causes @code{Staff} and @code{Voice}
667 contexts to be created if none exist, just like notes and rests
670 @lilypond[quote,verbatim,fragment]
674 @code{\skip} simply skips musical time; it creates no output of
677 @lilypond[quote,verbatim,fragment]
678 % This is valid input, but does nothing
679 \skip 1 \skip1 \skip 1
687 Internals Reference: @rinternals{SkipMusic}
690 @node Full measure rests
691 @unnumberedsubsubsec Full measure rests
693 @cindex multi-measure rests
694 @cindex full-measure rests
695 @cindex rest, multi-measure
696 @cindex rest, full-measure
697 @cindex whole rest for a full measure
698 @cindex rest, whole for a full measure
702 Rests for one or more full measures are entered like notes with
703 the note name uppercase @code{R}:
705 @lilypond[quote,verbatim,relative=2]
706 % Rest measures contracted to single measure
707 \compressFullBarRests
714 The duration of full-measure rests is identical to the duration
715 notation used for notes. The duration in a multi-measure rest must
716 always be an integral number of measure-lengths, so augmentation dots
717 or fractions must often be used:
719 @lilypond[quote,fragment,verbatim]
720 \compressFullBarRests
726 R1*13/8 | R1*13/8*12 |
731 A full-measure rest is printed as either a whole or breve rest,
732 centered in the measure, depending on the time signature.
734 @lilypond[quote,verbatim,fragment]
743 @cindex multi-measure rest, expanding
744 @cindex multi-measure rest, contracting
746 @funindex \expandFullBarRests
747 @funindex expandFullBarRests
748 @funindex \compressFullBarRests
749 @funindex compressFullBarRests
751 By default a multi-measure rest is expanded in the printed score to
752 show all the rest measures explicitly. Alternatively, a multi-measure
753 rest can be shown as a single measure containing a multi-measure rest
754 symbol, with the number of measures of rest printed above the measure:
756 @lilypond[quote,fragment,verbatim]
758 \time 3/4 r2. | R2.*2 |
761 % Rest measures contracted to single measure
762 \compressFullBarRests
764 % Rest measures expanded
771 @cindex text on multi-measure rest
772 @cindex multi-measure rest, attaching text
773 @cindex script on multi-measure rest
774 @cindex multi-measure rest, script
775 @cindex fermata on multi-measure rest
776 @cindex multi-measure rest, attaching fermata
778 @funindex \fermataMarkup
779 @funindex fermataMarkup
781 Markups can be added to multi-measure rests.
782 The predefined command @code{\fermataMarkup}
783 is provided for adding fermatas.
785 @lilypond[quote,verbatim,fragment]
786 \compressFullBarRests
788 R2.*10^\markup { \italic "ad lib." }
793 Markups attached to a multi-measure rest are
794 objects of type @code{MultiMeasureRestText}, not
795 @code{TextScript}. Overrides must be directed to the correct
796 object, or they will be ignored. See the following example.
799 @lilypond[quote,verbatim,fragment]
800 % This fails, as the wrong object name is specified
801 \override TextScript #'padding = #5
803 % This is correct and works
804 \override MultiMeasureRestText #'padding = #5
808 When a multi-measure rest immediately follows a @code{\partial}
809 setting, resulting bar-check warnings may not be displayed.
813 @code{\textLengthOn},
814 @code{\textLengthOff},
815 @code{\fermataMarkup},
816 @code{\compressFullBarRests},
817 @code{\expandFullBarRests}.
825 @cindex kirchenpausen
827 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
828 {changing-form-of-multi--measure-rests.ly}
830 @cindex multi-measure rests, positioning
831 @cindex positioning multi-measure rests
833 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
834 {positioning-multi--measure-rests.ly}
836 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
837 {multi--measure-rest-markup.ly}
842 @rglos{multi-measure rest}.
847 @ref{Formatting text},
854 @rinternals{MultiMeasureRest},
855 @rinternals{MultiMeasureRestNumber},
856 @rinternals{MultiMeasureRestText}.
859 @cindex fingerings and multi-measure rests
860 @cindex multi-measure rests and fingerings
864 If an attempt is made to use fingerings (e.g.,
865 @code{R1*10-4}) to put numbers over multi-measure rests, the
866 fingering numeral (4) may collide with the bar counter
869 @cindex condensing rests
870 @cindex rest, condensing ordinary
872 There is no way to automatically condense multiple ordinary rests
873 into a single multi-measure rest.
875 @cindex rest, collisions of
877 Multi-measure rests do not take part in rest collisions.
879 @node Displaying rhythms
880 @subsection Displaying rhythms
886 * Polymetric notation::
887 * Automatic note splitting::
888 * Showing melody rhythms::
892 @unnumberedsubsubsec Time signature
894 @cindex time signature
900 The time signature is set as follows:
902 @lilypond[quote,verbatim,relative=2]
907 @cindex time signature, visibility of
909 Time signatures are printed at the beginning of a piece
910 and whenever the time signature changes. If a change takes place
911 at the end of a line a warning time signature sign is printed
912 there. This default behavior may be changed, see
913 @ref{Visibility of objects}.
915 @lilypond[quote,verbatim,relative=2]
925 @cindex time signature style
928 @funindex \numericTimeSignature
929 @funindex numericTimeSignature
930 @funindex \defaultTimeSignature
931 @funindex defaultTimeSignature
933 The time signature symbol that is used in 2/2 and 4/4 time can be
934 changed to a numeric style:
936 @lilypond[quote,verbatim,relative=2]
940 % Change to numeric style
941 \numericTimeSignature
944 % Revert to default style
945 \defaultTimeSignature
951 Mensural time signatures are covered in
952 @ref{Mensural time signatures}.
956 @code{\numericTimeSignature},
957 @code{\defaultTimeSignature}.
963 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
964 {changing-the-time-signature-without-affecting-the-beaming.ly}
966 @cindex compound time signatures
967 @cindex time signature, compound
969 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
970 {compound-time-signatures.ly}
975 @rglos{time signature}
978 @ref{Mensural time signatures},
979 @ref{Time administration}.
985 @rinternals{TimeSignature},
986 @rinternals{Timing_translator}.
990 @unnumberedsubsubsec Upbeats
994 @cindex partial measure
995 @cindex measure, partial
996 @cindex pickup measure
997 @cindex measure, change length
998 @cindex measurePosition
1003 Partial or pick-up measures, such as an anacrusis or upbeat, are
1004 entered using the @code{\partial} command, with the syntax
1007 \partial @var{duration}
1010 where @code{duration} is the rhythmic length of the interval
1011 before the start of the first complete measure:
1013 @lilypond[quote,verbatim,relative=2]
1018 The partial measure can be any duration less than a full measure:
1020 @lilypond[quote,verbatim,relative=2]
1021 \partial 8*3 c8 d e |
1025 Internally, this is translated into
1028 \set Timing.measurePosition = -@var{duration}
1031 The property @code{measurePosition} contains a rational number
1032 indicating how much of the measure has passed at this point. Note
1033 that this is set to a negative number by the @code{\partial}
1034 command: i.e., @code{\partial 4} is internally translated to
1035 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1049 @rinternals{Timing_translator}.
1054 The @code{\partial} command is intended to be used only at the
1055 beginning of a piece. If you use it after the beginning, some
1056 odd warnings may occur.
1058 @node Unmetered music
1059 @unnumberedsubsubsec Unmetered music
1061 @cindex bar lines, turning off
1062 @cindex bar numbering, turning off
1064 @cindex unmetered music
1066 @funindex \cadenzaOn
1068 @funindex \cadenzaOff
1069 @funindex cadenzaOff
1071 Bar lines and bar numbers are calculated automatically. For
1072 unmetered music (some cadenzas, for example), this is not desirable.
1073 To turn off automatic calculation of bar lines and bar numbers,
1074 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1075 to turn them on again.
1077 @lilypond[verbatim,relative=2,fragment]
1086 Bar numbering is resumed at the end of the cadenza as if the
1087 cadenza were not there:
1089 @lilypond[verbatim,relative=2,fragment]
1090 % Show all bar numbers
1091 \override Score.BarNumber #'break-visibility = #all-visible
1112 @ref{Visibility of objects}.
1120 LilyPond will insert line breaks and page breaks only at a
1121 bar line. Unless the unmetered music ends before the end of the
1122 staff line, you will need to insert invisible bar lines with
1129 to indicate where breaks can occur.
1132 @node Polymetric notation
1133 @unnumberedsubsubsec Polymetric notation
1135 @c This section necessarily uses \set
1136 @c This is acceptable -td
1138 @cindex double time signatures
1139 @cindex signatures, polymetric
1140 @cindex time signatures, polymetric
1141 @cindex time signatures, double
1142 @cindex polymetric signatures
1143 @cindex meter, polymetric
1145 @funindex timeSignatureFraction
1146 @funindex \scaleDurations
1147 @funindex scaleDurations
1151 Polymetric notation is supported, either explicitly or by modifying
1152 the visible time signature symbol and scaling the note durations.
1154 @strong{@i{Staves with different time signatures, equal measure lengths}}
1156 This notation can be created by setting a common time signature
1157 for each staff but replacing the symbol manually by setting
1158 @code{timeSignatureFraction} to the desired fraction and scaling
1159 the printed durations in each staff to the common time
1160 signature; see @ref{Time signature}. The scaling is done with
1161 @code{\scaleDurations}, which is used in a similar way to
1162 @code{\times}, but does not create a tuplet bracket; see
1163 @ref{Scaling durations}.
1165 @cindex beaming in polymetric music
1166 @cindex beaming in polymetric meter
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.
1172 It will often be necessary to insert beams manually, as the
1173 duration scaling affects the autobeaming rules.
1175 @lilypond[quote,verbatim,fragment]
1184 \set Staff.timeSignatureFraction = #'(9 . 8)
1185 \scaleDurations #'(2 . 3)
1186 \repeat unfold 6 { c8[ c c] }
1190 \set Staff.timeSignatureFraction = #'(10 . 8)
1191 \scaleDurations #'(3 . 5) {
1192 \repeat unfold 2 { c8[ c c] }
1193 \repeat unfold 2 { c8[ c] } |
1194 c4. c4. \times 2/3 { c8[ c c] } c4
1200 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1202 Each staff can be given its own independent time signature by
1203 moving the @code{Timing_translator} and the
1204 @code{Default_bar_line_engraver} to the @code{Staff} context.
1206 @lilypond[quote,verbatim]
1210 \remove "Timing_translator"
1211 \remove "Default_bar_line_engraver"
1215 \consists "Timing_translator"
1216 \consists "Default_bar_line_engraver"
1220 % Now each staff has its own time signature.
1246 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1247 {compound-time-signatures.ly}
1253 @rglos{polymetric time signature},
1257 @ref{Time signature},
1258 @ref{Scaling durations}.
1263 Internals Reference:
1264 @rinternals{TimeSignature},
1265 @rinternals{Timing_translator},
1266 @rinternals{Default_bar_line_engraver},
1272 When using different time signatures in parallel, notes
1273 at the same moment will be be placed at the same horizontal
1274 location. However, the bar lines in the different staves
1275 will cause the note spacing to be less regular in each of the
1276 individual staves than would be normal without the different
1279 @node Automatic note splitting
1280 @unnumberedsubsubsec Automatic note splitting
1282 @cindex notes, splitting
1283 @cindex splitting notes
1285 @funindex Note_heads_engraver
1286 @funindex Completion_heads_engraver
1288 Long notes which overrun bar lines can be converted automatically
1289 to tied notes. This is done by replacing the
1290 @code{Note_heads_engraver} with the
1291 @code{Completion_heads_engraver}. In the following
1292 example, notes crossing the bar lines are split and tied.
1294 @lilypond[quote,verbatim,relative=1]
1296 \remove "Note_heads_engraver"
1297 \consists "Completion_heads_engraver"
1300 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1303 This engraver splits all running notes at the bar line, and
1304 inserts ties. One of its uses is to debug complex scores: if the
1305 measures are not entirely filled, then the ties show exactly how
1306 much each measure is off.
1310 Music Glossary: @rglos{tie}
1313 @rlearning{Engravers explained},
1314 @rlearning{Adding and removing engravers}.
1319 Internals Reference:
1320 @rinternals{Note_heads_engraver},
1321 @rinternals{Completion_heads_engraver},
1322 @rinternals{Forbid_line_break_engraver}.
1327 Not all durations (especially those containing tuplets) can be
1328 represented exactly with normal notes and dots, but the
1329 @code{Completion_heads_engraver} will not insert tuplets.
1331 The @code{Completion_heads_engraver} only affects notes; it does not
1335 @node Showing melody rhythms
1336 @unnumberedsubsubsec Showing melody rhythms
1338 @cindex melody rhythms, showing
1339 @cindex rhythms, showing melody
1341 Sometimes you might want to show only the rhythm of a melody. This
1342 can be done with the rhythmic staff. All pitches of notes on such a
1343 staff are squashed, and the staff itself has a single line
1345 @lilypond[quote,relative=1,verbatim]
1347 \new RhythmicStaff {
1348 \new Voice = "myRhythm" {
1356 \lyricsto "myRhythm" {
1364 @cindex guitar chord charts
1365 @cindex strumming rhythms, showing
1366 @cindex guitar strumming rhythms, showing
1368 @funindex Pitch_squash_engraver
1369 @funindex \improvisationOn
1370 @funindex improvisationOn
1371 @funindex \improvisationOff
1372 @funindex improvisationOff
1374 Guitar chord charts often show the strumming rhythms. This can
1375 be done with the @code{Pitch_squash_engraver} and
1376 @code{\improvisationOn}.
1379 @lilypond[quote,verbatim]
1388 \consists Pitch_squash_engraver
1401 @code{\improvisationOn},
1402 @code{\improvisationOff}.
1408 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1409 {guitar-strum-rhythms.ly}
1416 Internals Reference:
1417 @rinternals{RhythmicStaff},
1418 @rinternals{Pitch_squash_engraver}.
1426 * Setting automatic beam behavior::
1431 @node Automatic beams
1432 @unnumberedsubsubsec Automatic beams
1434 By default, beams are inserted automatically:
1436 @cindex beams, manual
1437 @cindex manual beams
1438 @cindex beams, setting rules for
1439 @cindex beams, custom rules for
1441 @funindex measureLength
1442 @funindex beatLength
1443 @funindex beatGrouping
1444 @funindex \autoBeamOn
1445 @funindex autoBeamOn
1446 @funindex \autoBeamOff
1447 @funindex autoBeamOff
1449 @lilypond[quote,verbatim,relative=2]
1451 \time 6/8 c c c c8. c16 c8
1454 If these automatic decisions are not satisfactory, beaming can be
1455 entered explicitly; see @ref{Manual beams}. Beams must also be
1456 entered manually in the same way if beams are to be extended over
1460 to define beaming patterns that differ from the defaults. The
1461 default beaming rules for most common time signatures are defined
1462 in @file{scm/@/auto@/-beam@/.scm}. If there are no beaming rules
1463 defined for a particular beam's duration in the time signature being
1464 used, its beaming is controlled by the values of three context
1465 properties, @code{measureLength}, @code{beatLength} and
1466 @code{beatGrouping}. Both the beaming rules and the context
1467 properties can be overridden, see @ref{Setting automatic beam behavior}.
1470 @warning{If beams are used to indicate melismata in songs, then automatic
1471 beaming should be switched off with @code{\autoBeamOff} and the beams
1472 indicated manually.}
1476 Automatic beaming may be turned off and on with
1477 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1479 @lilypond[quote,relative=1,verbatim]
1480 c4 c8 c8. c16 c8. c16 c8
1489 @code{\autoBeamOff},
1496 @cindex line breaks and beams
1497 @cindex beams and line breaks
1501 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1502 {beams-across-line-breaks.ly}
1504 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1505 {changing-beam-knee-gap.ly}
1511 @ref{Setting automatic beam behavior}.
1514 @file{scm/@/auto@/-beam@/.scm}.
1519 Internals Reference: @rinternals{Beam}.
1524 Automatically kneed cross-staff beams cannot be used together with
1525 hidden staves. See @ref{Hiding staves}.
1527 Beams can collide with note heads and accidentals in other voices
1530 @node Setting automatic beam behavior
1531 @unnumberedsubsubsec Setting automatic beam behavior
1534 @cindex automatic beams, tuning
1535 @cindex tuning automatic beaming
1536 @cindex automatic beam generation
1538 @cindex lyrics and beaming
1540 @funindex autoBeaming
1541 @funindex autoBeamSettings
1542 @funindex (end * * * *)
1543 @funindex (begin * * * *)
1544 @funindex measureLength
1545 @funindex beatLength
1546 @funindex beatGrouping
1552 The placement of automatic beams is determined by the rules
1553 described in @ref{Automatic beams}. There are two mutually
1554 exclusive ways in which these rules may be modified. The
1555 first, modifying the grouping of beats, applies to uncommon time
1556 signatures, i.e. those for which there are no predefined rules
1557 defining the beam end points. The second method, modifying the
1558 specification of the beam end points, can be used for any time
1559 signature. This second method @strong{must} be used for those time
1560 signatures and beam durations combinations for which beam ending
1561 rules are pre-defined, unless these have all been reverted. There
1562 are predefined rules for time signatures of 3/2, 3/4, 4/4, 2/4,
1563 4/8, 4/16, 6/8, 9/8 and 12/8.
1565 @i{@strong{Modifying the grouping of beats}}
1567 If there are no beam-ending rules defined for the beam duration of a
1568 particular beam in the time signature in use, its beaming is
1569 controlled by three context properties:
1570 @code{measureLength}, @code{beatLength} and @code{beatGrouping}.
1571 These properties may be set in the @code{Score}, @code{Staff} or
1572 @code{Voice} contexts to delimit their scope. The default values
1573 are set while processing @code{\time} commands, so the @code{\set}
1574 commands must be placed after all @code{\time} commands.
1576 These determine the beaming as follows:
1578 Beams may begin anywhere (unless a beam is already active). Beams
1579 end at a time determined by the values of @code{beatGrouping} and
1580 @code{beatLength}, as follows:
1584 @item If @code{beatGrouping} and @code{beatLength} are consistent
1585 with @code{measureLength}, @code{beatGrouping} is used to determine
1586 the end points of beams.
1588 @item If @code{beatGrouping} and @code{beatLength} are inconsistent
1589 with @code{measureLength}, @code{beatLength} is used to determine
1590 the end points of beams.
1594 @warning{These three properties become effective for a particular
1595 beam @strong{only} if there are no beam-ending rules predefined for
1596 that beam's duration in the time signature in use, or if these
1597 beam-ending rules have all been reverted.}
1599 By default the @code{measureLength} and @code{beatLength} are
1600 derived from the time signature set by the @code{\time} command.
1601 The @code{measureLength} is set to be exactly the same length as
1602 the measure length given by the time signature, and the
1603 @code{beatLength} is set to be the same as one over the denominator
1604 of the time signature.
1606 The default value of @code{beatGrouping} is taken from a table in
1607 @file{scm/@/music@/-functions@/.scm}. To find this, see
1608 @rlearning{Other sources of information}. It defines the beat
1609 grouping for 5/8, 6/8, 8/8, 9/8 and 12/8 time signatures.
1611 Both @code{measureLength} and @code{beatLength} are @i{moments},
1612 units of musical duration. A quantity of type @i{moment} is
1613 created by the scheme function @code{ly:make-moment}. For more
1614 information about this function, see @ref{Time administration}.
1616 @code{beatGrouping} is a list of integers giving the number of
1617 beats in each group.
1621 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1624 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1625 {specifying-context-with-beatgrouping.ly}
1627 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1628 {using-beatlength-and-beatgrouping.ly}
1630 @funindex subdivideBeams
1632 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1633 {sub-dividing-beams.ly}
1635 @cindex measure groupings
1636 @cindex beats, grouping
1637 @cindex grouping beats
1638 @cindex measure sub-grouping
1640 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1641 {conducting-signs,-measure-grouping-signs.ly}
1644 @strong{@i{Modifying the beam end points}}
1646 In common time signatures, automatic beams can start on any note
1647 but can end at only a few positions within the measure, namely at
1648 durations specified by the properties in @code{autoBeamSettings}.
1649 These properties consist of a list of rules defining where beams can
1650 end. The default @code{autoBeamSettings} rules are defined in
1651 @file{scm/@/auto@/-beam@/.scm}. To find this, see
1652 @rlearning{Other sources of information}.
1654 This method @strong{must} be used for the time signatures for which
1655 beam-ending rules are defined by default, unless these have all
1656 been reverted. It is also particularly suitable for many other time
1657 signatures if the time signature of the measures changes frequently,
1658 or if the beaming should be different for different beam durations.
1660 In order to add a rule to the list, use
1663 #(override-auto-beam-setting
1665 beam-numerator beam-denominator
1666 time-signature-numerator time-signature-denominator)
1667 moment-numerator moment-denominator [context])
1675 @item @code{beam-limit} is the type of automatic beam limit
1676 defined. This can be either @code{begin} or @code{end} but
1677 only @code{end} is effective.
1679 @item @code{beam-numerator/beam-denominator} is the beam duration
1680 to which the rule is to apply. A beam is considered to have
1681 the duration of its shortest note. Set @code{beam-numerator}
1682 and @code{beam-denominator} to @code{'*'} to have this rule apply
1683 to beams of any duration.
1685 @item @code{time-signature-numerator/time-signature-denominator}
1686 specifies the time signature to which this rule should apply.
1687 If @code{time-signature-numerator} and
1688 @code{time-signature-denominator} are set to @code{'*'} this rule
1689 will apply in any time signature.
1691 @item @code{monent-numerator/moment-denominator} is the position
1692 in the bar at which the beam should end.
1694 @item @code{context} is optional, and it specifies the context at which
1695 the change should be made. The default is @code{'Voice}.
1697 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1698 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1702 For example, if automatic beams should always end on the first quarter
1703 note, whatever the time signature or beam duration, use
1705 @lilypond[quote,verbatim,relative=2]
1707 #(override-auto-beam-setting '(end * * * *) 1 4)
1711 You can force the beam settings to take effect only on beams whose shortest
1712 note is a certain duration
1714 @lilypond[quote,verbatim,relative=2]
1716 % end 1/16 beams for all time signatures at the 1/16 moment
1717 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1719 a32 a a a a16 a a a a a |
1720 % end 1/32 beams for all time signatures at the 1/16 moment
1721 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1722 a32 a a a a16 a a a a a |
1725 You can force the beam settings to take effect only in certain time
1728 @lilypond[quote,verbatim,relative=2]
1730 % end beams of all durations in 5/8 time signature at the 2/8 moment
1731 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1739 When multiple voices are used the @code{Staff} context must be
1740 specified if the beaming is to be applied to all voices in the
1743 @lilypond[quote,verbatim,relative=2]
1746 % Context not specified - does not work correctly
1747 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1748 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1749 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1750 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1752 % Works correctly with context specified
1753 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1754 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1755 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1756 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1759 @warning{If any unexpected beam behavior occurs, check the default
1760 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1761 possible interference, because the beam endings defined there will
1762 still apply in addition to your own.}
1764 Any unwanted or conflicting default endings must be reverted for
1765 your time signature(s). Existing auto-beam rules are removed by
1769 #(revert-auto-beam-setting
1771 beam-numerator beam-denominator
1772 time-signature-numerator time-signature-denominator)
1773 moment-numerator moment-denominator [context])
1777 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1778 @code{time-signature-numerator}, @code{time-signature-denominator},
1779 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1780 are the same as above.
1782 @lilypond[quote,verbatim,relative=2]
1784 a16 a a a a a a a a a a a a a a a
1785 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1786 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1787 a16 a a a a a a a a a a a a a a a
1790 The rule in a @code{revert-auto-beam-setting} statement must exactly
1791 match the original rule. That is, no wildcard expansion is taken into
1794 @lilypond[quote,verbatim,relative=2]
1796 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1798 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1800 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1806 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1807 {beam-grouping-in-7-8-time.ly}
1809 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1810 {reverting-default-beam-endings.ly}
1812 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1813 {beam-endings-in-score-context.ly}
1815 @funindex \autoBeamOff
1816 @funindex autoBeamOff
1817 @funindex \autoBeamOn
1818 @funindex autoBeamOn
1821 @code{\autoBeamOff},
1826 @cindex beam, last in score
1827 @cindex beam, last in polyphonic voice
1831 If a score ends while an automatic beam has not been ended and is
1832 still accepting notes, this last beam will not be typeset at all.
1833 The same holds for polyphonic voices, entered with @code{<<
1834 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1835 automatic beam is still accepting notes, it is not typeset.
1844 @unnumberedsubsubsec Manual beams
1846 @cindex beams, manual
1847 @cindex manual beams
1852 In some cases it may be necessary to override the automatic
1853 beaming algorithm. For example, the autobeamer will not put beams
1854 over rests or bar lines, and in choral scores the beaming is
1855 often set to follow the meter of the lyrics rather than the
1856 notes. Such beams can be specified manually by
1857 marking the begin and end point with @code{[} and @code{]}
1859 @lilypond[quote,relative=1,verbatim]
1861 r4 r8[ g' a r8] r8 g[ | a] r8
1869 Individual notes may be marked with @code{\noBeam} to prevent them
1872 @lilypond[quote,verbatim,relative=2]
1873 \time 2/4 c8 c\noBeam c c
1876 @funindex stemLeftBeamCount
1877 @funindex stemRightBeamCount
1879 Even more strict manual control with the beams can be achieved by
1880 setting the properties @code{stemLeftBeamCount} and
1881 @code{stemRightBeamCount}. They specify the number of beams to
1882 draw on the left and right side, respectively, of the next note.
1883 If either property is set, its value will be used only once, and
1884 then it is erased. In this example, the last @code{f} is printed
1885 with only one beam on the left side, i.e., the eighth-note beam of
1886 the group as a whole.
1888 @lilypond[quote,relative=2,verbatim]
1891 \set stemLeftBeamCount = #2
1892 \set stemRightBeamCount = #1
1894 \set stemLeftBeamCount = #1
1901 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1902 {flat-flags-and-beam-nibs.ly}
1904 @node Feathered beams
1905 @unnumberedsubsubsec Feathered beams
1907 @cindex beams, feathered
1909 @funindex \featherDurations
1910 @funindex featherDurations
1911 @funindex grow-direction
1913 Feathered beams are used to indicate that a small group of notes
1914 should be played at an increasing (or decreasing) tempo, without
1915 changing the overall tempo of the piece. The extent of the
1916 feathered beam must be indicated manually using @code{[} and
1917 @code{]}, and the beam feathering is turned on by specifying a
1918 direction to the @code{Beam} property @code{grow-direction}.
1920 If the placement of the notes and the sound in the MIDI output
1921 is to reflect the ritardando or accelerando indicated by the
1922 feathered beam the notes must be grouped as a
1923 music expression delimited by braces and preceded by a
1924 @code{featheredDurations} command which specifies the ratio
1925 between the durations of the first and last notes in the group.
1927 The square brackets show the extent of the beam and the braces show
1928 which notes are to have their durations modified. Normally these
1929 would delimit the same group of notes, but this is not required: the
1930 two commands are independent.
1932 In the following example the eight 16th notes occupy exactly the
1933 same time as a half note, but the first note is one half as long
1934 as the last one, with the intermediate notes gradually
1935 lengthening. The first four 32nd notes gradually speed up, while
1936 the last four 32nd notes are at a constant tempo.
1938 @lilypond[relative=1,verbatim,quote]
1939 \override Beam #'grow-direction = #LEFT
1940 \featherDurations #(ly:make-moment 2 1)
1941 { c16[ c c c c c c c] }
1942 \override Beam #'grow-direction = #RIGHT
1943 \featherDurations #(ly:make-moment 2 3)
1945 % revert to non-feathered beams
1946 \override Beam #'grow-direction = #'()
1951 The spacing in the printed output represents the
1952 note durations only approximately, but the MIDI output is exact.
1956 The @code{\featherDurations} command only works with very short
1957 music snippets, and when numbers in the fraction are small.
1972 * Bar and bar number checks::
1977 @unnumberedsubsubsec Bar lines
1980 @cindex measure lines
1986 Bar lines delimit measures, and are also used to indicate
1987 repeats. Normally, simple bar lines are automatically inserted
1988 into the printed output at places based on the current time
1991 The simple bar lines inserted automatically can be changed to
1992 other types with the @code{\bar} command. For example, a closing
1993 double bar line is usually placed at the end of a piece:
1995 @lilypond[quote,relative=1,verbatim]
1999 It is not invalid if the final note in a measure does not
2000 end on the automatically entered bar line: the note is assumed
2001 to carry over into the next measure. But if a long sequence
2002 of such carry-over measures appears the music can appear compressed
2003 or even flowing off the page. This is because automatic line
2004 breaks happen only at the end of complete measures, i.e., where
2005 all notes end before the end of a measure.
2007 @warning{An incorrect duration can cause line breaks to be
2008 inhibited, leading to a line of highly compressed music or
2009 music which flows off the page.}
2012 @cindex bar lines, invisible
2013 @cindex measure lines, invisible
2015 Line breaks are also permitted at manually inserted bar lines
2016 even within incomplete measures. To allow a line break without
2017 printing a bar line, use
2024 This will insert an invisible bar line and allow (but not
2025 force) a line break to occur at this point. The bar number
2026 counter is not increased. To force a line break see
2027 @ref{Line breaking}.
2029 @cindex manual bar lines
2030 @cindex manual measure lines
2031 @cindex bar lines, manual
2032 @cindex measure lines, manual
2034 This and other special bar lines may be inserted manually at any
2035 point. When they coincide with the end of a measure they replace the
2036 simple bar line which would have been inserted there automatically.
2037 When they do not coincide with the end of a measure the specified bar
2038 line is inserted at that point in the printed output. Such insertions
2039 do not affect the calculation and placement of subsequent automatic
2042 Two types of simple bar lines and five types of double bar lines are available
2043 for manual insertion:
2045 @lilypond[quote,relative=1,verbatim]
2046 f1 \bar "|" f \bar "." g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
2050 together with dotted and dashed bar lines:
2052 @lilypond[quote,relative=1,verbatim]
2053 f1 \bar ":" g \bar "dashed" a
2057 and five types of repeat bar line:
2059 @lilypond[quote,relative=1,verbatim]
2060 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
2063 Additionally, a bar line can be printed as a simple tick:
2064 @lilypond[quote,relative=1,verbatim]
2067 However, as such ticks are typically used in Gregorian chant, it is preferable
2068 to use @code{\divisioMinima} there instead, described in the section
2069 @ref{Divisiones} in Gregorian chant.
2074 Although the bar line types signifying repeats may be inserted
2075 manually they do not in themselves cause LilyPond to recognize
2076 a repeated section. Such repeated sections are better entered
2077 using the various repeat commands (see @ref{Repeats}), which
2078 automatically print the appropriate bar lines.
2080 In addition, you can specify @code{"||:"}, which is equivalent to
2081 @code{"|:"} except at line breaks, where it gives a double bar
2082 line at the end of the line and a start repeat at the beginning of
2085 @lilypond[quote,relative=2,verbatim]
2086 \override Score.RehearsalMark #'padding = #3
2094 In scores with many staves, a @code{\bar} command in one staff is
2095 automatically applied to all staves. The resulting bar lines are
2096 connected between different staves of a @code{StaffGroup},
2097 @code{PianoStaff}, or @code{GrandStaff}.
2099 @lilypond[quote,fragment,verbatim]
2107 \new Staff { \clef bass c4 g e g }
2109 \new Staff { \clef bass c2 c2 }
2117 @funindex defaultBarType
2122 The command @code{\bar }@var{bartype} is a shortcut for
2123 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2124 created whenever the @code{whichBar} property is
2127 The default bar type used for automatically inserted bar lines is
2128 @code{"|"}. This may be changed at any time
2129 with @code{\set Timing.defaultBarType = }@var{bartype}.
2134 @ref{Line breaking},
2136 @ref{Grouping staves}.
2141 Internals Reference: @rinternals{BarLine} (created at
2142 @rinternals{Staff} level), @rinternals{SpanBar} (across
2143 staves), @rinternals{Timing_translator} (for Timing
2148 @unnumberedsubsubsec Bar numbers
2151 @cindex measure numbers
2152 @cindex numbers, bar
2153 @cindex numbers, measure
2155 @funindex currentBarNumber
2157 Bar numbers are typeset by default at the start of every line except
2158 the first line. The number itself is stored in the
2159 @code{currentBarNumber} property, which is normally updated
2160 automatically for every measure. It may also be set manually:
2162 @lilypond[verbatim,quote,fragment,relative=1]
2165 \set Score.currentBarNumber = #50
2172 @cindex bar numbers, regular spacing
2174 @funindex barNumberVisibility
2176 @c Uncomment this after next LSR update.
2177 @c @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2178 @c {printing-the-bar-number-for-the-first-measure.ly}
2180 Bar numbers can be typeset at regular intervals instead of just at
2181 the beginning of every line. To do this the default behavior
2182 must be overridden to permit bar numbers to be printed at places
2183 other than the start of a line. This is controlled by the
2184 @code{break-visibility} property of @code{BarNumber}. This takes
2185 three values which may be set to @code{#t} or @code{#f} to specify
2186 whether the corresponding bar number is visible or not. The order
2187 of the three values is @code{end of line visible}, @code{middle of
2188 line visible}, @code{beginning of line visible}. In the following
2189 example bar numbers are printed at all possible places:
2191 @lilypond[verbatim,quote,relative=1]
2192 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2193 \set Score.currentBarNumber = #11
2194 \bar "" % Permit first bar number to be printed
2200 @c All the rest of these examples will be added to LSR
2201 @c and moved into the Snippets. -gp
2204 and here the bar numbers are printed every two measures
2205 except at the end of the line:
2207 @lilypond[verbatim,quote,relative=1]
2208 \override Score.BarNumber #'break-visibility = #'#(#f #t #t)
2209 \set Score.currentBarNumber = #11
2210 \bar "" % Permit first bar number to be printed
2211 % Print a bar number every second measure
2212 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2218 @cindex measure number, format
2219 @cindex bar number, format
2221 The size of the bar number may be changed. This is illustrated
2222 in the following example, which also shows how to enclose bar
2223 numbers in boxes and circles, and shows an alternative way
2224 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
2226 @lilypond[verbatim,quote,relative=1]
2227 % Prevent bar numbers at the end of a line and permit them elsewhere
2228 \override Score.BarNumber #'break-visibility
2229 = #end-of-line-invisible
2231 % Increase the size of the bar number by 2
2232 \override Score.BarNumber #'font-size = #2
2233 \repeat unfold 3 { c1 } \bar "|"
2235 % Draw a box round the following bar number(s)
2236 \override Score.BarNumber #'stencil
2237 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
2238 \repeat unfold 3 { c1 } \bar "|"
2240 % Draw a circle round the following bar number(s)
2241 \override Score.BarNumber #'stencil
2242 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2243 \repeat unfold 4 { c1 } \bar "|."
2246 @cindex bar number alignment
2248 Bar numbers by default are left-aligned to their parent object.
2249 This is usually the left edge of a line or, if numbers are printed
2250 within a line, the left bar line of the measure. The numbers may also
2251 be positioned directly on the bar line or right-aligned to the
2254 @lilypond[verbatim,quote,relative=1]
2255 \set Score.currentBarNumber = #111
2256 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2257 % Increase the size of the bar number by 2
2258 \override Score.BarNumber #'font-size = #2
2259 % Print a bar number every second measure
2260 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2262 % Center-align bar numbers
2263 \override Score.BarNumber #'self-alignment-X = #0
2265 % Right-align bar numbers
2266 \override Score.BarNumber #'self-alignment-X = #-1
2270 Bar numbers can be removed entirely by removing the
2271 @code{Bar_number_engraver} from the @code{Score} context.
2273 @lilypond[verbatim,quote]
2277 \remove "Bar_number_engraver"
2291 Internals Reference: @rinternals{BarNumber}.
2294 @cindex bar number collision
2295 @cindex collision, bar number
2299 Bar numbers may collide with the top of the
2300 @rinternals{StaffGroup} bracket, if there is one. To solve
2301 this, the @code{padding} property of @rinternals{BarNumber} can
2302 be used to position the number correctly.
2306 @node Bar and bar number checks
2307 @unnumberedsubsubsec Bar and bar number checks
2310 @cindex bar number check
2311 @cindex measure check
2312 @cindex measure number check
2314 @funindex barCheckSynchronize
2317 Bar checks help detect errors in the entered durations. A bar check
2318 may be entered using the bar symbol, @code{|}, at any place where a
2319 bar line is expected to fall. If bar check lines are encountered at
2320 other places, a list of warnings is printed in the log file, showing
2321 the line numbers and lines in which the bar checks failed. In the
2322 next example, the second bar check will signal an error.
2325 \time 3/4 c2 e4 | g2 |
2328 Bar checks can also be used in lyrics, for example
2333 Twin -- kle | Twin -- kle |
2337 An incorrect duration can result in a completely garbled score,
2338 especially if the score is polyphonic, so a good place to start
2339 correcting input is by scanning for failed bar checks and
2340 incorrect durations.
2342 If successive bar checks are off by the same musical interval,
2343 only the first warning message is displayed. This allows the
2344 warning to focus on the source of the timing error.
2348 @funindex pipeSymbol
2350 It is also possible to redefine the action taken when a bar check
2351 or pipe symbol, @code{|}, is encountered in the input, so that
2352 it does something other than a bar check. This is done by
2353 assigning a music expression to @code{pipeSymbol}.
2354 In the following example @code{|} is set to insert a double bar
2355 line wherever it appears in the input, rather than checking
2358 @lilypond[quote,verbatim]
2359 pipeSymbol = \bar "||"
2368 @funindex \barNumberCheck
2369 @funindex barNumberCheck
2371 When copying large pieces of music, it can be helpful to check
2372 that the LilyPond bar number corresponds to the original that you
2373 are entering from. This can be checked with
2374 @code{\barNumberCheck}, for example,
2377 \barNumberCheck #123
2381 will print a warning if the @code{currentBarNumber} is not 123
2382 when it is processed.
2390 @node Rehearsal marks
2391 @unnumberedsubsubsec Rehearsal marks
2393 @cindex rehearsal marks
2394 @cindex mark, rehearsal
2399 To print a rehearsal mark, use the @code{\mark} command
2401 @lilypond[quote,verbatim,relative=2]
2410 The letter@tie{}@q{I} is skipped in accordance with engraving
2411 traditions. If you wish to include the letter @q{I}, then use
2414 \set Score.markFormatter = #format-mark-alphabet
2417 The mark is incremented automatically if you use @code{\mark
2418 \default}, but you can also use an integer argument to set the
2419 mark manually. The value to use is stored in the property
2420 @code{rehearsalMark}.
2422 @cindex rehearsal mark format
2423 @cindex rehearsal mark style
2424 @cindex style, rehearsal mark
2425 @cindex format, rehearsal mark
2426 @cindex mark, rehearsal, style
2427 @cindex mark, rehearsal, format
2428 @cindex rehearsal mark, manual
2429 @cindex mark, rehearsal, manual
2430 @cindex custom rehearsal mark
2432 The style is defined by the property @code{markFormatter}. It is
2433 a function taking the current mark (an integer) and the current
2434 context as argument. It should return a markup object. In the
2435 following example, @code{markFormatter} is set to a pre-defined
2436 procedure. After a few measures, it is set to a procedure that
2437 produces a boxed number.
2439 @lilypond[quote,verbatim,relative=2]
2440 \set Score.markFormatter = #format-mark-numbers
2443 \set Score.markFormatter = #format-mark-box-numbers
2445 \set Score.markFormatter = #format-mark-circle-numbers
2447 \set Score.markFormatter = #format-mark-circle-letters
2451 The file @file{scm/@/translation@/-functions@/.scm} contains the
2452 definitions of @code{format-mark-numbers} (the default format),
2453 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2454 @code{format-mark-box-letters}. These can be used as inspiration
2455 for other formatting functions.
2457 You may use @code{format-mark-barnumbers},
2458 @code{format-mark-box-barnumbers}, and
2459 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2460 incremented numbers or letters.
2462 Other styles of rehearsal mark can be specified manually
2469 @code{Score.markFormatter} does not affect marks specified in this
2470 manner. However, it is possible to apply a @code{\markup} to the
2474 \mark \markup@{ \box A1 @}
2481 @cindex music glyphs
2482 @cindex glyphs, music
2484 @funindex \musicglyph
2485 @funindex musicglyph
2487 Music glyphs (such as the segno sign) may be printed inside a
2490 @lilypond[quote,verbatim,relative=1]
2491 c1 \mark \markup { \musicglyph #"scripts.segno" }
2492 c1 \mark \markup { \musicglyph #"scripts.coda" }
2493 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2498 See @ref{The Feta font}, for a list of symbols which may be
2499 printed with @code{\musicglyph}.
2501 For common tweaks to the positioning of rehearsal marks, see
2502 @ref{Formatting text}.
2507 @ref{The Feta font},
2508 @ref{Formatting text}.
2511 @file{scm/@/translation@/-functions@/.scm} contains
2512 the definition of @code{format-mark-numbers} and
2513 @code{format-mark-letters}. They can be used as inspiration for
2514 other formatting functions.
2519 Internals Reference: @rinternals{RehearsalMark}.
2522 @node Special rhythmic concerns
2523 @subsection Special rhythmic concerns
2528 * Aligning to cadenzas::
2529 * Time administration::
2533 @unnumberedsubsubsec Grace notes
2537 @cindex appoggiatura
2538 @cindex acciaccatura
2543 Grace notes are ornaments that are written out. Grace notes
2544 are printed in a smaller font and take up no logical time
2547 @lilypond[quote,relative=2,verbatim]
2549 \grace { c16[ d16] } c2
2552 Lilypond also supports two special types of grace notes, the
2553 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2554 small note with a slashed stem--and the @emph{appoggiatura}, which
2555 takes a fixed fraction of the main note and appears in small print
2558 @lilypond[quote,relative=2,verbatim]
2562 \acciaccatura { g16[ f] } e4
2565 The placement of grace notes is synchronized between different
2566 staves. In the following example, there are two sixteenth grace
2567 notes for every eighth grace note
2569 @lilypond[quote,relative=2,verbatim]
2570 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2571 \new Staff { c2 \grace { g8[ b] } c2 } >>
2574 @cindex grace notes, following
2576 @funindex \afterGrace
2577 @funindex afterGrace
2579 If you want to end a note with a grace, use the @code{\afterGrace}
2580 command. It takes two arguments: the main note, and the grace
2581 notes following the main note.
2583 @lilypond[quote,verbatim,relative=2]
2584 c1 \afterGrace d1 { c16[ d] } c1
2587 This will put the grace notes after a space lasting 3/4 of the
2588 length of the main note. The default fraction 3/4 can be changed by
2589 setting @code{afterGraceFraction}. The following example shows
2590 the results from setting the space at the default, at 15/16, and
2591 finally at 1/2 of the main note.
2593 @lilypond[quote,verbatim,relative=2]
2596 c1 \afterGrace d1 { c16[ d] } c1
2599 #(define afterGraceFraction (cons 15 16))
2600 c1 \afterGrace d1 { c16[ d] } c1
2603 #(define afterGraceFraction (cons 1 2))
2604 c1 \afterGrace d1 { c16[ d] } c1
2609 The space between the main note and the grace note may also be
2610 specified using spacers. The following example places the grace
2611 note after a space lasting 7/8 of the main note.
2613 @lilypond[quote,verbatim,relative=2]
2616 { s2 s4. \grace { c16[ d] } } >>
2621 A @code{\grace} music expression will introduce special
2622 typesetting settings, for example, to produce smaller type, and
2623 set directions. Hence, when introducing layout tweaks to
2624 override the special settings, they should be placed inside
2625 the grace expression. The overrides should also be reverted
2626 inside the grace expression. Here, the grace note's default stem
2627 direction is overriden and then reverted.
2629 @lilypond[quote,verbatim,relative=2]
2641 @cindex stem, with slash
2646 The slash through the stem found in @emph{acciaccatura}s can be applied
2647 in other situations:
2649 @lilypond[quote,verbatim,relative=2]
2651 \override Stem #'stroke-style = #"grace"
2656 The layout of grace expressions can be changed throughout the
2657 music using the function @code{add-grace-property}. The following
2658 example undefines the @code{Stem} direction for this grace, so
2659 that stems do not always point up.
2661 @lilypond[quote,verbatim,relative=2]
2664 #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
2665 #(remove-grace-property 'Voice 'Stem 'direction)
2667 \acciaccatura { f16 } g4
2668 \grace { d16[ e] } f4
2669 \appoggiatura { a,32[ b c d] } e2
2675 Another option is to change the variables @code{startGraceMusic},
2676 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2677 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2678 @code{stopAppoggiaturaMusic}. The default values of these can be
2679 seen in the file @code{ly/@/grace@/-init@/.ly}. By redefining
2680 them other effects may be obtained.
2682 Grace notes may be forced to align with regular notes
2685 @lilypond[verbatim,quote]
2688 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2691 \afterGrace c4 { c16[ c8 c16] }
2695 c16 c c c c c c c c4 r
2704 @rglos{grace notes},
2705 @rglos{acciaccatura},
2706 @rglos{appoggiatura}.
2708 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2710 Snippets: @rlsr{Rhythms}.
2712 Internals Reference: @rinternals{GraceMusic}.
2717 A multi-note beamed @i{acciaccatura} is printed without a slash,
2718 and looks exactly the same as a multi-note beamed
2721 @c TODO Add link to LSR snippet to add slash when available
2723 Grace note synchronization can also lead to surprises. Staff
2724 notation, such as key signatures, bar lines, etc., are also
2725 synchronized. Take care when you mix staves with grace notes and
2726 staves without, for example,
2728 @lilypond[quote,relative=2,verbatim]
2729 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2730 \new Staff { c4 \bar "|:" d2. } >>
2734 This can be remedied by inserting grace skips of the corresponding
2735 durations in the other staves. For the above example
2737 @lilypond[quote,relative=2,verbatim]
2738 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2739 \new Staff { c4 \bar "|:" \grace s16 d2. } >>
2742 Grace sections should only be used within sequential music
2743 expressions. Nesting or juxtaposing grace sections is not
2744 supported, and might produce crashes or other errors.
2746 @node Aligning to cadenzas
2747 @unnumberedsubsubsec Aligning to cadenzas
2750 @cindex cadenza, aligning to
2751 @cindex aligning to cadenza
2753 In an orchestral context, cadenzas present a special problem: when
2754 constructing a score that includes a measured cadenza or other solo
2755 passage, all other instruments should skip just as many notes as the
2756 length of the cadenza, otherwise they will start too soon or too late.
2758 One solution to this problem is to use the functions
2759 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2760 functions take a defined piece of music as an argument and generate a
2761 multi-measure rest or @code{\skip} exactly as long as the piece.
2763 @lilypond[verbatim,quote]
2764 MyCadenza = \relative c' {
2775 #(ly:export (mmrest-of-length MyCadenza))
2777 #(ly:export (skip-of-length MyCadenza))
2792 @node Time administration
2793 @unnumberedsubsubsec Time administration
2795 @cindex time administration
2796 @cindex timing (within the score)
2797 @cindex music, unmetered
2798 @cindex unmetered music
2800 @funindex currentBarNumber
2801 @funindex measurePosition
2802 @funindex measureLength
2804 Time is administered by the @code{Timing_translator}, which by
2805 default is to be found in the @code{Score} context. An alias,
2806 @code{Timing}, is added to the context in which the
2807 @code{Timing_translator} is placed.
2809 The following properties of @code{Timing} are used
2810 to keep track of timing within the score.
2813 @cindex measure number
2816 @item currentBarNumber
2817 The current measure number. For an example showing the
2818 use of this property see @ref{Bar numbers}.
2821 The length of the measures in the current time signature. For a
2822 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2823 determines when bar lines are inserted and how automatic beams
2824 should be generated.
2826 @item measurePosition
2827 The point within the measure where we currently are. This
2828 quantity is reset by subtracting @code{measureLength} whenever
2829 @code{measureLength} is reached or exceeded. When that happens,
2830 @code{currentBarNumber} is incremented.
2833 If set to true, the above variables are updated for every time
2834 step. When set to false, the engraver stays in the current
2835 measure indefinitely.
2839 Timing can be changed by setting any of these variables
2840 explicitly. In the next example, the default 4/4 time
2841 signature is printed, but @code{measureLength} is set to 5/4.
2842 At 4/8 through the third measure, the @code{measurePosition} is
2843 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2844 The next bar line then falls at 9/8 rather than 5/4.
2846 @lilypond[quote,verbatim,relative=1]
2847 \set Score.measureLength = #(ly:make-moment 5 4)
2851 \set Score.measurePosition = #(ly:make-moment 5 8)
2857 As the example illustrates, @code{ly:make-moment n m} constructs a
2858 duration of n/m of a whole note. For example,
2859 @code{ly:make-moment 1 8} is an eighth note duration and
2860 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2865 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2870 Internals Reference: @rinternals{Timing_translator},