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.
12 @lilypondfile[quote]{rhythms-headword.ly}
14 This section discusses rhythms, rests, durations, beaming and bars.
19 * Displaying rhythms::
22 * Special rhythmic concerns::
27 @subsection Writing rhythms
37 @subsubsection Durations
39 @cindex durations, of notes
40 @cindex note durations
46 Durations are designated by numbers and dots.
47 Durations are entered as their reciprocal values. For example, a
48 quarter note is entered using a @code{4} (since it is a 1/4 note),
49 and a half note is entered using a @code{2} (since it is a 1/2
50 note). For notes longer than a whole you must use the
51 @code{\longa} (a double breve) and @code{\breve} commands.
52 Durations as short as 64th notes may be specified. Shorter values
53 are possible, but only as beamed notes.
55 @c Two 64th notes are needed to obtain beams
56 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
63 Here are the same durations with automatic beaming turned off.
65 @c not strictly "writing rhythms"; more of a "displaying" thing,
66 @c but it's ok here. -gp
67 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
74 A note with the duration of a quadruple breve may be entered with
75 @code{\maxima}, but this is supported only within ancient music
76 notation. For details, see @ref{Ancient notation}.
78 If the duration is omitted, it is set to the previously
79 entered duration. The default for the first note is a quarter
82 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
91 To obtain dotted note lengths, place a dot (@code{.}) after the
92 duration. Double-dotted notes are specified by appending two
95 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
96 a4 b c4. b8 a4. b4.. c8.
99 Some durations cannot be represented with just binary durations
100 and dots; they can be represented only by tying two or more
101 notes together. For details, see @ref{Ties}.
103 For ways of specifying durations for the syllables of lyrics and
104 ways of aligning lyrics to notes, see @ref{Vocal music}.
106 Optionally, notes can be spaced strictly proportionately to their
107 duration. For details of this and other settings which control
108 proportional notation, see @ref{Proportional notation}.
110 Dots are normally moved up to avoid staff lines, except in
111 polyphonic situations. To force a particular direction manually,
112 see @ref{Controlling direction and placement}.
120 @funindex \dotsNeutral
130 @rglos{Duration names notes and rests}.
133 @ref{Automatic beams},
135 @ref{Writing rhythms},
138 @ref{Ancient notation},
139 @ref{Proportional notation}.
141 Snippets: @lsrdir{Rhythms,Rhythms}
145 @internalsref{DotColumn}.
150 @c Deliberately duplicated in Durations and Rests. -gp
151 There is no fundamental limit to rest durations (both in terms of
152 longest and shortest), but the number of glyphs is limited:
153 rests from 128th to maxima (8 x whole) may be printed.
157 @subsubsection Tuplets
163 Tuplets are made from a music expression by multiplying all the
164 durations with a fraction:
167 \times @var{fraction} @var{musicexpr}
171 The duration of @var{musicexpr} will be multiplied by the
172 fraction. The fraction's denominator will be printed over or
173 under the notes, optionally with a bracket. The most common
174 tuplet is the triplet in which 3 notes have the duration of 2, so
175 the notes are 2/3 of their written length.
177 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
178 a2 \times 2/3 {b4 b b}
179 c4 c \times 2/3 {b4 a g}
183 The automatic placement of the tuplet bracket above or below the
184 notes may be overridden manually, for details see
185 @ref{Controlling direction and placement}.
187 Tuplets may be nested:
189 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
191 c4 \times 4/5 { f8 e f \times 2/3 {e[ f g] } } f4 |
194 Modifying nested tuplets which begin at the same musical moment
195 must be done with @code{\tweak}.
197 To modify the duration of notes without printing a tuplet bracket,
198 see @ref{Scaling durations}.
204 @funindex \tupletDown
206 @funindex \tupletNeutral
207 @code{\tupletNeutral}.
212 @cindex tuplet formatting
213 @cindex triplet formatting
215 @funindex tupletNumberFormatFunction
216 @funindex tupletSpannerDuration
218 @lilypondfile [verbatim,lilyquote,ragged-right,texidoc]
219 {entering-several-tuplets-using-only-one--times-command.ly}
221 @funindex TupletNumber
223 @c Sent to VV on 12 Feb - replace with @lilypondfile when available
224 @c TODO and delete from here ...
225 By default, only the numerator of the tuplet number
226 is printed over the tuplet bracket, i.e. the denominator
227 of the argument to the @code{\times} command. Alternatively,
228 @var{num}:@var{den} of the tuplet number may be printed, or
229 the tuplet number may be suppressed altogether.
232 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
233 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
234 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
235 \times 2/3 { c8 c c }
236 \override TupletNumber #'transparent = ##t
237 \times 2/3 { c8 c c }
243 @c Sent to VV on 12 Feb - replace with @lilypondfile when available
244 @c TODO and delete from here ...
245 This artificial example shows how both manual and automatic line
246 breaks may be permitted within a beamed tuplet. Note that such
247 off-beat tuplets have to be beamed manually.
249 @lilypond[quote,ragged-right,verbatim]
252 \repeat unfold 8 {\times 2/3 { c[ b a]}}
253 % Insert a manual line break within a tuplet
254 \times 2/3 { c[ b \bar "" \break a]}
255 \repeat unfold 2 {\times 2/3 { c[ b a]}}
261 % Permit line breaks within tuplets
262 \remove "Forbid_line_break_engraver"
263 % Allow beams to be broken at line breaks
264 \override Beam #'breakable = ##t
279 @ref{Time administration},
280 @ref{Scaling durations},
281 @ref{Objects connected to the input},
282 @ref{Polymetric notation}.
284 Snippets: @lsrdir{Rhythms,Rhythms}.
287 @internalsref{TupletBracket},
288 @internalsref{TupletNumber},
289 @internalsref{TimeScaledMusic}.
292 @node Scaling durations
293 @subsubsection Scaling durations
295 @cindex scaling durations
296 @cindex durations, scaling
298 You can alter the duration of single notes, rests or chords by a
299 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if
300 @code{M} is 1) to the duration.
301 This will not affect the appearance of the notes or rests
302 produced, but the altered duration will be used in calculating the
303 position within the measure and setting the duration in the MIDI
304 output. Multiplying factors may be combined such as @code{*L*M/N}.
306 In the following example, the first three notes take up exactly
307 two beats, but no triplet bracket is printed.
309 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
311 % Alter durations to triplets
312 a4*2/3 gis4*2/3 a4*2/3
315 % Double the duration of chord
317 % Duration of quarter, appears like sixteeth
321 The duration of skip or spacing notes may also be modified by
322 a multiplier. This is useful for skipping many measures, e.g.,
325 @cindex compressing music
326 @funindex \compressMusic
328 Longer stretches of music may be compressed by a fraction in
329 the same way, as if every note, chord or rest had the fraction
330 as a multiplier. The general syntax of the command to do this
334 \compressMusic #'(@emph{num} . @emph{den}) @{ @emph{music} @}
338 This will leave the appearance of @emph{music} unchanged but
339 the internal duration of the notes will be multiplied by the
340 fraction @emph{num}/@emph{den}. The spaces around the dot
341 are required. Here is an example showing how music can be
342 compressed and expanded:
344 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
348 % Scale music by *2/3
349 \compressMusic #'(2 . 3) {
353 \compressMusic #'(2 . 1) {
359 One application of this command is in polymetric
360 notation, see @ref{Polymetric notation}.
368 @ref{Polymetric notation}.
370 Snippets: @lsrdir{Rhythms,Rhythms}
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,ragged-right,fragment,verbatim]
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[fragment,quote,ragged-right]
400 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
404 If you need to tie a lot of 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,ragged-right,fragment,verbatim,relative=1]
419 <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
428 When a second alternative of a repeat starts with a tied note, you
429 have to specify the repeated tie as follows:
431 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
432 \repeat volta 2 { c g <c e>2 ~ }
434 % Following note is tied normally in first alternative
436 % Following note has a repeated tie in second alternative
437 {<c e>2\repeatTie d4 c }}
440 @cindex laissez vibrer
441 @cindex ties, laissez vibrer
442 @funindex \laissezVibrer
444 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
445 notes must not be damped at the end. It is used in notation for
446 piano, harp and other string and percussion instruments. They can
447 be entered as follows:
449 @lilypond[fragment,ragged-right,verbatim,relative=1]
450 <c f g>\laissezVibrer
453 @cindex ties, placement
456 @funindex \tieNeutral
458 The vertical placement of ties may be controlled, see the
459 predefined commands. For details, see
460 @ref{Controlling direction and placement}.
462 @cindex ties, appearance
467 Solid, dotted or dashed ties may be specified, see predefined
477 @funindex \tieNeutral
489 @c TODO Remove when snippet available - sent 15 Mar 08
490 Ties are sometimes used to write out arpeggios. In this case, two
491 tied notes need not be consecutive. This can be achieved by
492 setting the @code{tieWaitForNote} property to true. The same
493 feature is also useful, for example, to tie a tremolo to a chord,
494 but in principle, it can also be used for ordinary, consecutive
497 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
498 \set tieWaitForNote = ##t
499 \grace { c16[~ e~ g]~ } <c, e g>2
500 \repeat tremolo 8 { c32~ c'~ } <c c,>1
501 e8~ c~ a~ f~ <e' c a f>2
502 \tieUp c8~ a \tieDown \tieDotted g~ c g2
505 @c end of section to be removed
507 @c TODO Remove when snippet available - sent 15 Mar 08
508 Ties may be engraved manually by changing the
509 @code{tie-configuration} property of the @code{TieColumn} object.
510 The first number indicates the distance from the center of the
511 staff in staff-spaces, and the second number indicates the
512 direction (1=up, -1=down).
514 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
516 \override TieColumn #'tie-configuration =
517 #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
521 @c end of section to be removed
528 @rglos{laissez vibrer}.
530 Notation Reference: @ref{Automatic note splitting}.
532 Snippets: @lsrdir{Rhythms,Rhythms}
535 @internalsref{LaissezVibrerTie}
536 @internalsref{LaissezVibrerTieColumn}
537 @internalsref{TieColumn}
543 Switching staves when a tie is active will not produce a slanted
546 Changing clefs or octavations during a tie is not really
547 well-defined. In these cases, a slur may be preferable.
554 @subsection Writing rests
559 * Full measure rests::
575 Rests are entered like notes with the note name @code{r}:
577 @c \time 16/1 is used to avoid spurious bar lines
578 @c and long tracts of empty measures
579 @lilypond[fragment,quote,ragged-right,verbatim]
582 \override Staff.TimeSignature #'stencil = ##f
584 r\longa r\breve r1 r2
589 Whole measure rests, centered in middle of the measure, must be entered as
590 multi-measure rests. They can be used for a single measure as well as
591 many measures and are discussed in @ref{Full measure rests}.
593 To explicitly specify a rest's vertical position, write a note
594 followed by @code{\rest}. A rest will be placed in the position
595 where the note would appear. This allows for precise manual
596 formatting of polyphonic music, since the automatic rest collision
597 formatter will leave these rests alone.
599 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
606 Notation Reference: @ref{Full measure rests}.
608 Snippets: @lsrdir{Rhythms,Rhythms}.
610 Internals Reference: @internalsref{Rest}.
615 @c Deliberately duplicated in Durations and Rests. -gp
616 There is no fundamental limit to rest durations (both in terms of
617 longest and shortest), but the number of glyphs is limited: there
618 are rests from 128th to maxima (8 x whole).
624 @cindex invisible rest
629 An invisible rest (also called a @q{skip}) can be entered like a
630 note with note name @code{s} or with @code{\skip @var{duration}}
632 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
633 a4 a4 s4 a4 \skip 1 a4
638 The @code{s} syntax is only available in note mode and chord mode.
639 In other situations, for example, when entering lyrics, one must
640 use the @code{\skip} command:
642 @lilypond[quote,ragged-right,verbatim,relative=2]
645 \new Lyrics \lyricmode { \skip 2 bla2 }
649 The skip command is merely an empty musical placeholder. It does
650 not produce any output, not even transparent output.
652 The @code{s} skip command does create @internalsref{Staff} and
653 @internalsref{Voice} when necessary, similar to note and rest
654 commands. For example, the following results in an empty staff.
656 @lilypond[quote,verbatim]
659 @c with ragged-right, the staff lines are cut BEFORE the time
660 @c signature, which makes for a VERY empty staff
662 @c The fragment @code{@{ \skip 4 @} } would produce an empty page.
663 @c Misleading -- it doesn't produce anything, not even an empty page.
664 @c Ppl who want to make empty sheets will see this and wonder what's
669 Snippets: @lsrdir{Rhythms,Rhythms}
671 Internals Reference: @internalsref{SkipMusic}.
674 @node Full measure rests
675 @subsubsection Full measure rests
677 @cindex multi measure rests
678 @cindex full measure rests
679 @cindex rest, multi measure
680 @cindex rest, full measure
681 @cindex whole rest for a full measure
684 Rests for one or more full measures are entered using @code{R}
685 followed by a duration (see @ref{Durations}). The duration should
686 correspond to an integral number of measures, otherwise a barcheck
687 warning is printed. A @rglos{multi-measure rest} is used
688 principally to indicate that a part in a multi-part score should
691 @lilypond[quote,fragment,verbatim,relative=2]
692 \set Score.skipBars = ##t
699 A multi-measure rest can be expanded in the printed score
700 to show all the rest measures explicitly, or, as above, it can be
701 condensed to a single measure
702 containing a multi-measure rest symbol, with the number of
703 measures of rest printed above the measure. This expansion
704 is controlled by the property @code{Score.skipBars}. If this is
705 set to true, empty measures will be condensed to a single measure.
707 @lilypond[quote,ragged-right,fragment,verbatim]
708 \time 4/4 r1 | R1 | R1*2 |
711 \set Score.skipBars = ##t
715 The @code{1} in @code{R1} is similar to the duration notation
716 used for notes and is the length of a measure in 2/2 or 4/4 time.
717 The duration in a multi-measure rest must always be an integral
718 number of measure-lengths, so in other time signatures augmentation
719 dots or fractions must be used:
721 @lilypond[quote,ragged-right,fragment,verbatim]
722 \set Score.skipBars = ##t
726 R1*13/8 | R1*13/8*12 |
731 An @code{R} spanning a single measure is printed as either a whole
732 or breve rest, centered in the measure, regardless of the time
737 @cindex kirchenpausen
739 If there are 10 or fewer measures of rest, LilyPond prints
740 a series of longa and breve rests (called in German
741 Kirchenpausen - @q{church rests}) within the staff and
742 prints a simple line otherwise. This default number of 10
743 may be changed by overriding
744 @code{MultiMeasureRest.expand-limit}.
746 @lilypond[quote,ragged-right,fragment,verbatim]
747 \set Score.skipBars = ##t
749 \override MultiMeasureRest #'expand-limit = 3
753 Note that unlike ordinary rests, the vertical position on the
754 staff of the multi-measure rest symbol of either form cannot be
757 @cindex text on multi-measure rest
758 @cindex script on multi-measure rest
759 @cindex fermata on multi-measure rest
761 Text can be added to multi-measure rests by using the
762 @var{note}-@code{markup} syntax described in @ref{Text markup}.
763 The variable @code{\fermataMarkup} is provided for adding
766 @lilypond[quote,ragged-right,verbatim,fragment]
767 \set Score.skipBars = ##t
769 R2.*10^\markup { \italic "ad lib." }
773 @warning{Text attached to a multi-measure rest is created
774 by @code{MultiMeasureRestText}, not
775 @code{TextScript}. Overrides must be directed to the correct
776 object, or they will be ignored. See the following example.}
778 @lilypond[quote,ragged-right,verbatim,fragment]
779 \override TextScript #'padding = #5
781 \override MultiMeasureRestText #'padding = #5
785 Text attached to a multi-measure rest will be centered above or
786 below it. Long text attached in this way does not cause the
787 measure to expand, and may collide with text in adjacent measures.
788 Long text is better attached to a zero-length skip note preceding
789 the rest, preceded by @code{\textLengthOn} (turn off again with
790 @code{\textLengthOff}), since this will cause the measure to expand to
791 accommodate the length of the text:
793 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
794 \set Score.skipBars = ##t
796 s1*0^\markup {[MAJOR GENERAL]}
798 s1*0^\markup {[MABEL] }
799 s1*0_\markup {\italic {Cue: ... it is yours}}
802 c4^\markup {CHORUS} d f c
806 Text attached to a skip note in this way is left-aligned to the
807 position where the note would be placed in the bar, and placed
808 above the bar count numeral, but because the bar length is
809 determined by the length of the text, the text will appear to be
810 centered. If two (or more) texts are
811 attached to skip notes in a bar the bar length is determined by
812 the longer text, and the shorter text is then clearly
813 left-aligned, as shown in the second bar above. If the shorter
814 text of two marks is short enough to fit it will be placed
815 alongside and to the left of the bar count numeral.
819 Notation Reference: @ref{Durations}, @ref{Text},
820 @ref{Text markup}, @ref{Text scripts}.
822 Snippets: @lsrdir{Rhythms,Rhythms}
824 Internals Reference: @internalsref{MultiMeasureRest}.
826 The layout object @internalsref{MultiMeasureRestNumber} is for the
827 default number, and @internalsref{MultiMeasureRestText} for user
833 If an attempt is made to use fingerings (e.g.,
834 @code{R1*10-4}) to put numbers over multi-measure rests, the
835 fingering numeral (4) may collide with the bar counter
838 @cindex condensing rests
840 There is no way to automatically condense multiple rests into a
841 single multi-measure rest. Multi-measure rests do not take part
844 Be careful when entering multi-measure rests followed by whole
845 notes. The following will enter two notes lasting four measures
853 @node Displaying rhythms
854 @subsection Displaying rhythms
860 * Polymetric notation::
861 * Automatic note splitting::
865 @subsubsection Time signature
867 @cindex time signature
871 The time signature is set with the @code{\time} command:
873 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
874 \time 2/4 c2 \time 3/4 c2.
879 The symbol that is printed can be customized with the @code{style}
880 property. Setting it to @code{#'()} uses fraction style for 4/4
883 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
886 \override Staff.TimeSignature #'style = #'()
891 A time signature symbol is normally printed whenever the time
892 signature changes. If this takes place at the end of a line a
893 warning time signature sign is printed at the end of the line and
894 again at the start of a new line. This default behaviour can be
895 modified by setting the value of the @code{break-visibility}
896 property. This takes three values which may be set to @code{#t}
897 or @code{#f} to specify whether the corresponding time signature
898 is visible or not. The order of the three values is @code{end of
899 line visible}, @code{middle of line visible}, @code{beginning of
902 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
903 % Do not print any time signatures at end of line
904 \override Staff.TimeSignature #'break-visibility = ##(#f #t #t)
907 % Do not print the following 9/8 time signature
908 \once \override Staff.TimeSignature #'break-visibility = ##(#t #f #t)
916 There are many more options for its layout. See @ref{Ancient time
917 signatures}, for more examples.
919 @code{\time} sets the properties @code{timeSignatureFraction},
920 @code{beatLength}, and @code{measureLength} in the @code{Timing}
921 context, which is normally aliased to @internalsref{Score}. The
922 property @code{measureLength} determines where bar lines should be
923 inserted, and how automatic beams should be generated. Changing
924 the value of @code{timeSignatureFraction} also causes the symbol
927 @cindex measure groupings
929 More options are available through the Scheme function
930 @code{set-time-signature}, which takes three arguments: the number
931 of beats, the beat length, and the internal grouping of beats in
932 the measure. If the @internalsref{Measure_grouping_engraver} is
933 included, the function will also create
934 @internalsref{MeasureGrouping} signs. Such signs ease reading
935 rhythmically complex modern music. In the following example, the
936 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
937 @code{set-time-signature} as the third argument @code{(2 2 2 3)}:
939 @lilypond[quote,ragged-right,verbatim]
942 #(set-time-signature 9 8 '(2 2 2 3))
943 g8[ g] d[ d] g[ g] a8[( bes g]) |
944 #(set-time-signature 5 8 '(3 2))
950 \consists "Measure_grouping_engraver"
959 Snippets: @lsrdir{Rhythms,Rhythms}
961 Internals Reference: @internalsref{TimeSignature}, and
962 @internalsref{Timing_translator}.
964 Examples: @c @lsr{contemporary,compound-time-signature.ly}.
969 Automatic beaming does not use the measure grouping specified with
970 @code{set-time-signature}.
974 @subsubsection Upbeats
978 @cindex partial measure
979 @cindex measure, partial
980 @cindex pickup measure
981 @cindex shorten measures
984 Partial or pickup measures, such as an anacrusis or upbeat, are
985 entered using the @code{\partial} command, with the syntax
988 \partial @var{duration}
991 where @code{duration} is the rhythmic length to be added before
994 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
995 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
998 Internally, this is translated into
1001 \set Timing.measurePosition = -@var{length of duration}
1004 The property @code{measurePosition} contains a rational number
1005 indicating how much of the measure has passed at this point. Note
1006 that this is a negative number; @code{\partial 4} is internally
1007 translated to mean @qq{there is a quarter note left in the bar.}
1012 This command does not take into account grace notes at the start
1013 of the music. When a piece starts with grace notes in the
1014 pickup, then the @code{\partial} should follow the grace notes:
1016 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1023 @code{\partial} is only intended to be used at the beginning of a
1024 piece. If you use it after the beginning, some odd warnings may
1029 Snippets: @lsrdir{Rhythms,Rhythms}
1031 @node Unmetered music
1032 @subsubsection Unmetered music
1035 @funindex \cadenzaOn
1036 @funindex \cadenzaOff
1038 Bar lines and bar numbers are calculated automatically. For
1039 unmetered music (cadenzas, for example), this is not desirable.
1040 To turn off automatic bar lines and bar numbers, use the commands
1041 @code{\cadenzaOn} and @code{\cadenzaOff}.
1043 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1052 Bar numbering is resumed at the end of the cadenza as if the
1053 cadenza were not there:
1055 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1056 \override Score.BarNumber #'break-visibility = ##( #t #t #t )
1067 LilyPond will only insert line breaks and page breaks at a
1068 bar line. Unless the unmetered music ends before the end of the
1069 staff line, you will need to insert invisible bar lines with
1076 to indicate where breaks can occur.
1080 Snippets: @lsrdir{Rhythms,Rhythms}
1083 @node Polymetric notation
1084 @subsubsection Polymetric notation
1086 @c TODO Work this example into the main text
1087 @c @lilypondfile [verbatim,lilyquote,ragged-right,texidoc]
1088 @c {printing-music-with-different-time-signatures.ly}
1090 @cindex double time signatures
1091 @cindex signatures, polymetric
1092 @cindex polymetric signatures
1093 @cindex meter, polymetric
1097 @rglos{polymetric time signature}
1100 Double time signatures are not supported explicitly, but they can
1101 be faked. In the next example, the markup for the time signature
1102 is created with a markup text. This markup text is inserted in
1103 the @internalsref{TimeSignature} grob. See also
1104 @c @lsr{contemporary,compound-time-signature}.
1106 @lilypond[verbatim,ragged-right]
1108 tsMarkup = \markup {
1109 \override #'(baseline-skip . 2) \number {
1112 \bracket \column { "5" "8" }
1117 \override Staff.TimeSignature #'stencil =
1118 #ly:text-interface::print
1119 \override Staff.TimeSignature #'text = #tsMarkup
1121 c'2 \bar ":" c'4 c'4.
1125 Each staff can also have its own time signature. This is done by
1126 moving the @internalsref{Timing_translator} to the
1127 @internalsref{Staff} context.
1129 @lilypond[quote,verbatim,ragged-right]
1133 \remove "Timing_translator"
1134 \remove "Default_bar_line_engraver"
1138 \consists "Timing_translator"
1139 \consists "Default_bar_line_engraver"
1142 %Now, each staff has its own time signature.
1155 c4. c8 c c c4. c8 c c
1161 A different form of polymetric notation is where note lengths have
1162 different values across staves, but the measures are all the same
1165 This notation can be created by setting a common time signature
1166 for each staff but replacing it manually using
1167 @code{timeSignatureFraction} to the desired fraction. Then the
1168 printed durations in each staff are scaled to the common time
1169 signature. The latter is done with @code{\compressMusic}, which
1170 is used in a similar way to @code{\times}, but does not create
1171 a tuplet bracket. The syntax is
1173 @funindex \compressMusic
1177 #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1182 In this example, music with the time signatures of 3/4, 9/8, and
1183 10/8 are used in parallel. In the second staff, shown durations
1184 are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the third
1185 staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 =
1188 @lilypond[quote,ragged-right,verbatim,fragment]
1196 \set Staff.timeSignatureFraction = #'(9 . 8)
1197 \compressMusic #'(2 . 3)
1198 \repeat unfold 6 { c8[ c c] }
1202 \set Staff.timeSignatureFraction = #'(10 . 8)
1203 \compressMusic #'(3 . 5) {
1204 \repeat unfold 2 { c8[ c c] }
1205 \repeat unfold 2 { c8[ c] }
1206 | c4. c4. \times 2/3 { c8 c c } c4
1215 When using different time signatures in parallel, the spacing is
1216 aligned vertically, but bar lines distort the regular spacing.
1220 Snippets: @lsrdir{Rhythms,Rhythms}, @c @lsr{contemporary,compound-time-signature}.
1222 Internals Reference: @internalsref{TimeSignature}, @internalsref{Timing-translator}, @internalsref{Staff}.
1225 @node Automatic note splitting
1226 @subsubsection Automatic note splitting
1228 Long notes which overrun bar lines can be converted automatically
1229 to tied notes. This is done by replacing the
1230 @internalsref{Note_heads_engraver} by the
1231 @internalsref{Completion_heads_engraver}. In the following
1232 examples, notes crossing the bar line are split and tied.
1234 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
1236 \remove "Note_heads_engraver"
1237 \consists "Completion_heads_engraver"
1239 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
1243 This engraver splits all running notes at the bar line, and
1244 inserts ties. One of its uses is to debug complex scores: if the
1245 measures are not entirely filled, then the ties exactly show how
1246 much each measure is off.
1248 If you want to allow line breaking on the bar lines where
1249 @internalsref{Completion_heads_engraver} splits notes, you must
1250 also remove @internalsref{Forbid_line_break_engraver}.
1255 Not all durations (especially those containing tuplets) can be
1256 represented exactly with normal notes and dots, but the engraver
1257 will not insert tuplets.
1259 @code{Completion_heads_engraver} only affects notes; it does not
1265 Snippets: @lsrdir{Rhythms,Rhythms}
1267 Internals Reference: @internalsref{Note_heads_engraver},
1268 @internalsref{Completion_heads_engraver},
1269 @internalsref{Forbid_line_break_engraver}.
1280 * Setting automatic beam behavior::
1285 @node Automatic beams
1286 @subsubsection Automatic beams
1288 By default, beams are inserted automatically:
1290 @cindex beams, manual
1291 @cindex manual beams
1293 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1295 \time 6/8 c c c c8. c16 c8
1298 If these automatic decisions are not satisfactory, beaming can be
1299 entered explicitly; see @ref{Manual beams}. It is also possible
1300 to define beaming patterns that differ from the defaults; see
1301 @ref{Setting automatic beam behavior}. The default beaming rules
1302 are defined in @file{scm/@/auto@/-beam@/.scm}.
1308 Automatic beaming may be turned off and on with
1309 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1311 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1312 c4 c8 c8. c16 c8. c16 c8
1322 Beaming patterns may be altered with the @code{beatGrouping} property,
1324 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1326 \set beatGrouping = #'(2 3)
1328 \set beatGrouping = #'(3 2)
1332 The beams of consecutive 16th (or shorter) notes are, by default,
1333 not sub-divided. That is, the three (or more) beams stretch
1334 unbroken over entire groups of notes. This behaviour can
1335 be modified to sub-divide the beams into sub-groups by setting
1336 the property @code{subdivideBeams}. When set, multiple beams
1337 will be sub-divided at intervals defined by the current value of
1338 @code{beatLength} by reducing the multiple beams to just one beam
1339 between the sub-groups. Note that @code{beatLength} lives in the
1340 @code{Score} context and defaults to a quarter note. It must be
1341 set to a fraction giving the duration of the beam sub-group
1342 using the @code{make-moment} function, as shown here:
1344 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1346 \set subdivideBeams = ##t
1348 % Set beam sub-group length to an eighth note
1349 \set Score.beatLength = #(ly:make-moment 1 8)
1351 % Set beam sub-group length to a sixteenth note
1352 \set Score.beatLength = #(ly:make-moment 1 16)
1355 @funindex subdivideBeams
1358 For more information about @code{make-moment}, see
1359 @ref{Time administration}.
1365 Line breaks are normally forbidden when beams cross bar lines.
1366 This behavior can be changed by setting the @code{breakable}
1367 property: @code{\override Beam #'breakable = ##t}.
1369 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1370 \override Beam #'breakable = ##t
1371 c8 \repeat unfold 15 {c[ c] } c
1374 @cindex beams and line breaks
1375 @cindex beams, kneed
1377 @cindex auto-knee-gap
1379 Kneed beams are inserted automatically when a large gap is
1380 detected between the note heads. This behavior can be tuned
1381 through the @code{auto-knee-gap} property. A kneed beam is
1382 drawn if the gap is larger than the value of
1383 @code{auto-knee-gap} plus the width of the beam object (which
1384 depends on the duration of the notes and the slope of the beam).
1385 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1387 @lilypond[fragment,ragged-right,quote,verbatim]
1389 \override Beam #'auto-knee-gap = #6
1396 Notation Reference: @ref{Manual beams}, @ref{Setting automatic beam behavior}.
1398 Snippets: @lsrdir{Rhythms,Rhythms}
1400 Internals Reference: @internalsref{Beam}.
1405 Automatically kneed cross-staff beams cannot be used together with
1406 hidden staves. See @ref{Hiding staves}.
1408 Beams can collide with note heads and accidentals in other voices
1411 @node Setting automatic beam behavior
1412 @subsubsection Setting automatic beam behavior
1414 @funindex autoBeamSettings
1415 @funindex (end * * * *)
1416 @funindex (begin * * * *)
1417 @cindex automatic beams, tuning
1418 @cindex tuning automatic beaming
1420 @c [TODO: use \applyContext]
1422 In normal time signatures, automatic beams can start on any note
1423 but can end in only a few positions within the measure: beams can
1424 end on a beat, or at durations specified by the properties in
1425 @code{autoBeamSettings}. The properties in
1426 @code{autoBeamSettings} consist of a list of rules for where beams
1427 can begin and end. The default @code{autoBeamSettings} rules are
1428 defined in @file{scm/@/auto@/-beam@/.scm}.
1430 In order to add a rule to the list, use
1432 #(override-auto-beam-setting '(be p q n m) a b [context])
1437 @item @code{be} is either @code{begin} or @code{end}.
1439 @item @code{p/q} is the duration of the note for which you want
1440 to add a rule. A beam is considered to have the duration of its
1441 shortest note. Set @code{p} and @code{q} to @code{'*'} to
1442 have this apply to any beam.
1444 @item @code{n/m} is the time signature to which
1445 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
1446 to have this apply in any time signature.
1448 @item @code{a/b} is the position in the bar at which the beam should
1451 @item @code{context} is optional, and it specifies the context at which
1452 the change should be made. The default is @code{'Voice}.
1454 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1455 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1459 For example, if automatic beams should always end on the first quarter
1463 #(override-auto-beam-setting '(end * * * *) 1 4)
1466 You can force the beam settings to only take effect on beams whose shortest
1467 note is a certain duration
1469 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1471 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1473 a32 a a a a16 a a a a a |
1474 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1475 a32 a a a a16 a a a a a |
1478 You can force the beam settings to only take effect in certain time
1481 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1483 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1491 You can also remove a previously set beam-ending rule by using
1494 #(revert-auto-beam-setting '(be p q n m) a b [context])
1498 be, p, q, n, m, a, b and context are the same as above. Note that the
1499 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
1500 so you can revert rules that you did not explicitly create.
1502 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1504 a16 a a a a a a a a a a a a a a a
1505 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1506 a16 a a a a a a a a a a a a a a a
1509 The rule in a revert-auto-beam-setting statement must exactly match the
1510 original rule. That is, no wildcard expansion is taken into account.
1512 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1514 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1516 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1518 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1524 @c TODO: old material -- not covered by above stuff, I think.
1525 If automatic beams should end on every quarter in 5/4 time, specify
1528 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1529 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1530 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1531 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1535 The same syntax can be used to specify beam starting points. In this
1536 example, automatic beams can only end on a dotted quarter note
1538 #(override-auto-beam-setting '(end * * * *) 3 8)
1539 #(override-auto-beam-setting '(end * * * *) 1 2)
1540 #(override-auto-beam-setting '(end * * * *) 7 8)
1542 In 4/4 time signature, this means that automatic beams could end only on
1543 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1544 3/8, has passed within the measure).
1546 If any unexpected beam behaviour occurs, check the default automatic beam
1547 settings in @file{scm/@/auto@/-beam@/.scm}
1548 for possible interference, because the beam
1549 endings defined there will still apply on top of your own overrides. Any
1550 unwanted endings in the default vales must be reverted for your time
1553 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1557 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1558 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1559 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1560 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1563 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1564 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1565 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1568 @cindex automatic beam generation
1570 @funindex autoBeaming
1573 If beams are used to indicate melismata in songs, then automatic
1574 beaming should be switched off with @code{\autoBeamOff}.
1579 @funindex \autoBeamOff
1580 @code{\autoBeamOff},
1581 @funindex \autoBeamOn
1587 If a score ends while an automatic beam has not been ended and is
1588 still accepting notes, this last beam will not be typeset at all.
1589 The same holds for polyphonic voices, entered with @code{<<
1590 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1591 automatic beam is still accepting notes, it is not typeset.
1595 Snippets: @lsrdir{Rhythms,Rhythms}
1599 @subsubsection Manual beams
1601 @cindex beams, manual
1603 In some cases it may be necessary to override the automatic
1604 beaming algorithm. For example, the autobeamer will not put beams
1605 over rests or bar lines, and in choral scores the beaming is
1606 often set to follow the meter of the lyrics rather than the
1607 notes. Such beams can be specified manually by
1608 marking the begin and end point with @code{[} and @code{]}
1610 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1612 r4 r8[ g' a r8] r8 g[ | a] r8
1617 Individual notes may be marked with @code{\noBeam} to prevent them
1620 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1621 \time 2/4 c8 c\noBeam c c
1627 @funindex stemLeftBeamCount
1628 @funindex stemRightBeamCount
1630 Even more strict manual control with the beams can be achieved by
1631 setting the properties @code{stemLeftBeamCount} and
1632 @code{stemRightBeamCount}. They specify the number of beams to
1633 draw on the left and right side, respectively, of the next note.
1634 If either property is set, its value will be used only once, and
1635 then it is erased. In this example, the last @code{f} is printed
1636 with only one beam on the left side, i.e. the eigth-note beam of
1637 the group as a whole.
1639 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1643 \set stemLeftBeamCount = #1
1651 @node Feathered beams
1652 @subsubsection Feathered beams
1654 @cindex beams, feathered
1655 @funindex \featherDurations
1657 Feathered beams are used to indicate that a small group of notes
1658 should be played at an increasing (or decreasing) tempo, without
1659 changing the overall tempo of the piece. The extent of the
1660 feathered beam must be indicated manually using @code{[} and
1661 @code{]}, and the beam feathering is turned on by specifying a
1662 direction to the Beam property @code{grow-direction}.
1664 If the placement of the notes and the sound in the MIDI output
1665 is to reflect the ritardando or accelerando indicated by the
1666 feathered beam the notes must be grouped as a
1667 music expression delimited by braces and preceded by a
1668 @code{featheredDurations} command which specifies the ratio
1669 between the durations of the first and last notes in the group.
1672 show the extent of the beam and the braces show
1673 which notes are to have their durations modified. Normally
1674 these would delimit the same group of notes, but this is not
1675 required: the two commands are independent.
1677 In the following example the eight 16th notes occupy exactly the
1678 same time as a half note, but the first note is one half as long
1679 as the last one, with the intermediate notes gradually
1680 lengthening. The first four 32nd notes gradually speed up, while
1681 the last four 32nd notes are at a constant tempo.
1683 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1684 \override Beam #'grow-direction = #LEFT
1685 \featherDurations #(ly:make-moment 2 1)
1686 { c16[ c c c c c c c] }
1687 \override Beam #'grow-direction = #RIGHT
1688 \featherDurations #(ly:make-moment 2 3)
1690 % revert to non-feathered beams
1691 \override Beam #'grow-direction = #'()
1696 The spacing in the printed output represents the
1697 note durations only approximately, but the midi output is exact.
1701 The @code{\featherDurations} command only works with very short
1702 music snippets, and when numbers in the fraction are small.
1706 Snippets: @lsrdir{Rhythms,Rhythms}
1717 * Bar and bar number checks::
1722 @subsubsection Bar lines
1726 @cindex measure lines
1729 Bar lines delimit measures, and are also used to indicate
1730 repeats. Normally, simple bar lines are automatically inserted
1731 into the printed output at places based on the current time
1734 The simple bar lines inserted automatically can be changed to
1735 other types with the @code{\bar} command. For example, a closing
1736 double bar line is usually placed at the end of a piece:
1738 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1742 @warning{An incorrect duration can lead to poorly formatted
1745 It is not invalid if the final note in a bar does not
1746 end on the automatically entered bar line: the note is assumed
1747 to carry over into the next bar. But if a long sequence
1748 of such carry-over bars appears the music can appear compressed
1749 or even flowing off the page. This is because automatic line
1750 breaks happen only at the end of complete bars, i.e. where
1751 the end of a note coincides with the end of a bar.
1754 @cindex bar lines, invisible
1755 @cindex measure lines, invisible
1757 Line breaks are also permitted at manually inserted bar lines
1758 even within incomplete bars. To allow a line break without
1759 printing a bar line, use
1766 This will insert an invisible bar line and allow (but not
1767 force) a line break to occur at this point. The bar number
1768 counter is not increased. To force a line break see
1769 @ref{Line breaking}.
1771 This and other special bar lines may be inserted manually at any
1772 point. When they coincide with the end of a bar they replace
1773 the simple bar line which would have been inserted there
1774 automatically. When they do not coincide
1775 with the end of a bar the specified bar line is inserted at that
1776 point in the printed output. Such insertions do not affect
1777 the calculation and placement of subsequent automatic bar lines.
1779 The simple bar line and four types of double bar line are available
1780 for manual insertion:
1782 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1783 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
1787 together with dotted and dashed bar lines:
1789 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1790 f1 \bar ":" g \bar "dashed" a
1794 and three types of repeat bar line:
1796 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1797 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
1802 Although the bar line types signifying repeats may be inserted
1803 manually they do not in themselves cause LilyPond to recognise
1804 a repeated section. Such repeated sections are better entered
1805 using the various repeat commands (see @ref{Repeats}), which
1806 automatically print the appropriate bar lines.
1808 In addition, you can specify @code{"||:"}, which is equivalent to
1809 @code{"|:"} except at line breaks, where it gives a double bar
1810 line at the end of the line and a start repeat at the beginning of
1813 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1814 \override Score.RehearsalMark #'padding = #3
1822 In scores with many staves, a @code{\bar} command in one staff is
1823 automatically applied to all staves. The resulting bar lines are
1824 connected between different staves of a @code{StaffGroup},
1825 @code{PianoStaff}, or @code{GrandStaff}.
1827 @lilypond[quote,ragged-right,fragment,verbatim]
1835 \new Staff { \clef bass c4 g e g }
1837 \new Staff { \clef bass c2 c2 }
1845 @funindex defaultBarType
1847 The command @code{\bar }@var{bartype} is a shortcut for
1848 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
1849 created whenever the @code{whichBar} property is
1852 The default bar type used for automatically inserted bar lines is
1853 @code{"|"}. This may be changed at any time
1854 with @code{\set Timing.defaultBarType = }@var{bartype}.
1858 Notation Reference: @ref{Line breaking}, @ref{Repeats},
1859 @c FIXME: node name changed, but is subject to further changes.
1860 @c @ref{System start delimiters}.
1862 Snippets: @lsrdir{Rhythms,Rhythms}
1864 Internals Reference: @internalsref{BarLine} (created at
1865 @internalsref{Staff} level), @internalsref{SpanBar} (across
1866 staves), @internalsref{Timing_translator} (for Timing
1871 @subsubsection Bar numbers
1874 @cindex measure numbers
1875 @funindex currentBarNumber
1877 Bar numbers are typeset by default at the start of every line except
1878 the first line. The number itself is stored in the
1879 @code{currentBarNumber} property, which is normally updated
1880 automatically for every measure. It may also be set manually:
1882 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1885 \set Score.currentBarNumber = #50
1892 @funindex barNumberVisibility
1893 @cindex bar numbers, regular spacing
1895 Bar numbers can be typeset at regular intervals instead of just at
1896 the beginning of every line. To do this the default behaviour
1897 must be overridden to permit bar numbers to be printed at places
1898 other than the start of a line. This is controlled by the
1899 @code{break-visibility} property of @code{BarNumber}. This takes
1900 three values which may be set to @code{#t} or @code{#f} to specify
1901 whether the corresponding bar number is visible or not. The order
1902 of the three values is @code{end of line visible}, @code{middle of
1903 line visible}, @code{beginning of line visible}. In the following
1904 example bar numbers are printed at all possible places:
1906 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1907 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1908 \set Score.currentBarNumber = #11
1909 \bar "" % Permit first bar number to be printed
1915 @c All the rest of these examples will be added to LSR
1916 @c and moved into the Snippets. -gp
1919 and here the bar numbers are printed every two bars
1920 except at the end of the line:
1922 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1923 \override Score.BarNumber #'break-visibility = ##(#f #t #t)
1924 \set Score.currentBarNumber = #11
1925 \bar "" % Permit first bar number to be printed
1926 % Print a bar number every 2nd bar
1927 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1933 @cindex measure number, format
1934 @cindex bar number, format
1936 The size of the bar number may be changed. This is illustrated
1937 in the following example, which also shows how to enclose bar
1938 numbers in boxes and circles, and shows an alternative way
1939 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
1941 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1942 % Prevent bar numbers at the end of a line and permit them elsewhere
1943 \override Score.BarNumber #'break-visibility
1944 = #end-of-line-invisible
1946 % Increase the size of the bar number by 2
1947 \override Score.BarNumber #'font-size = #2
1948 \repeat unfold 3 { c1 } \bar "|"
1950 % Draw a box round the following bar number(s)
1951 \override Score.BarNumber #'stencil
1952 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
1953 \repeat unfold 3 { c1 } \bar "|"
1955 % Draw a circle round the following bar number(s)
1956 \override Score.BarNumber #'stencil
1957 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
1958 \repeat unfold 4 { c1 } \bar "|."
1961 @cindex bar number alignment
1963 Bar numbers by default are left-aligned to their parent object.
1964 This is usually the left edge of a line or, if numbers are printed
1965 within a line, the left bar line of the bar. The numbers may also
1966 be positioned directly on the bar line or right-aligned to the
1969 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1970 \set Score.currentBarNumber = #111
1971 \override Score.BarNumber #'break-visibility = ##(#t #t #t)
1972 % Increase the size of the bar number by 2
1973 \override Score.BarNumber #'font-size = #2
1974 % Print a bar number every 2nd bar
1975 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
1977 % Centre-align bar numbers
1978 \override Score.BarNumber #'self-alignment-X = #0
1980 % Right-align bar numbers
1981 \override Score.BarNumber #'self-alignment-X = #-1
1985 Bar numbers can be removed entirely by removing the Bar number
1986 engraver from the score context.
1988 @lilypond[verbatim,ragged-right,quote]
1992 \remove "Bar_number_engraver"
2004 Snippets: @lsrdir{Rhythms,Rhythms}
2006 Internals Reference: @internalsref{BarNumber}.
2011 Bar numbers may collide with the top of the
2012 @internalsref{StaffGroup} bracket, if there is one. To solve
2013 this, the @code{padding} property of @internalsref{BarNumber} can
2014 be used to position the number correctly.
2016 Bar numbers may only be printed at bar lines; to print a bar
2017 number at the beginning of a piece, an empty bar line must be
2018 inserted there, and a value other than @code{1} must be placed
2019 in @code{currentBarNumber}:
2021 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2022 \set Score.currentBarNumber = #50
2031 @node Bar and bar number checks
2032 @subsubsection Bar and bar number checks
2035 @funindex barCheckSynchronize
2038 Bar checks help detect errors in the entered durations.
2039 A bar check may be entered using the bar symbol, @code{|},
2040 at any place where a bar line is expected to fall.
2041 If bar check lines are encountered at other places,
2042 a list of warnings is printed in the log file,
2043 showing the line numbers and lines
2044 in which the bar checks failed. In the next
2045 example, the second bar check will signal an error.
2048 \time 3/4 c2 e4 | g2 |
2051 Bar checks can also be used in lyrics, for example
2056 Twin -- kle | Twin -- kle |
2060 An incorrect duration can result in a completely garbled score,
2061 especially if the score is polyphonic, so a good place to start
2062 correcting input is by scanning for failed bar checks and
2063 incorrect durations.
2066 @funindex pipeSymbol
2068 It is also possible to redefine the action taken when a bar check
2069 or pipe symbol, @code{|}, is encountered in the input, so that
2070 it does something other than a bar check. This is done by
2071 assigning a music expression to @code{pipeSymbol}.
2072 In the following example @code{|} is set to insert a double bar
2073 line wherever it appears in the input, rather than checking
2076 @lilypond[quote,ragged-right,verbatim]
2077 pipeSymbol = \bar "||"
2086 When copying large pieces of music, it can be helpful to check
2087 that the LilyPond bar number corresponds to the original that you
2088 are entering from. This can be checked with
2089 @code{\barNumberCheck}, for example,
2092 \barNumberCheck #123
2096 will print a warning if the @code{currentBarNumber} is not 123
2097 when it is processed.
2101 Snippets: @lsrdir{Rhythms,Rhythms}
2104 @node Rehearsal marks
2105 @subsubsection Rehearsal marks
2107 @cindex rehearsal marks
2108 @cindex mark, rehearsal
2111 To print a rehearsal mark, use the @code{\mark} command
2113 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2122 The letter@tie{}@q{I} is skipped in accordance with engraving
2123 traditions. If you wish to include the letter @q{I}, then use
2126 \set Score.markFormatter = #format-mark-alphabet
2129 The mark is incremented automatically if you use @code{\mark
2130 \default}, but you can also use an integer argument to set the
2131 mark manually. The value to use is stored in the property
2132 @code{rehearsalMark}.
2134 @cindex rehearsal mark format
2135 @cindex rehearsal mark style
2136 @cindex style, rehearsal mark
2137 @cindex format, rehearsal mark
2138 @cindex mark, rehearsal, style
2139 @cindex mark, rehearsal, format
2141 The style is defined by the property @code{markFormatter}. It is
2142 a function taking the current mark (an integer) and the current
2143 context as argument. It should return a markup object. In the
2144 following example, @code{markFormatter} is set to a pre-defined
2145 procedure. After a few measures, it is set to a procedure that
2146 produces a boxed number.
2148 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2149 \set Score.markFormatter = #format-mark-numbers
2152 \set Score.markFormatter = #format-mark-box-numbers
2158 The file @file{scm/@/translation@/-functions@/.scm} contains the
2159 definitions of @code{format-mark-numbers} (the default format),
2160 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2161 @code{format-mark-box-letters}. These can be used as inspiration
2162 for other formatting functions.
2164 You may use @code{format-mark-barnumbers},
2165 @code{format-mark-box-barnumbers}, and
2166 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2167 incremented numbers or letters.
2169 Other styles of rehearsal mark can be specified manually
2176 @code{Score.markFormatter} does not affect marks specified in this
2177 manner. However, it is possible to apply a @code{\markup} to the
2181 \mark \markup@{ \box A1 @}
2188 Music glyphs (such as the segno sign) may be printed inside a
2191 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2192 c1 \mark \markup { \musicglyph #"scripts.segno" }
2193 c1 \mark \markup { \musicglyph #"scripts.coda" }
2194 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2199 See @ref{The Feta font}, for a list of symbols which may be
2200 printed with @code{\musicglyph}.
2202 For common tweaks to the positioning of rehearsal marks, see
2207 Snippets: @lsrdir{Rhythms,Rhythms}
2209 This manual: @ref{The Feta font}, @ref{Text marks}.
2211 Internals Reference: @internalsref{RehearsalMark}.
2213 Init files: @file{scm/@/translation@/-functions@/.scm} contains
2214 the definition of @code{format-mark-numbers} and
2215 @code{format-mark-letters}. They can be used as inspiration for
2216 other formatting functions.
2218 Examples: @c @lsr{parts,rehearsal-mark-numbers.ly}
2221 @node Special rhythmic concerns
2222 @subsection Special rhythmic concerns
2227 * Aligning to cadenzas::
2228 * Time administration::
2232 @subsubsection Grace notes
2237 @cindex appoggiatura
2238 @cindex acciaccatura
2240 Grace notes are ornaments that are written out. They are made with
2241 the @code{\grace} command. By prefixing this keyword to a music
2242 expression, a new one is formed, which will be printed in a
2243 smaller font and takes up no logical time in a measure.
2245 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2247 \grace { c16[ d16] } c2 c4
2250 Two special forms of the @code{\grace} command exist.
2251 An @emph{acciaccatura}, which should be played as very short,
2252 is denoted by a slurred small note with a slashed stem. The
2253 @emph{appoggiatura}, a grace note that takes a fixed fraction of the
2254 main note, is denoted as a slurred note in small print without
2255 a slash. They are entered with the commands @code{\acciaccatura}
2256 and @code{\appoggiatura}, as demonstrated in the following
2259 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2260 b4 \acciaccatura d8 c4
2262 \acciaccatura { g16[ f] } e4
2266 @code{\acciaccatura} and @code{\appoggiatura} start a slur,
2267 @code{\grace} does not.
2269 The placement of grace notes is synchronized between different
2270 staves. In the following example, there are two sixteenth grace
2271 notes for every eighth grace note
2273 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2274 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2275 \new Staff { c4 \grace { g8[ b] } c4 } >>
2278 @funindex \afterGrace
2280 @cindex grace notes, following
2282 If you want to end a note with a grace, use the @code{\afterGrace}
2283 command. It takes two arguments: the main note, and the grace
2284 notes following the main note.
2286 @lilypond[ragged-right, verbatim,relative=2,fragment]
2287 c1 \afterGrace d1 { c16[ d] } c4
2290 This will put the grace notes after a @q{space} lasting 3/4 of the
2291 length of the main note. The fraction 3/4 can be changed by
2292 setting @code{afterGraceFraction}, ie.
2295 #(define afterGraceFraction (cons 7 8))
2299 will put the grace note at 7/8 of the main note.
2301 The same effect can be achieved manually by doing
2303 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2306 { s2 \grace { c16[ d] } } >>
2312 By adjusting the duration of the skip note (here it is a
2313 half-note), the space between the main-note and the grace
2316 A @code{\grace} music expression will introduce special
2317 typesetting settings, for example, to produce smaller type, and
2318 set directions. Hence, when introducing layout tweaks, they
2319 should be inside the grace expression, for example,
2321 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2333 The overrides should also be reverted inside the grace expression.
2335 The layout of grace expressions can be changed throughout the
2336 music using the function @code{add-grace-property}. The following
2337 example undefines the @code{Stem} direction for this grace, so
2338 that stems do not always point up.
2342 #(add-grace-property 'Voice 'Stem 'direction '())
2348 Another option is to change the variables @code{startGraceMusic},
2349 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2350 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2351 @code{stopAppoggiaturaMusic}. The default values of these can be
2352 seen in the file @file{ly/@/grace@/-init@/.ly}. By redefining
2353 them other effects may be obtained.
2355 @cindex stem, with slash
2358 The slash through the stem in @emph{acciaccatura}s can be obtained in
2359 other situations by @code{\override Stem #'stroke-style =
2365 Grace notes may be forced to use align with regular notes
2366 in other staves by setting @code{strict-grace-spacing} to
2369 @lilypond[relative=2,ragged-right]
2371 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2380 c'16[ c'16 c'16 c'16]
2381 c'16[ c'16 c'16 c'16]
2391 @rglos{grace notes},
2392 @rglos{acciaccatura},
2393 @rglos{appoggiatura}
2395 Snippets: @lsrdir{Rhythms,Rhythms}
2397 Internals Reference: @internalsref{GraceMusic}.
2402 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2403 and looks exactly the same as a multi-note beamed
2404 @emph{appoggiatura}.
2405 @c TODO Add link to LSR snippet to add slash when available
2407 Grace note synchronization can also lead to surprises. Staff
2408 notation, such as key signatures, bar lines, etc., are also
2409 synchronized. Take care when you mix staves with grace notes and
2410 staves without, for example,
2412 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2413 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2414 \new Staff { c4 \bar "|:" d4 } >>
2418 This can be remedied by inserting grace skips of the corresponding
2419 durations in the other staves. For the above example
2421 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2422 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2423 \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2426 Grace sections should only be used within sequential music
2427 expressions. Nesting or juxtaposing grace sections is not
2428 supported, and might produce crashes or other errors.
2430 @node Aligning to cadenzas
2431 @subsubsection Aligning to cadenzas
2434 @cindex cadenza, aligning to
2435 @cindex aligning to cadenza
2437 In an orchestral context, cadenzas present a special problem: when
2438 constructing a score that includes a cadenza, all other
2439 instruments should skip just as many notes as the length of the
2440 cadenza, otherwise they will start too soon or too late.
2442 A solution to this problem is to use the functions
2443 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2444 functions take a piece of music as argument, and generate a multi-rest
2445 or @code{\skip}, exactly as long as the piece. The use of
2446 @code{mmrest-of-length} is demonstrated in the following example.
2448 @lilypond[verbatim,ragged-right,quote]
2449 cadenza = \relative c' {
2450 c4 d8 << { e f g } \\ { d4. } >>
2455 \new Staff { \cadenza c'4 }
2457 #(ly:export (mmrest-of-length cadenza))
2465 Snippets: @lsrdir{Rhythms,Rhythms}
2468 @node Time administration
2469 @subsubsection Time administration
2471 @cindex time administration
2472 @cindex timing (within the score)
2473 @cindex music, unmetered
2474 @cindex unmetered music
2476 @funindex currentBarNumber
2477 @funindex measurePosition
2478 @funindex measureLength
2480 Time is administered by the @code{Timing_translator}, which by
2481 default is to be found in the @code{Score} context. An alias,
2482 @code{Timing}, is added to the context in which the
2483 @code{Timing_translator} is placed.
2485 The following properties of @code{Timing} are used
2486 to keep track of timing within the score.
2489 @cindex measure number
2492 @item currentBarNumber
2493 The current measure number. For an example showing the
2494 use of this property see @ref{Bar numbers}.
2497 The length of the measures in the current time signature. For a
2498 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2499 determines when bar lines are inserted and how automatic beams
2500 should be generated.
2502 @item measurePosition
2503 The point within the measure where we currently are. This
2504 quantity is reset by subtracting @code{measureLength} whenever
2505 @code{measureLength} is reached or exceeded. When that happens,
2506 @code{currentBarNumber} is incremented.
2509 If set to true, the above variables are updated for every time
2510 step. When set to false, the engraver stays in the current
2511 measure indefinitely.
2515 Timing can be changed by setting any of these variables
2516 explicitly. In the next example, the default 4/4 time
2517 signature is printed, but @code{measureLength} is set to 5/4.
2518 At 4/8 through the third measure, the @code{measurePosition} is
2519 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2520 The next bar line then falls at 9/8 rather than 5/4.
2522 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2523 \set Score.measureLength = #(ly:make-moment 5 4)
2527 \set Score.measurePosition = #(ly:make-moment 5 8)
2533 As the example illustrates, @code{ly:make-moment n m} constructs a
2534 duration of n/m of a whole note. For example,
2535 @code{ly:make-moment 1 8} is an eighth note duration and
2536 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2542 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2544 Snippets: @lsrdir{Rhythms,Rhythms}
2546 Internals Reference: @internalsref{Timing_translator},
2547 @internalsref{Score}