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 1.2.3.1 Time signature
15 Needs an example of beatLength, which is broken (see my recent
17 to -bug). What to do? For now I've left a paragraph of text
19 needs to be inserted with an example in a snippet.
21 1.2.3.4 Polymetric notation
22 Quite extensive changes. Could you please check through. Divided
24 sections. Necessarily uses tweaks. I've also left an @lsr under
26 Snippets - is this permitted or is @lsr now verboten? This
28 long to include, but seems relevant.
29 A snippet "grouping beats" hasn't yet appeared (only sent to vv a
31 days ago). Text left in Snippets: with TODO.
37 @lilypondfile[quote]{rhythms-headword.ly}
39 This section discusses rhythms, rests, durations, beaming and bars.
44 * Displaying rhythms::
47 * Special rhythmic concerns::
52 @subsection Writing rhythms
62 @subsubsection Durations
64 @cindex durations, of notes
65 @cindex note durations
71 Durations are designated by numbers and dots.
72 Durations are entered as their reciprocal values. For example, a
73 quarter note is entered using a @code{4} (since it is a 1/4 note),
74 and a half note is entered using a @code{2} (since it is a 1/2
75 note). For notes longer than a whole you must use the
76 @code{\longa} (a double breve) and @code{\breve} commands.
77 Durations as short as 64th notes may be specified. Shorter values
78 are possible, but only as beamed notes.
80 @c Two 64th notes are needed to obtain beams
81 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
88 Here are the same durations with automatic beaming turned off.
90 @c not strictly "writing rhythms"; more of a "displaying" thing,
91 @c but it's ok here. -gp
92 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
99 A note with the duration of a quadruple breve may be entered with
100 @code{\maxima}, but this is supported only within ancient music
101 notation. For details, see @ref{Ancient notation}.
103 If the duration is omitted, it is set to the previously
104 entered duration. The default for the first note is a quarter
107 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
111 @cindex notes, dotted
116 To obtain dotted note lengths, place a dot (@code{.}) after the
117 duration. Double-dotted notes are specified by appending two
120 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
121 a4 b c4. b8 a4. b4.. c8.
124 Some durations cannot be represented with just binary durations
125 and dots; they can be represented only by tying two or more
126 notes together. For details, see @ref{Ties}.
128 For ways of specifying durations for the syllables of lyrics and
129 ways of aligning lyrics to notes, see @ref{Vocal music}.
131 Optionally, notes can be spaced strictly proportionately to their
132 duration. For details of this and other settings which control
133 proportional notation, see @ref{Proportional notation}.
137 @funindex \dotsNeutral
139 Dots are normally moved up to avoid staff lines, except in
140 polyphonic situations. Predefined commands are available to
141 force a particular direction manually, for details
142 see @ref{Direction and placement}.
158 @rglos{Duration names notes and rests}.
161 @ref{Automatic beams},
163 @ref{Writing rhythms},
166 @ref{Ancient notation},
167 @ref{Proportional notation}.
174 @rinternals{DotColumn}.
179 @c Deliberately duplicated in Durations and Rests. -gp
180 There is no fundamental limit to rest durations (both in terms of
181 longest and shortest), but the number of glyphs is limited:
182 rests from 128th to maxima (8 x whole) may be printed.
186 @subsubsection Tuplets
192 Tuplets are made from a music expression by multiplying all the
193 durations with a fraction:
196 \times @var{fraction} @{ @var{music} @}
200 The duration of @var{music} will be multiplied by the
201 fraction. The fraction's denominator will be printed over or
202 under the notes, optionally with a bracket. The most common
203 tuplet is the triplet in which 3 notes have the duration of 2, so
204 the notes are 2/3 of their written length.
206 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
207 a2 \times 2/3 { b4 b b }
208 c4 c \times 2/3 { b4 a g }
212 @funindex \tupletDown
213 @funindex \tupletNeutral
215 The automatic placement of the tuplet bracket above or below the
216 notes may be overridden manually with predefined commands, for
217 details see @ref{Direction and placement}.
219 Tuplets may be nested:
221 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
223 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
226 Modifying nested tuplets which begin at the same musical moment
227 must be done with @code{\tweak}.
229 To modify the duration of notes without printing a tuplet bracket,
230 see @ref{Scaling durations}.
236 @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 @funindex TupletNumber
252 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
253 {changing-the-tuplet-number.ly}
255 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
256 {permitting-line-breaks-within-beamed-tuplets.ly}
265 Learning Manual: @rlearning{Tweaking methods}.
268 @ref{Time administration},
269 @ref{Scaling durations},
270 @ref{The tweak command},
271 @ref{Polymetric notation}.
277 @rinternals{TupletBracket},
278 @rinternals{TupletNumber},
279 @rinternals{TimeScaledMusic}.
282 @cindex grace notes within tuplet brackets
283 When the first note on a staff is a grace note followed by a
284 tuplet the grace note must be placed before the @code{\times}
285 command to avoid errors. Anywhere else, grace notes may be
286 placed within tuplet brackets.
289 @node Scaling durations
290 @subsubsection Scaling durations
292 @cindex scaling durations
293 @cindex durations, scaling
295 You can alter the duration of single notes, rests or chords by a
296 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if
297 @code{M} is 1) to the duration.
298 This will not affect the appearance of the notes or rests
299 produced, but the altered duration will be used in calculating the
300 position within the measure and setting the duration in the MIDI
301 output. Multiplying factors may be combined such as @code{*L*M/N}.
303 In the following example, the first three notes take up exactly
304 two beats, but no triplet bracket is printed.
306 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
308 % Alter durations to triplets
309 a4*2/3 gis4*2/3 a4*2/3
312 % Double the duration of chord
314 % Duration of quarter, appears like sixteenth
318 The duration of skip or spacing notes may also be modified by
319 a multiplier. This is useful for skipping many measures, e.g.,
322 @cindex compressing music
323 @funindex \scaleDurations
325 Longer stretches of music may be compressed by a fraction in the
326 same way, as if every note, chord or rest had the fraction as a
327 multiplier. This leaves the appearance of the music unchanged but
328 the internal duration of the notes will be multiplied by the
329 fraction @emph{num}/@emph{den}. The spaces around the dot are
330 required. Here is an example showing how music can be compressed
333 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
337 % Scale music by *2/3
338 \scaleDurations #'(2 . 3) {
342 \scaleDurations #'(2 . 1) {
348 One application of this command is in polymetric
349 notation, see @ref{Polymetric notation}.
356 @ref{Invisible rests},
357 @ref{Polymetric notation}.
369 A tie connects two adjacent note heads of the same pitch. The tie
370 in effect extends the duration of a note.
372 @warning{Ties should not be confused with @emph{slurs}, which
373 indicate articulation, or @emph{phrasing slurs}, which indicate
374 musical phrasing. A tie is just a way of extending a note
375 duration, similar to the augmentation dot.}
377 A tie is entered using the tilde symbol @code{~}
379 @lilypond[quote,ragged-right,fragment,verbatim]
385 Ties are used either when the note crosses a bar line, or when
386 dots cannot be used to denote the rhythm. Ties should also be
387 used when note values cross larger subdivisions of the measure:
389 @lilypond[fragment,quote,ragged-right]
396 If you need to tie many notes across bar lines, it may be
397 easier to use automatic note splitting, see @ref{Automatic note
398 splitting}. This mechanism automatically splits long notes, and
399 ties them across bar lines.
401 @cindex ties and chords
402 @cindex chords and ties
404 When a tie is applied to a chord, all note heads whose pitches
405 match are connected. When no note heads match, no ties will be
406 created. Chords may be partially tied by placing the tie inside
409 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
411 <c~ e g~ b> <c e g b>
415 @cindex repeating ties
416 @cindex ties, repeating
417 @cindex volta brackets and ties
418 @cindex ties and volta brackets
420 When a second alternative of a repeat starts with a tied note, you
421 have to specify the repeated tie as follows:
423 @lilypond[fragment,quote,ragged-right,relative=2,verbatim]
424 \repeat volta 2 { c g <c e>2 ~ }
426 % First alternative: following note is tied normally
428 % Second alternative: following note has a repeated tie
429 { <c e>2\repeatTie d4 c } }
432 @cindex laissez vibrer
433 @cindex ties, laissez vibrer
434 @funindex \laissezVibrer
436 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
437 notes must not be damped at the end. It is used in notation for
438 piano, harp and other string and percussion instruments. They can
439 be entered as follows:
441 @lilypond[fragment,quote,ragged-right,verbatim,relative=1]
442 <c f g>1\laissezVibrer
445 @cindex ties, placement
448 @funindex \tieNeutral
450 The vertical placement of ties may be controlled, see
451 Predefined commands, or for details, see
452 @ref{Direction and placement}.
454 @cindex ties, appearance
459 Solid, dotted or dashed ties may be specified, see Predefined
475 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
476 {using-ties-with-arpeggios.ly}
478 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
479 {engraving-ties-manually.ly}
486 @rglos{laissez vibrer}.
488 Notation Reference: @ref{Automatic note splitting}.
494 @rinternals{LaissezVibrerTie},
495 @rinternals{LaissezVibrerTieColumn},
496 @rinternals{TieColumn},
502 Switching staves when a tie is active will not produce a slanted
505 Changing clefs or octavations during a tie is not really
506 well-defined. In these cases, a slur may be preferable.
513 @subsection Writing rests
515 Rests are entered as part of the music in music expressions.
520 * Full measure rests::
526 @cindex rest, entering durations
537 Rests are entered like notes with the note name @code{r}.
538 Durations longer than a whole rest use the predefined
541 @c \time 16/1 is used to avoid spurious bar lines
542 @c and long tracts of empty measures
543 @lilypond[fragment,quote,ragged-right,verbatim]
545 % These two lines are just to prettify this example
547 \override Staff.TimeSignature #'stencil = ##f
548 % Print a maxima rest, equal to four breves
550 % Print a longa rest, equal to two breves
554 r1 r2 r4 r8 r16 r32 r64 r128
558 @cindex rest, multi-measure
559 @cindex rest, whole-measure
561 Whole measure rests, centered in the middle of the measure, must be
562 entered as multi-measure rests. They can be used for a single
563 measure as well as many measures and are discussed in @ref{Full
566 @cindex rest, specifying vertical position
568 To explicitly specify a rest's vertical position, write a note
569 followed by @code{\rest}. A rest of the duration of the note will
570 be placed at the staff position where the note would appear. This
571 allows for precise manual formatting of polyphonic music, since the
572 automatic rest collision formatter will not move these rests.
574 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
580 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
587 @ref{Full measure rests}.
598 @c Deliberately duplicated in Durations and Rests. -gp
599 There is no fundamental limit to rest durations (both in terms of
600 longest and shortest), but the number of glyphs is limited: there
601 are rests from 128th to maxima (8 x whole).
604 @node Invisible rests
605 @subsubsection Invisible rests
608 @cindex invisible rest
609 @cindex rest, invisible
614 An invisible rest (also called a @q{spacer rest}) can be entered
615 like a note with the note name@tie{}@code{s}:
617 @lilypond[verbatim,quote,relative=2]
624 Spacer rests are available only in note mode and chord mode. In
625 other situations, for example, when entering lyrics, @code{\skip}
626 is used to skip a musical moment. @code{\skip} requires an
629 @lilypond[quote,ragged-right,verbatim,relative=2]
642 A spacer rest implicitly causes @code{Staff} and @code{Voice}
643 contexts to be created if none exist, just like notes and rests
646 @lilypond[quote,verbatim,fragment]
650 @code{\skip} simply skips musical time; it creates no output of
653 @lilypond[quote,verbatim,fragment]
654 % This is valid input, but does nothing
655 \skip 1 \skip1 \skip 1
663 Internals Reference: @rinternals{SkipMusic}
666 @node Full measure rests
667 @subsubsection Full measure rests
669 @cindex multi-measure rests
670 @cindex full-measure rests
671 @cindex rest, multi-measure
672 @cindex rest, full-measure
673 @cindex whole rest for a full measure
676 Rests for one or more full measures are entered like notes with
677 the note name uppercase @code{R}:
679 @lilypond[quote,fragment,verbatim,relative=2]
680 % Rest measures contracted to single measure
681 \compressFullBarRests
688 The duration of full-measure rests is identical to the duration notation
689 used for notes. The duration in a multi-measure rest must always be an
690 integral number of measure-lengths, so augmentation
691 dots or fractions must often be used:
693 @lilypond[quote,ragged-right,fragment,verbatim]
694 \compressFullBarRests
700 R1*13/8 | R1*13/8*12 |
705 A full-measure rest is printed as either a whole
706 or breve rest, centered in the measure, depending on the time
709 @lilypond[quote,ragged-right,fragment,verbatim]
717 @funindex \expandFullBarRests
718 @funindex \compressFullBarRests
719 @cindex multi-measure rest, expanding
720 @cindex multi-measure rest, contracting
722 By default a multi-measure rest is expanded in the printed score
723 to show all the rest measures explicitly.
724 Alternatively, a mult-measure rest can be shown as a single measure
725 containing a multi-measure rest symbol, with the number of measures of rest
726 printed above the measure:
728 @lilypond[quote,ragged-right,fragment,verbatim]
730 \time 3/4 r2. | R2.*2 |
733 % Rest measures contracted to single measure
734 \compressFullBarRests
736 % Rest measures expanded
743 @cindex text on multi-measure rest
744 @cindex multi-measure rest, attaching text
745 @cindex script on multi-measure rest
746 @cindex multi-measure rest, script
747 @cindex fermata on multi-measure rest
748 @cindex multi-measure rest, attaching fermata
750 Markups can be added to multi-measure rests.
751 The predefined command @code{\fermataMarkup}
752 is provided for adding fermatas.
754 @lilypond[quote,ragged-right,verbatim,fragment]
755 \compressFullBarRests
757 R2.*10^\markup { \italic "ad lib." }
762 Markups attached to a multi-measure rest are
763 objects of type @code{MultiMeasureRestText}, not
764 @code{TextScript}. Overrides must be directed to the correct
765 object, or they will be ignored. See the following example.
768 @lilypond[quote,ragged-right,verbatim,fragment]
769 % This fails, as the wrong object name is specified
770 \override TextScript #'padding = #5
772 % This is correct and works
773 \override MultiMeasureRestText #'padding = #5
777 When a multi-measure rest immediately follows a @code{\partial}
778 setting, resulting bar-check warnings may not be displayed.
781 @code{\textLengthOn},
782 @code{\textLengthOff},
783 @code{\fermataMarkup},
784 @code{\compressFullBarRests},
785 @code{\expandFullBarRests}.
791 @cindex kirchenpausen
793 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
794 {changing-form-of-multi--measure-rests.ly}
796 @cindex multi-measure rests, positioning
797 @cindex positioning multi-measure rests
799 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
800 {positioning-multi--measure-rests.ly}
802 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
803 {multi--measure-rest-markup.ly}
808 @rglos{multi-measure rest}.
813 @ref{Formatting text},
820 @rinternals{MultiMeasureRest},
821 @rinternals{MultiMeasureRestNumber},
822 @rinternals{MultiMeasureRestText}.
827 If an attempt is made to use fingerings (e.g.,
828 @code{R1*10-4}) to put numbers over multi-measure rests, the
829 fingering numeral (4) may collide with the bar counter
832 @cindex condensing rests
833 @cindex rest, condensing ordinary
835 There is no way to automatically condense multiple ordinary rests
836 into a single multi-measure rest.
838 @cindex rest, collisions of
840 Multi-measure rests do not take part in rest collisions.
842 @node Displaying rhythms
843 @subsection Displaying rhythms
849 * Polymetric notation::
850 * Automatic note splitting::
851 * Showing melody rhythms::
855 @subsubsection Time signature
857 @cindex time signature
861 The time signature is set as follows:
863 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
868 @cindex Time signature, visibility of
870 Time signatures are printed at the beginning of a piece
871 and whenever the time signature changes. If a change takes place
872 at the end of a line a warning time signature sign is printed
873 there. This default behavior may be changed, see
874 @c ref{Controlling visibility of objects}.
876 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
886 @funindex \numericTimeSignature
887 @funindex \defaultTimeSignature
888 @cindex time signature style
890 The time signature symbol that is used in 2/2 and 4/4 time can be
891 changed to a numeric style:
893 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
897 % Change to numeric style
898 \numericTimeSignature
901 % Revert to default style
902 \defaultTimeSignature
908 Ancient time signatures are covered in
909 @ref{Ancient time signatures}.
913 @code{\numericTimeSignature},
914 @code{\defaultTimeSignature}.
918 @c TODO Send as snippet called "setting measure and beat lengths"
919 @c when example is added
920 @code{\time} sets the properties @code{timeSignatureFraction},
921 @code{beatLength}, and @code{measureLength} in the @code{Timing}
922 context, which is normally aliased to @code{Score}. Changing the
923 value of @code{timeSignatureFraction} causes the new time
924 signature symbol to be printed without changing the other
925 properties. The property @code{measureLength} determines where
926 bar lines should be inserted and, with @code{beatLength}
927 and @code{beatGrouping}, how
928 automatic beams should be generated.
930 @lilypond[quote,verbatim,relative=2]
931 \time 3/4 % auto beam on 1/4 note groups
932 a16 a a a a a a a a a a a a a a a
933 \time 12/16 % no defined auto-beaming for this time sig
934 a16 a a a a a a a a a a a a a a a
936 a16 a a a a a a a a a a a a a a a
937 \set Score.timeSignatureFraction = #'(12 16) %keep 3/4 beaming
939 a16 a a a a a a a a a a a a a a a
940 \set Score.beatLength = #(ly:make-moment 1 8) %beam on 1/8 notes
941 a16 a a a a a a a a a a a a a a a
942 \set Score.beatLength = #(ly:make-moment 1 16)
943 \set Score.beatGrouping = #'(3 4 2 3) %beam on 3/16, 7/16, 9/16, 12/16
944 a16 a a a a a a a a a a a a a a a
950 @cindex measure groupings
951 @cindex beats, grouping
952 @cindex grouping beats
953 @cindex measure sub-grouping
955 @c TODO Sent as snippet called "grouping beats" 25 Mar 08
956 Options to group beats within a bar are available through the
957 Scheme function @code{set-time-signature}, which takes three
958 arguments: the number of beats, the beat length, and the internal
959 grouping of beats in the measure. If the
960 @rinternals{Measure_grouping_engraver} is included, the function
961 will also create @rinternals{MeasureGrouping} signs. Such signs
962 ease reading rhythmically complex modern music. In the example,
963 the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
964 @code{set-time-signature} as the third argument: @code{'(2 2 2 3)}:
966 @lilypond[quote,ragged-right,verbatim]
969 #(set-time-signature 9 8 '(2 2 2 3))
970 g8[ g] d[ d] g[ g] a8[( bes g]) |
971 #(set-time-signature 5 8 '(3 2))
977 \consists "Measure_grouping_engraver"
982 @c TODO End of snippet called "grouping beats"
984 @cindex compound time signatures
985 @cindex time signature, compound
987 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
988 {compound-time-signatures.ly}
994 @rglos{time signature}
997 @ref{Ancient time signatures},
998 @ref{Time administration}.
1003 Internals Reference:
1004 @rinternals{TimeSignature},
1005 @rinternals{Timing_translator}.
1009 @subsubsection Upbeats
1013 @cindex partial measure
1014 @cindex measure, partial
1015 @cindex pickup measure
1016 @cindex measure, change length
1017 @cindex measurePosition
1020 Partial or pick-up measures, such as an anacrusis or upbeat, are
1021 entered using the @code{\partial} command, with the syntax
1024 \partial @var{duration}
1027 where @code{duration} is the rhythmic length of the interval
1028 before the start of the first complete measure:
1030 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1035 The partial measure can be any duration less than a full measure:
1037 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1038 \partial 8*3 c8 d e |
1042 Internally, this is translated into
1045 \set Timing.measurePosition = -@var{duration}
1048 The property @code{measurePosition} contains a rational number
1049 indicating how much of the measure has passed at this point. Note
1050 that this is set to a negative number by the @code{\partial}
1051 command: i.e., @code{\partial 4} is internally translated to
1052 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1066 @rinternals{Timing_translator}.
1070 The @code{\partial} command is intended to be used only at the
1071 beginning of a piece. If you use it after the beginning, some
1072 odd warnings may occur.
1074 @node Unmetered music
1075 @subsubsection Unmetered music
1077 @funindex \cadenzaOn
1078 @funindex \cadenzaOff
1079 @cindex bar lines, turning off
1080 @cindex bar numbering, turning off
1082 @cindex unmetered music
1084 Bar lines and bar numbers are calculated automatically. For
1085 unmetered music (some cadenzas, for example), this is not desirable.
1086 To turn off automatic calculation of bar lines and bar numbers,
1087 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1088 to turn them on again.
1090 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1099 Bar numbering is resumed at the end of the cadenza as if the
1100 cadenza were not there:
1102 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1103 % Show all bar numbers
1104 \override Score.BarNumber #'break-visibility = #all-visible
1124 @c ref{Controlling visibility of objects}.
1131 LilyPond will insert line breaks and page breaks only at a
1132 bar line. Unless the unmetered music ends before the end of the
1133 staff line, you will need to insert invisible bar lines with
1140 to indicate where breaks can occur.
1143 @node Polymetric notation
1144 @subsubsection Polymetric notation
1146 @cindex double time signatures
1147 @cindex signatures, polymetric
1148 @cindex polymetric signatures
1149 @cindex meter, polymetric
1151 Polymetric notation is supported, either explicitly or through
1152 clever use of markup features.
1154 @strong{Staves with different time signatures, equal measure lengths}
1156 This notation can be created by setting a common time signature
1157 for each staff but replacing the symbol manually by setting
1158 @code{timeSignatureFraction} to the desired fraction and scaling
1159 the printed durations in each staff to the common time
1160 signature. This is done with @code{\scaleDurations}, which
1161 is used in a similar way to @code{\times}, but does not create
1162 a tuplet bracket, see @ref{Scaling durations}.
1164 In this example, music with the time signatures of 3/4, 9/8, and
1165 10/8 are used in parallel. In the second staff, shown durations
1166 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1167 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1169 @lilypond[quote,ragged-right,verbatim,fragment]
1178 \set Staff.timeSignatureFraction = #'(9 . 8)
1179 \scaleDurations #'(2 . 3)
1180 \repeat unfold 6 { c8[ c c] }
1184 \set Staff.timeSignatureFraction = #'(10 . 8)
1185 \scaleDurations #'(3 . 5) {
1186 \repeat unfold 2 { c8[ c c] }
1187 \repeat unfold 2 { c8[ c] } |
1188 c4. c4. \times 2/3 { c8 c c } c4
1194 @strong{Staves with different time signatures, unequal bar lengths}
1196 Each staff can be given its own independent time signature by
1197 moving the @code{Timing_translator} to the @code{Staff} context.
1199 @lilypond[quote,verbatim,ragged-right]
1203 \remove "Timing_translator"
1204 \remove "Default_bar_line_engraver"
1208 \consists "Timing_translator"
1209 \consists "Default_bar_line_engraver"
1213 % Now each staff has its own time signature.
1239 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1240 {compound-time-signatures.ly}
1247 @rglos{polymetric time signature},
1250 Notation Reference: @ref{Scaling durations}
1255 Internals Reference:
1256 @rinternals{TimeSignature},
1257 @rinternals{Timing_translator},
1262 When using different time signatures in parallel, notes
1263 at the same moment will be be placed at the same horizontal
1264 location. However, the bar lines in the different staves
1265 will cause the note spacing to be less regular in each of the
1266 individual staves than would be normal without the different
1269 @node Automatic note splitting
1270 @subsubsection Automatic note splitting
1272 @cindex notes, splitting
1273 @cindex splitting notes
1275 Long notes which overrun bar lines can be converted automatically
1276 to tied notes. This is done by replacing the
1277 @code{Note_heads_engraver} with the
1278 @code{Completion_heads_engraver}. In the following
1279 example, notes crossing the bar lines are split and tied.
1281 @lilypond[quote,fragment,verbatim,relative=1,ragged-right]
1283 \remove "Note_heads_engraver"
1284 \consists "Completion_heads_engraver"
1287 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1290 This engraver splits all running notes at the bar line, and
1291 inserts ties. One of its uses is to debug complex scores: if the
1292 measures are not entirely filled, then the ties show exactly how
1293 much each measure is off.
1297 Music Glossary: @rglos{tie}
1300 @rlearning{Engravers explained},
1301 @rlearning{Adding and removing engravers}.
1306 Internals Reference:
1307 @rinternals{Note_heads_engraver},
1308 @rinternals{Completion_heads_engraver},
1309 @rinternals{Forbid_line_break_engraver}.
1314 Not all durations (especially those containing tuplets) can be
1315 represented exactly with normal notes and dots, but the
1316 @code{Completion_heads_engraver} will not insert tuplets.
1318 The @code{Completion_heads_engraver} only affects notes; it does not
1322 @node Showing melody rhythms
1323 @subsubsection Showing melody rhythms
1325 Sometimes you might want to show only the rhythm of a melody. This
1326 can be done with the rhythmic staff. All pitches of notes on such a
1327 staff are squashed, and the staff itself has a single line
1329 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1331 \new RhythmicStaff {
1332 \new Voice = "myRhythm" {
1340 \lyricsto "myRhythm" {
1348 Guitar chord charts often show the strumming rhythms. This can
1349 be done with the @code{Pitch_squash_engraver} and
1350 @code{\improvisationOn}.
1353 @lilypond[quote,verbatim]
1362 \consists Pitch_squash_engraver
1374 @code{\improvisationOn},
1375 @code{\improvisationOff}.
1378 @c TODO -- Convert to snippet;
1379 @c tag for both Rhythms and Guitar? Move to @seealso?
1381 For guitar music, it is possible to show strum rhythms, along
1382 with melody notes, chord names, and fret diagrams.
1385 @lilypond[quote,verbatim]
1386 \include "predefined-guitar-fretboards.ly"
1402 \consists Pitch_squash_engraver
1412 \new Voice = "melody" {
1423 \lyricsto "melody" {
1436 Internals Reference:
1437 @rinternals{RhythmicStaff},
1438 @rinternals{Pitch_squash_engraver}.
1445 * Setting automatic beam behavior::
1450 @node Automatic beams
1451 @subsubsection Automatic beams
1453 By default, beams are inserted automatically:
1455 @cindex beams, manual
1456 @cindex manual beams
1458 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1460 \time 6/8 c c c c8. c16 c8
1463 If these automatic decisions are not satisfactory, beaming can be
1464 entered explicitly; see @ref{Manual beams}. It is also possible
1465 to define beaming patterns that differ from the defaults; see
1466 @ref{Setting automatic beam behavior}. The default beaming rules
1467 are defined in @file{scm/@/auto@/-beam@/.scm}.
1473 Automatic beaming may be turned off and on with
1474 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1476 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1477 c4 c8 c8. c16 c8. c16 c8
1485 @code{\autoBeamOff},
1490 @c TODO -- convert to snippet
1491 Beaming patterns may be altered with the @code{beatGrouping} property,
1493 @lilypond[quote,verbatim,relative=2,fragment,ragged-right]
1495 \set beatGrouping = #'(2 3)
1497 \set beatGrouping = #'(3 2)
1501 @c TODO convert to snippet
1502 The beams of consecutive 16th (or shorter) notes are, by default,
1503 not sub-divided. That is, the three (or more) beams stretch
1504 unbroken over entire groups of notes. This behavior can
1505 be modified to sub-divide the beams into sub-groups by setting
1506 the property @code{subdivideBeams}. When set, multiple beams
1507 will be sub-divided at intervals defined by the current value of
1508 @code{beatLength} by reducing the multiple beams to just one beam
1509 between the sub-groups. Note that @code{beatLength} lives in the
1510 @code{Score} context and defaults to a quarter note. It must be
1511 set to a fraction giving the duration of the beam sub-group
1512 using the @code{make-moment} function, as shown here:
1514 @lilypond[fragment,ragged-right,quote,relative=2,verbatim]
1516 \set subdivideBeams = ##t
1518 % Set beam sub-group length to an eighth note
1519 \set Score.beatLength = #(ly:make-moment 1 8)
1521 % Set beam sub-group length to a sixteenth note
1522 \set Score.beatLength = #(ly:make-moment 1 16)
1525 @funindex subdivideBeams
1528 For more information about @code{make-moment}, see
1529 @ref{Time administration}.
1535 @c TODO convert to snippet
1536 Line breaks are normally forbidden when beams cross bar lines.
1537 This behavior can be changed by setting the @code{breakable}
1538 property: @code{\override Beam #'breakable = ##t}.
1540 @lilypond[ragged-right,relative=2,fragment,verbatim,quote]
1541 \override Beam #'breakable = ##t
1542 c8 \repeat unfold 15 { c[ c] } c
1545 @cindex beams and line breaks
1546 @cindex beams, kneed
1548 @cindex auto-knee-gap
1550 @c TODO convert to snippet
1551 Kneed beams are inserted automatically when a large gap is
1552 detected between the note heads. This behavior can be tuned
1553 through the @code{auto-knee-gap} property. A kneed beam is
1554 drawn if the gap is larger than the value of
1555 @code{auto-knee-gap} plus the width of the beam object (which
1556 depends on the duration of the notes and the slope of the beam).
1557 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1559 @lilypond[fragment,ragged-right,quote,verbatim]
1561 \override Beam #'auto-knee-gap = #6
1570 @ref{Setting automatic beam behavior}.
1573 @file{scm/auto-beam.scm}.
1578 Internals Reference: @rinternals{Beam}.
1583 Automatically kneed cross-staff beams cannot be used together with
1584 hidden staves. See @ref{Hiding staves}.
1586 Beams can collide with note heads and accidentals in other voices
1589 @node Setting automatic beam behavior
1590 @subsubsection Setting automatic beam behavior
1592 @funindex autoBeamSettings
1593 @funindex (end * * * *)
1594 @funindex (begin * * * *)
1595 @cindex automatic beams, tuning
1596 @cindex tuning automatic beaming
1598 @c [TODO: use \applyContext]
1600 In normal time signatures, automatic beams can start on any note
1601 but can end in only a few positions within the measure: beams can
1602 end on a beat, or at durations specified by the properties in
1603 @code{autoBeamSettings}. The properties in
1604 @code{autoBeamSettings} consist of a list of rules for where beams
1605 can begin and end. The default @code{autoBeamSettings} rules are
1606 defined in @file{scm/@/auto@/-beam@/.scm}.
1608 In order to add a rule to the list, use
1610 #(override-auto-beam-setting
1611 '(beam-limit beam-numerator beam-denominator
1612 time-signature-numerator time-signature-denominator)
1613 moment-numerator moment-denominator [context])
1618 @item @code{beam-limit} is the type of automatic beam limit
1619 defined, either @code{begin} or @code{end}.
1621 @item @code{beam-numerator/beam-denominator} is the beam duration
1622 for which you want to add a rule. A beam is considered to have
1623 the duration of its shortest note. Set @code{beam-numerator} and
1624 @code{beam-denominator} to @code{'*'} to
1625 have this rule apply beams of any duration.
1627 @item @code{time-signature-numerator/time-signature-denominator}
1628 is the time signature to which
1629 this rule should apply. Set @code{time-signature-numerator} and
1630 @code{time-signature-denominator} to @code{'*'}
1631 to have this rule apply in any time signature.
1633 @item @code{monent-numerator/moment-denominator} is the position
1634 in the bar at which the beam should
1637 @item @code{context} is optional, and it specifies the context at which
1638 the change should be made. The default is @code{'Voice}.
1640 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1641 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1645 TODO -- convert to music example
1646 For example, if automatic beams should always end on the first quarter
1650 #(override-auto-beam-setting '(end * * * *) 1 4)
1653 You can force the beam settings to only take effect on beams whose shortest
1654 note is a certain duration
1656 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1658 % end 1/16 beams for all time signatures at the 1/16 moment
1659 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1661 a32 a a a a16 a a a a a |
1662 % end 1/32 beams for all time signatures at the 1/16 moment
1663 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1664 a32 a a a a16 a a a a a |
1667 You can force the beam settings to only take effect in certain time
1670 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1672 % end beams of all durations in 5/8 time signature at the 2/8 moment
1673 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1681 Existing auto-beam rules are removed by using
1684 #(revert-auto-beam-setting
1685 '(beam-limit beam-numerator beam-denominator
1686 time-signature-numerator time-signature-denominator)
1687 moment-numerator moment-denominator [context])
1691 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1692 @code{time-signature-numerator}, @code{time-signature-denominator},
1693 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1694 are the same as above. Note that the default auto-beaming rules are
1695 specified in @file{scm/@/auto@/-beam@/.scm},
1696 so you can revert rules that you did not explicitly create.
1698 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1700 a16 a a a a a a a a a a a a a a a
1701 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1702 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1703 a16 a a a a a a a a a a a a a a a
1706 The rule in a @code{revert-auto-beam-setting} statement must exactly
1707 match the original rule. That is, no wildcard expansion is taken into
1710 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
1712 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1714 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1716 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1722 @c TODO: old material -- not covered by above stuff, I think.
1723 If automatic beams should end on every quarter in 5/4 time, specify
1726 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1727 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
1728 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
1729 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
1733 The same syntax can be used to specify beam starting points. In this
1734 example, automatic beams can only end on a dotted quarter note
1736 #(override-auto-beam-setting '(end * * * *) 3 8)
1737 #(override-auto-beam-setting '(end * * * *) 1 2)
1738 #(override-auto-beam-setting '(end * * * *) 7 8)
1740 In 4/4 time signature, this means that automatic beams could end only on
1741 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1742 3/8, has passed within the measure).
1744 If any unexpected beam behavior occurs, check the default automatic beam
1745 settings in @file{scm/@/auto@/-beam@/.scm}
1746 for possible interference, because the beam
1747 endings defined there will still apply on top of your own overrides. Any
1748 unwanted endings in the default vales must be reverted for your time
1751 For example, to typeset @code{(3 4 3 2)}-beam endings in 12/8, begin
1755 %%% revert default values in scm/auto-beam.scm regarding 12/8 time
1756 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1757 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1758 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1761 #(override-auto-beam-setting '(end 1 8 12 8) 3 8)
1762 #(override-auto-beam-setting '(end 1 8 12 8) 7 8)
1763 #(override-auto-beam-setting '(end 1 8 12 8) 10 8)
1766 @cindex automatic beam generation
1768 @funindex autoBeaming
1771 If beams are used to indicate melismata in songs, then automatic
1772 beaming should be switched off with @code{\autoBeamOff}.
1777 @funindex \autoBeamOff
1778 @code{\autoBeamOff},
1779 @funindex \autoBeamOn
1785 If a score ends while an automatic beam has not been ended and is
1786 still accepting notes, this last beam will not be typeset at all.
1787 The same holds for polyphonic voices, entered with @code{<<
1788 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1789 automatic beam is still accepting notes, it is not typeset.
1798 @subsubsection Manual beams
1800 @cindex beams, manual
1804 In some cases it may be necessary to override the automatic
1805 beaming algorithm. For example, the autobeamer will not put beams
1806 over rests or bar lines, and in choral scores the beaming is
1807 often set to follow the meter of the lyrics rather than the
1808 notes. Such beams can be specified manually by
1809 marking the begin and end point with @code{[} and @code{]}
1811 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1813 r4 r8[ g' a r8] r8 g[ | a] r8
1818 Individual notes may be marked with @code{\noBeam} to prevent them
1821 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1822 \time 2/4 c8 c\noBeam c c
1825 @funindex stemLeftBeamCount
1826 @funindex stemRightBeamCount
1828 Even more strict manual control with the beams can be achieved by
1829 setting the properties @code{stemLeftBeamCount} and
1830 @code{stemRightBeamCount}. They specify the number of beams to
1831 draw on the left and right side, respectively, of the next note.
1832 If either property is set, its value will be used only once, and
1833 then it is erased. In this example, the last @code{f} is printed
1834 with only one beam on the left side, i.e., the eighth-note beam of
1835 the group as a whole.
1837 TODO -- no difference based on stemLeftBeamCount in this example
1838 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1842 \set stemLeftBeamCount = #1
1850 @node Feathered beams
1851 @subsubsection Feathered beams
1853 @cindex beams, feathered
1854 @funindex \featherDurations
1856 TODO -- this section relies on overrides. We need to either add
1857 a predefined, move this to snippets (whole section), or violate
1858 policy for this section.
1860 Feathered beams are used to indicate that a small group of notes
1861 should be played at an increasing (or decreasing) tempo, without
1862 changing the overall tempo of the piece. The extent of the
1863 feathered beam must be indicated manually using @code{[} and
1864 @code{]}, and the beam feathering is turned on by specifying a
1865 direction to the @code{Beam} property @code{grow-direction}.
1867 If the placement of the notes and the sound in the MIDI output
1868 is to reflect the ritardando or accelerando indicated by the
1869 feathered beam the notes must be grouped as a
1870 music expression delimited by braces and preceded by a
1871 @code{featheredDurations} command which specifies the ratio
1872 between the durations of the first and last notes in the group.
1875 show the extent of the beam and the braces show
1876 which notes are to have their durations modified. Normally
1877 these would delimit the same group of notes, but this is not
1878 required: the two commands are independent.
1880 @c TODO -- eliminate "Talking through code"
1882 In the following example the eight 16th notes occupy exactly the
1883 same time as a half note, but the first note is one half as long
1884 as the last one, with the intermediate notes gradually
1885 lengthening. The first four 32nd notes gradually speed up, while
1886 the last four 32nd notes are at a constant tempo.
1888 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1889 \override Beam #'grow-direction = #LEFT
1890 \featherDurations #(ly:make-moment 2 1)
1891 { c16[ c c c c c c c] }
1892 \override Beam #'grow-direction = #RIGHT
1893 \featherDurations #(ly:make-moment 2 3)
1895 % revert to non-feathered beams
1896 \override Beam #'grow-direction = #'()
1901 The spacing in the printed output represents the
1902 note durations only approximately, but the midi output is exact.
1904 @c TODO -- resolve whether or not midi is capitalized -- policy
1909 The @code{\featherDurations} command only works with very short
1910 music snippets, and when numbers in the fraction are small.
1926 * Bar and bar number checks::
1931 @subsubsection Bar lines
1935 @cindex measure lines
1938 Bar lines delimit measures, and are also used to indicate
1939 repeats. Normally, simple bar lines are automatically inserted
1940 into the printed output at places based on the current time
1943 The simple bar lines inserted automatically can be changed to
1944 other types with the @code{\bar} command. For example, a closing
1945 double bar line is usually placed at the end of a piece:
1947 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
1951 @c TODO -- make this warning more clear. What does it mean?
1952 @warning{An incorrect duration can lead to poorly formatted
1955 @c TODO -- check this. I think this behavior no longer happens
1956 @c with completion_heads_engraver, but it may with note_heads_engraver
1957 @c Make an example showing the problem
1959 It is not invalid if the final note in a measure does not
1960 end on the automatically entered bar line: the note is assumed
1961 to carry over into the next measure. But if a long sequence
1962 of such carry-over measures appears the music can appear compressed
1963 or even flowing off the page. This is because automatic line
1964 breaks happen only at the end of complete measures, i.e., where
1965 the end of a note coincides with the end of a measure.
1968 @cindex bar lines, invisible
1969 @cindex measure lines, invisible
1971 Line breaks are also permitted at manually inserted bar lines
1972 even within incomplete measures. To allow a line break without
1973 printing a bar line, use
1980 This will insert an invisible bar line and allow (but not
1981 force) a line break to occur at this point. The bar number
1982 counter is not increased. To force a line break see
1983 @ref{Line breaking}.
1985 This and other special bar lines may be inserted manually at any
1986 point. When they coincide with the end of a measure they replace
1987 the simple bar line which would have been inserted there
1988 automatically. When they do not coincide
1989 with the end of a measure the specified bar line is inserted at that
1990 point in the printed output. Such insertions do not affect
1991 the calculation and placement of subsequent automatic bar lines.
1993 The simple bar line and four types of double bar line are available
1994 for manual insertion:
1996 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1997 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
2001 together with dotted and dashed bar lines:
2003 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2004 f1 \bar ":" g \bar "dashed" a
2008 and three types of repeat bar line:
2010 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2011 f1 \bar "|:" g \bar ":|:" a \bar ":|" b
2016 Although the bar line types signifying repeats may be inserted
2017 manually they do not in themselves cause LilyPond to recognize
2018 a repeated section. Such repeated sections are better entered
2019 using the various repeat commands (see @ref{Repeats}), which
2020 automatically print the appropriate bar lines.
2022 In addition, you can specify @code{"||:"}, which is equivalent to
2023 @code{"|:"} except at line breaks, where it gives a double bar
2024 line at the end of the line and a start repeat at the beginning of
2027 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
2028 \override Score.RehearsalMark #'padding = #3
2036 In scores with many staves, a @code{\bar} command in one staff is
2037 automatically applied to all staves. The resulting bar lines are
2038 connected between different staves of a @code{StaffGroup},
2039 @code{InnerStaffGroup}, @code{PianoStaff}, or @code{GrandStaff}.
2041 @lilypond[quote,ragged-right,fragment,verbatim]
2049 \new Staff { \clef bass c4 g e g }
2051 \new Staff { \clef bass c2 c2 }
2059 @funindex defaultBarType
2061 The command @code{\bar }@var{bartype} is a shortcut for
2062 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2063 created whenever the @code{whichBar} property is
2066 The default bar type used for automatically inserted bar lines is
2067 @code{"|"}. This may be changed at any time
2068 with @code{\set Timing.defaultBarType = }@var{bartype}.
2072 Notation Reference: @ref{Line breaking}, @ref{Repeats},
2073 @c FIXME: node name changed, but is subject to further changes.
2074 @c @ref{System start delimiters}.
2079 Internals Reference: @rinternals{BarLine} (created at
2080 @rinternals{Staff} level), @rinternals{SpanBar} (across
2081 staves), @rinternals{Timing_translator} (for Timing
2086 @subsubsection Bar numbers
2089 @cindex measure numbers
2090 @funindex currentBarNumber
2092 Bar numbers are typeset by default at the start of every line except
2093 the first line. The number itself is stored in the
2094 @code{currentBarNumber} property, which is normally updated
2095 automatically for every measure. It may also be set manually:
2097 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2100 \set Score.currentBarNumber = #50
2107 @funindex barNumberVisibility
2108 @cindex bar numbers, regular spacing
2110 Bar numbers can be typeset at regular intervals instead of just at
2111 the beginning of every line. To do this the default behavior
2112 must be overridden to permit bar numbers to be printed at places
2113 other than the start of a line. This is controlled by the
2114 @code{break-visibility} property of @code{BarNumber}. This takes
2115 three values which may be set to @code{#t} or @code{#f} to specify
2116 whether the corresponding bar number is visible or not. The order
2117 of the three values is @code{end of line visible}, @code{middle of
2118 line visible}, @code{beginning of line visible}. In the following
2119 example bar numbers are printed at all possible places:
2121 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2122 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2123 \set Score.currentBarNumber = #11
2124 \bar "" % Permit first bar number to be printed
2130 @c All the rest of these examples will be added to LSR
2131 @c and moved into the Snippets. -gp
2134 and here the bar numbers are printed every two measures
2135 except at the end of the line:
2137 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2138 \override Score.BarNumber #'break-visibility = #'#(#f #t #t)
2139 \set Score.currentBarNumber = #11
2140 \bar "" % Permit first bar number to be printed
2141 % Print a bar number every second measure
2142 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2148 @cindex measure number, format
2149 @cindex bar number, format
2151 The size of the bar number may be changed. This is illustrated
2152 in the following example, which also shows how to enclose bar
2153 numbers in boxes and circles, and shows an alternative way
2154 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
2156 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2157 % Prevent bar numbers at the end of a line and permit them elsewhere
2158 \override Score.BarNumber #'break-visibility
2159 = #end-of-line-invisible
2161 % Increase the size of the bar number by 2
2162 \override Score.BarNumber #'font-size = #2
2163 \repeat unfold 3 { c1 } \bar "|"
2165 % Draw a box round the following bar number(s)
2166 \override Score.BarNumber #'stencil
2167 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
2168 \repeat unfold 3 { c1 } \bar "|"
2170 % Draw a circle round the following bar number(s)
2171 \override Score.BarNumber #'stencil
2172 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2173 \repeat unfold 4 { c1 } \bar "|."
2176 @cindex bar number alignment
2178 Bar numbers by default are left-aligned to their parent object.
2179 This is usually the left edge of a line or, if numbers are printed
2180 within a line, the left bar line of the measure. The numbers may also
2181 be positioned directly on the bar line or right-aligned to the
2184 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2185 \set Score.currentBarNumber = #111
2186 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2187 % Increase the size of the bar number by 2
2188 \override Score.BarNumber #'font-size = #2
2189 % Print a bar number every second measure
2190 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2192 % Center-align bar numbers
2193 \override Score.BarNumber #'self-alignment-X = #0
2195 % Right-align bar numbers
2196 \override Score.BarNumber #'self-alignment-X = #-1
2200 Bar numbers can be removed entirely by removing the
2201 @code{Bar_number_engraver} from the @code{Score} context.
2203 @lilypond[verbatim,ragged-right,quote]
2207 \remove "Bar_number_engraver"
2222 Internals Reference: @rinternals{BarNumber}.
2227 Bar numbers may collide with the top of the
2228 @rinternals{StaffGroup} bracket, if there is one. To solve
2229 this, the @code{padding} property of @rinternals{BarNumber} can
2230 be used to position the number correctly.
2232 Bar numbers may only be printed at bar lines; to print a bar
2233 number at the beginning of a piece, an empty bar line must be
2234 inserted there, and a value other than @code{1} must be placed
2235 in @code{currentBarNumber}:
2237 @lilypond[verbatim,ragged-right,quote,fragment,relative]
2238 \set Score.currentBarNumber = #50
2247 @node Bar and bar number checks
2248 @subsubsection Bar and bar number checks
2251 @funindex barCheckSynchronize
2254 Bar checks help detect errors in the entered durations.
2255 A bar check may be entered using the bar symbol, @code{|},
2256 at any place where a bar line is expected to fall.
2257 If bar check lines are encountered at other places,
2258 a list of warnings is printed in the log file,
2259 showing the line numbers and lines
2260 in which the bar checks failed. In the next
2261 example, the second bar check will signal an error.
2264 \time 3/4 c2 e4 | g2 |
2267 Bar checks can also be used in lyrics, for example
2272 Twin -- kle | Twin -- kle |
2276 An incorrect duration can result in a completely garbled score,
2277 especially if the score is polyphonic, so a good place to start
2278 correcting input is by scanning for failed bar checks and
2279 incorrect durations.
2281 If successive bar checks are off by the same musical interval,
2282 only the first warning message is displayed. This allows the
2283 warning to focus on the source of the timing error.
2287 @funindex pipeSymbol
2289 It is also possible to redefine the action taken when a bar check
2290 or pipe symbol, @code{|}, is encountered in the input, so that
2291 it does something other than a bar check. This is done by
2292 assigning a music expression to @code{pipeSymbol}.
2293 In the following example @code{|} is set to insert a double bar
2294 line wherever it appears in the input, rather than checking
2297 @lilypond[quote,ragged-right,verbatim]
2298 pipeSymbol = \bar "||"
2307 When copying large pieces of music, it can be helpful to check
2308 that the LilyPond bar number corresponds to the original that you
2309 are entering from. This can be checked with
2310 @code{\barNumberCheck}, for example,
2313 \barNumberCheck #123
2317 will print a warning if the @code{currentBarNumber} is not 123
2318 when it is processed.
2326 @node Rehearsal marks
2327 @subsubsection Rehearsal marks
2329 @cindex rehearsal marks
2330 @cindex mark, rehearsal
2333 To print a rehearsal mark, use the @code{\mark} command
2335 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2344 The letter@tie{}@q{I} is skipped in accordance with engraving
2345 traditions. If you wish to include the letter @q{I}, then use
2348 \set Score.markFormatter = #format-mark-alphabet
2351 The mark is incremented automatically if you use @code{\mark
2352 \default}, but you can also use an integer argument to set the
2353 mark manually. The value to use is stored in the property
2354 @code{rehearsalMark}.
2356 @cindex rehearsal mark format
2357 @cindex rehearsal mark style
2358 @cindex style, rehearsal mark
2359 @cindex format, rehearsal mark
2360 @cindex mark, rehearsal, style
2361 @cindex mark, rehearsal, format
2363 The style is defined by the property @code{markFormatter}. It is
2364 a function taking the current mark (an integer) and the current
2365 context as argument. It should return a markup object. In the
2366 following example, @code{markFormatter} is set to a pre-defined
2367 procedure. After a few measures, it is set to a procedure that
2368 produces a boxed number.
2370 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
2371 \set Score.markFormatter = #format-mark-numbers
2374 \set Score.markFormatter = #format-mark-box-numbers
2380 The file @file{scm/@/translation@/-functions@/.scm} contains the
2381 definitions of @code{format-mark-numbers} (the default format),
2382 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2383 @code{format-mark-box-letters}. These can be used as inspiration
2384 for other formatting functions.
2386 You may use @code{format-mark-barnumbers},
2387 @code{format-mark-box-barnumbers}, and
2388 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2389 incremented numbers or letters.
2391 Other styles of rehearsal mark can be specified manually
2398 @code{Score.markFormatter} does not affect marks specified in this
2399 manner. However, it is possible to apply a @code{\markup} to the
2403 \mark \markup@{ \box A1 @}
2410 Music glyphs (such as the segno sign) may be printed inside a
2413 @lilypond[fragment,quote,ragged-right,verbatim,relative]
2414 c1 \mark \markup { \musicglyph #"scripts.segno" }
2415 c1 \mark \markup { \musicglyph #"scripts.coda" }
2416 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2421 See @ref{The Feta font}, for a list of symbols which may be
2422 printed with @code{\musicglyph}.
2424 For common tweaks to the positioning of rehearsal marks, see
2425 @ref{Formatting text}.
2430 @ref{The Feta font},
2431 @ref{Formatting text}.
2434 @file{scm/@/translation@/-functions@/.scm} contains
2435 the definition of @code{format-mark-numbers} and
2436 @code{format-mark-letters}. They can be used as inspiration for
2437 other formatting functions.
2442 Internals Reference: @rinternals{RehearsalMark}.
2444 Examples: @c @lsr{parts,rehearsal-mark-numbers.ly}
2446 @node Special rhythmic concerns
2447 @subsection Special rhythmic concerns
2452 * Aligning to cadenzas::
2453 * Time administration::
2457 @subsubsection Grace notes
2462 @cindex appoggiatura
2463 @cindex acciaccatura
2465 Grace notes are ornaments that are written out. Grace notes
2466 are printed in a smaller font and take up no logical time
2469 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2471 \grace { c16[ d16] } c2
2474 Lilypond also supports two special types of grace notes, the
2475 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2476 small note with a slashed stem--and the @emph{appoggiatura}, which
2477 takes a fixed fraction of the main note and appears in small print
2480 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2484 \acciaccatura { g16[ f] } e4
2487 The placement of grace notes is synchronized between different
2488 staves. In the following example, there are two sixteenth grace
2489 notes for every eighth grace note
2491 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2492 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2493 \new Staff { c2 \grace { g8[ b] } c2 } >>
2496 @funindex \afterGrace
2498 @cindex grace notes, following
2500 If you want to end a note with a grace, use the @code{\afterGrace}
2501 command. It takes two arguments: the main note, and the grace
2502 notes following the main note.
2504 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2505 c1 \afterGrace d1 { c16[ d] } c1
2508 This will put the grace notes after a space lasting 3/4 of the
2509 length of the main note. The default fraction 3/4 can be changed by
2510 setting @code{afterGraceFraction}. The following example shows
2511 the results from setting the space at the default, at 15/16, and
2512 finally at 1/2 of the main note.
2514 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2517 c1 \afterGrace d1 { c16[ d] } c1
2520 #(define afterGraceFraction (cons 15 16))
2521 c1 \afterGrace d1 { c16[ d] } c1
2524 #(define afterGraceFraction (cons 1 2))
2525 c1 \afterGrace d1 { c16[ d] } c1
2530 The space between the main note and the grace note may also be
2531 specified using spacers. The following example places the grace
2532 note after a space lasting 7/8 of the main note.
2534 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2537 { s2 s4. \grace { c16[ d] } } >>
2542 A @code{\grace} music expression will introduce special
2543 typesetting settings, for example, to produce smaller type, and
2544 set directions. Hence, when introducing layout tweaks to
2545 override the special settings, they should be placed inside
2546 the grace expression. The overrides should also be reverted
2547 inside the grace expression. Here, the grace note's default stem
2548 direction is overriden and then reverted.
2550 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2562 @cindex stem, with slash
2567 The slash through the stem found in @emph{acciaccatura}s can be applied
2568 in other situations:
2570 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2572 \override Stem #'stroke-style = #"grace"
2577 The layout of grace expressions can be changed throughout the
2578 music using the function @code{add-grace-property}. The following
2579 example undefines the @code{Stem} direction for this grace, so
2580 that stems do not always point up.
2582 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2585 #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
2586 #(remove-grace-property 'Voice 'Stem 'direction)
2588 \acciaccatura { f16 } g4
2589 \grace { d16[ e] } f4
2590 \appoggiatura { a,32[ b c d] } e2
2596 Another option is to change the variables @code{startGraceMusic},
2597 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2598 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2599 @code{stopAppoggiaturaMusic}. The default values of these can be
2600 seen in the file @code{ly/@/grace@/-init@/.ly}. By redefining
2601 them other effects may be obtained.
2603 Grace notes may be forced to align with regular notes
2606 @lilypond[verbatim,quote,ragged-right]
2609 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2612 \afterGrace c4 { c16[ c8 c16] }
2616 c16 c c c c c c c c4 r
2626 @rglos{grace notes},
2627 @rglos{acciaccatura},
2628 @rglos{appoggiatura}.
2630 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2632 Snippets: @rlsr{Rhythms}.
2634 Internals Reference: @rinternals{GraceMusic}.
2639 A multi-note beamed @emph{acciaccatura} is printed without a slash,
2640 and looks exactly the same as a multi-note beamed
2641 @emph{appoggiatura}.
2642 @c TODO Add link to LSR snippet to add slash when available
2644 Grace note synchronization can also lead to surprises. Staff
2645 notation, such as key signatures, bar lines, etc., are also
2646 synchronized. Take care when you mix staves with grace notes and
2647 staves without, for example,
2649 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2650 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2651 \new Staff { c4 \bar "|:" d2. } >>
2655 This can be remedied by inserting grace skips of the corresponding
2656 durations in the other staves. For the above example
2658 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2659 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2660 \new Staff { c4 \bar "|:" \grace s16 d2. } >>
2663 Grace sections should only be used within sequential music
2664 expressions. Nesting or juxtaposing grace sections is not
2665 supported, and might produce crashes or other errors.
2667 @node Aligning to cadenzas
2668 @subsubsection Aligning to cadenzas
2671 @cindex cadenza, aligning to
2672 @cindex aligning to cadenza
2674 In an orchestral context, cadenzas present a special problem: when
2675 constructing a score that includes a measured cadenza or other solo
2676 passage, all other instruments should skip just as many notes as the
2677 length of the cadenza, otherwise they will start too soon or too late.
2679 One solution to this problem is to use the functions
2680 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2681 functions take a defined piece of music as an argument and generate a
2682 multi-measure rest or @code{\skip} exactly as long as the piece.
2684 @lilypond[verbatim,ragged-right,quote]
2685 MyCadenza = \relative c' {
2696 #(ly:export (mmrest-of-length MyCadenza))
2698 #(ly:export (skip-of-length MyCadenza))
2713 @node Time administration
2714 @subsubsection Time administration
2716 @cindex time administration
2717 @cindex timing (within the score)
2718 @cindex music, unmetered
2719 @cindex unmetered music
2721 @funindex currentBarNumber
2722 @funindex measurePosition
2723 @funindex measureLength
2725 Time is administered by the @code{Timing_translator}, which by
2726 default is to be found in the @code{Score} context. An alias,
2727 @code{Timing}, is added to the context in which the
2728 @code{Timing_translator} is placed.
2730 The following properties of @code{Timing} are used
2731 to keep track of timing within the score.
2734 @cindex measure number
2737 @item currentBarNumber
2738 The current measure number. For an example showing the
2739 use of this property see @ref{Bar numbers}.
2742 The length of the measures in the current time signature. For a
2743 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2744 determines when bar lines are inserted and how automatic beams
2745 should be generated.
2747 @item measurePosition
2748 The point within the measure where we currently are. This
2749 quantity is reset by subtracting @code{measureLength} whenever
2750 @code{measureLength} is reached or exceeded. When that happens,
2751 @code{currentBarNumber} is incremented.
2754 If set to true, the above variables are updated for every time
2755 step. When set to false, the engraver stays in the current
2756 measure indefinitely.
2760 Timing can be changed by setting any of these variables
2761 explicitly. In the next example, the default 4/4 time
2762 signature is printed, but @code{measureLength} is set to 5/4.
2763 At 4/8 through the third measure, the @code{measurePosition} is
2764 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2765 The next bar line then falls at 9/8 rather than 5/4.
2767 @lilypond[quote,ragged-right,verbatim,relative,fragment]
2768 \set Score.measureLength = #(ly:make-moment 5 4)
2772 \set Score.measurePosition = #(ly:make-moment 5 8)
2778 As the example illustrates, @code{ly:make-moment n m} constructs a
2779 duration of n/m of a whole note. For example,
2780 @code{ly:make-moment 1 8} is an eighth note duration and
2781 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2787 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2792 Internals Reference: @rinternals{Timing_translator},