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 @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. Predefined commands are available to
131 force a particular direction manually, for details
132 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 The automatic placement of the tuplet bracket above or below the
215 notes may be overridden manually with predefined commands, for
216 details see @ref{Direction and placement}.
218 Tuplets may be nested:
220 @lilypond[quote,verbatim,relative=2]
222 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
225 Modifying nested tuplets which begin at the same musical moment
226 must be done with @code{\tweak}.
228 To modify the duration of notes without printing a tuplet bracket,
229 see @ref{Scaling durations}.
235 @code{\tupletNeutral}.
241 @cindex tuplet formatting
242 @cindex triplet formatting
244 @funindex tupletNumberFormatFunction
245 @funindex tupletSpannerDuration
247 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
248 {entering-several-tuplets-using-only-one--times-command.ly}
250 @cindex Tuplet number changes
252 @funindex TupletNumber
254 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
255 {changing-the-tuplet-number.ly}
257 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
258 {non-default-tuplet-numbers.ly}
260 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
261 {permitting-line-breaks-within-beamed-tuplets.ly}
270 Learning Manual: @rlearning{Tweaking methods}.
273 @ref{Time administration},
274 @ref{Scaling durations},
275 @ref{The tweak command},
276 @ref{Polymetric notation}.
282 @rinternals{TupletBracket},
283 @rinternals{TupletNumber},
284 @rinternals{TimeScaledMusic}.
286 @cindex grace notes within tuplet brackets
289 When the first note on a staff is a grace note followed by a
290 tuplet the grace note must be placed before the @code{\times}
291 command to avoid errors. Anywhere else, grace notes may be
292 placed within tuplet brackets.
295 @node Scaling durations
296 @unnumberedsubsubsec Scaling durations
298 @cindex scaling durations
299 @cindex durations, scaling
301 You can alter the duration of single notes, rests or chords by a
302 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
303 is 1) to the duration. This will not affect the appearance of the
304 notes or rests produced, but the altered duration will be used in
305 calculating the position within the measure and setting the duration
306 in the MIDI output. Multiplying factors may be combined such as
309 In the following example, the first three notes take up exactly
310 two beats, but no triplet bracket is printed.
312 @lilypond[quote,relative=2,verbatim]
314 % Alter durations to triplets
315 a4*2/3 gis4*2/3 a4*2/3
318 % Double the duration of chord
320 % Duration of quarter, appears like sixteenth
324 The duration of skip or spacing notes may also be modified by
325 a multiplier. This is useful for skipping many measures, e.g.,
328 @cindex compressing music
329 @cindex expanding music
331 @funindex \scaleDurations
332 @funindex scaleDurations
334 Longer stretches of music may be compressed by a fraction in the
335 same way, as if every note, chord or rest had the fraction as a
336 multiplier. This leaves the appearance of the music unchanged but
337 the internal duration of the notes will be multiplied by the
338 fraction @emph{num}/@emph{den}. The spaces around the dot are
339 required. Here is an example showing how music can be compressed
342 @lilypond[quote,relative=2,verbatim]
346 % Scale music by *2/3
347 \scaleDurations #'(2 . 3) {
351 \scaleDurations #'(2 . 1) {
357 One application of this command is in polymetric
358 notation, see @ref{Polymetric notation}.
364 @ref{Invisible rests},
365 @ref{Polymetric notation}.
372 @unnumberedsubsubsec Ties
378 A tie connects two adjacent note heads of the same pitch. The tie
379 in effect extends the duration of a note.
381 @warning{Ties should not be confused with @emph{slurs}, which
382 indicate articulation, or @emph{phrasing slurs}, which indicate
383 musical phrasing. A tie is just a way of extending a note
384 duration, similar to the augmentation dot.}
386 A tie is entered using the tilde symbol (@code{~}).
388 @lilypond[quote,verbatim,relative=2]
394 Ties are used either when the note crosses a bar line, or when
395 dots cannot be used to denote the rhythm. Ties should also be
396 used when note values cross larger subdivisions of the measure:
398 @lilypond[verbatim,quote]
405 If you need to tie many notes across bar lines, it may be
406 easier to use automatic note splitting, see @ref{Automatic note
407 splitting}. This mechanism automatically splits long notes, and
408 ties them across bar lines.
410 @cindex ties and chords
411 @cindex chords and ties
413 When a tie is applied to a chord, all note heads whose pitches
414 match are connected. When no note heads match, no ties will be
415 created. Chords may be partially tied by placing the tie inside
418 @lilypond[quote,verbatim,relative=1]
420 <c~ e g~ b> <c e g b>
423 @cindex repeating ties
424 @cindex ties, repeating
425 @cindex volta brackets and ties
426 @cindex ties and volta brackets
431 When a second alternative of a repeat starts with a tied note, you
432 have to specify the repeated tie as follows:
434 @lilypond[quote,relative=2,verbatim]
435 \repeat volta 2 { c g <c e>2 ~ }
437 % First alternative: following note is tied normally
439 % Second alternative: following note has a repeated tie
440 { <c e>2\repeatTie d4 c } }
443 @cindex laissez vibrer
444 @cindex ties, laissez vibrer
446 @funindex \laissezVibrer
447 @funindex laissezVibrer
449 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
450 notes must not be damped at the end. It is used in notation for
451 piano, harp and other string and percussion instruments. They can
452 be entered as follows:
454 @lilypond[quote,verbatim,relative=1]
455 <c f g>1\laissezVibrer
458 @cindex ties, placement
464 @funindex \tieNeutral
467 The vertical placement of ties may be controlled, see
468 Predefined commands, or for details, see
469 @ref{Direction and placement}.
471 @cindex ties, appearance
484 Ties may be made dashed, dotted, or a combination of solid and
487 @lilypond[quote, verbatim, relative=1]
500 Custom dash patterns can be specified:
502 @lilypond[quote, verbatim, relative=1]
503 \tieDashPattern #0.3 #0.75
505 \tieDashPattern #0.7 #1.5
511 Dash pattern definitions for ties have the same structure as
512 dash pattern definitions for slurs.
513 For more information about complex dash patterns,
514 see the snippets under @ref{Slurs}.
522 @code{\tieDashPattern},
523 @code{\tieHalfDashed},
524 @code{\tieHalfSolid},
531 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
532 {using-ties-with-arpeggios.ly}
534 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
535 {engraving-ties-manually.ly}
541 @rglos{laissez vibrer}.
545 @ref{Automatic note splitting}.
551 @rinternals{LaissezVibrerTie},
552 @rinternals{LaissezVibrerTieColumn},
553 @rinternals{TieColumn},
559 Switching staves when a tie is active will not produce a slanted
562 Changing clefs or octavations during a tie is not really
563 well-defined. In these cases, a slur may be preferable.
568 @subsection Writing rests
570 Rests are entered as part of the music in music expressions.
575 * Full measure rests::
579 @unnumberedsubsubsec Rests
582 @cindex rest, entering durations
597 Rests are entered like notes with the note name @code{r}.
598 Durations longer than a whole rest use the predefined
601 @c \time 16/1 is used to avoid spurious bar lines
602 @c and long tracts of empty measures
603 @lilypond[fragment,quote,verbatim]
605 % These two lines are just to prettify this example
607 \override Staff.TimeSignature #'stencil = ##f
608 % Print a maxima rest, equal to four breves
610 % Print a longa rest, equal to two breves
614 r1 r2 r4 r8 r16 r32 r64 r128
618 @cindex rest, multi-measure
619 @cindex rest, whole-measure
621 Whole measure rests, centered in the middle of the measure, must be
622 entered as multi-measure rests. They can be used for a single
623 measure as well as many measures and are discussed in @ref{Full
626 @cindex rest, specifying vertical position
628 To explicitly specify a rest's vertical position, write a note
629 followed by @code{\rest}. A rest of the duration of the note will
630 be placed at the staff position where the note would appear. This
631 allows for precise manual formatting of polyphonic music, since the
632 automatic rest collision formatter will not move these rests.
634 @lilypond[quote,verbatim,relative=2]
640 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
651 @ref{Full measure rests}.
662 @c Deliberately duplicated in Durations and Rests. -gp
663 There is no fundamental limit to rest durations (both in terms of
664 longest and shortest), but the number of glyphs is limited: there
665 are rests from 128th to maxima (8 x whole).
668 @node Invisible rests
669 @unnumberedsubsubsec Invisible rests
672 @cindex invisible rest
673 @cindex rest, invisible
681 An invisible rest (also called a @q{spacer rest}) can be entered
682 like a note with the note name@tie{}@code{s}:
684 @lilypond[verbatim,quote,relative=2]
691 Spacer rests are available only in note mode and chord mode. In
692 other situations, for example, when entering lyrics, @code{\skip}
693 is used to skip a musical moment. @code{\skip} requires an
696 @lilypond[quote,verbatim,relative=2]
709 A spacer rest implicitly causes @code{Staff} and @code{Voice}
710 contexts to be created if none exist, just like notes and rests
713 @lilypond[quote,verbatim,fragment]
717 @code{\skip} simply skips musical time; it creates no output of
720 @lilypond[quote,verbatim,fragment]
721 % This is valid input, but does nothing
722 \skip 1 \skip1 \skip 1
730 Internals Reference: @rinternals{SkipMusic}
733 @node Full measure rests
734 @unnumberedsubsubsec Full measure rests
736 @cindex multi-measure rests
737 @cindex full-measure rests
738 @cindex rest, multi-measure
739 @cindex rest, full-measure
740 @cindex whole rest for a full measure
741 @cindex rest, whole for a full measure
745 Rests for one or more full measures are entered like notes with
746 the note name uppercase @code{R}:
748 @lilypond[quote,verbatim,relative=2]
749 % Rest measures contracted to single measure
750 \compressFullBarRests
757 The duration of full-measure rests is identical to the duration
758 notation used for notes. The duration in a multi-measure rest must
759 always be an integral number of measure-lengths, so augmentation dots
760 or fractions must often be used:
762 @lilypond[quote,fragment,verbatim]
763 \compressFullBarRests
769 R1*13/8 | R1*13/8*12 |
774 A full-measure rest is printed as either a whole or breve rest,
775 centered in the measure, depending on the time signature.
777 @lilypond[quote,verbatim,fragment]
786 @cindex multi-measure rest, expanding
787 @cindex multi-measure rest, contracting
789 @funindex \expandFullBarRests
790 @funindex expandFullBarRests
791 @funindex \compressFullBarRests
792 @funindex compressFullBarRests
794 By default a multi-measure rest is expanded in the printed score to
795 show all the rest measures explicitly. Alternatively, a multi-measure
796 rest can be shown as a single measure containing a multi-measure rest
797 symbol, with the number of measures of rest printed above the measure:
799 @lilypond[quote,fragment,verbatim]
801 \time 3/4 r2. | R2.*2 |
804 % Rest measures contracted to single measure
805 \compressFullBarRests
807 % Rest measures expanded
814 @cindex text on multi-measure rest
815 @cindex multi-measure rest, attaching text
816 @cindex script on multi-measure rest
817 @cindex multi-measure rest, script
818 @cindex fermata on multi-measure rest
819 @cindex multi-measure rest, attaching fermata
820 @cindex markup on multi-measure rest
821 @cindex multi-measure rest with markup
823 @funindex \fermataMarkup
824 @funindex fermataMarkup
825 @funindex MultiMeasureRestText
827 Markups can be added to multi-measure rests.
828 The predefined command @code{\fermataMarkup}
829 is provided for adding fermatas.
831 @lilypond[quote,verbatim,fragment]
832 \compressFullBarRests
834 R2.*10^\markup { \italic "ad lib." }
839 Markups attached to a multi-measure rest are
840 objects of type @code{MultiMeasureRestText}, not
841 @code{TextScript}. Overrides must be directed to the correct
842 object, or they will be ignored. See the following example.
845 @lilypond[quote,verbatim,fragment]
846 % This fails, as the wrong object name is specified
847 \override TextScript #'padding = #5
849 % This is correct and works
850 \override MultiMeasureRestText #'padding = #5
854 When a multi-measure rest immediately follows a @code{\partial}
855 setting, resulting bar-check warnings may not be displayed.
858 @funindex \textLengthOn
859 @funindex textLengthOn
860 @funindex \textLengthOff
861 @funindex textLenthOff
862 @funindex \fermataMarkup
863 @funindex fermataMarkup
864 @funindex \compressFullBarRests
865 @funindex compressFullBarRests
866 @funindex \expandFullBarRests
867 @funindex expandFullBarRests
870 @code{\textLengthOn},
871 @code{\textLengthOff},
872 @code{\fermataMarkup},
873 @code{\compressFullBarRests},
874 @code{\expandFullBarRests}.
882 @cindex kirchenpausen
884 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
885 {changing-form-of-multi--measure-rests.ly}
887 @cindex multi-measure rests, positioning
888 @cindex positioning multi-measure rests
890 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
891 {positioning-multi--measure-rests.ly}
893 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
894 {multi--measure-rest-markup.ly}
899 @rglos{multi-measure rest}.
904 @ref{Formatting text},
911 @rinternals{MultiMeasureRest},
912 @rinternals{MultiMeasureRestNumber},
913 @rinternals{MultiMeasureRestText}.
916 @cindex fingerings and multi-measure rests
917 @cindex multi-measure rests and fingerings
921 If an attempt is made to use fingerings (e.g.,
922 @code{R1*10-4}) to put numbers over multi-measure rests, the
923 fingering numeral (4) may collide with the bar counter
926 @cindex condensing rests
927 @cindex rest, condensing ordinary
929 There is no way to automatically condense multiple ordinary rests
930 into a single multi-measure rest.
932 @cindex rest, collisions of
934 Multi-measure rests do not take part in rest collisions.
936 @node Displaying rhythms
937 @subsection Displaying rhythms
943 * Polymetric notation::
944 * Automatic note splitting::
945 * Showing melody rhythms::
949 @unnumberedsubsubsec Time signature
951 @cindex time signature
957 The time signature is set as follows:
959 @lilypond[quote,verbatim,relative=2]
964 @cindex time signature, visibility of
966 Time signatures are printed at the beginning of a piece
967 and whenever the time signature changes. If a change takes place
968 at the end of a line a warning time signature sign is printed
969 there. This default behavior may be changed, see
970 @ref{Visibility of objects}.
972 @lilypond[quote,verbatim,relative=2]
982 @cindex time signature style
985 @funindex \numericTimeSignature
986 @funindex numericTimeSignature
987 @funindex \defaultTimeSignature
988 @funindex defaultTimeSignature
990 The time signature symbol that is used in 2/2 and 4/4 time can be
991 changed to a numeric style:
993 @lilypond[quote,verbatim,relative=2]
997 % Change to numeric style
998 \numericTimeSignature
1001 % Revert to default style
1002 \defaultTimeSignature
1008 Mensural time signatures are covered in
1009 @ref{Mensural time signatures}.
1013 @code{\numericTimeSignature},
1014 @code{\defaultTimeSignature}.
1020 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1021 {changing-the-time-signature-without-affecting-the-beaming.ly}
1023 @cindex compound time signatures
1024 @cindex time signature, compound
1026 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1027 {compound-time-signatures.ly}
1032 @rglos{time signature}
1035 @ref{Mensural time signatures},
1036 @ref{Time administration}.
1041 Internals Reference:
1042 @rinternals{TimeSignature},
1043 @rinternals{Timing_translator}.
1047 @unnumberedsubsubsec Upbeats
1051 @cindex partial measure
1052 @cindex measure, partial
1053 @cindex pickup measure
1054 @cindex measure, change length
1056 @funindex measurePosition
1060 Partial or pick-up measures, such as an anacrusis or upbeat, are
1061 entered using the @code{\partial} command, with the syntax
1064 \partial @var{duration}
1067 where @code{duration} is the rhythmic length of the interval
1068 before the start of the first complete measure:
1070 @lilypond[quote,verbatim,relative=2]
1075 The partial measure can be any duration less than a full measure:
1077 @lilypond[quote,verbatim,relative=2]
1078 \partial 8*3 c8 d e |
1082 Internally, this is translated into
1085 \set Timing.measurePosition = -@var{duration}
1088 The property @code{measurePosition} contains a rational number
1089 indicating how much of the measure has passed at this point. Note
1090 that this is set to a negative number by the @code{\partial}
1091 command: i.e., @code{\partial 4} is internally translated to
1092 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1106 @rinternals{Timing_translator}.
1111 The @code{\partial} command is intended to be used only at the
1112 beginning of a piece. If you use it after the beginning, some
1113 odd warnings may occur.
1115 @node Unmetered music
1116 @unnumberedsubsubsec Unmetered music
1118 @cindex bar lines, turning off
1119 @cindex bar numbering, turning off
1121 @cindex unmetered music
1123 @funindex \cadenzaOn
1125 @funindex \cadenzaOff
1126 @funindex cadenzaOff
1128 Bar lines and bar numbers are calculated automatically. For
1129 unmetered music (some cadenzas, for example), this is not desirable.
1130 To turn off automatic calculation of bar lines and bar numbers,
1131 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1132 to turn them on again.
1134 @lilypond[verbatim,relative=2,fragment]
1143 Bar numbering is resumed at the end of the cadenza as if the
1144 cadenza were not there:
1146 @lilypond[verbatim,relative=2,fragment]
1147 % Show all bar numbers
1148 \override Score.BarNumber #'break-visibility = #all-visible
1169 @ref{Visibility of objects}.
1175 @cindex cadenza line breaks
1176 @cindex cadenza page breaks
1177 @cindex unmetered music, line breaks
1178 @cindex unmetered music, page breaks
1179 @cindex breaks in unmetered music
1180 @cindex line breaks in cadenzas
1181 @cindex page breaks in cadenzas
1182 @cindex line breaks in unmetered music
1183 @cindex page breaks in unmetered music
1187 LilyPond will insert line breaks and page breaks only at a
1188 bar line. Unless the unmetered music ends before the end of the
1189 staff line, you will need to insert invisible bar lines with
1196 to indicate where breaks can occur.
1199 @node Polymetric notation
1200 @unnumberedsubsubsec Polymetric notation
1202 @c This section necessarily uses \set
1203 @c This is acceptable -td
1205 @cindex double time signatures
1206 @cindex signatures, polymetric
1207 @cindex time signatures, polymetric
1208 @cindex time signatures, double
1209 @cindex polymetric signatures
1210 @cindex meter, polymetric
1212 @funindex timeSignatureFraction
1213 @funindex \scaleDurations
1214 @funindex scaleDurations
1218 Polymetric notation is supported, either explicitly or by modifying
1219 the visible time signature symbol and scaling the note durations.
1221 @strong{@i{Staves with different time signatures, equal measure lengths}}
1223 This notation can be created by setting a common time signature
1224 for each staff but replacing the symbol manually by setting
1225 @code{timeSignatureFraction} to the desired fraction and scaling
1226 the printed durations in each staff to the common time
1227 signature; see @ref{Time signature}. The scaling is done with
1228 @code{\scaleDurations}, which is used in a similar way to
1229 @code{\times}, but does not create a tuplet bracket; see
1230 @ref{Scaling durations}.
1232 @cindex beaming in polymetric music
1233 @cindex beaming in polymetric meter
1235 In this example, music with the time signatures of 3/4, 9/8, and
1236 10/8 are used in parallel. In the second staff, shown durations
1237 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1238 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1239 It will often be necessary to insert beams manually, as the
1240 duration scaling affects the autobeaming rules.
1242 @lilypond[quote,verbatim,fragment]
1251 \set Staff.timeSignatureFraction = #'(9 . 8)
1252 \scaleDurations #'(2 . 3)
1253 \repeat unfold 6 { c8[ c c] }
1257 \set Staff.timeSignatureFraction = #'(10 . 8)
1258 \scaleDurations #'(3 . 5) {
1259 \repeat unfold 2 { c8[ c c] }
1260 \repeat unfold 2 { c8[ c] } |
1261 c4. c4. \times 2/3 { c8[ c c] } c4
1267 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1269 Each staff can be given its own independent time signature by
1270 moving the @code{Timing_translator} and the
1271 @code{Default_bar_line_engraver} to the @code{Staff} context.
1273 @lilypond[quote,verbatim]
1277 \remove "Timing_translator"
1278 \remove "Default_bar_line_engraver"
1282 \consists "Timing_translator"
1283 \consists "Default_bar_line_engraver"
1287 % Now each staff has its own time signature.
1313 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1314 {compound-time-signatures.ly}
1320 @rglos{polymetric time signature},
1324 @ref{Time signature},
1325 @ref{Scaling durations}.
1330 Internals Reference:
1331 @rinternals{TimeSignature},
1332 @rinternals{Timing_translator},
1333 @rinternals{Default_bar_line_engraver},
1339 When using different time signatures in parallel, notes
1340 at the same moment will be be placed at the same horizontal
1341 location. However, the bar lines in the different staves
1342 will cause the note spacing to be less regular in each of the
1343 individual staves than would be normal without the different
1346 @node Automatic note splitting
1347 @unnumberedsubsubsec Automatic note splitting
1349 @cindex notes, splitting
1350 @cindex splitting notes
1352 @funindex Note_heads_engraver
1353 @funindex Completion_heads_engraver
1355 Long notes which overrun bar lines can be converted automatically
1356 to tied notes. This is done by replacing the
1357 @code{Note_heads_engraver} with the
1358 @code{Completion_heads_engraver}. In the following
1359 example, notes crossing the bar lines are split and tied.
1361 @lilypond[quote,verbatim,relative=1]
1363 \remove "Note_heads_engraver"
1364 \consists "Completion_heads_engraver"
1367 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1370 This engraver splits all running notes at the bar line, and
1371 inserts ties. One of its uses is to debug complex scores: if the
1372 measures are not entirely filled, then the ties show exactly how
1373 much each measure is off.
1377 Music Glossary: @rglos{tie}
1380 @rlearning{Engravers explained},
1381 @rlearning{Adding and removing engravers}.
1386 Internals Reference:
1387 @rinternals{Note_heads_engraver},
1388 @rinternals{Completion_heads_engraver},
1389 @rinternals{Forbid_line_break_engraver}.
1394 Not all durations (especially those containing tuplets) can be
1395 represented exactly with normal notes and dots, but the
1396 @code{Completion_heads_engraver} will not insert tuplets.
1398 The @code{Completion_heads_engraver} only affects notes; it does not
1402 @node Showing melody rhythms
1403 @unnumberedsubsubsec Showing melody rhythms
1405 @cindex melody rhythms, showing
1406 @cindex rhythms, showing melody
1408 Sometimes you might want to show only the rhythm of a melody. This
1409 can be done with the rhythmic staff. All pitches of notes on such a
1410 staff are squashed, and the staff itself has a single line
1412 @lilypond[quote,relative=1,verbatim]
1414 \new RhythmicStaff {
1415 \new Voice = "myRhythm" {
1423 \lyricsto "myRhythm" {
1431 @cindex guitar chord charts
1432 @cindex strumming rhythms, showing
1433 @cindex guitar strumming rhythms, showing
1435 @funindex Pitch_squash_engraver
1436 @funindex \improvisationOn
1437 @funindex improvisationOn
1438 @funindex \improvisationOff
1439 @funindex improvisationOff
1441 Guitar chord charts often show the strumming rhythms. This can
1442 be done with the @code{Pitch_squash_engraver} and
1443 @code{\improvisationOn}.
1446 @lilypond[quote,verbatim]
1455 \consists Pitch_squash_engraver
1468 @code{\improvisationOn},
1469 @code{\improvisationOff}.
1475 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1476 {guitar-strum-rhythms.ly}
1483 Internals Reference:
1484 @rinternals{RhythmicStaff},
1485 @rinternals{Pitch_squash_engraver}.
1493 * Setting automatic beam behavior::
1498 @node Automatic beams
1499 @unnumberedsubsubsec Automatic beams
1501 By default, beams are inserted automatically:
1503 @cindex beams, manual
1504 @cindex manual beams
1505 @cindex beams, setting rules for
1506 @cindex beams, custom rules for
1508 @funindex \autoBeamOn
1509 @funindex autoBeamOn
1510 @funindex \autoBeamOff
1511 @funindex autoBeamOff
1513 @lilypond[quote,verbatim,relative=2]
1515 \time 6/8 c c c c8. c16 c8
1518 If these automatic decisions are not satisfactory, beaming can be
1519 entered explicitly; see @ref{Manual beams}. Beams @emph{must} be
1520 entered manually if beams are to be extended over rests.
1522 If automatic beaming is not required, it may be turned off with
1523 @code{\autoBeamOff} and on with @code{\autoBeamOn}:
1525 @lilypond[quote,relative=1,verbatim]
1526 c4 c8 c8. c16 c8. c16 c8
1533 @cindex melismata, beams
1534 @cindex beams and melismata
1536 @warning{If beams are used to indicate melismata in songs, then
1537 automatic beaming should be switched off with @code{\autoBeamOff}
1538 and the beams indicated manually.}
1540 Beaming patterns that differ from the automatic defaults may be
1541 created, see @ref{Setting automatic beam behavior}.
1545 @code{\autoBeamOff},
1552 @cindex line breaks and beams
1553 @cindex beams and line breaks
1557 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1558 {beams-across-line-breaks.ly}
1560 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1561 {changing-beam-knee-gap.ly}
1567 @ref{Setting automatic beam behavior}.
1570 @file{scm/@/auto@/-beam@/.scm}.
1575 Internals Reference: @rinternals{Beam}.
1580 Automatically kneed cross-staff beams cannot be used together with
1581 hidden staves. See @ref{Hiding staves}.
1583 Beams can collide with note heads and accidentals in other voices
1586 @node Setting automatic beam behavior
1587 @unnumberedsubsubsec Setting automatic beam behavior
1590 @cindex automatic beams, tuning
1591 @cindex tuning automatic beaming
1592 @cindex automatic beam generation
1594 @cindex lyrics and beaming
1596 @funindex autoBeaming
1597 @funindex autoBeamSettings
1598 @funindex (end * * * *)
1599 @funindex (begin * * * *)
1600 @funindex measureLength
1601 @funindex beatLength
1602 @funindex beatGrouping
1608 There are two types of beaming rules: @emph{beam-grouping}
1609 rules and @emph{beam-ending} rules. Beam-grouping rules are the
1610 simplest, but are over-ridden by any beam-ending rules which apply.
1612 The placement of automatic beams is determined by applying the
1613 following rules in order:
1617 @item If a manual beam is specified with @code{[..]} set the beam
1618 as specified, otherwise
1620 @item if @code{\autoBeamOff} is in force do not beam, otherwise
1622 @item if a beam-ending rule applies use it to determine the valid
1623 places where beams may end, otherwise
1625 @item if a valid (see below) beat-grouping rule applies use it to
1626 group notes with beams, otherwise
1628 @item use the value of @code{beatLength} to group notes with beams
1632 @i{@strong{Modifying the grouping of beats}}
1634 If there are no beam-ending rules defined for the beam duration of a
1635 particular beam in the time signature in use, its beaming is
1636 controlled by three context properties: @code{measureLength},
1637 @code{beatLength} and @code{beatGrouping}. These properties may be
1638 set in the @code{Score}, @code{Staff} or @code{Voice} contexts to
1639 delimit their scope. The default values are set while processing
1640 @code{\time} commands, so any @code{\set} commands to modify their
1641 value must be placed after all @code{\time} commands.
1643 @warning{These three properties become effective for a particular
1644 beam @strong{only} if there are no beam-ending rules predefined for
1645 that beam's duration in the time signature in use, or if these
1646 beam-ending rules have all been reverted.}
1648 These determine the beaming as follows:
1650 Beams may begin anywhere (unless a beam is already active). Beams
1651 end at a time determined by the values of @code{beatGrouping} and
1652 @code{beatLength}, as follows:
1656 @item If @code{beatGrouping} and @code{beatLength} are consistent
1657 with @code{measureLength}, @code{beatGrouping} is used to determine
1658 the end points of beams.
1660 @item If @code{beatGrouping} and @code{beatLength} are inconsistent
1661 with @code{measureLength}, @code{beatLength} is used to determine
1662 the end points of beams.
1666 By default the @code{measureLength} and @code{beatLength} are
1667 derived from the time signature set by the @code{\time} command.
1668 The @code{measureLength} is set to be exactly the same length as
1669 the measure length given by the time signature, and the
1670 @code{beatLength} is set to be the same as one over the denominator
1671 of the time signature.
1673 The default value of @code{beatGrouping} is taken from a table in
1674 @file{scm/@/music@/-functions@/.scm}. To find this, see
1675 @rlearning{Other sources of information}. It defines the beat
1676 grouping for 3/8, 4/8, 5/8, 8/8, and all the common compound time
1679 Both @code{measureLength} and @code{beatLength} are @i{moments},
1680 units of musical duration. A quantity of type @i{moment} is
1681 created by the scheme function @code{ly:make-moment}. For more
1682 information about this function, see @ref{Time administration}.
1684 @code{beatGrouping} is a list of integers giving the number of
1685 beats in each group.
1689 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1692 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1693 {specifying-context-with-beatgrouping.ly}
1695 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1696 {using-beatlength-and-beatgrouping.ly}
1698 @funindex subdivideBeams
1700 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1701 {sub-dividing-beams.ly}
1703 @cindex measure groupings
1704 @cindex beats, grouping
1705 @cindex grouping beats
1706 @cindex measure sub-grouping
1708 @funindex autoBeamSettings
1709 @funindex beam-limit
1710 @funindex beam-numerator
1711 @funindex beam-denominator
1714 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1715 {conducting-signs,-measure-grouping-signs.ly}
1718 @strong{@i{Modifying the beam end points}}
1720 Beam-ending rules are required when beams of different durations are
1721 to end at different points within the measure. For example, it may
1722 be desirable for eighth-note beams in 4/4 time to end only at the
1723 end of the measure or half-way through it, but for sixteenth-note
1724 beams to end at quarter note positions to avoid overly long beamed
1725 runs. The rules work as follows:
1727 Automatic beams can start on any note but can end at only a few
1728 positions within the measure, namely at positions specified by the
1729 properties in @code{autoBeamSettings}. These properties consist of
1730 a list of rules defining where beams can end. The default
1731 @code{autoBeamSettings} rules are defined in
1732 @file{scm/@/auto@/-beam@/.scm}. To find this file, see
1733 @rlearning{Other sources of information}.
1735 In order to add a rule to the list, use
1738 #(override-auto-beam-setting
1740 beam-numerator beam-denominator
1741 time-signature-numerator time-signature-denominator)
1742 moment-numerator moment-denominator [context])
1750 @item @code{beam-limit} is the type of automatic beam limit
1751 defined. This can be either @code{begin} or @code{end} but
1752 only @code{end} is effective.
1754 @item @code{beam-numerator/beam-denominator} is the beam duration
1755 to which the rule is to apply. A beam is considered to have the
1756 duration of its shortest note. Set @code{beam-numerator} and
1757 @code{beam-denominator} to @code{'*'} to have this rule apply to beams
1760 @funindex time-signature-numerator
1761 @funindex time-signature-denominator
1763 @item @code{time-signature-numerator/time-signature-denominator}
1764 specifies the time signature to which this rule should apply. If
1765 @code{time-signature-numerator} and @code{time-signature-denominator}
1766 are set to @code{'*'} this rule will apply in any time signature.
1768 @funindex moment-numerator
1769 @funindex moment-denominator
1771 @item @code{moment-numerator/moment-denominator} is the position
1772 in the bar at which the beam should end.
1774 @funindex score-override-auto-beam-setting
1775 @funindex override-auto-beam-setting
1777 @item @code{context} is optional, and it specifies the context at which
1778 the change should be made. The default is @code{'Voice}.
1780 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1781 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1785 For example, if automatic beams should always end on the first quarter
1786 note, whatever the time signature or beam duration, use
1788 @lilypond[quote,verbatim,relative=2]
1790 #(override-auto-beam-setting '(end * * * *) 1 4)
1794 You can force the beam settings to take effect only on beams whose shortest
1795 note is a certain duration
1797 @lilypond[quote,verbatim,relative=2]
1799 % end 1/16 beams for all time signatures at the 1/16 moment
1800 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1802 a32 a a a a16 a a a a a |
1803 % end 1/32 beams for all time signatures at the 1/16 moment
1804 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1805 a32 a a a a16 a a a a a |
1808 You can force the beam settings to take effect only in certain time
1811 @lilypond[quote,verbatim,relative=2]
1813 % end beams of all durations in 5/8 time signature at the 2/8 moment
1814 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1822 When multiple voices are used the @code{Staff} context must be
1823 specified if the beaming is to be applied to all voices in the
1826 @lilypond[quote,verbatim,relative=2]
1829 % Context not specified - does not work correctly
1830 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1831 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1832 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1833 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1835 % Works correctly with context specified
1836 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1837 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1838 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1839 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1842 @warning{If any unexpected beam behavior occurs, check the default
1843 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1844 possible interference, because the beam endings defined there will
1845 still apply in addition to your own.}
1847 @funindex revert-auto-beam-setting
1849 Any unwanted or conflicting default endings must be reverted for
1850 your time signature(s). Existing default or user-defined
1851 beam-ending rules are removed by using
1854 #(revert-auto-beam-setting
1856 beam-numerator beam-denominator
1857 time-signature-numerator time-signature-denominator)
1858 moment-numerator moment-denominator [context])
1862 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1863 @code{time-signature-numerator}, @code{time-signature-denominator},
1864 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1865 are the same as above.
1867 @lilypond[quote,verbatim,relative=2]
1869 a16 a a a a a a a a a a a a a a a
1870 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1871 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1872 a16 a a a a a a a a a a a a a a a
1875 The rule in a @code{revert-auto-beam-setting} statement must exactly
1876 match the original rule. That is, no wildcard expansion is taken into
1879 @lilypond[quote,verbatim,relative=2]
1881 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1883 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1885 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1891 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1892 {beam-grouping-in-7-8-time.ly}
1894 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1895 {reverting-default-beam-endings.ly}
1897 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1898 {beam-endings-in-score-context.ly}
1900 @funindex \autoBeamOff
1901 @funindex autoBeamOff
1902 @funindex \autoBeamOn
1903 @funindex autoBeamOn
1906 @code{\autoBeamOff},
1911 @cindex beam, last in score
1912 @cindex beam, last in polyphonic voice
1916 If a score ends while an automatic beam has not been ended and is
1917 still accepting notes, this last beam will not be typeset at all.
1918 The same holds for polyphonic voices, entered with @code{<<
1919 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1920 automatic beam is still accepting notes, it is not typeset.
1929 @unnumberedsubsubsec Manual beams
1931 @cindex beams, manual
1932 @cindex manual beams
1937 In some cases it may be necessary to override the automatic
1938 beaming algorithm. For example, the autobeamer will not put beams
1939 over rests or bar lines, and in choral scores the beaming is
1940 often set to follow the meter of the lyrics rather than the
1941 notes. Such beams can be specified manually by
1942 marking the begin and end point with @code{[} and @code{]}
1944 @lilypond[quote,relative=1,verbatim]
1946 r4 r8[ g' a r8] r8 g[ | a] r8
1954 Individual notes may be marked with @code{\noBeam} to prevent them
1957 @lilypond[quote,verbatim,relative=2]
1958 \time 2/4 c8 c\noBeam c c
1961 @funindex stemLeftBeamCount
1962 @funindex stemRightBeamCount
1964 Even more strict manual control with the beams can be achieved by
1965 setting the properties @code{stemLeftBeamCount} and
1966 @code{stemRightBeamCount}. They specify the number of beams to
1967 draw on the left and right side, respectively, of the next note.
1968 If either property is set, its value will be used only once, and
1969 then it is erased. In this example, the last @code{f} is printed
1970 with only one beam on the left side, i.e., the eighth-note beam of
1971 the group as a whole.
1973 @lilypond[quote,relative=2,verbatim]
1976 \set stemLeftBeamCount = #2
1977 \set stemRightBeamCount = #1
1979 \set stemLeftBeamCount = #1
1986 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1987 {flat-flags-and-beam-nibs.ly}
1989 @node Feathered beams
1990 @unnumberedsubsubsec Feathered beams
1992 @cindex beams, feathered
1993 @cindex feathered beams
1995 @funindex \featherDurations
1996 @funindex featherDurations
1997 @funindex grow-direction
1999 Feathered beams are used to indicate that a small group of notes
2000 should be played at an increasing (or decreasing) tempo, without
2001 changing the overall tempo of the piece. The extent of the
2002 feathered beam must be indicated manually using @code{[} and
2003 @code{]}, and the beam feathering is turned on by specifying a
2004 direction to the @code{Beam} property @code{grow-direction}.
2006 If the placement of the notes and the sound in the MIDI output is to
2007 reflect the ritardando or accelerando indicated by the feathered beam
2008 the notes must be grouped as a music expression delimited by braces
2009 and preceded by a @code{featherDurations} command which specifies
2010 the ratio between the durations of the first and last notes in the
2013 The square brackets show the extent of the beam and the braces show
2014 which notes are to have their durations modified. Normally these
2015 would delimit the same group of notes, but this is not required: the
2016 two commands are independent.
2018 In the following example the eight 16th notes occupy exactly the
2019 same time as a half note, but the first note is one half as long
2020 as the last one, with the intermediate notes gradually
2021 lengthening. The first four 32nd notes gradually speed up, while
2022 the last four 32nd notes are at a constant tempo.
2024 @lilypond[relative=1,verbatim,quote]
2025 \override Beam #'grow-direction = #LEFT
2026 \featherDurations #(ly:make-moment 2 1)
2027 { c16[ c c c c c c c] }
2028 \override Beam #'grow-direction = #RIGHT
2029 \featherDurations #(ly:make-moment 2 3)
2031 % revert to non-feathered beams
2032 \override Beam #'grow-direction = #'()
2037 The spacing in the printed output represents the
2038 note durations only approximately, but the MIDI output is exact.
2042 The @code{\featherDurations} command only works with very short
2043 music snippets, and when numbers in the fraction are small.
2058 * Bar and bar number checks::
2063 @unnumberedsubsubsec Bar lines
2066 @cindex measure lines
2067 @cindex closing bar lines
2068 @cindex bar lines, closing
2069 @cindex double bar lines
2070 @cindex bar lines, double
2076 Bar lines delimit measures, and are also used to indicate
2077 repeats. Normally, simple bar lines are automatically inserted
2078 into the printed output at places based on the current time
2081 The simple bar lines inserted automatically can be changed to
2082 other types with the @code{\bar} command. For example, a closing
2083 double bar line is usually placed at the end of a piece:
2085 @lilypond[quote,relative=1,verbatim]
2089 It is not invalid if the final note in a measure does not
2090 end on the automatically entered bar line: the note is assumed
2091 to carry over into the next measure. But if a long sequence
2092 of such carry-over measures appears the music can appear compressed
2093 or even flowing off the page. This is because automatic line
2094 breaks happen only at the end of complete measures, i.e., where
2095 all notes end before the end of a measure.
2097 @warning{An incorrect duration can cause line breaks to be
2098 inhibited, leading to a line of highly compressed music or
2099 music which flows off the page.}
2102 @cindex bar lines, invisible
2103 @cindex measure lines, invisible
2105 Line breaks are also permitted at manually inserted bar lines
2106 even within incomplete measures. To allow a line break without
2107 printing a bar line, use
2114 This will insert an invisible bar line and allow (but not
2115 force) a line break to occur at this point. The bar number
2116 counter is not increased. To force a line break see
2117 @ref{Line breaking}.
2119 @cindex manual bar lines
2120 @cindex manual measure lines
2121 @cindex bar lines, manual
2122 @cindex measure lines, manual
2124 This and other special bar lines may be inserted manually at any
2125 point. When they coincide with the end of a measure they replace the
2126 simple bar line which would have been inserted there automatically.
2127 When they do not coincide with the end of a measure the specified bar
2128 line is inserted at that point in the printed output. Such insertions
2129 do not affect the calculation and placement of subsequent automatic
2132 Two types of simple bar lines and five types of double bar lines are available
2133 for manual insertion:
2135 @lilypond[quote,relative=1,verbatim]
2136 f1 \bar "|" f \bar "." g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
2140 together with dotted and dashed bar lines:
2142 @lilypond[quote,relative=1,verbatim]
2143 f1 \bar ":" g \bar "dashed" a
2147 and five types of repeat bar line:
2149 @lilypond[quote,relative=1,verbatim]
2150 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
2153 Additionally, a bar line can be printed as a simple tick:
2154 @lilypond[quote,relative=1,verbatim]
2157 However, as such ticks are typically used in Gregorian chant, it is preferable
2158 to use @code{\divisioMinima} there instead, described in the section
2159 @ref{Divisiones} in Gregorian chant.
2164 Although the bar line types signifying repeats may be inserted
2165 manually they do not in themselves cause LilyPond to recognize
2166 a repeated section. Such repeated sections are better entered
2167 using the various repeat commands (see @ref{Repeats}), which
2168 automatically print the appropriate bar lines.
2170 In addition, you can specify @code{"||:"}, which is equivalent to
2171 @code{"|:"} except at line breaks, where it gives a double bar
2172 line at the end of the line and a start repeat at the beginning of
2175 @lilypond[quote,relative=2,verbatim]
2176 \override Score.RehearsalMark #'padding = #3
2184 In scores with many staves, a @code{\bar} command in one staff is
2185 automatically applied to all staves. The resulting bar lines are
2186 connected between different staves of a @code{StaffGroup},
2187 @code{PianoStaff}, or @code{GrandStaff}.
2189 @lilypond[quote,fragment,verbatim]
2197 \new Staff { \clef bass c4 g e g }
2199 \new Staff { \clef bass c2 c2 }
2204 @cindex default bar lines, changing
2205 @cindex bar lines, default, changing
2210 @funindex defaultBarType
2215 The command @code{\bar }@var{bartype} is a shortcut for
2216 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2217 created whenever the @code{whichBar} property is
2220 The default bar type used for automatically inserted bar lines is
2221 @code{"|"}. This may be changed at any time
2222 with @code{\set Timing.defaultBarType = }@var{bartype}.
2227 @ref{Line breaking},
2229 @ref{Grouping staves}.
2234 Internals Reference: @rinternals{BarLine} (created at
2235 @rinternals{Staff} level), @rinternals{SpanBar} (across
2236 staves), @rinternals{Timing_translator} (for Timing
2241 @unnumberedsubsubsec Bar numbers
2244 @cindex measure numbers
2245 @cindex numbers, bar
2246 @cindex numbers, measure
2248 @funindex currentBarNumber
2250 Bar numbers are typeset by default at the start of every line except
2251 the first line. The number itself is stored in the
2252 @code{currentBarNumber} property, which is normally updated
2253 automatically for every measure. It may also be set manually:
2255 @lilypond[verbatim,quote,fragment,relative=1]
2258 \set Score.currentBarNumber = #50
2262 @cindex bar numbers, regular spacing
2264 @funindex barNumberVisibility
2267 Bar numbers can be typeset at regular intervals instead of just at
2268 the beginning of every line. To do this the default behavior
2269 must be overridden to permit bar numbers to be printed at places
2270 other than the start of a line. This is controlled by the
2271 @code{break-visibility} property of @code{BarNumber}. This takes
2272 three values which may be set to @code{#t} or @code{#f} to specify
2273 whether the corresponding bar number is visible or not. The order
2274 of the three values is @code{end of line visible}, @code{middle of
2275 line visible}, @code{beginning of line visible}. In the following
2276 example bar numbers are printed at all possible places:
2278 @lilypond[verbatim,quote,relative=1]
2279 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2280 \set Score.currentBarNumber = #11
2281 % Permit first bar number to be printed
2291 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2292 {printing-the-bar-number-for-the-first-measure.ly}
2294 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2295 {printing-bar-numbers-at-regular-intervals.ly}
2297 @cindex measure number, format
2298 @cindex bar number, format
2300 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2301 {printing-bar-numbers-inside-boxes-or-circles.ly}
2303 @cindex bar number alignment
2305 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2306 {aligning-bar-numbers.ly}
2308 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2309 {removing-bar-numbers-from-a-score.ly}
2316 Internals Reference: @rinternals{BarNumber}.
2319 @cindex bar number collision
2320 @cindex collision, bar number
2324 Bar numbers may collide with the top of the
2325 @rinternals{StaffGroup} bracket, if there is one. To solve
2326 this, the @code{padding} property of @rinternals{BarNumber} can
2327 be used to position the number correctly.
2331 @node Bar and bar number checks
2332 @unnumberedsubsubsec Bar and bar number checks
2335 @cindex bar number check
2336 @cindex measure check
2337 @cindex measure number check
2339 @funindex barCheckSynchronize
2342 Bar checks help detect errors in the entered durations. A bar check
2343 may be entered using the bar symbol, @code{|}, at any place where a
2344 bar line is expected to fall. If bar check lines are encountered at
2345 other places, a list of warnings is printed in the log file, showing
2346 the line numbers and lines in which the bar checks failed. In the
2347 next example, the second bar check will signal an error.
2350 \time 3/4 c2 e4 | g2 |
2353 Bar checks can also be used in lyrics, for example
2358 Twin -- kle | Twin -- kle |
2362 An incorrect duration can result in a completely garbled score,
2363 especially if the score is polyphonic, so a good place to start
2364 correcting input is by scanning for failed bar checks and
2365 incorrect durations.
2367 If successive bar checks are off by the same musical interval,
2368 only the first warning message is displayed. This allows the
2369 warning to focus on the source of the timing error.
2373 @funindex pipeSymbol
2375 It is also possible to redefine the action taken when a bar check
2376 or pipe symbol, @code{|}, is encountered in the input, so that
2377 it does something other than a bar check. This is done by
2378 assigning a music expression to @code{pipeSymbol}.
2379 In the following example @code{|} is set to insert a double bar
2380 line wherever it appears in the input, rather than checking
2383 @lilypond[quote,verbatim]
2384 pipeSymbol = \bar "||"
2393 @funindex \barNumberCheck
2394 @funindex barNumberCheck
2396 When copying large pieces of music, it can be helpful to check that
2397 the LilyPond bar number corresponds to the original that you are
2398 entering from. This can be checked with @code{\barNumberCheck}, for
2402 \barNumberCheck #123
2406 will print a warning if the @code{currentBarNumber} is not 123
2407 when it is processed.
2415 @node Rehearsal marks
2416 @unnumberedsubsubsec Rehearsal marks
2418 @cindex rehearsal marks
2419 @cindex mark, rehearsal
2424 To print a rehearsal mark, use the @code{\mark} command
2426 @lilypond[quote,verbatim,relative=2]
2435 The letter@tie{}@q{I} is skipped in accordance with engraving
2436 traditions. If you wish to include the letter @q{I}, then use
2439 \set Score.markFormatter = #format-mark-alphabet
2442 The mark is incremented automatically if you use @code{\mark
2443 \default}, but you can also use an integer argument to set the
2444 mark manually. The value to use is stored in the property
2445 @code{rehearsalMark}.
2447 @cindex rehearsal mark format
2448 @cindex rehearsal mark style
2449 @cindex style, rehearsal mark
2450 @cindex format, rehearsal mark
2451 @cindex mark, rehearsal, style
2452 @cindex mark, rehearsal, format
2453 @cindex rehearsal mark, manual
2454 @cindex mark, rehearsal, manual
2455 @cindex custom rehearsal mark
2456 @cindex manual rehearsal mark
2458 The style is defined by the property @code{markFormatter}. It is
2459 a function taking the current mark (an integer) and the current
2460 context as argument. It should return a markup object. In the
2461 following example, @code{markFormatter} is set to a pre-defined
2462 procedure. After a few measures, it is set to a procedure that
2463 produces a boxed number.
2465 @lilypond[quote,verbatim,relative=2]
2466 \set Score.markFormatter = #format-mark-numbers
2469 \set Score.markFormatter = #format-mark-box-numbers
2471 \set Score.markFormatter = #format-mark-circle-numbers
2473 \set Score.markFormatter = #format-mark-circle-letters
2477 The file @file{scm/@/translation@/-functions@/.scm} contains the
2478 definitions of @code{format-mark-numbers} (the default format),
2479 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2480 @code{format-mark-box-letters}. These can be used as inspiration
2481 for other formatting functions.
2483 You may use @code{format-mark-barnumbers},
2484 @code{format-mark-box-barnumbers}, and
2485 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2486 incremented numbers or letters.
2488 Other styles of rehearsal mark can be specified manually
2495 @code{Score.markFormatter} does not affect marks specified in this
2496 manner. However, it is possible to apply a @code{\markup} to the
2500 \mark \markup@{ \box A1 @}
2505 @cindex D.S. al Fine
2507 @cindex music glyphs
2508 @cindex glyphs, music
2510 @funindex \musicglyph
2511 @funindex musicglyph
2513 Music glyphs (such as the segno sign) may be printed inside a
2516 @lilypond[quote,verbatim,relative=1]
2517 c1 \mark \markup { \musicglyph #"scripts.segno" }
2518 c1 \mark \markup { \musicglyph #"scripts.coda" }
2519 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2524 See @ref{The Feta font}, for a list of symbols which may be
2525 printed with @code{\musicglyph}.
2527 For common tweaks to the positioning of rehearsal marks, see
2528 @ref{Formatting text}.
2533 @ref{The Feta font},
2534 @ref{Formatting text}.
2537 @file{scm/@/translation@/-functions@/.scm} contains
2538 the definition of @code{format-mark-numbers} and
2539 @code{format-mark-letters}. They can be used as inspiration for
2540 other formatting functions.
2545 Internals Reference: @rinternals{RehearsalMark}.
2548 @node Special rhythmic concerns
2549 @subsection Special rhythmic concerns
2554 * Aligning to cadenzas::
2555 * Time administration::
2559 @unnumberedsubsubsec Grace notes
2563 @cindex appoggiatura
2564 @cindex acciaccatura
2569 Grace notes are ornaments that are written out. Grace notes
2570 are printed in a smaller font and take up no logical time
2573 @lilypond[quote,relative=2,verbatim]
2575 \grace { c16[ d16] } c2
2578 Lilypond also supports two special types of grace notes, the
2579 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2580 small note with a slashed stem--and the @emph{appoggiatura}, which
2581 takes a fixed fraction of the main note and appears in small print
2584 @lilypond[quote,relative=2,verbatim]
2588 \acciaccatura { g16[ f] } e4
2591 The placement of grace notes is synchronized between different
2592 staves. In the following example, there are two sixteenth grace
2593 notes for every eighth grace note
2595 @lilypond[quote,relative=2,verbatim]
2596 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2597 \new Staff { c2 \grace { g8[ b] } c2 } >>
2600 @cindex grace notes, following
2602 @funindex \afterGrace
2603 @funindex afterGrace
2605 If you want to end a note with a grace, use the @code{\afterGrace}
2606 command. It takes two arguments: the main note, and the grace
2607 notes following the main note.
2609 @lilypond[quote,verbatim,relative=2]
2610 c1 \afterGrace d1 { c16[ d] } c1
2613 This will put the grace notes after a space lasting 3/4 of the
2614 length of the main note. The default fraction 3/4 can be changed by
2615 setting @code{afterGraceFraction}. The following example shows
2616 the results from setting the space at the default, at 15/16, and
2617 finally at 1/2 of the main note.
2619 @lilypond[quote,verbatim,relative=2]
2622 c1 \afterGrace d1 { c16[ d] } c1
2625 #(define afterGraceFraction (cons 15 16))
2626 c1 \afterGrace d1 { c16[ d] } c1
2629 #(define afterGraceFraction (cons 1 2))
2630 c1 \afterGrace d1 { c16[ d] } c1
2635 The space between the main note and the grace note may also be
2636 specified using spacers. The following example places the grace
2637 note after a space lasting 7/8 of the main note.
2639 @lilypond[quote,verbatim,relative=2]
2642 { s2 s4. \grace { c16[ d] } } >>
2647 @cindex tweaking grace notes
2648 @cindex grace notes, tweaking
2649 @cindex grace notes, changing layout settings
2651 A @code{\grace} music expression will introduce special
2652 typesetting settings, for example, to produce smaller type, and
2653 set directions. Hence, when introducing layout tweaks to
2654 override the special settings, they should be placed inside
2655 the grace expression. The overrides should also be reverted
2656 inside the grace expression. Here, the grace note's default stem
2657 direction is overriden and then reverted.
2659 @lilypond[quote,verbatim,relative=2]
2671 @cindex stem, with slash
2676 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2677 {using-grace-note-slashes-with-normal-heads.ly}
2679 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2680 {tweaking-grace-layout-within-music.ly}
2682 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2683 {redefining-grace-note-global-defaults.ly}
2685 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2686 {positioning-grace-notes-with-floating-space.ly}
2691 @rglos{grace notes},
2692 @rglos{acciaccatura},
2693 @rglos{appoggiatura}.
2695 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2697 Snippets: @rlsr{Rhythms}.
2699 Internals Reference: @rinternals{GraceMusic}.
2704 @cindex acciaccatura, multi-note
2705 @cindex multi-note acciaccatura
2706 @cindex grace-note synchronization
2708 A multi-note beamed @i{acciaccatura} is printed without a slash,
2709 and looks exactly the same as a multi-note beamed
2712 @c TODO Add link to LSR snippet to add slash when available
2714 Grace note synchronization can also lead to surprises. Staff
2715 notation, such as key signatures, bar lines, etc., are also
2716 synchronized. Take care when you mix staves with grace notes and
2717 staves without, for example,
2719 @lilypond[quote,relative=2,verbatim]
2721 \new Staff { e4 \bar "|:" \grace c16 d2. }
2722 \new Staff { c4 \bar "|:" d2. }
2727 This can be remedied by inserting grace skips of the corresponding
2728 durations in the other staves. For the above example
2730 @lilypond[quote,relative=2,verbatim]
2732 \new Staff { e4 \bar "|:" \grace c16 d2. }
2733 \new Staff { c4 \bar "|:" \grace s16 d2. }
2737 Grace sections should only be used within sequential music
2738 expressions. Nesting or juxtaposing grace sections is not
2739 supported, and might produce crashes or other errors.
2741 @node Aligning to cadenzas
2742 @unnumberedsubsubsec Aligning to cadenzas
2745 @cindex cadenza, aligning to
2746 @cindex aligning to cadenza
2748 In an orchestral context, cadenzas present a special problem: when
2749 constructing a score that includes a measured cadenza or other solo
2750 passage, all other instruments should skip just as many notes as the
2751 length of the cadenza, otherwise they will start too soon or too late.
2753 One solution to this problem is to use the functions
2754 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2755 functions take a defined piece of music as an argument and generate a
2756 multi-measure rest or @code{\skip} exactly as long as the piece.
2758 @lilypond[verbatim,quote]
2759 MyCadenza = \relative c' {
2770 #(ly:export (mmrest-of-length MyCadenza))
2772 #(ly:export (skip-of-length MyCadenza))
2787 @node Time administration
2788 @unnumberedsubsubsec Time administration
2790 @cindex time administration
2791 @cindex timing (within the score)
2792 @cindex music, unmetered
2793 @cindex unmetered music
2795 @funindex currentBarNumber
2796 @funindex measurePosition
2797 @funindex measureLength
2799 Time is administered by the @code{Timing_translator}, which by
2800 default is to be found in the @code{Score} context. An alias,
2801 @code{Timing}, is added to the context in which the
2802 @code{Timing_translator} is placed.
2804 The following properties of @code{Timing} are used
2805 to keep track of timing within the score.
2808 @cindex measure number
2811 @item currentBarNumber
2812 The current measure number. For an example showing the
2813 use of this property see @ref{Bar numbers}.
2816 The length of the measures in the current time signature. For a
2817 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2818 determines when bar lines are inserted and how automatic beams
2819 should be generated.
2821 @item measurePosition
2822 The point within the measure where we currently are. This
2823 quantity is reset by subtracting @code{measureLength} whenever
2824 @code{measureLength} is reached or exceeded. When that happens,
2825 @code{currentBarNumber} is incremented.
2828 If set to true, the above variables are updated for every time
2829 step. When set to false, the engraver stays in the current
2830 measure indefinitely.
2834 Timing can be changed by setting any of these variables
2835 explicitly. In the next example, the default 4/4 time
2836 signature is printed, but @code{measureLength} is set to 5/4.
2837 At 4/8 through the third measure, the @code{measurePosition} is
2838 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2839 The next bar line then falls at 9/8 rather than 5/4.
2841 @lilypond[quote,verbatim,relative=1]
2842 \set Score.measureLength = #(ly:make-moment 5 4)
2846 \set Score.measurePosition = #(ly:make-moment 5 8)
2852 As the example illustrates, @code{ly:make-moment n m} constructs a
2853 duration of n/m of a whole note. For example,
2854 @code{ly:make-moment 1 8} is an eighth note duration and
2855 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2860 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2865 Internals Reference: @rinternals{Timing_translator},