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]
65 c4 c8 c16 c32 c64 c128 c128
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]
77 c4 c8 c16 c32 c64 c128 c128
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 @cindex duration, default
85 @cindex default note duration
86 @cindex note duration, default
88 If the duration is omitted, it is set to the previously
89 entered duration. The default for the first note is a quarter
92 @lilypond[quote,verbatim,relative=2]
98 @cindex notes, double-dotted
99 @cindex double-dotted notes
103 To obtain dotted note lengths, place a dot (@code{.}) after the
104 duration. Double-dotted notes are specified by appending two
107 @lilypond[quote,verbatim,relative=2]
108 a4 b c4. b8 a4. b4.. c8.
111 Some durations cannot be represented with just binary durations
112 and dots; they can be represented only by tying two or more
113 notes together. For details, see @ref{Ties}.
115 For ways of specifying durations for the syllables of lyrics and
116 ways of aligning lyrics to notes, see @ref{Vocal music}.
118 Optionally, notes can be spaced strictly proportionately to their
119 duration. For details of this and other settings which control
120 proportional notation, see @ref{Proportional notation}.
126 @funindex \dotsNeutral
127 @funindex dotsNeutral
129 Dots are normally moved up to avoid staff lines, except in
130 polyphonic situations. Dots may be manually placed above or below
131 the staff; see @ref{Direction and placement}.
149 @rglos{Duration names notes and rests}.
152 @ref{Automatic beams},
155 @ref{Writing rhythms},
158 @ref{Ancient notation},
159 @ref{Proportional notation}.
166 @rinternals{DotColumn}.
171 @c Deliberately duplicated in Durations and Rests. -gp
172 There is no fundamental limit to rest durations (both in terms of
173 longest and shortest), but the number of glyphs is limited:
174 rests from 128th to maxima (8 x whole) may be printed.
178 @unnumberedsubsubsec Tuplets
186 Tuplets are made from a music expression by multiplying all the
187 durations with a fraction:
190 \times @var{fraction} @{ @var{music} @}
194 The duration of @var{music} will be multiplied by the
195 fraction. The fraction's denominator will be printed over or
196 under the notes, optionally with a bracket. The most common
197 tuplet is the triplet in which 3 notes have the duration of 2, so
198 the notes are 2/3 of their written length.
200 @lilypond[quote,verbatim,relative=2]
201 a2 \times 2/3 { b4 b b }
202 c4 c \times 2/3 { b4 a g }
205 @cindex tuplet bracket placement
209 @funindex \tupletDown
211 @funindex \tupletNeutral
212 @funindex tupletNeutral
214 Tuplet brackets may be manually placed above or below the staff;
215 see @ref{Direction and placement}.
217 Tuplets may be nested:
219 @lilypond[quote,verbatim,relative=2]
221 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
224 Modifying nested tuplets which begin at the same musical moment
225 must be done with @code{\tweak}.
227 To modify the duration of notes without printing a tuplet bracket,
228 see @ref{Scaling durations}.
234 @code{\tupletNeutral}.
240 @cindex tuplet formatting
241 @cindex triplet formatting
243 @funindex tupletNumberFormatFunction
244 @funindex tupletSpannerDuration
246 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
247 {entering-several-tuplets-using-only-one--times-command.ly}
249 @cindex Tuplet number changes
251 @funindex TupletNumber
253 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
254 {changing-the-tuplet-number.ly}
256 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
257 {non-default-tuplet-numbers.ly}
259 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
260 {permitting-line-breaks-within-beamed-tuplets.ly}
269 Learning Manual: @rlearning{Tweaking methods}.
272 @ref{Time administration},
273 @ref{Scaling durations},
274 @ref{The tweak command},
275 @ref{Polymetric notation}.
281 @rinternals{TupletBracket},
282 @rinternals{TupletNumber},
283 @rinternals{TimeScaledMusic}.
285 @cindex grace notes within tuplet brackets
288 When the first note on a staff is a grace note followed by a
289 tuplet the grace note must be placed before the @code{\times}
290 command to avoid errors. Anywhere else, grace notes may be
291 placed within tuplet brackets.
294 @node Scaling durations
295 @unnumberedsubsubsec Scaling durations
297 @cindex scaling durations
298 @cindex durations, scaling
300 You can alter the duration of single notes, rests or chords by a
301 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
302 is 1) to the duration. This will not affect the appearance of the
303 notes or rests produced, but the altered duration will be used in
304 calculating the position within the measure and setting the duration
305 in the MIDI output. Multiplying factors may be combined such as
308 In the following example, the first three notes take up exactly
309 two beats, but no triplet bracket is printed.
311 @lilypond[quote,relative=2,verbatim]
313 % Alter durations to triplets
314 a4*2/3 gis4*2/3 a4*2/3
317 % Double the duration of chord
319 % Duration of quarter, appears like sixteenth
323 The duration of skip or spacing notes may also be modified by
324 a multiplier. This is useful for skipping many measures, e.g.,
327 @cindex compressing music
328 @cindex expanding music
330 @funindex \scaleDurations
331 @funindex scaleDurations
333 Longer stretches of music may be compressed by a fraction in the
334 same way, as if every note, chord or rest had the fraction as a
335 multiplier. This leaves the appearance of the music unchanged but
336 the internal duration of the notes will be multiplied by the
337 fraction @emph{num}/@emph{den}. The spaces around the dot are
338 required. Here is an example showing how music can be compressed
341 @lilypond[quote,relative=2,verbatim]
345 % Scale music by *2/3
346 \scaleDurations #'(2 . 3) {
350 \scaleDurations #'(2 . 1) {
356 One application of this command is in polymetric
357 notation, see @ref{Polymetric notation}.
363 @ref{Invisible rests},
364 @ref{Polymetric notation}.
371 @unnumberedsubsubsec Ties
377 A tie connects two adjacent note heads of the same pitch. The tie
378 in effect extends the duration of a note.
380 @warning{Ties should not be confused with @emph{slurs}, which
381 indicate articulation, or @emph{phrasing slurs}, which indicate
382 musical phrasing. A tie is just a way of extending a note
383 duration, similar to the augmentation dot.}
385 A tie is entered using the tilde symbol (@code{~}).
387 @lilypond[quote,verbatim,relative=2]
393 Ties are used either when the note crosses a bar line, or when
394 dots cannot be used to denote the rhythm. Ties should also be
395 used when note values cross larger subdivisions of the measure:
397 @lilypond[verbatim,quote]
404 If you need to tie many notes across bar lines, it may be
405 easier to use automatic note splitting, see @ref{Automatic note
406 splitting}. This mechanism automatically splits long notes, and
407 ties them across bar lines.
409 @cindex ties and chords
410 @cindex chords and ties
412 When a tie is applied to a chord, all note heads whose pitches
413 match are connected. When no note heads match, no ties will be
414 created. Chords may be partially tied by placing the tie inside
417 @lilypond[quote,verbatim,relative=1]
419 <c~ e g~ b> <c e g b>
422 @cindex repeating ties
423 @cindex ties, repeating
424 @cindex volta brackets and ties
425 @cindex ties and volta brackets
430 When a second alternative of a repeat starts with a tied note, you
431 have to specify the repeated tie as follows:
433 @lilypond[quote,relative=2,verbatim]
434 \repeat volta 2 { c g <c e>2 ~ }
436 % First alternative: following note is tied normally
438 % Second alternative: following note has a repeated tie
439 { <c e>2\repeatTie d4 c } }
442 @cindex laissez vibrer
443 @cindex ties, laissez vibrer
445 @funindex \laissezVibrer
446 @funindex laissezVibrer
448 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
449 notes must not be damped at the end. It is used in notation for
450 piano, harp and other string and percussion instruments. They can
451 be entered as follows:
453 @lilypond[quote,verbatim,relative=1]
454 <c f g>1\laissezVibrer
457 @cindex ties, placement
463 @funindex \tieNeutral
466 Ties may be manually placed above or below the staff; see
467 @ref{Direction and placement}.
469 @cindex ties, appearance
482 Ties may be made dashed, dotted, or a combination of solid and
485 @lilypond[quote, verbatim, relative=1]
498 Custom dash patterns can be specified:
500 @lilypond[quote, verbatim, relative=1]
501 \tieDashPattern #0.3 #0.75
503 \tieDashPattern #0.7 #1.5
509 Dash pattern definitions for ties have the same structure as
510 dash pattern definitions for slurs.
511 For more information about complex dash patterns,
512 see the snippets under @ref{Slurs}.
520 @code{\tieDashPattern},
521 @code{\tieHalfDashed},
522 @code{\tieHalfSolid},
529 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
530 {using-ties-with-arpeggios.ly}
532 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
533 {engraving-ties-manually.ly}
539 @rglos{laissez vibrer}.
543 @ref{Automatic note splitting}.
549 @rinternals{LaissezVibrerTie},
550 @rinternals{LaissezVibrerTieColumn},
551 @rinternals{TieColumn},
557 Switching staves when a tie is active will not produce a slanted
560 Changing clefs or octavations during a tie is not really
561 well-defined. In these cases, a slur may be preferable.
566 @subsection Writing rests
568 Rests are entered as part of the music in music expressions.
573 * Full measure rests::
577 @unnumberedsubsubsec Rests
580 @cindex rest, entering durations
595 Rests are entered like notes with the note name @code{r}.
596 Durations longer than a whole rest use the predefined
599 @c \time 16/1 is used to avoid spurious bar lines
600 @c and long tracts of empty measures
601 @lilypond[fragment,quote,verbatim]
603 % These two lines are just to prettify this example
605 \override Staff.TimeSignature #'stencil = ##f
606 % Print a maxima rest, equal to four breves
608 % Print a longa rest, equal to two breves
612 r1 r2 r4 r8 r16 r32 r64 r128
616 @cindex rest, multi-measure
617 @cindex rest, whole-measure
619 Whole measure rests, centered in the middle of the measure, must be
620 entered as multi-measure rests. They can be used for a single
621 measure as well as many measures and are discussed in @ref{Full
624 @cindex rest, specifying vertical position
626 To explicitly specify a rest's vertical position, write a note
627 followed by @code{\rest}. A rest of the duration of the note will
628 be placed at the staff position where the note would appear. This
629 allows for precise manual formatting of polyphonic music, since the
630 automatic rest collision formatter will not move these rests.
632 @lilypond[quote,verbatim,relative=2]
638 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
649 @ref{Full measure rests}.
660 @c Deliberately duplicated in Durations and Rests. -gp
661 There is no fundamental limit to rest durations (both in terms of
662 longest and shortest), but the number of glyphs is limited: there
663 are rests from 128th to maxima (8 x whole).
666 @node Invisible rests
667 @unnumberedsubsubsec Invisible rests
670 @cindex invisible rest
671 @cindex rest, invisible
679 An invisible rest (also called a @q{spacer rest}) can be entered
680 like a note with the note name@tie{}@code{s}:
682 @lilypond[verbatim,quote,relative=2]
689 Spacer rests are available only in note mode and chord mode. In
690 other situations, for example, when entering lyrics, @code{\skip}
691 is used to skip a musical moment. @code{\skip} requires an
694 @lilypond[quote,verbatim,relative=2]
707 A spacer rest implicitly causes @code{Staff} and @code{Voice}
708 contexts to be created if none exist, just like notes and rests
711 @lilypond[quote,verbatim,fragment]
715 @code{\skip} simply skips musical time; it creates no output of
718 @lilypond[quote,verbatim,fragment]
719 % This is valid input, but does nothing
720 \skip 1 \skip1 \skip 1
726 @rlearning{Visibility and color of objects}.
730 @ref{Visibility of objects}.
736 @rinternals{SkipMusic}.
739 @node Full measure rests
740 @unnumberedsubsubsec Full measure rests
742 @cindex multi-measure rests
743 @cindex full-measure rests
744 @cindex rest, multi-measure
745 @cindex rest, full-measure
746 @cindex whole rest for a full measure
747 @cindex rest, whole for a full measure
751 Rests for one or more full measures are entered like notes with
752 the note name uppercase @code{R}:
754 @lilypond[quote,verbatim,relative=2]
755 % Rest measures contracted to single measure
756 \compressFullBarRests
763 The duration of full-measure rests is identical to the duration
764 notation used for notes. The duration in a multi-measure rest must
765 always be an integral number of measure-lengths, so augmentation dots
766 or fractions must often be used:
768 @lilypond[quote,fragment,verbatim]
769 \compressFullBarRests
775 R1*13/8 | R1*13/8*12 |
780 A full-measure rest is printed as either a whole or breve rest,
781 centered in the measure, depending on the time signature.
783 @lilypond[quote,verbatim,fragment]
792 @cindex multi-measure rest, expanding
793 @cindex multi-measure rest, contracting
795 @funindex \expandFullBarRests
796 @funindex expandFullBarRests
797 @funindex \compressFullBarRests
798 @funindex compressFullBarRests
800 By default a multi-measure rest is expanded in the printed score to
801 show all the rest measures explicitly. Alternatively, a multi-measure
802 rest can be shown as a single measure containing a multi-measure rest
803 symbol, with the number of measures of rest printed above the measure:
805 @lilypond[quote,fragment,verbatim]
807 \time 3/4 r2. | R2.*2 |
810 % Rest measures contracted to single measure
811 \compressFullBarRests
813 % Rest measures expanded
820 @cindex text on multi-measure rest
821 @cindex multi-measure rest, attaching text
822 @cindex script on multi-measure rest
823 @cindex multi-measure rest, script
824 @cindex fermata on multi-measure rest
825 @cindex multi-measure rest, attaching fermata
826 @cindex markup on multi-measure rest
827 @cindex multi-measure rest with markup
829 @funindex \fermataMarkup
830 @funindex fermataMarkup
831 @funindex MultiMeasureRestText
833 Markups can be added to multi-measure rests.
834 The predefined command @code{\fermataMarkup}
835 is provided for adding fermatas.
837 @lilypond[quote,verbatim,fragment]
838 \compressFullBarRests
840 R2.*10^\markup { \italic "ad lib." }
845 Markups attached to a multi-measure rest are
846 objects of type @code{MultiMeasureRestText}, not
847 @code{TextScript}. Overrides must be directed to the correct
848 object, or they will be ignored. See the following example.
851 @lilypond[quote,verbatim,fragment]
852 % This fails, as the wrong object name is specified
853 \override TextScript #'padding = #5
855 % This is correct and works
856 \override MultiMeasureRestText #'padding = #5
860 When a multi-measure rest immediately follows a @code{\partial}
861 setting, resulting bar-check warnings may not be displayed.
864 @funindex \textLengthOn
865 @funindex textLengthOn
866 @funindex \textLengthOff
867 @funindex textLenthOff
868 @funindex \fermataMarkup
869 @funindex fermataMarkup
870 @funindex \compressFullBarRests
871 @funindex compressFullBarRests
872 @funindex \expandFullBarRests
873 @funindex expandFullBarRests
876 @code{\textLengthOn},
877 @code{\textLengthOff},
878 @code{\fermataMarkup},
879 @code{\compressFullBarRests},
880 @code{\expandFullBarRests}.
888 @cindex kirchenpausen
890 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
891 {changing-form-of-multi-measure-rests.ly}
893 @cindex multi-measure rests, positioning
894 @cindex positioning multi-measure rests
896 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
897 {positioning-multi-measure-rests.ly}
899 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
900 {multi-measure-rest-markup.ly}
905 @rglos{multi-measure rest}.
910 @ref{Formatting text},
917 @rinternals{MultiMeasureRest},
918 @rinternals{MultiMeasureRestNumber},
919 @rinternals{MultiMeasureRestText}.
922 @cindex fingerings and multi-measure rests
923 @cindex multi-measure rests and fingerings
927 If an attempt is made to use fingerings (e.g.,
928 @code{R1*10-4}) to put numbers over multi-measure rests, the
929 fingering numeral (4) may collide with the bar counter
932 @cindex condensing rests
933 @cindex rest, condensing ordinary
935 There is no way to automatically condense multiple ordinary rests
936 into a single multi-measure rest.
938 @cindex rest, collisions of
940 Multi-measure rests do not take part in rest collisions.
942 @node Displaying rhythms
943 @subsection Displaying rhythms
949 * Polymetric notation::
950 * Automatic note splitting::
951 * Showing melody rhythms::
955 @unnumberedsubsubsec Time signature
957 @cindex time signature
963 The time signature is set as follows:
965 @lilypond[quote,verbatim,relative=2]
970 @cindex time signature, visibility of
972 Time signatures are printed at the beginning of a piece
973 and whenever the time signature changes. If a change takes place
974 at the end of a line a warning time signature sign is printed
975 there. This default behavior may be changed, see
976 @ref{Visibility of objects}.
978 @lilypond[quote,verbatim,relative=2]
988 @cindex time signature style
991 @funindex \numericTimeSignature
992 @funindex numericTimeSignature
993 @funindex \defaultTimeSignature
994 @funindex defaultTimeSignature
996 The time signature symbol that is used in 2/2 and 4/4 time can be
997 changed to a numeric style:
999 @lilypond[quote,verbatim,relative=2]
1003 % Change to numeric style
1004 \numericTimeSignature
1007 % Revert to default style
1008 \defaultTimeSignature
1014 Mensural time signatures are covered in
1015 @ref{Mensural time signatures}.
1019 @code{\numericTimeSignature},
1020 @code{\defaultTimeSignature}.
1026 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1027 {changing-the-time-signature-without-affecting-the-beaming.ly}
1029 @cindex compound time signatures
1030 @cindex time signature, compound
1032 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1033 {compound-time-signatures.ly}
1038 @rglos{time signature}
1041 @ref{Mensural time signatures},
1042 @ref{Time administration}.
1047 Internals Reference:
1048 @rinternals{TimeSignature},
1049 @rinternals{Timing_translator}.
1053 @unnumberedsubsubsec Upbeats
1057 @cindex partial measure
1058 @cindex measure, partial
1059 @cindex pickup measure
1060 @cindex measure, change length
1062 @funindex measurePosition
1066 Partial or pick-up measures, such as an anacrusis or upbeat, are
1067 entered using the @code{\partial} command, with the syntax
1070 \partial @var{duration}
1073 where @code{duration} is the rhythmic length of the interval
1074 before the start of the first complete measure:
1076 @lilypond[quote,verbatim,relative=2]
1081 The partial measure can be any duration less than a full measure:
1083 @lilypond[quote,verbatim,relative=2]
1084 \partial 8*3 c8 d e |
1088 Internally, this is translated into
1091 \set Timing.measurePosition = -@var{duration}
1094 The property @code{measurePosition} contains a rational number
1095 indicating how much of the measure has passed at this point. Note
1096 that this is set to a negative number by the @code{\partial}
1097 command: i.e., @code{\partial 4} is internally translated to
1098 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1112 @rinternals{Timing_translator}.
1117 The @code{\partial} command is intended to be used only at the
1118 beginning of a piece. If you use it after the beginning, some
1119 odd warnings may occur.
1121 @node Unmetered music
1122 @unnumberedsubsubsec Unmetered music
1124 @cindex bar lines, turning off
1125 @cindex bar numbering, turning off
1127 @cindex unmetered music
1129 @funindex \cadenzaOn
1131 @funindex \cadenzaOff
1132 @funindex cadenzaOff
1134 Bar lines and bar numbers are calculated automatically. For
1135 unmetered music (some cadenzas, for example), this is not desirable.
1136 To turn off automatic calculation of bar lines and bar numbers,
1137 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1138 to turn them on again.
1140 @lilypond[verbatim,relative=2,fragment]
1149 Bar numbering is resumed at the end of the cadenza as if the
1150 cadenza were not there:
1152 @lilypond[verbatim,relative=2,fragment]
1153 % Show all bar numbers
1154 \override Score.BarNumber #'break-visibility = #all-visible
1175 @ref{Visibility of objects}.
1181 @cindex cadenza line breaks
1182 @cindex cadenza page breaks
1183 @cindex unmetered music, line breaks
1184 @cindex unmetered music, page breaks
1185 @cindex breaks in unmetered music
1186 @cindex line breaks in cadenzas
1187 @cindex page breaks in cadenzas
1188 @cindex line breaks in unmetered music
1189 @cindex page breaks in unmetered music
1193 LilyPond will insert line breaks and page breaks only at a
1194 bar line. Unless the unmetered music ends before the end of the
1195 staff line, you will need to insert invisible bar lines with
1202 to indicate where breaks can occur.
1205 @node Polymetric notation
1206 @unnumberedsubsubsec Polymetric notation
1208 @c This section necessarily uses \set
1209 @c This is acceptable -td
1211 @cindex double time signatures
1212 @cindex signatures, polymetric
1213 @cindex time signatures, polymetric
1214 @cindex time signatures, double
1215 @cindex polymetric signatures
1216 @cindex meter, polymetric
1218 @funindex timeSignatureFraction
1219 @funindex \scaleDurations
1220 @funindex scaleDurations
1224 Polymetric notation is supported, either explicitly or by modifying
1225 the visible time signature symbol and scaling the note durations.
1227 @strong{@i{Staves with different time signatures, equal measure lengths}}
1229 This notation can be created by setting a common time signature
1230 for each staff but replacing the symbol manually by setting
1231 @code{timeSignatureFraction} to the desired fraction and scaling
1232 the printed durations in each staff to the common time
1233 signature; see @ref{Time signature}. The scaling is done with
1234 @code{\scaleDurations}, which is used in a similar way to
1235 @code{\times}, but does not create a tuplet bracket; see
1236 @ref{Scaling durations}.
1238 @cindex beaming in polymetric music
1239 @cindex beaming in polymetric meter
1241 In this example, music with the time signatures of 3/4, 9/8, and
1242 10/8 are used in parallel. In the second staff, shown durations
1243 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1244 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1245 It will often be necessary to insert beams manually, as the
1246 duration scaling affects the autobeaming rules.
1248 @lilypond[quote,verbatim,fragment]
1257 \set Staff.timeSignatureFraction = #'(9 . 8)
1258 \scaleDurations #'(2 . 3)
1259 \repeat unfold 6 { c8[ c c] }
1263 \set Staff.timeSignatureFraction = #'(10 . 8)
1264 \scaleDurations #'(3 . 5) {
1265 \repeat unfold 2 { c8[ c c] }
1266 \repeat unfold 2 { c8[ c] } |
1267 c4. c4. \times 2/3 { c8[ c c] } c4
1273 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1275 Each staff can be given its own independent time signature by
1276 moving the @code{Timing_translator} and the
1277 @code{Default_bar_line_engraver} to the @code{Staff} context.
1279 @lilypond[quote,verbatim]
1283 \remove "Timing_translator"
1284 \remove "Default_bar_line_engraver"
1288 \consists "Timing_translator"
1289 \consists "Default_bar_line_engraver"
1293 % Now each staff has its own time signature.
1319 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1320 {compound-time-signatures.ly}
1326 @rglos{polymetric time signature},
1330 @ref{Time signature},
1331 @ref{Scaling durations}.
1336 Internals Reference:
1337 @rinternals{TimeSignature},
1338 @rinternals{Timing_translator},
1339 @rinternals{Default_bar_line_engraver},
1345 When using different time signatures in parallel, notes
1346 at the same moment will be be placed at the same horizontal
1347 location. However, the bar lines in the different staves
1348 will cause the note spacing to be less regular in each of the
1349 individual staves than would be normal without the different
1352 @node Automatic note splitting
1353 @unnumberedsubsubsec Automatic note splitting
1355 @cindex notes, splitting
1356 @cindex splitting notes
1358 @funindex Note_heads_engraver
1359 @funindex Completion_heads_engraver
1361 Long notes which overrun bar lines can be converted automatically
1362 to tied notes. This is done by replacing the
1363 @code{Note_heads_engraver} with the
1364 @code{Completion_heads_engraver}. In the following
1365 example, notes crossing the bar lines are split and tied.
1367 @lilypond[quote,verbatim,relative=1]
1369 \remove "Note_heads_engraver"
1370 \consists "Completion_heads_engraver"
1373 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1376 This engraver splits all running notes at the bar line, and
1377 inserts ties. One of its uses is to debug complex scores: if the
1378 measures are not entirely filled, then the ties show exactly how
1379 much each measure is off.
1383 Music Glossary: @rglos{tie}
1386 @rlearning{Engravers explained},
1387 @rlearning{Adding and removing engravers}.
1392 Internals Reference:
1393 @rinternals{Note_heads_engraver},
1394 @rinternals{Completion_heads_engraver},
1395 @rinternals{Forbid_line_break_engraver}.
1400 Not all durations (especially those containing tuplets) can be
1401 represented exactly with normal notes and dots, but the
1402 @code{Completion_heads_engraver} will not insert tuplets.
1404 The @code{Completion_heads_engraver} only affects notes; it does not
1408 @node Showing melody rhythms
1409 @unnumberedsubsubsec Showing melody rhythms
1411 @cindex melody rhythms, showing
1412 @cindex rhythms, showing melody
1414 Sometimes you might want to show only the rhythm of a melody. This
1415 can be done with the rhythmic staff. All pitches of notes on such a
1416 staff are squashed, and the staff itself has a single line
1418 @lilypond[quote,relative=1,verbatim]
1420 \new RhythmicStaff {
1421 \new Voice = "myRhythm" {
1429 \lyricsto "myRhythm" {
1437 @cindex guitar chord charts
1438 @cindex strumming rhythms, showing
1439 @cindex guitar strumming rhythms, showing
1441 @funindex Pitch_squash_engraver
1442 @funindex \improvisationOn
1443 @funindex improvisationOn
1444 @funindex \improvisationOff
1445 @funindex improvisationOff
1447 Guitar chord charts often show the strumming rhythms. This can
1448 be done with the @code{Pitch_squash_engraver} and
1449 @code{\improvisationOn}.
1452 @lilypond[quote,verbatim]
1461 \consists Pitch_squash_engraver
1474 @code{\improvisationOn},
1475 @code{\improvisationOff}.
1481 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1482 {guitar-strum-rhythms.ly}
1489 Internals Reference:
1490 @rinternals{RhythmicStaff},
1491 @rinternals{Pitch_squash_engraver}.
1499 * Setting automatic beam behavior::
1504 @node Automatic beams
1505 @unnumberedsubsubsec Automatic beams
1507 By default, beams are inserted automatically:
1509 @cindex beams, manual
1510 @cindex manual beams
1511 @cindex beams, setting rules for
1512 @cindex beams, custom rules for
1514 @funindex \autoBeamOn
1515 @funindex autoBeamOn
1516 @funindex \autoBeamOff
1517 @funindex autoBeamOff
1519 @lilypond[quote,verbatim,relative=2]
1521 \time 6/8 c c c c8. c16 c8
1524 If these automatic decisions are not satisfactory, beaming can be
1525 entered explicitly; see @ref{Manual beams}. Beams @emph{must} be
1526 entered manually if beams are to be extended over rests.
1528 If automatic beaming is not required, it may be turned off with
1529 @code{\autoBeamOff} and on with @code{\autoBeamOn}:
1531 @lilypond[quote,relative=1,verbatim]
1532 c4 c8 c8. c16 c8. c16 c8
1539 @cindex melismata, beams
1540 @cindex beams and melismata
1542 @warning{If beams are used to indicate melismata in songs, then
1543 automatic beaming should be switched off with @code{\autoBeamOff}
1544 and the beams indicated manually.}
1546 Beaming patterns that differ from the automatic defaults may be
1547 created, see @ref{Setting automatic beam behavior}.
1551 @code{\autoBeamOff},
1558 @cindex line breaks and beams
1559 @cindex beams and line breaks
1563 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1564 {beams-across-line-breaks.ly}
1566 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1567 {changing-beam-knee-gap.ly}
1573 @ref{Setting automatic beam behavior}.
1576 @file{scm/@/auto@/-beam@/.scm}.
1581 Internals Reference: @rinternals{Beam}.
1586 Beams can collide with note heads and accidentals in other voices
1589 @node Setting automatic beam behavior
1590 @unnumberedsubsubsec Setting automatic beam behavior
1593 @cindex automatic beams, tuning
1594 @cindex tuning automatic beaming
1595 @cindex automatic beam generation
1597 @cindex lyrics and beaming
1599 @funindex autoBeaming
1600 @funindex autoBeamSettings
1601 @funindex (end * * * *)
1602 @funindex (begin * * * *)
1603 @funindex measureLength
1604 @funindex beatLength
1605 @funindex beatGrouping
1611 There are two types of beaming rules: @emph{beam-grouping}
1612 rules and @emph{beam-ending} rules. Beam-grouping rules are the
1613 simplest, but are over-ridden by any beam-ending rules which apply.
1615 The placement of automatic beams is determined by applying the
1616 following rules in order:
1620 @item If a manual beam is specified with @code{[..]} set the beam
1621 as specified, otherwise
1623 @item if @code{\autoBeamOff} is in force do not beam, otherwise
1625 @item if a beam-ending rule applies use it to determine the valid
1626 places where beams may end, otherwise
1628 @item if a valid (see below) beat-grouping rule applies use it to
1629 group notes with beams, otherwise
1631 @item use the value of @code{beatLength} to group notes with beams
1635 @i{@strong{Modifying the grouping of beats}}
1637 If there are no beam-ending rules defined for the beam duration of a
1638 particular beam in the time signature in use, its beaming is
1639 controlled by three context properties: @code{measureLength},
1640 @code{beatLength} and @code{beatGrouping}. These properties may be
1641 set in the @code{Score}, @code{Staff} or @code{Voice} contexts to
1642 delimit their scope. The default values are set while processing
1643 @code{\time} commands, so any @code{\set} commands to modify their
1644 value must be placed after all @code{\time} commands.
1646 @warning{These three properties become effective for a particular
1647 beam @strong{only} if there are no beam-ending rules predefined for
1648 that beam's duration in the time signature in use, or if these
1649 beam-ending rules have all been reverted.}
1651 These determine the beaming as follows:
1653 Beams may begin anywhere (unless a beam is already active). Beams
1654 end at a time determined by the values of @code{beatGrouping} and
1655 @code{beatLength}, as follows:
1659 @item If @code{beatGrouping} and @code{beatLength} are consistent
1660 with @code{measureLength}, @code{beatGrouping} is used to determine
1661 the end points of beams.
1663 @item If @code{beatGrouping} and @code{beatLength} are inconsistent
1664 with @code{measureLength}, @code{beatLength} is used to determine
1665 the end points of beams.
1669 By default the @code{measureLength} and @code{beatLength} are
1670 derived from the time signature set by the @code{\time} command.
1671 The @code{measureLength} is set to be exactly the same length as
1672 the measure length given by the time signature, and the
1673 @code{beatLength} is set to be the same as one over the denominator
1674 of the time signature.
1676 The default value of @code{beatGrouping} is taken from a table in
1677 @file{scm/@/music@/-functions@/.scm}. To find this, see
1678 @rlearning{Other sources of information}. It defines the beat
1679 grouping for 3/8, 4/8, 5/8, 8/8, and all the common compound time
1682 Both @code{measureLength} and @code{beatLength} are @i{moments},
1683 units of musical duration. A quantity of type @i{moment} is
1684 created by the scheme function @code{ly:make-moment}. For more
1685 information about this function, see @ref{Time administration}.
1687 @code{beatGrouping} is a list of integers giving the number of
1688 beats in each group.
1692 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1695 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1696 {specifying-context-with-beatgrouping.ly}
1698 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1699 {using-beatlength-and-beatgrouping.ly}
1701 @funindex subdivideBeams
1703 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1704 {sub-dividing-beams.ly}
1706 @cindex measure groupings
1707 @cindex beats, grouping
1708 @cindex grouping beats
1709 @cindex measure sub-grouping
1711 @funindex autoBeamSettings
1713 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1714 {conducting-signs,-measure-grouping-signs.ly}
1717 @strong{@i{Modifying the beam end points}}
1719 Beam-ending rules are required when beams of different durations are
1720 to end at different points within the measure. For example, it may
1721 be desirable for eighth-note beams in 4/4 time to end only at the
1722 end of the measure or half-way through it, but for sixteenth-note
1723 beams to end at quarter note positions to avoid overly long beamed
1724 runs. The rules work as follows:
1726 Automatic beams can start on any note but can end at only a few
1727 positions within the measure, namely at positions specified by the
1728 properties in @code{autoBeamSettings}. These properties consist of
1729 a list of rules defining where beams can end. The default
1730 @code{autoBeamSettings} rules are defined in
1731 @file{scm/@/auto@/-beam@/.scm}. To find this file, see
1732 @rlearning{Other sources of information}.
1734 In order to add a rule to the list, use
1737 #(override-auto-beam-setting
1739 beam-numerator beam-denominator
1740 time-signature-numerator time-signature-denominator)
1741 moment-numerator moment-denominator [context])
1749 @item @code{beam-limit} is the type of automatic beam limit
1750 defined. This can be either @code{begin} or @code{end} but
1751 only @code{end} is effective.
1753 @item @code{beam-numerator/beam-denominator} is the beam duration
1754 to which the rule is to apply. A beam is considered to have the
1755 duration of its shortest note. Set @code{beam-numerator} and
1756 @code{beam-denominator} to @code{'*'} to have this rule apply to beams
1759 @item @code{time-signature-numerator/time-signature-denominator}
1760 specifies the time signature to which this rule should apply. If
1761 @code{time-signature-numerator} and @code{time-signature-denominator}
1762 are set to @code{'*'} this rule will apply in any time signature.
1764 @item @code{moment-numerator/moment-denominator} is the position
1765 in the bar at which the beam should end.
1767 @funindex score-override-auto-beam-setting
1768 @funindex override-auto-beam-setting
1770 @item @code{context} is optional, and it specifies the context at which
1771 the change should be made. The default is @code{'Voice}.
1773 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1774 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1778 For example, if automatic beams should always end on the first quarter
1779 note, whatever the time signature or beam duration, use
1781 @lilypond[quote,verbatim,relative=2]
1783 #(override-auto-beam-setting '(end * * * *) 1 4)
1787 You can force the beam settings to take effect only on beams whose shortest
1788 note is a certain duration
1790 @lilypond[quote,verbatim,relative=2]
1792 % end 1/16 beams for all time signatures at the 1/16 moment
1793 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1795 a32 a a a a16 a a a a a |
1796 % end 1/32 beams for all time signatures at the 1/16 moment
1797 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1798 a32 a a a a16 a a a a a |
1801 You can force the beam settings to take effect only in certain time
1804 @lilypond[quote,verbatim,relative=2]
1806 % end beams of all durations in 5/8 time signature at the 2/8 moment
1807 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1815 When multiple voices are used the @code{Staff} context must be
1816 specified if the beaming is to be applied to all voices in the
1819 @lilypond[quote,verbatim,relative=2]
1822 % Context not specified - does not work correctly
1823 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1824 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1825 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1826 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1828 % Works correctly with context specified
1829 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1830 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1831 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1832 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1835 @warning{If any unexpected beam behavior occurs, check the default
1836 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1837 possible interference, because the beam endings defined there will
1838 still apply in addition to your own.}
1840 @funindex revert-auto-beam-setting
1842 Any unwanted or conflicting default endings must be reverted for
1843 your time signature(s). Existing default or user-defined
1844 beam-ending rules are removed by using
1847 #(revert-auto-beam-setting
1849 beam-numerator beam-denominator
1850 time-signature-numerator time-signature-denominator)
1851 moment-numerator moment-denominator [context])
1855 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1856 @code{time-signature-numerator}, @code{time-signature-denominator},
1857 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1858 are the same as above.
1860 @lilypond[quote,verbatim,relative=2]
1862 a16 a a a a a a a a a a a a a a a
1863 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1864 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1865 a16 a a a a a a a a a a a a a a a
1868 The rule in a @code{revert-auto-beam-setting} statement must exactly
1869 match the original rule. That is, no wildcard expansion is taken into
1872 @lilypond[quote,verbatim,relative=2]
1874 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1876 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1878 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1884 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1885 {beam-grouping-in-7-8-time.ly}
1887 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1888 {reverting-default-beam-endings.ly}
1890 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1891 {beam-endings-in-score-context.ly}
1893 @funindex \autoBeamOff
1894 @funindex autoBeamOff
1895 @funindex \autoBeamOn
1896 @funindex autoBeamOn
1899 @code{\autoBeamOff},
1904 @cindex beam, last in score
1905 @cindex beam, last in polyphonic voice
1909 If a score ends while an automatic beam has not been ended and is
1910 still accepting notes, this last beam will not be typeset at all.
1911 The same holds for polyphonic voices, entered with @code{<<
1912 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1913 automatic beam is still accepting notes, it is not typeset.
1922 @unnumberedsubsubsec Manual beams
1924 @cindex beams, manual
1925 @cindex manual beams
1930 In some cases it may be necessary to override the automatic
1931 beaming algorithm. For example, the autobeamer will not put beams
1932 over rests or bar lines, and in choral scores the beaming is
1933 often set to follow the meter of the lyrics rather than the
1934 notes. Such beams can be specified manually by
1935 marking the begin and end point with @code{[} and @code{]}
1937 @lilypond[quote,relative=1,verbatim]
1939 r4 r8[ g' a r8] r8 g[ | a] r8
1947 Individual notes may be marked with @code{\noBeam} to prevent them
1950 @lilypond[quote,verbatim,relative=2]
1951 \time 2/4 c8 c\noBeam c c
1954 @funindex stemLeftBeamCount
1955 @funindex stemRightBeamCount
1957 Even more strict manual control with the beams can be achieved by
1958 setting the properties @code{stemLeftBeamCount} and
1959 @code{stemRightBeamCount}. They specify the number of beams to
1960 draw on the left and right side, respectively, of the next note.
1961 If either property is set, its value will be used only once, and
1962 then it is erased. In this example, the last @code{f} is printed
1963 with only one beam on the left side, i.e., the eighth-note beam of
1964 the group as a whole.
1966 @lilypond[quote,relative=2,verbatim]
1969 \set stemLeftBeamCount = #2
1970 \set stemRightBeamCount = #1
1972 \set stemLeftBeamCount = #1
1979 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1980 {flat-flags-and-beam-nibs.ly}
1982 @node Feathered beams
1983 @unnumberedsubsubsec Feathered beams
1985 @cindex beams, feathered
1986 @cindex feathered beams
1988 @funindex \featherDurations
1989 @funindex featherDurations
1990 @funindex grow-direction
1992 Feathered beams are used to indicate that a small group of notes
1993 should be played at an increasing (or decreasing) tempo, without
1994 changing the overall tempo of the piece. The extent of the
1995 feathered beam must be indicated manually using @code{[} and
1996 @code{]}, and the beam feathering is turned on by specifying a
1997 direction to the @code{Beam} property @code{grow-direction}.
1999 If the placement of the notes and the sound in the MIDI output is to
2000 reflect the ritardando or accelerando indicated by the feathered beam
2001 the notes must be grouped as a music expression delimited by braces
2002 and preceded by a @code{featherDurations} command which specifies
2003 the ratio between the durations of the first and last notes in the
2006 The square brackets show the extent of the beam and the braces show
2007 which notes are to have their durations modified. Normally these
2008 would delimit the same group of notes, but this is not required: the
2009 two commands are independent.
2011 In the following example the eight 16th notes occupy exactly the
2012 same time as a half note, but the first note is one half as long
2013 as the last one, with the intermediate notes gradually
2014 lengthening. The first four 32nd notes gradually speed up, while
2015 the last four 32nd notes are at a constant tempo.
2017 @lilypond[relative=1,verbatim,quote]
2018 \override Beam #'grow-direction = #LEFT
2019 \featherDurations #(ly:make-moment 2 1)
2020 { c16[ c c c c c c c] }
2021 \override Beam #'grow-direction = #RIGHT
2022 \featherDurations #(ly:make-moment 2 3)
2024 % revert to non-feathered beams
2025 \override Beam #'grow-direction = #'()
2030 The spacing in the printed output represents the
2031 note durations only approximately, but the MIDI output is exact.
2035 The @code{\featherDurations} command only works with very short
2036 music snippets, and when numbers in the fraction are small.
2051 * Bar and bar number checks::
2056 @unnumberedsubsubsec Bar lines
2059 @cindex measure lines
2060 @cindex closing bar lines
2061 @cindex bar lines, closing
2062 @cindex double bar lines
2063 @cindex bar lines, double
2069 Bar lines delimit measures, and are also used to indicate
2070 repeats. Normally, simple bar lines are automatically inserted
2071 into the printed output at places based on the current time
2074 The simple bar lines inserted automatically can be changed to
2075 other types with the @code{\bar} command. For example, a closing
2076 double bar line is usually placed at the end of a piece:
2078 @lilypond[quote,relative=1,verbatim]
2082 It is not invalid if the final note in a measure does not
2083 end on the automatically entered bar line: the note is assumed
2084 to carry over into the next measure. But if a long sequence
2085 of such carry-over measures appears the music can appear compressed
2086 or even flowing off the page. This is because automatic line
2087 breaks happen only at the end of complete measures, i.e., where
2088 all notes end before the end of a measure.
2090 @warning{An incorrect duration can cause line breaks to be
2091 inhibited, leading to a line of highly compressed music or
2092 music which flows off the page.}
2095 @cindex bar lines, invisible
2096 @cindex measure lines, invisible
2098 Line breaks are also permitted at manually inserted bar lines
2099 even within incomplete measures. To allow a line break without
2100 printing a bar line, use
2107 This will insert an invisible bar line and allow (but not
2108 force) a line break to occur at this point. The bar number
2109 counter is not increased. To force a line break see
2110 @ref{Line breaking}.
2112 @cindex manual bar lines
2113 @cindex manual measure lines
2114 @cindex bar lines, manual
2115 @cindex measure lines, manual
2117 This and other special bar lines may be inserted manually at any
2118 point. When they coincide with the end of a measure they replace the
2119 simple bar line which would have been inserted there automatically.
2120 When they do not coincide with the end of a measure the specified bar
2121 line is inserted at that point in the printed output. Such insertions
2122 do not affect the calculation and placement of subsequent automatic
2125 Two types of simple bar lines and five types of double bar lines are available
2126 for manual insertion:
2128 @lilypond[quote,relative=1,verbatim]
2129 f1 \bar "|" f \bar "." g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
2133 together with dotted and dashed bar lines:
2135 @lilypond[quote,relative=1,verbatim]
2136 f1 \bar ":" g \bar "dashed" a
2140 and five types of repeat bar line:
2142 @lilypond[quote,relative=1,verbatim]
2143 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
2146 Additionally, a bar line can be printed as a simple tick:
2147 @lilypond[quote,relative=1,verbatim]
2150 However, as such ticks are typically used in Gregorian chant, it is preferable
2151 to use @code{\divisioMinima} there instead, described in the section
2152 @ref{Divisiones} in Gregorian chant.
2157 Although the bar line types signifying repeats may be inserted
2158 manually they do not in themselves cause LilyPond to recognize
2159 a repeated section. Such repeated sections are better entered
2160 using the various repeat commands (see @ref{Repeats}), which
2161 automatically print the appropriate bar lines.
2163 In addition, you can specify @code{"||:"}, which is equivalent to
2164 @code{"|:"} except at line breaks, where it gives a double bar
2165 line at the end of the line and a start repeat at the beginning of
2168 @lilypond[quote,relative=2,verbatim]
2169 \override Score.RehearsalMark #'padding = #3
2177 In scores with many staves, a @code{\bar} command in one staff is
2178 automatically applied to all staves. The resulting bar lines are
2179 connected between different staves of a @code{StaffGroup},
2180 @code{PianoStaff}, or @code{GrandStaff}.
2182 @lilypond[quote,fragment,verbatim]
2190 \new Staff { \clef bass c4 g e g }
2192 \new Staff { \clef bass c2 c2 }
2197 @cindex default bar lines, changing
2198 @cindex bar lines, default, changing
2203 @funindex defaultBarType
2208 The command @code{\bar }@var{bartype} is a shortcut for
2209 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2210 created whenever the @code{whichBar} property is
2213 The default bar type used for automatically inserted bar lines is
2214 @code{"|"}. This may be changed at any time
2215 with @code{\set Timing.defaultBarType = }@var{bartype}.
2220 @ref{Line breaking},
2222 @ref{Grouping staves}.
2227 Internals Reference: @rinternals{BarLine} (created at
2228 @rinternals{Staff} level), @rinternals{SpanBar} (across
2229 staves), @rinternals{Timing_translator} (for Timing
2234 @unnumberedsubsubsec Bar numbers
2237 @cindex measure numbers
2238 @cindex numbers, bar
2239 @cindex numbers, measure
2241 @funindex currentBarNumber
2243 Bar numbers are typeset by default at the start of every line except
2244 the first line. The number itself is stored in the
2245 @code{currentBarNumber} property, which is normally updated
2246 automatically for every measure. It may also be set manually:
2248 @lilypond[verbatim,quote,fragment,relative=1]
2251 \set Score.currentBarNumber = #50
2255 @cindex bar numbers, regular spacing
2257 @funindex barNumberVisibility
2260 Bar numbers can be typeset at regular intervals instead of just at
2261 the beginning of every line. To do this the default behavior
2262 must be overridden to permit bar numbers to be printed at places
2263 other than the start of a line. This is controlled by the
2264 @code{break-visibility} property of @code{BarNumber}. This takes
2265 three values which may be set to @code{#t} or @code{#f} to specify
2266 whether the corresponding bar number is visible or not. The order
2267 of the three values is @code{end of line visible}, @code{middle of
2268 line visible}, @code{beginning of line visible}. In the following
2269 example bar numbers are printed at all possible places:
2271 @lilypond[verbatim,quote,relative=1]
2272 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2273 \set Score.currentBarNumber = #11
2274 % Permit first bar number to be printed
2284 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2285 {printing-the-bar-number-for-the-first-measure.ly}
2287 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2288 {printing-bar-numbers-at-regular-intervals.ly}
2290 @cindex measure number, format
2291 @cindex bar number, format
2293 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2294 {printing-bar-numbers-inside-boxes-or-circles.ly}
2296 @cindex bar number alignment
2298 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2299 {aligning-bar-numbers.ly}
2301 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2302 {removing-bar-numbers-from-a-score.ly}
2309 Internals Reference: @rinternals{BarNumber}.
2312 @cindex bar number collision
2313 @cindex collision, bar number
2317 Bar numbers may collide with the top of the
2318 @rinternals{StaffGroup} bracket, if there is one. To solve
2319 this, the @code{padding} property of @rinternals{BarNumber} can
2320 be used to position the number correctly.
2324 @node Bar and bar number checks
2325 @unnumberedsubsubsec Bar and bar number checks
2328 @cindex bar number check
2329 @cindex measure check
2330 @cindex measure number check
2332 @funindex barCheckSynchronize
2335 Bar checks help detect errors in the entered durations. A bar check
2336 may be entered using the bar symbol, @code{|}, at any place where a
2337 bar line is expected to fall. If bar check lines are encountered at
2338 other places, a list of warnings is printed in the log file, showing
2339 the line numbers and lines in which the bar checks failed. In the
2340 next example, the second bar check will signal an error.
2343 \time 3/4 c2 e4 | g2 |
2346 Bar checks can also be used in lyrics, for example
2351 Twin -- kle | Twin -- kle |
2355 An incorrect duration can result in a completely garbled score,
2356 especially if the score is polyphonic, so a good place to start
2357 correcting input is by scanning for failed bar checks and
2358 incorrect durations.
2360 If successive bar checks are off by the same musical interval,
2361 only the first warning message is displayed. This allows the
2362 warning to focus on the source of the timing error.
2366 @funindex pipeSymbol
2368 It is also possible to redefine the action taken when a bar check
2369 or pipe symbol, @code{|}, is encountered in the input, so that
2370 it does something other than a bar check. This is done by
2371 assigning a music expression to @code{pipeSymbol}.
2372 In the following example @code{|} is set to insert a double bar
2373 line wherever it appears in the input, rather than checking
2376 @lilypond[quote,verbatim]
2377 pipeSymbol = \bar "||"
2386 @funindex \barNumberCheck
2387 @funindex barNumberCheck
2389 When copying large pieces of music, it can be helpful to check that
2390 the LilyPond bar number corresponds to the original that you are
2391 entering from. This can be checked with @code{\barNumberCheck}, for
2395 \barNumberCheck #123
2399 will print a warning if the @code{currentBarNumber} is not 123
2400 when it is processed.
2408 @node Rehearsal marks
2409 @unnumberedsubsubsec Rehearsal marks
2411 @cindex rehearsal marks
2412 @cindex mark, rehearsal
2417 To print a rehearsal mark, use the @code{\mark} command
2419 @lilypond[quote,verbatim,relative=2]
2428 The letter@tie{}@q{I} is skipped in accordance with engraving
2429 traditions. If you wish to include the letter @q{I}, then use
2432 \set Score.markFormatter = #format-mark-alphabet
2435 The mark is incremented automatically if you use @code{\mark
2436 \default}, but you can also use an integer argument to set the
2437 mark manually. The value to use is stored in the property
2438 @code{rehearsalMark}.
2440 @cindex rehearsal mark format
2441 @cindex rehearsal mark style
2442 @cindex style, rehearsal mark
2443 @cindex format, rehearsal mark
2444 @cindex mark, rehearsal, style
2445 @cindex mark, rehearsal, format
2446 @cindex rehearsal mark, manual
2447 @cindex mark, rehearsal, manual
2448 @cindex custom rehearsal mark
2449 @cindex manual rehearsal mark
2451 The style is defined by the property @code{markFormatter}. It is
2452 a function taking the current mark (an integer) and the current
2453 context as argument. It should return a markup object. In the
2454 following example, @code{markFormatter} is set to a pre-defined
2455 procedure. After a few measures, it is set to a procedure that
2456 produces a boxed number.
2458 @lilypond[quote,verbatim,relative=2]
2459 \set Score.markFormatter = #format-mark-numbers
2462 \set Score.markFormatter = #format-mark-box-numbers
2464 \set Score.markFormatter = #format-mark-circle-numbers
2466 \set Score.markFormatter = #format-mark-circle-letters
2470 The file @file{scm/@/translation@/-functions@/.scm} contains the
2471 definitions of @code{format-mark-numbers} (the default format),
2472 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2473 @code{format-mark-box-letters}. These can be used as inspiration
2474 for other formatting functions.
2476 You may use @code{format-mark-barnumbers},
2477 @code{format-mark-box-barnumbers}, and
2478 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2479 incremented numbers or letters.
2481 Other styles of rehearsal mark can be specified manually
2488 @code{Score.markFormatter} does not affect marks specified in this
2489 manner. However, it is possible to apply a @code{\markup} to the
2493 \mark \markup@{ \box A1 @}
2498 @cindex D.S. al Fine
2500 @cindex music glyphs
2501 @cindex glyphs, music
2503 @funindex \musicglyph
2504 @funindex musicglyph
2506 Music glyphs (such as the segno sign) may be printed inside a
2509 @lilypond[quote,verbatim,relative=1]
2510 c1 \mark \markup { \musicglyph #"scripts.segno" }
2511 c1 \mark \markup { \musicglyph #"scripts.coda" }
2512 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2517 See @ref{The Feta font}, for a list of symbols which may be
2518 printed with @code{\musicglyph}.
2520 For common tweaks to the positioning of rehearsal marks, see
2521 @ref{Formatting text}.
2526 @ref{The Feta font},
2527 @ref{Formatting text}.
2530 @file{scm/@/translation@/-functions@/.scm} contains
2531 the definition of @code{format-mark-numbers} and
2532 @code{format-mark-letters}. They can be used as inspiration for
2533 other formatting functions.
2538 Internals Reference: @rinternals{RehearsalMark}.
2541 @node Special rhythmic concerns
2542 @subsection Special rhythmic concerns
2547 * Aligning to cadenzas::
2548 * Time administration::
2552 @unnumberedsubsubsec Grace notes
2556 @cindex appoggiatura
2557 @cindex acciaccatura
2562 Grace notes are ornaments that are written out. Grace notes
2563 are printed in a smaller font and take up no logical time
2566 @lilypond[quote,relative=2,verbatim]
2568 \grace { c16[ d16] } c2
2571 LilyPond also supports two special types of grace notes, the
2572 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2573 small note with a slashed stem--and the @emph{appoggiatura}, which
2574 takes a fixed fraction of the main note and appears in small print
2577 @lilypond[quote,relative=2,verbatim]
2581 \acciaccatura { g16[ f] } e4
2584 The placement of grace notes is synchronized between different
2585 staves. In the following example, there are two sixteenth grace
2586 notes for every eighth grace note
2588 @lilypond[quote,relative=2,verbatim]
2589 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2590 \new Staff { c2 \grace { g8[ b] } c2 } >>
2593 @cindex grace notes, following
2595 @funindex \afterGrace
2596 @funindex afterGrace
2598 If you want to end a note with a grace, use the @code{\afterGrace}
2599 command. It takes two arguments: the main note, and the grace
2600 notes following the main note.
2602 @lilypond[quote,verbatim,relative=2]
2603 c1 \afterGrace d1 { c16[ d] } c1
2606 This will put the grace notes after a space lasting 3/4 of the
2607 length of the main note. The default fraction 3/4 can be changed by
2608 setting @code{afterGraceFraction}. The following example shows
2609 the results from setting the space at the default, at 15/16, and
2610 finally at 1/2 of the main note.
2612 @lilypond[quote,verbatim,relative=2]
2615 c1 \afterGrace d1 { c16[ d] } c1
2618 #(define afterGraceFraction (cons 15 16))
2619 c1 \afterGrace d1 { c16[ d] } c1
2622 #(define afterGraceFraction (cons 1 2))
2623 c1 \afterGrace d1 { c16[ d] } c1
2628 The space between the main note and the grace note may also be
2629 specified using spacers. The following example places the grace
2630 note after a space lasting 7/8 of the main note.
2632 @lilypond[quote,verbatim,relative=2]
2635 { s2 s4. \grace { c16[ d] } } >>
2640 @cindex tweaking grace notes
2641 @cindex grace notes, tweaking
2642 @cindex grace notes, changing layout settings
2644 A @code{\grace} music expression will introduce special
2645 typesetting settings, for example, to produce smaller type, and
2646 set directions. Hence, when introducing layout tweaks to
2647 override the special settings, they should be placed inside
2648 the grace expression. The overrides should also be reverted
2649 inside the grace expression. Here, the grace note's default stem
2650 direction is overridden and then reverted.
2652 @lilypond[quote,verbatim,relative=2]
2664 @cindex stem, with slash
2669 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2670 {using-grace-note-slashes-with-normal-heads.ly}
2672 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2673 {tweaking-grace-layout-within-music.ly}
2675 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2676 {redefining-grace-note-global-defaults.ly}
2678 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2679 {positioning-grace-notes-with-floating-space.ly}
2684 @rglos{grace notes},
2685 @rglos{acciaccatura},
2686 @rglos{appoggiatura}.
2688 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2690 Snippets: @rlsr{Rhythms}.
2692 Internals Reference: @rinternals{GraceMusic}.
2697 @cindex acciaccatura, multi-note
2698 @cindex multi-note acciaccatura
2699 @cindex grace-note synchronization
2701 A multi-note beamed @i{acciaccatura} is printed without a slash,
2702 and looks exactly the same as a multi-note beamed
2705 @c TODO Add link to LSR snippet to add slash when available
2707 Grace note synchronization can also lead to surprises. Staff
2708 notation, such as key signatures, bar lines, etc., are also
2709 synchronized. Take care when you mix staves with grace notes and
2710 staves without, for example,
2712 @lilypond[quote,relative=2,verbatim]
2714 \new Staff { e4 \bar "|:" \grace c16 d2. }
2715 \new Staff { c4 \bar "|:" d2. }
2720 This can be remedied by inserting grace skips of the corresponding
2721 durations in the other staves. For the above example
2723 @lilypond[quote,relative=2,verbatim]
2725 \new Staff { e4 \bar "|:" \grace c16 d2. }
2726 \new Staff { c4 \bar "|:" \grace s16 d2. }
2730 Grace sections should only be used within sequential music
2731 expressions. Nesting or juxtaposing grace sections is not
2732 supported, and might produce crashes or other errors.
2734 @node Aligning to cadenzas
2735 @unnumberedsubsubsec Aligning to cadenzas
2738 @cindex cadenza, aligning to
2739 @cindex aligning to cadenza
2741 In an orchestral context, cadenzas present a special problem: when
2742 constructing a score that includes a measured cadenza or other solo
2743 passage, all other instruments should skip just as many notes as the
2744 length of the cadenza, otherwise they will start too soon or too late.
2746 One solution to this problem is to use the functions
2747 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2748 functions take a defined piece of music as an argument and generate a
2749 multi-measure rest or @code{\skip} exactly as long as the piece.
2751 @lilypond[verbatim,quote]
2752 MyCadenza = \relative c' {
2763 #(ly:export (mmrest-of-length MyCadenza))
2765 #(ly:export (skip-of-length MyCadenza))
2780 @node Time administration
2781 @unnumberedsubsubsec Time administration
2783 @cindex time administration
2784 @cindex timing (within the score)
2785 @cindex music, unmetered
2786 @cindex unmetered music
2788 @funindex currentBarNumber
2789 @funindex measurePosition
2790 @funindex measureLength
2792 Time is administered by the @code{Timing_translator}, which by
2793 default is to be found in the @code{Score} context. An alias,
2794 @code{Timing}, is added to the context in which the
2795 @code{Timing_translator} is placed.
2797 The following properties of @code{Timing} are used
2798 to keep track of timing within the score.
2801 @cindex measure number
2804 @item currentBarNumber
2805 The current measure number. For an example showing the
2806 use of this property see @ref{Bar numbers}.
2809 The length of the measures in the current time signature. For a
2810 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2811 determines when bar lines are inserted and how automatic beams
2812 should be generated.
2814 @item measurePosition
2815 The point within the measure where we currently are. This
2816 quantity is reset by subtracting @code{measureLength} whenever
2817 @code{measureLength} is reached or exceeded. When that happens,
2818 @code{currentBarNumber} is incremented.
2821 If set to true, the above variables are updated for every time
2822 step. When set to false, the engraver stays in the current
2823 measure indefinitely.
2827 Timing can be changed by setting any of these variables
2828 explicitly. In the next example, the default 4/4 time
2829 signature is printed, but @code{measureLength} is set to 5/4.
2830 At 4/8 through the third measure, the @code{measurePosition} is
2831 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2832 The next bar line then falls at 9/8 rather than 5/4.
2834 @lilypond[quote,verbatim,relative=1]
2835 \set Score.measureLength = #(ly:make-moment 5 4)
2839 \set Score.measurePosition = #(ly:make-moment 5 8)
2845 As the example illustrates, @code{ly:make-moment n m} constructs a
2846 duration of n/m of a whole note. For example,
2847 @code{ly:make-moment 1 8} is an eighth note duration and
2848 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2853 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2858 Internals Reference: @rinternals{Timing_translator},