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.
30 @lilypondfile[quote]{rhythms-headword.ly}
32 This section discusses rhythms, rests, durations, beaming and bars.
37 * Displaying rhythms::
40 * Special rhythmic concerns::
45 @subsection Writing rhythms
55 @unnumberedsubsubsec Durations
57 @cindex durations, of notes
58 @cindex note durations
64 Durations are designated by numbers and dots.
65 Durations are entered as their reciprocal values. For example, a
66 quarter note is entered using a @code{4} (since it is a 1/4 note),
67 and a half note is entered using a @code{2} (since it is a 1/2
68 note). For notes longer than a whole you must use the
69 @code{\longa} (a double breve) and @code{\breve} commands.
70 Durations as short as 64th notes may be specified. Shorter values
71 are possible, but only as beamed notes.
73 @c Two 64th notes are needed to obtain beams
74 @lilypond[quote,verbatim,relative=2]
81 Here are the same durations with automatic beaming turned off.
83 @c not strictly "writing rhythms"; more of a "displaying" thing,
84 @c but it's ok here. -gp
85 @lilypond[quote,verbatim,relative=2]
92 A note with the duration of a quadruple breve may be entered with
93 @code{\maxima}, but this is supported only within ancient music
94 notation. For details, see @ref{Ancient notation}.
96 If the duration is omitted, it is set to the previously
97 entered duration. The default for the first note is a quarter
100 @lilypond[quote,verbatim,relative=2]
104 @cindex notes, dotted
109 To obtain dotted note lengths, place a dot (@code{.}) after the
110 duration. Double-dotted notes are specified by appending two
113 @lilypond[quote,verbatim,relative=2]
114 a4 b c4. b8 a4. b4.. c8.
117 Some durations cannot be represented with just binary durations
118 and dots; they can be represented only by tying two or more
119 notes together. For details, see @ref{Ties}.
121 For ways of specifying durations for the syllables of lyrics and
122 ways of aligning lyrics to notes, see @ref{Vocal music}.
124 Optionally, notes can be spaced strictly proportionately to their
125 duration. For details of this and other settings which control
126 proportional notation, see @ref{Proportional notation}.
130 @funindex \dotsNeutral
132 Dots are normally moved up to avoid staff lines, except in
133 polyphonic situations. Predefined commands are available to
134 force a particular direction manually, for details
135 see @ref{Direction and placement}.
151 @rglos{Duration names notes and rests}.
154 @ref{Automatic beams},
156 @ref{Writing rhythms},
159 @ref{Ancient notation},
160 @ref{Proportional notation}.
167 @rinternals{DotColumn}.
172 @c Deliberately duplicated in Durations and Rests. -gp
173 There is no fundamental limit to rest durations (both in terms of
174 longest and shortest), but the number of glyphs is limited:
175 rests from 128th to maxima (8 x whole) may be printed.
179 @unnumberedsubsubsec Tuplets
185 Tuplets are made from a music expression by multiplying all the
186 durations with a fraction:
189 \times @var{fraction} @{ @var{music} @}
193 The duration of @var{music} will be multiplied by the
194 fraction. The fraction's denominator will be printed over or
195 under the notes, optionally with a bracket. The most common
196 tuplet is the triplet in which 3 notes have the duration of 2, so
197 the notes are 2/3 of their written length.
199 @lilypond[quote,verbatim,relative=2]
200 a2 \times 2/3 { b4 b b }
201 c4 c \times 2/3 { b4 a g }
205 @funindex \tupletDown
206 @funindex \tupletNeutral
208 The automatic placement of the tuplet bracket above or below the
209 notes may be overridden manually with predefined commands, for
210 details see @ref{Direction and placement}.
212 Tuplets may be nested:
214 @lilypond[quote,verbatim,relative=2]
216 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
219 Modifying nested tuplets which begin at the same musical moment
220 must be done with @code{\tweak}.
222 To modify the duration of notes without printing a tuplet bracket,
223 see @ref{Scaling durations}.
229 @code{\tupletNeutral}.
234 @cindex tuplet formatting
235 @cindex triplet formatting
237 @funindex tupletNumberFormatFunction
238 @funindex tupletSpannerDuration
240 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
241 {entering-several-tuplets-using-only-one--times-command.ly}
243 @funindex TupletNumber
245 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
246 {changing-the-tuplet-number.ly}
248 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
249 {permitting-line-breaks-within-beamed-tuplets.ly}
258 Learning Manual: @rlearning{Tweaking methods}.
261 @ref{Time administration},
262 @ref{Scaling durations},
263 @ref{The tweak command},
264 @ref{Polymetric notation}.
270 @rinternals{TupletBracket},
271 @rinternals{TupletNumber},
272 @rinternals{TimeScaledMusic}.
275 @cindex grace notes within tuplet brackets
276 When the first note on a staff is a grace note followed by a
277 tuplet the grace note must be placed before the @code{\times}
278 command to avoid errors. Anywhere else, grace notes may be
279 placed within tuplet brackets.
282 @node Scaling durations
283 @unnumberedsubsubsec Scaling durations
285 @cindex scaling durations
286 @cindex durations, scaling
288 You can alter the duration of single notes, rests or chords by a
289 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if
290 @code{M} is 1) to the duration.
291 This will not affect the appearance of the notes or rests
292 produced, but the altered duration will be used in calculating the
293 position within the measure and setting the duration in the MIDI
294 output. Multiplying factors may be combined such as @code{*L*M/N}.
296 In the following example, the first three notes take up exactly
297 two beats, but no triplet bracket is printed.
299 @lilypond[quote,relative=2,verbatim]
301 % Alter durations to triplets
302 a4*2/3 gis4*2/3 a4*2/3
305 % Double the duration of chord
307 % Duration of quarter, appears like sixteenth
311 The duration of skip or spacing notes may also be modified by
312 a multiplier. This is useful for skipping many measures, e.g.,
315 @cindex compressing music
316 @funindex \scaleDurations
318 Longer stretches of music may be compressed by a fraction in the
319 same way, as if every note, chord or rest had the fraction as a
320 multiplier. This leaves the appearance of the music unchanged but
321 the internal duration of the notes will be multiplied by the
322 fraction @emph{num}/@emph{den}. The spaces around the dot are
323 required. Here is an example showing how music can be compressed
326 @lilypond[quote,relative=2,verbatim]
330 % Scale music by *2/3
331 \scaleDurations #'(2 . 3) {
335 \scaleDurations #'(2 . 1) {
341 One application of this command is in polymetric
342 notation, see @ref{Polymetric notation}.
349 @ref{Invisible rests},
350 @ref{Polymetric notation}.
357 @unnumberedsubsubsec Ties
362 A tie connects two adjacent note heads of the same pitch. The tie
363 in effect extends the duration of a note.
365 @warning{Ties should not be confused with @emph{slurs}, which
366 indicate articulation, or @emph{phrasing slurs}, which indicate
367 musical phrasing. A tie is just a way of extending a note
368 duration, similar to the augmentation dot.}
370 A tie is entered using the tilde symbol @code{~}
372 @lilypond[quote,verbatim,relative=2]
378 Ties are used either when the note crosses a bar line, or when
379 dots cannot be used to denote the rhythm. Ties should also be
380 used when note values cross larger subdivisions of the measure:
382 @lilypond[verbatim,quote]
389 If you need to tie many notes across bar lines, it may be
390 easier to use automatic note splitting, see @ref{Automatic note
391 splitting}. This mechanism automatically splits long notes, and
392 ties them across bar lines.
394 @cindex ties and chords
395 @cindex chords and ties
397 When a tie is applied to a chord, all note heads whose pitches
398 match are connected. When no note heads match, no ties will be
399 created. Chords may be partially tied by placing the tie inside
402 @lilypond[quote,verbatim,relative=1]
404 <c~ e g~ b> <c e g b>
408 @cindex repeating ties
409 @cindex ties, repeating
410 @cindex volta brackets and ties
411 @cindex ties and volta brackets
413 When a second alternative of a repeat starts with a tied note, you
414 have to specify the repeated tie as follows:
416 @lilypond[quote,relative=2,verbatim]
417 \repeat volta 2 { c g <c e>2 ~ }
419 % First alternative: following note is tied normally
421 % Second alternative: following note has a repeated tie
422 { <c e>2\repeatTie d4 c } }
425 @cindex laissez vibrer
426 @cindex ties, laissez vibrer
427 @funindex \laissezVibrer
429 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
430 notes must not be damped at the end. It is used in notation for
431 piano, harp and other string and percussion instruments. They can
432 be entered as follows:
434 @lilypond[quote,verbatim,relative=1]
435 <c f g>1\laissezVibrer
438 @cindex ties, placement
441 @funindex \tieNeutral
443 The vertical placement of ties may be controlled, see
444 Predefined commands, or for details, see
445 @ref{Direction and placement}.
447 @cindex ties, appearance
452 Solid, dotted or dashed ties may be specified, see Predefined
468 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
469 {using-ties-with-arpeggios.ly}
471 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
472 {engraving-ties-manually.ly}
479 @rglos{laissez vibrer}.
481 Notation Reference: @ref{Automatic note splitting}.
487 @rinternals{LaissezVibrerTie},
488 @rinternals{LaissezVibrerTieColumn},
489 @rinternals{TieColumn},
495 Switching staves when a tie is active will not produce a slanted
498 Changing clefs or octavations during a tie is not really
499 well-defined. In these cases, a slur may be preferable.
506 @subsection Writing rests
508 Rests are entered as part of the music in music expressions.
513 * Full measure rests::
517 @unnumberedsubsubsec Rests
519 @cindex rest, entering durations
530 Rests are entered like notes with the note name @code{r}.
531 Durations longer than a whole rest use the predefined
534 @c \time 16/1 is used to avoid spurious bar lines
535 @c and long tracts of empty measures
536 @lilypond[fragment,quote,verbatim]
538 % These two lines are just to prettify this example
540 \override Staff.TimeSignature #'stencil = ##f
541 % Print a maxima rest, equal to four breves
543 % Print a longa rest, equal to two breves
547 r1 r2 r4 r8 r16 r32 r64 r128
551 @cindex rest, multi-measure
552 @cindex rest, whole-measure
554 Whole measure rests, centered in the middle of the measure, must be
555 entered as multi-measure rests. They can be used for a single
556 measure as well as many measures and are discussed in @ref{Full
559 @cindex rest, specifying vertical position
561 To explicitly specify a rest's vertical position, write a note
562 followed by @code{\rest}. A rest of the duration of the note will
563 be placed at the staff position where the note would appear. This
564 allows for precise manual formatting of polyphonic music, since the
565 automatic rest collision formatter will not move these rests.
567 @lilypond[quote,verbatim,relative=2]
573 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
580 @ref{Full measure rests}.
591 @c Deliberately duplicated in Durations and Rests. -gp
592 There is no fundamental limit to rest durations (both in terms of
593 longest and shortest), but the number of glyphs is limited: there
594 are rests from 128th to maxima (8 x whole).
597 @node Invisible rests
598 @unnumberedsubsubsec Invisible rests
601 @cindex invisible rest
602 @cindex rest, invisible
607 An invisible rest (also called a @q{spacer rest}) can be entered
608 like a note with the note name@tie{}@code{s}:
610 @lilypond[verbatim,quote,relative=2]
617 Spacer rests are available only in note mode and chord mode. In
618 other situations, for example, when entering lyrics, @code{\skip}
619 is used to skip a musical moment. @code{\skip} requires an
622 @lilypond[quote,verbatim,relative=2]
635 A spacer rest implicitly causes @code{Staff} and @code{Voice}
636 contexts to be created if none exist, just like notes and rests
639 @lilypond[quote,verbatim,fragment]
643 @code{\skip} simply skips musical time; it creates no output of
646 @lilypond[quote,verbatim,fragment]
647 % This is valid input, but does nothing
648 \skip 1 \skip1 \skip 1
656 Internals Reference: @rinternals{SkipMusic}
659 @node Full measure rests
660 @unnumberedsubsubsec Full measure rests
662 @cindex multi-measure rests
663 @cindex full-measure rests
664 @cindex rest, multi-measure
665 @cindex rest, full-measure
666 @cindex whole rest for a full measure
669 Rests for one or more full measures are entered like notes with
670 the note name uppercase @code{R}:
672 @lilypond[quote,verbatim,relative=2]
673 % Rest measures contracted to single measure
674 \compressFullBarRests
681 The duration of full-measure rests is identical to the duration notation
682 used for notes. The duration in a multi-measure rest must always be an
683 integral number of measure-lengths, so augmentation
684 dots or fractions must often be used:
686 @lilypond[quote,fragment,verbatim]
687 \compressFullBarRests
693 R1*13/8 | R1*13/8*12 |
698 A full-measure rest is printed as either a whole
699 or breve rest, centered in the measure, depending on the time
702 @lilypond[quote,verbatim,fragment]
710 @funindex \expandFullBarRests
711 @funindex \compressFullBarRests
712 @cindex multi-measure rest, expanding
713 @cindex multi-measure rest, contracting
715 By default a multi-measure rest is expanded in the printed score
716 to show all the rest measures explicitly.
717 Alternatively, a mult-measure rest can be shown as a single measure
718 containing a multi-measure rest symbol, with the number of measures of rest
719 printed above the measure:
721 @lilypond[quote,fragment,verbatim]
723 \time 3/4 r2. | R2.*2 |
726 % Rest measures contracted to single measure
727 \compressFullBarRests
729 % Rest measures expanded
736 @cindex text on multi-measure rest
737 @cindex multi-measure rest, attaching text
738 @cindex script on multi-measure rest
739 @cindex multi-measure rest, script
740 @cindex fermata on multi-measure rest
741 @cindex multi-measure rest, attaching fermata
743 Markups can be added to multi-measure rests.
744 The predefined command @code{\fermataMarkup}
745 is provided for adding fermatas.
747 @lilypond[quote,verbatim,fragment]
748 \compressFullBarRests
750 R2.*10^\markup { \italic "ad lib." }
755 Markups attached to a multi-measure rest are
756 objects of type @code{MultiMeasureRestText}, not
757 @code{TextScript}. Overrides must be directed to the correct
758 object, or they will be ignored. See the following example.
761 @lilypond[quote,verbatim,fragment]
762 % This fails, as the wrong object name is specified
763 \override TextScript #'padding = #5
765 % This is correct and works
766 \override MultiMeasureRestText #'padding = #5
770 When a multi-measure rest immediately follows a @code{\partial}
771 setting, resulting bar-check warnings may not be displayed.
774 @code{\textLengthOn},
775 @code{\textLengthOff},
776 @code{\fermataMarkup},
777 @code{\compressFullBarRests},
778 @code{\expandFullBarRests}.
784 @cindex kirchenpausen
786 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
787 {changing-form-of-multi--measure-rests.ly}
789 @cindex multi-measure rests, positioning
790 @cindex positioning multi-measure rests
792 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
793 {positioning-multi--measure-rests.ly}
795 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
796 {multi--measure-rest-markup.ly}
801 @rglos{multi-measure rest}.
806 @ref{Formatting text},
813 @rinternals{MultiMeasureRest},
814 @rinternals{MultiMeasureRestNumber},
815 @rinternals{MultiMeasureRestText}.
820 If an attempt is made to use fingerings (e.g.,
821 @code{R1*10-4}) to put numbers over multi-measure rests, the
822 fingering numeral (4) may collide with the bar counter
825 @cindex condensing rests
826 @cindex rest, condensing ordinary
828 There is no way to automatically condense multiple ordinary rests
829 into a single multi-measure rest.
831 @cindex rest, collisions of
833 Multi-measure rests do not take part in rest collisions.
835 @node Displaying rhythms
836 @subsection Displaying rhythms
842 * Polymetric notation::
843 * Automatic note splitting::
844 * Showing melody rhythms::
848 @unnumberedsubsubsec Time signature
850 @cindex time signature
854 The time signature is set as follows:
856 @lilypond[quote,verbatim,relative=2]
861 @cindex Time signature, visibility of
863 Time signatures are printed at the beginning of a piece
864 and whenever the time signature changes. If a change takes place
865 at the end of a line a warning time signature sign is printed
866 there. This default behavior may be changed, see
867 @c ref{Controlling visibility of objects}.
869 @lilypond[quote,verbatim,relative=2]
879 @funindex \numericTimeSignature
880 @funindex \defaultTimeSignature
881 @cindex time signature style
883 The time signature symbol that is used in 2/2 and 4/4 time can be
884 changed to a numeric style:
886 @lilypond[quote,verbatim,relative=2]
890 % Change to numeric style
891 \numericTimeSignature
894 % Revert to default style
895 \defaultTimeSignature
901 Mensural time signatures are covered in
902 @ref{Mensural time signatures}.
906 @code{\numericTimeSignature},
907 @code{\defaultTimeSignature}.
911 @c TODO Send as snippet called "setting measure and beat lengths"
912 @c when example is added
914 @c This example seems rather obscure. Perhaps the effect of
915 @c changing the three variables could be separated out -td
917 @code{\time} sets the properties @code{timeSignatureFraction},
918 @code{beatLength}, and @code{measureLength} in the @code{Timing}
919 context, which is normally aliased to @code{Score}. Changing the
920 value of @code{timeSignatureFraction} causes the new time
921 signature symbol to be printed without changing the other
922 properties. The property @code{measureLength} determines where
923 bar lines should be inserted and, with @code{beatLength}
924 and @code{beatGrouping}, how
925 automatic beams should be generated.
927 @lilypond[quote,verbatim,relative=2]
928 \time 3/4 % auto beam on 1/4 note groups
929 a16 a a a a a a a a a a a a a a a
930 \time 12/16 % no defined auto-beaming for this time sig
931 a16 a a a a a a a a a a a a a a a
933 a16 a a a a a a a a a a a a a a a
934 \set Score.timeSignatureFraction = #'(12 16) %keep 3/4 beaming
936 a16 a a a a a a a a a a a a a a a
937 \set Score.beatLength = #(ly:make-moment 1 8) %beam on 1/8 notes
938 a16 a a a a a a a a a a a a a a a
939 \set Score.beatLength = #(ly:make-moment 1 16)
940 \set Score.beatGrouping = #'(3 4 2 3) %beam on 3/16, 7/16, 9/16, 12/16
941 a16 a a a a a a a a a a a a a a a
947 @cindex measure groupings
948 @cindex beats, grouping
949 @cindex grouping beats
950 @cindex measure sub-grouping
952 @c TODO Sent as snippet called "Conducting signs, measure grouping signs" 18 Oct 08 -td
953 Options to group beats within a bar are available through the
954 Scheme function @code{set-time-signature}, which takes three
955 arguments: the number of beats, the beat length, and the internal
956 grouping of beats in the measure. If the
957 @rinternals{Measure_grouping_engraver} is included, the function
958 will also create @rinternals{MeasureGrouping} signs. Such signs
959 ease reading rhythmically complex modern music. In the example,
960 the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to
961 @code{set-time-signature} as the third argument: @code{'(2 2 2 3)}:
963 @lilypond[quote,ragged-right,verbatim]
966 #(set-time-signature 9 8 '(2 2 2 3))
967 g8[ g] d[ d] g[ g] a8[( bes g]) |
968 #(set-time-signature 5 8 '(3 2))
974 \consists "Measure_grouping_engraver"
979 @c TODO End of snippet called "grouping beats"
981 @cindex compound time signatures
982 @cindex time signature, compound
984 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
985 {compound-time-signatures.ly}
991 @rglos{time signature}
994 @ref{Mensural time signatures},
995 @ref{Time administration}.
1000 Internals Reference:
1001 @rinternals{TimeSignature},
1002 @rinternals{Timing_translator}.
1006 @unnumberedsubsubsec Upbeats
1010 @cindex partial measure
1011 @cindex measure, partial
1012 @cindex pickup measure
1013 @cindex measure, change length
1014 @cindex measurePosition
1017 Partial or pick-up measures, such as an anacrusis or upbeat, are
1018 entered using the @code{\partial} command, with the syntax
1021 \partial @var{duration}
1024 where @code{duration} is the rhythmic length of the interval
1025 before the start of the first complete measure:
1027 @lilypond[quote,verbatim,relative=2]
1032 The partial measure can be any duration less than a full measure:
1034 @lilypond[quote,verbatim,relative=2]
1035 \partial 8*3 c8 d e |
1039 Internally, this is translated into
1042 \set Timing.measurePosition = -@var{duration}
1045 The property @code{measurePosition} contains a rational number
1046 indicating how much of the measure has passed at this point. Note
1047 that this is set to a negative number by the @code{\partial}
1048 command: i.e., @code{\partial 4} is internally translated to
1049 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1063 @rinternals{Timing_translator}.
1067 The @code{\partial} command is intended to be used only at the
1068 beginning of a piece. If you use it after the beginning, some
1069 odd warnings may occur.
1071 @node Unmetered music
1072 @unnumberedsubsubsec Unmetered music
1074 @funindex \cadenzaOn
1075 @funindex \cadenzaOff
1076 @cindex bar lines, turning off
1077 @cindex bar numbering, turning off
1079 @cindex unmetered music
1081 Bar lines and bar numbers are calculated automatically. For
1082 unmetered music (some cadenzas, for example), this is not desirable.
1083 To turn off automatic calculation of bar lines and bar numbers,
1084 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1085 to turn them on again.
1087 @lilypond[verbatim,relative=2,fragment]
1096 Bar numbering is resumed at the end of the cadenza as if the
1097 cadenza were not there:
1099 @lilypond[verbatim,relative=2,fragment]
1100 % Show all bar numbers
1101 \override Score.BarNumber #'break-visibility = #all-visible
1121 @c ref{Controlling visibility of objects}.
1128 LilyPond will insert line breaks and page breaks only at a
1129 bar line. Unless the unmetered music ends before the end of the
1130 staff line, you will need to insert invisible bar lines with
1137 to indicate where breaks can occur.
1140 @node Polymetric notation
1141 @unnumberedsubsubsec Polymetric notation
1143 @cindex double time signatures
1144 @cindex signatures, polymetric
1145 @cindex polymetric signatures
1146 @cindex meter, polymetric
1148 Polymetric notation is supported, either explicitly or through
1149 clever use of markup features.
1151 @strong{Staves with different time signatures, equal measure lengths}
1153 This notation can be created by setting a common time signature
1154 for each staff but replacing the symbol manually by setting
1155 @code{timeSignatureFraction} to the desired fraction and scaling
1156 the printed durations in each staff to the common time
1157 signature. This is done with @code{\scaleDurations}, which
1158 is used in a similar way to @code{\times}, but does not create
1159 a tuplet bracket, see @ref{Scaling durations}.
1161 In this example, music with the time signatures of 3/4, 9/8, and
1162 10/8 are used in parallel. In the second staff, shown durations
1163 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1164 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1166 @lilypond[quote,verbatim,fragment]
1175 \set Staff.timeSignatureFraction = #'(9 . 8)
1176 \scaleDurations #'(2 . 3)
1177 \repeat unfold 6 { c8[ c c] }
1181 \set Staff.timeSignatureFraction = #'(10 . 8)
1182 \scaleDurations #'(3 . 5) {
1183 \repeat unfold 2 { c8[ c c] }
1184 \repeat unfold 2 { c8[ c] } |
1185 c4. c4. \times 2/3 { c8 c c } c4
1191 @strong{Staves with different time signatures, unequal bar lengths}
1193 Each staff can be given its own independent time signature by
1194 moving the @code{Timing_translator} to the @code{Staff} context.
1196 @lilypond[quote,verbatim]
1200 \remove "Timing_translator"
1201 \remove "Default_bar_line_engraver"
1205 \consists "Timing_translator"
1206 \consists "Default_bar_line_engraver"
1210 % Now each staff has its own time signature.
1236 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1237 {compound-time-signatures.ly}
1244 @rglos{polymetric time signature},
1247 Notation Reference: @ref{Scaling durations}
1252 Internals Reference:
1253 @rinternals{TimeSignature},
1254 @rinternals{Timing_translator},
1259 When using different time signatures in parallel, notes
1260 at the same moment will be be placed at the same horizontal
1261 location. However, the bar lines in the different staves
1262 will cause the note spacing to be less regular in each of the
1263 individual staves than would be normal without the different
1266 @node Automatic note splitting
1267 @unnumberedsubsubsec Automatic note splitting
1269 @cindex notes, splitting
1270 @cindex splitting notes
1272 Long notes which overrun bar lines can be converted automatically
1273 to tied notes. This is done by replacing the
1274 @code{Note_heads_engraver} with the
1275 @code{Completion_heads_engraver}. In the following
1276 example, notes crossing the bar lines are split and tied.
1278 @lilypond[quote,verbatim,relative=1]
1280 \remove "Note_heads_engraver"
1281 \consists "Completion_heads_engraver"
1284 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1287 This engraver splits all running notes at the bar line, and
1288 inserts ties. One of its uses is to debug complex scores: if the
1289 measures are not entirely filled, then the ties show exactly how
1290 much each measure is off.
1294 Music Glossary: @rglos{tie}
1297 @rlearning{Engravers explained},
1298 @rlearning{Adding and removing engravers}.
1303 Internals Reference:
1304 @rinternals{Note_heads_engraver},
1305 @rinternals{Completion_heads_engraver},
1306 @rinternals{Forbid_line_break_engraver}.
1311 Not all durations (especially those containing tuplets) can be
1312 represented exactly with normal notes and dots, but the
1313 @code{Completion_heads_engraver} will not insert tuplets.
1315 The @code{Completion_heads_engraver} only affects notes; it does not
1319 @node Showing melody rhythms
1320 @unnumberedsubsubsec Showing melody rhythms
1322 Sometimes you might want to show only the rhythm of a melody. This
1323 can be done with the rhythmic staff. All pitches of notes on such a
1324 staff are squashed, and the staff itself has a single line
1326 @lilypond[quote,relative=1,verbatim]
1328 \new RhythmicStaff {
1329 \new Voice = "myRhythm" {
1337 \lyricsto "myRhythm" {
1345 Guitar chord charts often show the strumming rhythms. This can
1346 be done with the @code{Pitch_squash_engraver} and
1347 @code{\improvisationOn}.
1350 @lilypond[quote,verbatim]
1359 \consists Pitch_squash_engraver
1371 @code{\improvisationOn},
1372 @code{\improvisationOff}.
1376 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1377 {guitar-strum-rhythms.ly}
1384 Internals Reference:
1385 @rinternals{RhythmicStaff},
1386 @rinternals{Pitch_squash_engraver}.
1393 * Setting automatic beam behavior::
1398 @node Automatic beams
1399 @unnumberedsubsubsec Automatic beams
1401 By default, beams are inserted automatically:
1403 @cindex beams, manual
1404 @cindex manual beams
1406 @lilypond[quote,verbatim,relative=2]
1408 \time 6/8 c c c c8. c16 c8
1411 If these automatic decisions are not satisfactory, beaming can be
1412 entered explicitly; see @ref{Manual beams}. It is also possible
1413 to define beaming patterns that differ from the defaults; see
1414 @ref{Setting automatic beam behavior}. The default beaming rules
1415 are defined in @file{scm/@/auto@/-beam@/.scm}.
1421 Automatic beaming may be turned off and on with
1422 @code{\autoBeamOff} and @code{\autoBeamOn} commands:
1424 @lilypond[quote,relative=1,verbatim]
1425 c4 c8 c8. c16 c8. c16 c8
1433 @code{\autoBeamOff},
1438 @c TODO -- convert to snippet called "Grouping beats"
1439 @c Added to lsr 18 Oct 08 -td
1441 Beaming patterns may be altered with the @code{beatGrouping} property,
1443 @lilypond[quote,verbatim,relative=2]
1445 \set beatGrouping = #'(2 3)
1447 \set beatGrouping = #'(3 2)
1451 @funindex subdivideBeams
1453 @c TODO convert to snippet called "Sub-dividing beams"
1454 @c Added to lsr 18 Oct 08
1456 The beams of consecutive 16th (or shorter) notes are, by default,
1457 not sub-divided. That is, the three (or more) beams stretch
1458 unbroken over entire groups of notes. This behavior can
1459 be modified to sub-divide the beams into sub-groups by setting
1460 the property @code{subdivideBeams}. When set, multiple beams
1461 will be sub-divided at intervals defined by the current value of
1462 @code{beatLength} by reducing the multiple beams to just one beam
1463 between the sub-groups. Note that @code{beatLength} lives in the
1464 @code{Score} context and defaults to a quarter note. It must be
1465 set to a fraction giving the duration of the beam sub-group
1466 using the @code{make-moment} function, as shown here:
1468 @lilypond[quote,relative=2,verbatim]
1470 \set subdivideBeams = ##t
1472 % Set beam sub-group length to an eighth note
1473 \set Score.beatLength = #(ly:make-moment 1 8)
1475 % Set beam sub-group length to a sixteenth note
1476 \set Score.beatLength = #(ly:make-moment 1 16)
1481 For more information about @code{make-moment}, see
1482 @ref{Time administration}.
1488 @c TODO convert to snippet called "Beams across line breaks"
1489 @c This snippet exists but doesn't show the effect - replaced it
1490 @c with this 18 Oct 08, but this also will not break
1492 Line breaks are normally forbidden when beams cross bar lines.
1493 This behavior can be changed by setting the @code{breakable}
1496 @lilypond[relative=2,verbatim,quote]
1497 \override Beam #'breakable = ##t
1498 c8 \repeat unfold 15 { c[ c] } c
1501 @cindex beams and line breaks
1502 @cindex beams, kneed
1504 @cindex auto-knee-gap
1506 @c TODO convert to snippet called "Changing beam knee gap"
1507 @c Added to lsr 18 Oct 08
1509 Kneed beams are inserted automatically when a large gap is
1510 detected between the note heads. This behavior can be tuned
1511 through the @code{auto-knee-gap} property. A kneed beam is
1512 drawn if the gap is larger than the value of
1513 @code{auto-knee-gap} plus the width of the beam object (which
1514 depends on the duration of the notes and the slope of the beam).
1515 By default @code{auto-knee-gap} is set to 5.5 staff spaces.
1517 @lilypond[fragment,quote,verbatim]
1519 \override Beam #'auto-knee-gap = #6
1528 @ref{Setting automatic beam behavior}.
1531 @file{scm/auto-beam.scm}.
1536 Internals Reference: @rinternals{Beam}.
1541 Automatically kneed cross-staff beams cannot be used together with
1542 hidden staves. See @ref{Hiding staves}.
1544 Beams can collide with note heads and accidentals in other voices
1547 @node Setting automatic beam behavior
1548 @unnumberedsubsubsec Setting automatic beam behavior
1550 @funindex autoBeaming
1551 @funindex autoBeamSettings
1552 @funindex (end * * * *)
1553 @funindex (begin * * * *)
1555 @cindex automatic beams, tuning
1556 @cindex tuning automatic beaming
1557 @cindex automatic beam generation
1559 @cindex lyrics and beaming
1562 @warning{If beams are used to indicate melismata in songs, then automatic
1563 beaming should be switched off with @code{\autoBeamOff} and the beams
1564 indicated manually.}
1566 In normal time signatures, automatic beams can start on any note
1567 but can end in only a few positions within the measure: beams can
1568 end on a beat, or at durations specified by the properties in
1569 @code{autoBeamSettings}. The properties in
1570 @code{autoBeamSettings} consist of a list of rules for where beams
1571 can begin and end. The default @code{autoBeamSettings} rules are
1572 defined in @file{scm/@/auto@/-beam@/.scm}.
1574 In order to add a rule to the list, use
1576 #(override-auto-beam-setting
1577 '(beam-limit beam-numerator beam-denominator
1578 time-signature-numerator time-signature-denominator)
1579 moment-numerator moment-denominator [context])
1584 @item @code{beam-limit} is the type of automatic beam limit
1585 defined, either @code{begin} or @code{end}.
1587 @item @code{beam-numerator/beam-denominator} is the beam duration
1588 for which you want to add a rule. A beam is considered to have
1589 the duration of its shortest note. Set @code{beam-numerator} and
1590 @code{beam-denominator} to @code{'*'} to
1591 have this rule apply beams of any duration.
1593 @item @code{time-signature-numerator/time-signature-denominator}
1594 is the time signature to which
1595 this rule should apply. Set @code{time-signature-numerator} and
1596 @code{time-signature-denominator} to @code{'*'}
1597 to have this rule apply in any time signature.
1599 @item @code{monent-numerator/moment-denominator} is the position
1600 in the bar at which the beam should
1603 @item @code{context} is optional, and it specifies the context at which
1604 the change should be made. The default is @code{'Voice}.
1606 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1607 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1611 For example, if automatic beams should always end on the first quarter
1612 note, whatever the time signature or beam duration, use
1614 @lilypond[quote,verbatim,relative=2]
1616 #(override-auto-beam-setting '(end * * * *) 1 4)
1620 You can force the beam settings to only take effect on beams whose shortest
1621 note is a certain duration
1623 @lilypond[quote,verbatim,relative=2]
1625 % end 1/16 beams for all time signatures at the 1/16 moment
1626 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1628 a32 a a a a16 a a a a a |
1629 % end 1/32 beams for all time signatures at the 1/16 moment
1630 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1631 a32 a a a a16 a a a a a |
1634 You can force the beam settings to only take effect in certain time
1637 @lilypond[quote,verbatim,relative=2]
1639 % end beams of all durations in 5/8 time signature at the 2/8 moment
1640 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1648 When multiple voices are used the @code{Staff} context must be
1651 @lilypond[quote,verbatim,relative=2]
1654 % Context not specified - does not work correctly
1655 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1656 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1657 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1658 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1660 % Works correctly with context specified
1661 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1662 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1663 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1664 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1667 @c TODO Add example using Score for multiple staves?
1669 @warning{If any unexpected beam behavior occurs, check the default
1670 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1671 possible interference, because the beam endings defined there will
1672 still apply in addition to your own.}
1674 Any unwanted or conflicting default endings must be reverted for
1675 your time signature(s). Existing auto-beam rules are removed by
1679 #(revert-auto-beam-setting
1680 '(beam-limit beam-numerator beam-denominator
1681 time-signature-numerator time-signature-denominator)
1682 moment-numerator moment-denominator [context])
1686 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1687 @code{time-signature-numerator}, @code{time-signature-denominator},
1688 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1689 are the same as above.
1691 @lilypond[quote,verbatim,relative=2]
1693 a16 a a a a a a a a a a a a a a a
1694 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1695 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1696 a16 a a a a a a a a a a a a a a a
1699 The rule in a @code{revert-auto-beam-setting} statement must exactly
1700 match the original rule. That is, no wildcard expansion is taken into
1703 @lilypond[quote,verbatim,relative=2]
1705 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1707 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1709 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1715 @c TODO Add to LSR with name "Beam grouping in 7/8 time"
1717 There are no default automatic beam groupings specified for 7/8
1718 time, so if automatic beams are required the grouping must be
1719 specified. For example, to group all beams 2-3-2 in 7/8 time,
1720 specify beam endings at 2/8 and 5/8:
1722 @lilypond[quote,verbatim,relative=2]
1726 #(override-auto-beam-setting '(end * * 7 8) 2 8)
1727 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1732 @c TODO Fix this example and convert to @lilypond
1733 @c Seems like setting beam starting points is no longer
1734 @c necessary, and/or has no effect. Remove mention?
1736 The same syntax can be used to specify beam starting points.
1738 @c TODO Does this example add anything?
1741 example, automatic beams can only end on a dotted quarter note
1743 #(override-auto-beam-setting '(end * * * *) 3 8)
1744 #(override-auto-beam-setting '(end * * * *) 1 2)
1745 #(override-auto-beam-setting '(end * * * *) 7 8)
1748 In 4/4 time signature, this means that automatic beams could end only on
1749 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1750 3/8, has passed within the measure).
1754 @c TODO Convert to snippet called "Reverting default beam endings"
1755 @c Added to lsr 19 Oct 08
1757 To typeset beams grouped @code{3-4-3-2} in 12/8 it is necessary
1758 first to override the default beam endings in 12/8, and then to
1759 set up the new beaming endings:
1761 @lilypond[verbatim,quote,relative=2]
1765 a8 a a a a a a a a a a a
1767 % Revert default values in scm/auto-beam.scm for 12/8 time
1768 #(revert-auto-beam-setting '(end * * 12 8) 3 8)
1769 #(revert-auto-beam-setting '(end * * 12 8) 3 4)
1770 #(revert-auto-beam-setting '(end * * 12 8) 9 8)
1771 a8 a a a a a a a a a a a
1773 % Set new values for beam endings
1774 #(override-auto-beam-setting '(end * * 12 8) 3 8)
1775 #(override-auto-beam-setting '(end * * 12 8) 7 8)
1776 #(override-auto-beam-setting '(end * * 12 8) 10 8)
1777 a8 a a a a a a a a a a a
1783 @funindex \autoBeamOff
1784 @code{\autoBeamOff},
1785 @funindex \autoBeamOn
1791 If a score ends while an automatic beam has not been ended and is
1792 still accepting notes, this last beam will not be typeset at all.
1793 The same holds for polyphonic voices, entered with @code{<<
1794 @dots{} \\ @dots{} >>}. If a polyphonic voice ends while an
1795 automatic beam is still accepting notes, it is not typeset.
1804 @unnumberedsubsubsec Manual beams
1806 @cindex beams, manual
1810 In some cases it may be necessary to override the automatic
1811 beaming algorithm. For example, the autobeamer will not put beams
1812 over rests or bar lines, and in choral scores the beaming is
1813 often set to follow the meter of the lyrics rather than the
1814 notes. Such beams can be specified manually by
1815 marking the begin and end point with @code{[} and @code{]}
1817 @lilypond[quote,relative=1,verbatim]
1819 r4 r8[ g' a r8] r8 g[ | a] r8
1824 Individual notes may be marked with @code{\noBeam} to prevent them
1827 @lilypond[quote,verbatim,relative=2]
1828 \time 2/4 c8 c\noBeam c c
1831 @funindex stemLeftBeamCount
1832 @funindex stemRightBeamCount
1834 Even more strict manual control with the beams can be achieved by
1835 setting the properties @code{stemLeftBeamCount} and
1836 @code{stemRightBeamCount}. They specify the number of beams to
1837 draw on the left and right side, respectively, of the next note.
1838 If either property is set, its value will be used only once, and
1839 then it is erased. In this example, the last @code{f} is printed
1840 with only one beam on the left side, i.e., the eighth-note beam of
1841 the group as a whole.
1843 @lilypond[quote,relative=2,verbatim]
1846 \set stemLeftBeamCount = #2
1847 \set stemRightBeamCount = #1
1849 \set stemLeftBeamCount = #1
1856 @node Feathered beams
1857 @unnumberedsubsubsec Feathered beams
1859 @cindex beams, feathered
1860 @funindex \featherDurations
1862 Feathered beams are used to indicate that a small group of notes
1863 should be played at an increasing (or decreasing) tempo, without
1864 changing the overall tempo of the piece. The extent of the
1865 feathered beam must be indicated manually using @code{[} and
1866 @code{]}, and the beam feathering is turned on by specifying a
1867 direction to the @code{Beam} property @code{grow-direction}.
1869 If the placement of the notes and the sound in the MIDI output
1870 is to reflect the ritardando or accelerando indicated by the
1871 feathered beam the notes must be grouped as a
1872 music expression delimited by braces and preceded by a
1873 @code{featheredDurations} command which specifies the ratio
1874 between the durations of the first and last notes in the group.
1877 show the extent of the beam and the braces show
1878 which notes are to have their durations modified. Normally
1879 these would delimit the same group of notes, but this is not
1880 required: the two commands are independent.
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[relative=1,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.
1906 The @code{\featherDurations} command only works with very short
1907 music snippets, and when numbers in the fraction are small.
1923 * Bar and bar number checks::
1928 @unnumberedsubsubsec Bar lines
1932 @cindex measure lines
1935 Bar lines delimit measures, and are also used to indicate
1936 repeats. Normally, simple bar lines are automatically inserted
1937 into the printed output at places based on the current time
1940 The simple bar lines inserted automatically can be changed to
1941 other types with the @code{\bar} command. For example, a closing
1942 double bar line is usually placed at the end of a piece:
1944 @lilypond[quote,relative=1,verbatim]
1948 It is not invalid if the final note in a measure does not
1949 end on the automatically entered bar line: the note is assumed
1950 to carry over into the next measure. But if a long sequence
1951 of such carry-over measures appears the music can appear compressed
1952 or even flowing off the page. This is because automatic line
1953 breaks happen only at the end of complete measures, i.e., where
1954 all notes end before the end of a measure.
1956 @warning{An incorrect duration can cause line breaks to be
1957 inhibited, leading to a line of highly compressed music or
1958 music which flows off the page.}
1961 @cindex bar lines, invisible
1962 @cindex measure lines, invisible
1964 Line breaks are also permitted at manually inserted bar lines
1965 even within incomplete measures. To allow a line break without
1966 printing a bar line, use
1973 This will insert an invisible bar line and allow (but not
1974 force) a line break to occur at this point. The bar number
1975 counter is not increased. To force a line break see
1976 @ref{Line breaking}.
1978 This and other special bar lines may be inserted manually at any
1979 point. When they coincide with the end of a measure they replace
1980 the simple bar line which would have been inserted there
1981 automatically. When they do not coincide
1982 with the end of a measure the specified bar line is inserted at that
1983 point in the printed output. Such insertions do not affect
1984 the calculation and placement of subsequent automatic bar lines.
1986 The simple bar line and five types of double bar line are available
1987 for manual insertion:
1989 @lilypond[quote,relative=1,verbatim]
1990 f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
1994 together with dotted and dashed bar lines:
1996 @lilypond[quote,relative=1,verbatim]
1997 f1 \bar ":" g \bar "dashed" a
2001 and five types of repeat bar line:
2003 @lilypond[quote,relative=1,verbatim]
2004 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
2009 Although the bar line types signifying repeats may be inserted
2010 manually they do not in themselves cause LilyPond to recognize
2011 a repeated section. Such repeated sections are better entered
2012 using the various repeat commands (see @ref{Repeats}), which
2013 automatically print the appropriate bar lines.
2015 In addition, you can specify @code{"||:"}, which is equivalent to
2016 @code{"|:"} except at line breaks, where it gives a double bar
2017 line at the end of the line and a start repeat at the beginning of
2020 @lilypond[quote,relative=2,verbatim]
2021 \override Score.RehearsalMark #'padding = #3
2029 In scores with many staves, a @code{\bar} command in one staff is
2030 automatically applied to all staves. The resulting bar lines are
2031 connected between different staves of a @code{StaffGroup},
2032 @code{InnerStaffGroup}, @code{PianoStaff}, or @code{GrandStaff}.
2034 @lilypond[quote,fragment,verbatim]
2042 \new Staff { \clef bass c4 g e g }
2044 \new Staff { \clef bass c2 c2 }
2052 @funindex defaultBarType
2054 The command @code{\bar }@var{bartype} is a shortcut for
2055 @code{\set Timing.whichBar = }@var{bartype}. A bar line is
2056 created whenever the @code{whichBar} property is
2059 The default bar type used for automatically inserted bar lines is
2060 @code{"|"}. This may be changed at any time
2061 with @code{\set Timing.defaultBarType = }@var{bartype}.
2066 @ref{Line breaking},
2068 @ref{Grouping staves}.
2073 Internals Reference: @rinternals{BarLine} (created at
2074 @rinternals{Staff} level), @rinternals{SpanBar} (across
2075 staves), @rinternals{Timing_translator} (for Timing
2080 @unnumberedsubsubsec Bar numbers
2083 @cindex measure numbers
2084 @funindex currentBarNumber
2086 Bar numbers are typeset by default at the start of every line except
2087 the first line. The number itself is stored in the
2088 @code{currentBarNumber} property, which is normally updated
2089 automatically for every measure. It may also be set manually:
2091 @lilypond[verbatim,quote,fragment,relative=1]
2094 \set Score.currentBarNumber = #50
2101 @funindex barNumberVisibility
2102 @cindex bar numbers, regular spacing
2104 Bar numbers can be typeset at regular intervals instead of just at
2105 the beginning of every line. To do this the default behavior
2106 must be overridden to permit bar numbers to be printed at places
2107 other than the start of a line. This is controlled by the
2108 @code{break-visibility} property of @code{BarNumber}. This takes
2109 three values which may be set to @code{#t} or @code{#f} to specify
2110 whether the corresponding bar number is visible or not. The order
2111 of the three values is @code{end of line visible}, @code{middle of
2112 line visible}, @code{beginning of line visible}. In the following
2113 example bar numbers are printed at all possible places:
2115 @lilypond[verbatim,quote,relative=1]
2116 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2117 \set Score.currentBarNumber = #11
2118 \bar "" % Permit first bar number to be printed
2124 @c All the rest of these examples will be added to LSR
2125 @c and moved into the Snippets. -gp
2128 and here the bar numbers are printed every two measures
2129 except at the end of the line:
2131 @lilypond[verbatim,quote,relative=1]
2132 \override Score.BarNumber #'break-visibility = #'#(#f #t #t)
2133 \set Score.currentBarNumber = #11
2134 \bar "" % Permit first bar number to be printed
2135 % Print a bar number every second measure
2136 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2142 @cindex measure number, format
2143 @cindex bar number, format
2145 The size of the bar number may be changed. This is illustrated
2146 in the following example, which also shows how to enclose bar
2147 numbers in boxes and circles, and shows an alternative way
2148 of specifying @code{#(#f #t #t)} for @code{break-visibility}.
2150 @lilypond[verbatim,quote,relative=1]
2151 % Prevent bar numbers at the end of a line and permit them elsewhere
2152 \override Score.BarNumber #'break-visibility
2153 = #end-of-line-invisible
2155 % Increase the size of the bar number by 2
2156 \override Score.BarNumber #'font-size = #2
2157 \repeat unfold 3 { c1 } \bar "|"
2159 % Draw a box round the following bar number(s)
2160 \override Score.BarNumber #'stencil
2161 = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
2162 \repeat unfold 3 { c1 } \bar "|"
2164 % Draw a circle round the following bar number(s)
2165 \override Score.BarNumber #'stencil
2166 = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
2167 \repeat unfold 4 { c1 } \bar "|."
2170 @cindex bar number alignment
2172 Bar numbers by default are left-aligned to their parent object.
2173 This is usually the left edge of a line or, if numbers are printed
2174 within a line, the left bar line of the measure. The numbers may also
2175 be positioned directly on the bar line or right-aligned to the
2178 @lilypond[verbatim,quote,relative=1]
2179 \set Score.currentBarNumber = #111
2180 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2181 % Increase the size of the bar number by 2
2182 \override Score.BarNumber #'font-size = #2
2183 % Print a bar number every second measure
2184 \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
2186 % Center-align bar numbers
2187 \override Score.BarNumber #'self-alignment-X = #0
2189 % Right-align bar numbers
2190 \override Score.BarNumber #'self-alignment-X = #-1
2194 Bar numbers can be removed entirely by removing the
2195 @code{Bar_number_engraver} from the @code{Score} context.
2197 @lilypond[verbatim,quote]
2201 \remove "Bar_number_engraver"
2216 Internals Reference: @rinternals{BarNumber}.
2221 Bar numbers may collide with the top of the
2222 @rinternals{StaffGroup} bracket, if there is one. To solve
2223 this, the @code{padding} property of @rinternals{BarNumber} can
2224 be used to position the number correctly.
2226 Bar numbers may only be printed at bar lines; to print a bar
2227 number at the beginning of a piece, an empty bar line must be
2228 inserted there, and a value other than @code{1} must be placed
2229 in @code{currentBarNumber}:
2231 @lilypond[verbatim,quote,relative=1]
2232 \set Score.currentBarNumber = #50
2241 @node Bar and bar number checks
2242 @unnumberedsubsubsec Bar and bar number checks
2245 @funindex barCheckSynchronize
2248 Bar checks help detect errors in the entered durations.
2249 A bar check may be entered using the bar symbol, @code{|},
2250 at any place where a bar line is expected to fall.
2251 If bar check lines are encountered at other places,
2252 a list of warnings is printed in the log file,
2253 showing the line numbers and lines
2254 in which the bar checks failed. In the next
2255 example, the second bar check will signal an error.
2258 \time 3/4 c2 e4 | g2 |
2261 Bar checks can also be used in lyrics, for example
2266 Twin -- kle | Twin -- kle |
2270 An incorrect duration can result in a completely garbled score,
2271 especially if the score is polyphonic, so a good place to start
2272 correcting input is by scanning for failed bar checks and
2273 incorrect durations.
2275 If successive bar checks are off by the same musical interval,
2276 only the first warning message is displayed. This allows the
2277 warning to focus on the source of the timing error.
2281 @funindex pipeSymbol
2283 It is also possible to redefine the action taken when a bar check
2284 or pipe symbol, @code{|}, is encountered in the input, so that
2285 it does something other than a bar check. This is done by
2286 assigning a music expression to @code{pipeSymbol}.
2287 In the following example @code{|} is set to insert a double bar
2288 line wherever it appears in the input, rather than checking
2291 @lilypond[quote,verbatim]
2292 pipeSymbol = \bar "||"
2301 When copying large pieces of music, it can be helpful to check
2302 that the LilyPond bar number corresponds to the original that you
2303 are entering from. This can be checked with
2304 @code{\barNumberCheck}, for example,
2307 \barNumberCheck #123
2311 will print a warning if the @code{currentBarNumber} is not 123
2312 when it is processed.
2320 @node Rehearsal marks
2321 @unnumberedsubsubsec Rehearsal marks
2323 @cindex rehearsal marks
2324 @cindex mark, rehearsal
2327 To print a rehearsal mark, use the @code{\mark} command
2329 @lilypond[quote,verbatim,relative=2]
2338 The letter@tie{}@q{I} is skipped in accordance with engraving
2339 traditions. If you wish to include the letter @q{I}, then use
2342 \set Score.markFormatter = #format-mark-alphabet
2345 The mark is incremented automatically if you use @code{\mark
2346 \default}, but you can also use an integer argument to set the
2347 mark manually. The value to use is stored in the property
2348 @code{rehearsalMark}.
2350 @cindex rehearsal mark format
2351 @cindex rehearsal mark style
2352 @cindex style, rehearsal mark
2353 @cindex format, rehearsal mark
2354 @cindex mark, rehearsal, style
2355 @cindex mark, rehearsal, format
2357 The style is defined by the property @code{markFormatter}. It is
2358 a function taking the current mark (an integer) and the current
2359 context as argument. It should return a markup object. In the
2360 following example, @code{markFormatter} is set to a pre-defined
2361 procedure. After a few measures, it is set to a procedure that
2362 produces a boxed number.
2364 @lilypond[quote,verbatim,relative=2]
2365 \set Score.markFormatter = #format-mark-numbers
2368 \set Score.markFormatter = #format-mark-box-numbers
2370 \set Score.markFormatter = #format-mark-circle-numbers
2372 \set Score.markFormatter = #format-mark-circle-letters
2376 The file @file{scm/@/translation@/-functions@/.scm} contains the
2377 definitions of @code{format-mark-numbers} (the default format),
2378 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2379 @code{format-mark-box-letters}. These can be used as inspiration
2380 for other formatting functions.
2382 You may use @code{format-mark-barnumbers},
2383 @code{format-mark-box-barnumbers}, and
2384 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2385 incremented numbers or letters.
2387 Other styles of rehearsal mark can be specified manually
2394 @code{Score.markFormatter} does not affect marks specified in this
2395 manner. However, it is possible to apply a @code{\markup} to the
2399 \mark \markup@{ \box A1 @}
2406 Music glyphs (such as the segno sign) may be printed inside a
2409 @lilypond[quote,verbatim,relative=1]
2410 c1 \mark \markup { \musicglyph #"scripts.segno" }
2411 c1 \mark \markup { \musicglyph #"scripts.coda" }
2412 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2417 See @ref{The Feta font}, for a list of symbols which may be
2418 printed with @code{\musicglyph}.
2420 For common tweaks to the positioning of rehearsal marks, see
2421 @ref{Formatting text}.
2426 @ref{The Feta font},
2427 @ref{Formatting text}.
2430 @file{scm/@/translation@/-functions@/.scm} contains
2431 the definition of @code{format-mark-numbers} and
2432 @code{format-mark-letters}. They can be used as inspiration for
2433 other formatting functions.
2438 Internals Reference: @rinternals{RehearsalMark}.
2440 @node Special rhythmic concerns
2441 @subsection Special rhythmic concerns
2446 * Aligning to cadenzas::
2447 * Time administration::
2451 @unnumberedsubsubsec Grace notes
2456 @cindex appoggiatura
2457 @cindex acciaccatura
2459 Grace notes are ornaments that are written out. Grace notes
2460 are printed in a smaller font and take up no logical time
2463 @lilypond[quote,relative=2,verbatim]
2465 \grace { c16[ d16] } c2
2468 Lilypond also supports two special types of grace notes, the
2469 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2470 small note with a slashed stem--and the @emph{appoggiatura}, which
2471 takes a fixed fraction of the main note and appears in small print
2474 @lilypond[quote,relative=2,verbatim]
2478 \acciaccatura { g16[ f] } e4
2481 The placement of grace notes is synchronized between different
2482 staves. In the following example, there are two sixteenth grace
2483 notes for every eighth grace note
2485 @lilypond[quote,relative=2,verbatim]
2486 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2487 \new Staff { c2 \grace { g8[ b] } c2 } >>
2490 @funindex \afterGrace
2492 @cindex grace notes, following
2494 If you want to end a note with a grace, use the @code{\afterGrace}
2495 command. It takes two arguments: the main note, and the grace
2496 notes following the main note.
2498 @lilypond[quote,verbatim,relative=2]
2499 c1 \afterGrace d1 { c16[ d] } c1
2502 This will put the grace notes after a space lasting 3/4 of the
2503 length of the main note. The default fraction 3/4 can be changed by
2504 setting @code{afterGraceFraction}. The following example shows
2505 the results from setting the space at the default, at 15/16, and
2506 finally at 1/2 of the main note.
2508 @lilypond[quote,verbatim,relative=2]
2511 c1 \afterGrace d1 { c16[ d] } c1
2514 #(define afterGraceFraction (cons 15 16))
2515 c1 \afterGrace d1 { c16[ d] } c1
2518 #(define afterGraceFraction (cons 1 2))
2519 c1 \afterGrace d1 { c16[ d] } c1
2524 The space between the main note and the grace note may also be
2525 specified using spacers. The following example places the grace
2526 note after a space lasting 7/8 of the main note.
2528 @lilypond[quote,verbatim,relative=2]
2531 { s2 s4. \grace { c16[ d] } } >>
2536 A @code{\grace} music expression will introduce special
2537 typesetting settings, for example, to produce smaller type, and
2538 set directions. Hence, when introducing layout tweaks to
2539 override the special settings, they should be placed inside
2540 the grace expression. The overrides should also be reverted
2541 inside the grace expression. Here, the grace note's default stem
2542 direction is overriden and then reverted.
2544 @lilypond[quote,verbatim,relative=2]
2556 @cindex stem, with slash
2561 The slash through the stem found in @emph{acciaccatura}s can be applied
2562 in other situations:
2564 @lilypond[quote,verbatim,relative=2]
2566 \override Stem #'stroke-style = #"grace"
2571 The layout of grace expressions can be changed throughout the
2572 music using the function @code{add-grace-property}. The following
2573 example undefines the @code{Stem} direction for this grace, so
2574 that stems do not always point up.
2576 @lilypond[quote,verbatim,relative=2]
2579 #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
2580 #(remove-grace-property 'Voice 'Stem 'direction)
2582 \acciaccatura { f16 } g4
2583 \grace { d16[ e] } f4
2584 \appoggiatura { a,32[ b c d] } e2
2590 Another option is to change the variables @code{startGraceMusic},
2591 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2592 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2593 @code{stopAppoggiaturaMusic}. The default values of these can be
2594 seen in the file @code{ly/@/grace@/-init@/.ly}. By redefining
2595 them other effects may be obtained.
2597 Grace notes may be forced to align with regular notes
2600 @lilypond[verbatim,quote]
2603 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2606 \afterGrace c4 { c16[ c8 c16] }
2610 c16 c c c c c c c c4 r
2620 @rglos{grace notes},
2621 @rglos{acciaccatura},
2622 @rglos{appoggiatura}.
2624 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2626 Snippets: @rlsr{Rhythms}.
2628 Internals Reference: @rinternals{GraceMusic}.
2633 A multi-note beamed @i{acciaccatura} is printed without a slash,
2634 and looks exactly the same as a multi-note beamed
2636 @c TODO Add link to LSR snippet to add slash when available
2638 Grace note synchronization can also lead to surprises. Staff
2639 notation, such as key signatures, bar lines, etc., are also
2640 synchronized. Take care when you mix staves with grace notes and
2641 staves without, for example,
2643 @lilypond[quote,relative=2,verbatim]
2644 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2645 \new Staff { c4 \bar "|:" d2. } >>
2649 This can be remedied by inserting grace skips of the corresponding
2650 durations in the other staves. For the above example
2652 @lilypond[quote,relative=2,verbatim]
2653 << \new Staff { e4 \bar "|:" \grace c16 d2. }
2654 \new Staff { c4 \bar "|:" \grace s16 d2. } >>
2657 Grace sections should only be used within sequential music
2658 expressions. Nesting or juxtaposing grace sections is not
2659 supported, and might produce crashes or other errors.
2661 @node Aligning to cadenzas
2662 @unnumberedsubsubsec Aligning to cadenzas
2665 @cindex cadenza, aligning to
2666 @cindex aligning to cadenza
2668 In an orchestral context, cadenzas present a special problem: when
2669 constructing a score that includes a measured cadenza or other solo
2670 passage, all other instruments should skip just as many notes as the
2671 length of the cadenza, otherwise they will start too soon or too late.
2673 One solution to this problem is to use the functions
2674 @code{mmrest-of-length} and @code{skip-of-length}. These Scheme
2675 functions take a defined piece of music as an argument and generate a
2676 multi-measure rest or @code{\skip} exactly as long as the piece.
2678 @lilypond[verbatim,quote]
2679 MyCadenza = \relative c' {
2690 #(ly:export (mmrest-of-length MyCadenza))
2692 #(ly:export (skip-of-length MyCadenza))
2707 @node Time administration
2708 @unnumberedsubsubsec Time administration
2710 @cindex time administration
2711 @cindex timing (within the score)
2712 @cindex music, unmetered
2713 @cindex unmetered music
2715 @funindex currentBarNumber
2716 @funindex measurePosition
2717 @funindex measureLength
2719 Time is administered by the @code{Timing_translator}, which by
2720 default is to be found in the @code{Score} context. An alias,
2721 @code{Timing}, is added to the context in which the
2722 @code{Timing_translator} is placed.
2724 The following properties of @code{Timing} are used
2725 to keep track of timing within the score.
2728 @cindex measure number
2731 @item currentBarNumber
2732 The current measure number. For an example showing the
2733 use of this property see @ref{Bar numbers}.
2736 The length of the measures in the current time signature. For a
2737 4/4 time this is@tie{}1, and for 6/8 it is 3/4. Its value
2738 determines when bar lines are inserted and how automatic beams
2739 should be generated.
2741 @item measurePosition
2742 The point within the measure where we currently are. This
2743 quantity is reset by subtracting @code{measureLength} whenever
2744 @code{measureLength} is reached or exceeded. When that happens,
2745 @code{currentBarNumber} is incremented.
2748 If set to true, the above variables are updated for every time
2749 step. When set to false, the engraver stays in the current
2750 measure indefinitely.
2754 Timing can be changed by setting any of these variables
2755 explicitly. In the next example, the default 4/4 time
2756 signature is printed, but @code{measureLength} is set to 5/4.
2757 At 4/8 through the third measure, the @code{measurePosition} is
2758 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2759 The next bar line then falls at 9/8 rather than 5/4.
2761 @lilypond[quote,verbatim,relative=1]
2762 \set Score.measureLength = #(ly:make-moment 5 4)
2766 \set Score.measurePosition = #(ly:make-moment 5 8)
2772 As the example illustrates, @code{ly:make-moment n m} constructs a
2773 duration of n/m of a whole note. For example,
2774 @code{ly:make-moment 1 8} is an eighth note duration and
2775 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2781 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2786 Internals Reference: @rinternals{Timing_translator},