]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/rhythms.itely
2c63d75d21e59d95780f750000a5c84d16231c2e
[lilypond.git] / Documentation / user / rhythms.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.12.0"
10
11 @node Rhythms
12 @section Rhythms
13
14 @lilypondfile[quote]{rhythms-headword.ly}
15
16 This section discusses rhythms, rests, durations, beaming and bars.
17
18 @menu
19 * Writing rhythms::
20 * Writing rests::
21 * Displaying rhythms::
22 * Beams::
23 * Bars::
24 * Special rhythmic concerns::
25 @end menu
26
27
28 @node Writing rhythms
29 @subsection Writing rhythms
30
31 @menu
32 * Durations::
33 * Tuplets::
34 * Scaling durations::
35 * Ties::
36 @end menu
37
38 @node Durations
39 @unnumberedsubsubsec Durations
40
41 @cindex durations, of notes
42 @cindex note durations
43 @cindex length of notes
44 @cindex note lengths
45
46 @funindex \longa
47 @funindex longa
48 @funindex \breve
49 @funindex breve
50 @funindex \maxima
51 @funindex maxima
52
53 Durations are designated by numbers and dots.  Durations are entered
54 as their reciprocal values.  For example, a quarter note is entered
55 using a @code{4} (since it is a 1/4 note), and a half note is entered
56 using a @code{2} (since it is a 1/2 note).  For notes longer than a
57 whole you must use the @code{\longa} (a double breve) and
58 @code{\breve} commands.  Durations as short as 128th notes may be
59 specified.  Shorter values are possible, but only as beamed notes.
60
61 @c Two 64th notes are needed to obtain beams
62 @lilypond[quote,verbatim,relative=2]
63 \time 8/1
64 c\longa c\breve c1 c2
65 c4 c8 c16 c32 c64 c64
66 @end lilypond
67
68 @noindent
69 Here are the same durations with automatic beaming turned off.
70
71 @c not strictly "writing rhythms"; more of a "displaying" thing,
72 @c but it's ok here.  -gp
73 @lilypond[quote,verbatim,relative=2]
74 \time 8/1
75 \autoBeamOff
76 c\longa c\breve c1 c2
77 c4 c8 c16 c32 c64 c64
78 @end lilypond
79
80 A note with the duration of a quadruple breve may be entered with
81 @code{\maxima}, but this is supported only within ancient music
82 notation.  For details, see @ref{Ancient notation}.
83
84 @cindex duration, default
85 @cindex default note duration
86 @cindex note duration, default
87
88 If the duration is omitted, it is set to the previously
89 entered duration.  The default for the first note is a quarter
90 note.
91
92 @lilypond[quote,verbatim,relative=2]
93 a a a2 a a4 a a1 a
94 @end lilypond
95
96 @cindex notes, dotted
97 @cindex dotted notes
98 @cindex notes, double-dotted
99 @cindex double-dotted notes
100
101 @funindex .
102
103 To obtain dotted note lengths, place a dot (@code{.}) after the
104 duration.  Double-dotted notes are specified by appending two
105 dots, and so on.
106
107 @lilypond[quote,verbatim,relative=2]
108 a4 b c4. b8 a4. b4.. c8.
109 @end lilypond
110
111 Some durations cannot be represented with just binary durations
112 and dots; they can be represented only by tying two or more
113 notes together.  For details, see @ref{Ties}.
114
115 For ways of specifying durations for the syllables of lyrics and
116 ways of aligning lyrics to notes, see @ref{Vocal music}.
117
118 Optionally, notes can be spaced strictly proportionately to their
119 duration.  For details of this and other settings which control
120 proportional notation, see @ref{Proportional notation}.
121
122 @funindex \dotsUp
123 @funindex dotsUp
124 @funindex \dotsDown
125 @funindex dotsDown
126 @funindex \dotsNeutral
127 @funindex dotsNeutral
128
129 Dots are normally moved up to avoid staff lines, except in
130 polyphonic situations.  Predefined commands are available to
131 force a particular direction manually, for details
132 see @ref{Direction and placement}.
133
134
135 @predefined
136 @code{\autoBeamOff},
137 @code{\dotsUp},
138 @code{\dotsDown},
139 @code{\dotsNeutral}.
140 @endpredefined
141
142
143 @seealso
144 Music Glossary:
145 @rglos{breve},
146 @rglos{longa},
147 @rglos{maxima},
148 @rglos{note value},
149 @rglos{Duration names notes and rests}.
150
151 Notation Reference:
152 @ref{Automatic beams},
153 @ref{Ties},
154 @ref{Stems},
155 @ref{Writing rhythms},
156 @ref{Writing rests},
157 @ref{Vocal music},
158 @ref{Ancient notation},
159 @ref{Proportional notation}.
160
161 Snippets:
162 @rlsr{Rhythms}.
163
164 Internals Reference:
165 @rinternals{Dots},
166 @rinternals{DotColumn}.
167
168
169 @knownissues
170
171 @c Deliberately duplicated in Durations and Rests.  -gp
172 There is no fundamental limit to rest durations (both in terms of
173 longest and shortest), but the number of glyphs is limited:
174 rests from 128th to maxima (8 x whole) may be printed.
175
176
177 @node Tuplets
178 @unnumberedsubsubsec Tuplets
179
180 @cindex tuplets
181 @cindex triplets
182
183 @funindex \times
184 @funindex times
185
186 Tuplets are made from a music expression by multiplying all the
187 durations with a fraction:
188
189 @example
190 \times @var{fraction} @{ @var{music} @}
191 @end example
192
193 @noindent
194 The duration of @var{music} will be multiplied by the
195 fraction.  The fraction's denominator will be printed over or
196 under the notes, optionally with a bracket.  The most common
197 tuplet is the triplet in which 3 notes have the duration of 2, so
198 the notes are 2/3 of their written length.
199
200 @lilypond[quote,verbatim,relative=2]
201 a2 \times 2/3 { b4 b b }
202 c4 c \times 2/3 { b4 a g }
203 @end lilypond
204
205 @cindex tuplet bracket placement
206
207 @funindex \tupletUp
208 @funindex tupletUp
209 @funindex \tupletDown
210 @funindex tupletDown
211 @funindex \tupletNeutral
212 @funindex tupletNeutral
213
214 The automatic placement of the tuplet bracket above or below the
215 notes may be overridden manually with predefined commands, for
216 details see @ref{Direction and placement}.
217
218 Tuplets may be nested:
219
220 @lilypond[quote,verbatim,relative=2]
221 \autoBeamOff
222 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
223 @end lilypond
224
225 Modifying nested tuplets which begin at the same musical moment
226 must be done with @code{\tweak}.
227
228 To modify the duration of notes without printing a tuplet bracket,
229 see @ref{Scaling durations}.
230
231
232 @predefined
233 @code{\tupletUp},
234 @code{\tupletDown},
235 @code{\tupletNeutral}.
236 @endpredefined
237
238
239 @snippets
240
241 @cindex tuplet formatting
242 @cindex triplet formatting
243
244 @funindex tupletNumberFormatFunction
245 @funindex tupletSpannerDuration
246
247 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
248 {entering-several-tuplets-using-only-one--times-command.ly}
249
250 @cindex Tuplet number changes
251
252 @funindex TupletNumber
253
254 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
255 {changing-the-tuplet-number.ly}
256
257 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
258 {non-default-tuplet-numbers.ly}
259
260 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
261 {permitting-line-breaks-within-beamed-tuplets.ly}
262
263
264 @seealso
265 Music Glossary:
266 @rglos{triplet},
267 @rglos{tuplet},
268 @rglos{polymetric}.
269
270 Learning Manual: @rlearning{Tweaking methods}.
271
272 Notation Reference:
273 @ref{Time administration},
274 @ref{Scaling durations},
275 @ref{The tweak command},
276 @ref{Polymetric notation}.
277
278 Snippets:
279 @rlsr{Rhythms}.
280
281 Internals Reference:
282 @rinternals{TupletBracket},
283 @rinternals{TupletNumber},
284 @rinternals{TimeScaledMusic}.
285
286 @cindex grace notes within tuplet brackets
287
288 @knownissues
289 When the first note on a staff is a grace note followed by a
290 tuplet the grace note must be placed before the @code{\times}
291 command to avoid errors.  Anywhere else, grace notes may be
292 placed within tuplet brackets.
293
294
295 @node Scaling durations
296 @unnumberedsubsubsec Scaling durations
297
298 @cindex scaling durations
299 @cindex durations, scaling
300
301 You can alter the duration of single notes, rests or chords by a
302 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
303 is 1) to the duration.  This will not affect the appearance of the
304 notes or rests produced, but the altered duration will be used in
305 calculating the position within the measure and setting the duration
306 in the MIDI output.  Multiplying factors may be combined such as
307 @code{*L*M/N}.
308
309 In the following example, the first three notes take up exactly
310 two beats, but no triplet bracket is printed.
311
312 @lilypond[quote,relative=2,verbatim]
313 \time 2/4
314 % Alter durations to triplets
315 a4*2/3 gis4*2/3 a4*2/3
316 % Normal durations
317 a4 a4
318 % Double the duration of chord
319 <a d>4*2
320 % Duration of quarter, appears like sixteenth
321 b16*4 c4
322 @end lilypond
323
324 The duration of skip or spacing notes may also be modified by
325 a multiplier.  This is useful for skipping many measures, e.g.,
326 @code{s1*23}.
327
328 @cindex compressing music
329 @cindex expanding music
330
331 @funindex \scaleDurations
332 @funindex scaleDurations
333
334 Longer stretches of music may be compressed by a fraction in the
335 same way, as if every note, chord or rest had the fraction as a
336 multiplier.  This leaves the appearance of the music unchanged but
337 the internal duration of the notes will be multiplied by the
338 fraction @emph{num}/@emph{den}.  The spaces around the dot are
339 required.  Here is an example showing how music can be compressed
340 and expanded:
341
342 @lilypond[quote,relative=2,verbatim]
343 \time 2/4
344 % Normal durations
345 <c a>4 c8 a
346 % Scale music by *2/3
347 \scaleDurations #'(2 . 3) {
348   <c a f>4. c8 a f
349 }
350 % Scale music by *2
351 \scaleDurations #'(2 . 1) {
352   <c' a>4 c8 b
353 }
354 @end lilypond
355
356 @noindent
357 One application of this command is in polymetric
358 notation, see @ref{Polymetric notation}.
359
360
361 @seealso
362 Notation Reference:
363 @ref{Tuplets},
364 @ref{Invisible rests},
365 @ref{Polymetric notation}.
366
367 Snippets:
368 @rlsr{Rhythms}.
369
370
371 @node Ties
372 @unnumberedsubsubsec Ties
373
374 @cindex tie
375
376 @funindex ~
377
378 A tie connects two adjacent note heads of the same pitch.  The tie
379 in effect extends the duration of a note.
380
381 @warning{Ties should not be confused with @emph{slurs}, which
382 indicate articulation, or @emph{phrasing slurs}, which indicate
383 musical phrasing.  A tie is just a way of extending a note
384 duration, similar to the augmentation dot.}
385
386 A tie is entered using the tilde symbol @code{~}
387
388 @lilypond[quote,verbatim,relative=2]
389 a2 ~ a
390 @end lilypond
391
392
393 @noindent
394 Ties are used either when the note crosses a bar line, or when
395 dots cannot be used to denote the rhythm.  Ties should also be
396 used when note values cross larger subdivisions of the measure:
397
398 @lilypond[verbatim,quote]
399 \relative c' {
400   r8 c8 ~ c2 r4 |
401   r8^"not" c2 ~ c8 r4
402 }
403 @end lilypond
404
405 If you need to tie many notes across bar lines, it may be
406 easier to use automatic note splitting, see @ref{Automatic note
407 splitting}.  This mechanism automatically splits long notes, and
408 ties them across bar lines.
409
410 @cindex ties and chords
411 @cindex chords and ties
412
413 When a tie is applied to a chord, all note heads whose pitches
414 match are connected.  When no note heads match, no ties will be
415 created.  Chords may be partially tied by placing the tie inside
416 the chord.
417
418 @lilypond[quote,verbatim,relative=1]
419 <c e g> ~ <c e g>
420 <c~ e g~ b> <c e g b>
421 @end lilypond
422
423 @cindex repeating ties
424 @cindex ties, repeating
425 @cindex volta brackets and ties
426 @cindex ties and volta brackets
427
428 @funindex \repeatTie
429 @funindex repeatTie
430
431 When a second alternative of a repeat starts with a tied note, you
432 have to specify the repeated tie as follows:
433
434 @lilypond[quote,relative=2,verbatim]
435 \repeat volta 2 { c g <c e>2 ~ }
436 \alternative {
437   % First alternative: following note is tied normally
438   { <c e>2. r4 }
439   % Second alternative: following note has a repeated tie
440   { <c e>2\repeatTie d4 c } }
441 @end lilypond
442
443 @cindex laissez vibrer
444 @cindex ties, laissez vibrer
445
446 @funindex \laissezVibrer
447 @funindex laissezVibrer
448
449 @notation{L.v.} ties (@notation{laissez vibrer}) indicate that
450 notes must not be damped at the end.  It is used in notation for
451 piano, harp and other string and percussion instruments.  They can
452 be entered as follows:
453
454 @lilypond[quote,verbatim,relative=1]
455 <c f g>1\laissezVibrer
456 @end lilypond
457
458 @cindex ties, placement
459
460 @funindex \tieUp
461 @funindex tieUp
462 @funindex \tieDown
463 @funindex tieDown
464 @funindex \tieNeutral
465 @funindex tieNeutral
466
467 The vertical placement of ties may be controlled, see
468 Predefined commands, or for details, see
469 @ref{Direction and placement}.
470
471 @cindex ties, appearance
472 @cindex ties, dotted
473 @cindex ties, dashed
474 @cindex dashed ties
475 @cindex dotted ties
476
477 @funindex \tieDotted
478 @funindex tieDotted
479 @funindex \tieDashed
480 @funindex tieDashed
481 @funindex \tieSolid
482 @funindex tieSolid
483
484 Solid, dotted or dashed ties may be specified, see Predefined
485 commands.
486
487
488 @predefined
489 @code{\tieUp},
490 @code{\tieDown},
491 @code{\tieNeutral},
492 @code{\tieDotted},
493 @code{\tieDashed},
494 @code{\tieSolid}.
495 @endpredefined
496
497
498 @snippets
499
500 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
501 {using-ties-with-arpeggios.ly}
502
503 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
504 {engraving-ties-manually.ly}
505
506
507 @seealso
508 Music Glossary:
509 @rglos{tie},
510 @rglos{laissez vibrer}.
511
512 Notation Reference: @ref{Automatic note splitting}.
513
514 Snippets:
515 @rlsr{Rhythms}.
516
517 Internals Reference:
518 @rinternals{LaissezVibrerTie},
519 @rinternals{LaissezVibrerTieColumn},
520 @rinternals{TieColumn},
521 @rinternals{Tie}.
522
523
524 @knownissues
525
526 Switching staves when a tie is active will not produce a slanted
527 tie.
528
529 Changing clefs or octavations during a tie is not really
530 well-defined.  In these cases, a slur may be preferable.
531
532
533
534 @node Writing rests
535 @subsection Writing rests
536
537 Rests are entered as part of the music in music expressions.
538
539 @menu
540 * Rests::
541 * Invisible rests::
542 * Full measure rests::
543 @end menu
544
545 @node Rests
546 @unnumberedsubsubsec Rests
547
548 @cindex rest
549 @cindex rest, entering durations
550 @cindex maxima rest
551 @cindex longa rest
552 @cindex breve rest
553
554 @funindex \rest
555 @funindex rest
556 @funindex r
557 @funindex \maxima
558 @funindex maxima
559 @funindex \longa
560 @funindex longa
561 @funindex \breve
562 @funindex breve
563
564 Rests are entered like notes with the note name @code{r}.
565 Durations longer than a whole rest use the predefined
566 commands shown:
567
568 @c \time 16/1 is used to avoid spurious bar lines
569 @c and long tracts of empty measures
570 @lilypond[fragment,quote,verbatim]
571 \new Staff {
572   % These two lines are just to prettify this example
573   \time 16/1
574   \override Staff.TimeSignature #'stencil = ##f
575   % Print a maxima rest, equal to four breves
576   r\maxima
577   % Print a longa rest, equal to two breves
578   r\longa
579   % Print a breve rest
580   r\breve
581   r1 r2 r4 r8 r16 r32 r64 r128
582 }
583 @end lilypond
584
585 @cindex rest, multi-measure
586 @cindex rest, whole-measure
587
588 Whole measure rests, centered in the middle of the measure, must be
589 entered as multi-measure rests.  They can be used for a single
590 measure as well as many measures and are discussed in @ref{Full
591 measure rests}.
592
593 @cindex rest, specifying vertical position
594
595 To explicitly specify a rest's vertical position, write a note
596 followed by @code{\rest}.  A rest of the duration of the note will
597 be placed at the staff position where the note would appear.  This
598 allows for precise manual formatting of polyphonic music, since the
599 automatic rest collision formatter will not move these rests.
600
601 @lilypond[quote,verbatim,relative=2]
602 a4\rest d4\rest
603 @end lilypond
604
605 @snippets
606
607 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
608 {rest-styles.ly}
609
610
611 @seealso
612 Music Glossary:
613 @rglos{breve},
614 @rglos{longa},
615 @rglos{maxima}.
616
617 Notation Reference:
618 @ref{Full measure rests}.
619
620 Snippets:
621 @rlsr{Rhythms}.
622
623 Internals Reference:
624 @rinternals{Rest}.
625
626
627 @knownissues
628
629 @c Deliberately duplicated in Durations and Rests.  -gp
630 There is no fundamental limit to rest durations (both in terms of
631 longest and shortest), but the number of glyphs is limited: there
632 are rests from 128th to maxima (8 x whole).
633
634
635 @node Invisible rests
636 @unnumberedsubsubsec Invisible rests
637
638 @cindex skip
639 @cindex invisible rest
640 @cindex rest, invisible
641 @cindex spacer note
642 @cindex spacer rest
643
644 @funindex s
645 @funindex \skip
646 @funindex skip
647
648 An invisible rest (also called a @q{spacer rest}) can be entered
649 like a note with the note name@tie{}@code{s}:
650
651 @lilypond[verbatim,quote,relative=2]
652 c4 c s c
653 s2 c
654 @end lilypond
655
656 @cindex lyrics, skip
657
658 Spacer rests are available only in note mode and chord mode.  In
659 other situations, for example, when entering lyrics, @code{\skip}
660 is used to skip a musical moment.  @code{\skip} requires an
661 explicit duration.
662
663 @lilypond[quote,verbatim,relative=2]
664 <<
665   {
666     a2 \skip2 a2 a2
667   }
668   \new Lyrics {
669     \lyricmode {
670       foo2 \skip 1 bla2
671     }
672   }
673 >>
674 @end lilypond
675
676 A spacer rest implicitly causes @code{Staff} and @code{Voice}
677 contexts to be created if none exist, just like notes and rests
678 do:
679
680 @lilypond[quote,verbatim,fragment]
681 s1 s s
682 @end lilypond
683
684 @code{\skip} simply skips musical time; it creates no output of
685 any kind.
686
687 @lilypond[quote,verbatim,fragment]
688 % This is valid input, but does nothing
689 \skip 1 \skip1 \skip 1
690 @end lilypond
691
692
693 @seealso
694 Snippets:
695 @rlsr{Rhythms}.
696
697 Internals Reference: @rinternals{SkipMusic}
698
699
700 @node Full measure rests
701 @unnumberedsubsubsec Full measure rests
702
703 @cindex multi-measure rests
704 @cindex full-measure rests
705 @cindex rest, multi-measure
706 @cindex rest, full-measure
707 @cindex whole rest for a full measure
708 @cindex rest, whole for a full measure
709
710 @funindex R
711
712 Rests for one or more full measures are entered like notes with
713 the note name uppercase @code{R}:
714
715 @lilypond[quote,verbatim,relative=2]
716 % Rest measures contracted to single measure
717 \compressFullBarRests
718 R1*4
719 R1*24
720 R1*4
721 b2^"Tutti" b4 a4
722 @end lilypond
723
724 The duration of full-measure rests is identical to the duration
725 notation used for notes.  The duration in a multi-measure rest must
726 always be an integral number of measure-lengths, so augmentation dots
727 or fractions must often be used:
728
729 @lilypond[quote,fragment,verbatim]
730 \compressFullBarRests
731 \time 2/4
732 R1 | R2 |
733 \time 3/4
734 R2. | R2.*2 |
735 \time 13/8
736 R1*13/8 | R1*13/8*12 |
737 \time 10/8
738 R4*5*4 |
739 @end lilypond
740
741 A full-measure rest is printed as either a whole or breve rest,
742 centered in the measure, depending on the time signature.
743
744 @lilypond[quote,verbatim,fragment]
745 \time 4/4
746 R1 |
747 \time 6/4
748 R1*3/2 |
749 \time 8/4
750 R1*2 |
751 @end lilypond
752
753 @cindex multi-measure rest, expanding
754 @cindex multi-measure rest, contracting
755
756 @funindex \expandFullBarRests
757 @funindex expandFullBarRests
758 @funindex \compressFullBarRests
759 @funindex compressFullBarRests
760
761 By default a multi-measure rest is expanded in the printed score to
762 show all the rest measures explicitly.  Alternatively, a multi-measure
763 rest can be shown as a single measure containing a multi-measure rest
764 symbol, with the number of measures of rest printed above the measure:
765
766 @lilypond[quote,fragment,verbatim]
767 % Default behavior
768 \time 3/4 r2. | R2.*2 |
769 \time 2/4 R2 |
770 \time 4/4
771 % Rest measures contracted to single measure
772 \compressFullBarRests
773 r1 | R1*17 | R1*4 |
774 % Rest measures expanded
775 \expandFullBarRests
776 \time 3/4
777 R2.*2 |
778 @end lilypond
779
780
781 @cindex text on multi-measure rest
782 @cindex multi-measure rest, attaching text
783 @cindex script on multi-measure rest
784 @cindex multi-measure rest, script
785 @cindex fermata on multi-measure rest
786 @cindex multi-measure rest, attaching fermata
787 @cindex markup on multi-measure rest
788 @cindex multi-measure rest with markup
789
790 @funindex \fermataMarkup
791 @funindex fermataMarkup
792 @funindex MultiMeasureRestText
793
794 Markups can be added to multi-measure rests.
795 The predefined command @code{\fermataMarkup}
796 is provided for adding fermatas.
797
798 @lilypond[quote,verbatim,fragment]
799 \compressFullBarRests
800 \time 3/4
801 R2.*10^\markup { \italic "ad lib." }
802 R2.^\fermataMarkup
803 @end lilypond
804
805 @warning{
806 Markups attached to a multi-measure rest are
807 objects of type @code{MultiMeasureRestText}, not
808 @code{TextScript}.  Overrides must be directed to the correct
809 object, or they will be ignored.  See the following example.
810 }
811
812 @lilypond[quote,verbatim,fragment]
813 % This fails, as the wrong object name is specified
814 \override TextScript #'padding = #5
815 R1^"wrong"
816 % This is correct and works
817 \override MultiMeasureRestText #'padding = #5
818 R1^"right"
819 @end lilypond
820
821 When a multi-measure rest immediately follows a @code{\partial}
822 setting, resulting bar-check warnings may not be displayed.
823
824
825 @funindex \textLengthOn
826 @funindex textLengthOn
827 @funindex \textLengthOff
828 @funindex textLenthOff
829 @funindex \fermataMarkup
830 @funindex fermataMarkup
831 @funindex \compressFullBarRests
832 @funindex compressFullBarRests
833 @funindex \expandFullBarRests
834 @funindex expandFullBarRests
835
836 @predefined
837 @code{\textLengthOn},
838 @code{\textLengthOff},
839 @code{\fermataMarkup},
840 @code{\compressFullBarRests},
841 @code{\expandFullBarRests}.
842 @endpredefined
843
844
845 @snippets
846
847 @cindex church rest
848 @cindex rest, church
849 @cindex kirchenpausen
850
851 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
852 {changing-form-of-multi--measure-rests.ly}
853
854 @cindex multi-measure rests, positioning
855 @cindex positioning multi-measure rests
856
857 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
858 {positioning-multi--measure-rests.ly}
859
860 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
861 {multi--measure-rest-markup.ly}
862
863
864 @seealso
865 Music Glossary:
866 @rglos{multi-measure rest}.
867
868 Notation Reference:
869 @ref{Durations},
870 @ref{Text},
871 @ref{Formatting text},
872 @ref{Text scripts}.
873
874 Snippets:
875 @rlsr{Rhythms}.
876
877 Internals Reference:
878 @rinternals{MultiMeasureRest},
879 @rinternals{MultiMeasureRestNumber},
880 @rinternals{MultiMeasureRestText}.
881
882
883 @cindex fingerings and multi-measure rests
884 @cindex multi-measure rests and fingerings
885
886 @knownissues
887
888 If an attempt is made to use fingerings (e.g.,
889 @code{R1*10-4}) to put numbers over multi-measure rests, the
890 fingering numeral (4) may collide with the bar counter
891 numeral (10).
892
893 @cindex condensing rests
894 @cindex rest, condensing ordinary
895
896 There is no way to automatically condense multiple ordinary rests
897 into a single multi-measure rest.
898
899 @cindex rest, collisions of
900
901 Multi-measure rests do not take part in rest collisions.
902
903 @node Displaying rhythms
904 @subsection Displaying rhythms
905
906 @menu
907 * Time signature::
908 * Upbeats::
909 * Unmetered music::
910 * Polymetric notation::
911 * Automatic note splitting::
912 * Showing melody rhythms::
913 @end menu
914
915 @node Time signature
916 @unnumberedsubsubsec Time signature
917
918 @cindex time signature
919 @cindex meter
920
921 @funindex \time
922 @funindex time
923
924 The time signature is set as follows:
925
926 @lilypond[quote,verbatim,relative=2]
927 \time 2/4 c2
928 \time 3/4 c2.
929 @end lilypond
930
931 @cindex time signature, visibility of
932
933 Time signatures are printed at the beginning of a piece
934 and whenever the time signature changes.  If a change takes place
935 at the end of a line a warning time signature sign is printed
936 there.  This default behavior may be changed, see
937 @ref{Visibility of objects}.
938
939 @lilypond[quote,verbatim,relative=2]
940 \time 2/4
941 c2 c
942 \break
943 c c
944 \break
945 \time 4/4
946 c c c c
947 @end lilypond
948
949 @cindex time signature style
950 @cindex meter style
951
952 @funindex \numericTimeSignature
953 @funindex numericTimeSignature
954 @funindex \defaultTimeSignature
955 @funindex defaultTimeSignature
956
957 The time signature symbol that is used in 2/2 and 4/4 time can be
958 changed to a numeric style:
959
960 @lilypond[quote,verbatim,relative=2]
961 % Default style
962 \time 4/4 c1
963 \time 2/2 c1
964 % Change to numeric style
965 \numericTimeSignature
966 \time 4/4 c1
967 \time 2/2 c1
968 % Revert to default style
969 \defaultTimeSignature
970 \time 4/4 c1
971 \time 2/2 c1
972 @end lilypond
973
974
975 Mensural time signatures are covered in
976 @ref{Mensural time signatures}.
977
978
979 @predefined
980 @code{\numericTimeSignature},
981 @code{\defaultTimeSignature}.
982 @endpredefined
983
984
985 @snippets
986
987 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
988 {changing-the-time-signature-without-affecting-the-beaming.ly}
989
990 @cindex compound time signatures
991 @cindex time signature, compound
992
993 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
994 {compound-time-signatures.ly}
995
996
997 @seealso
998 Music Glossary:
999 @rglos{time signature}
1000
1001 Notation Reference:
1002 @ref{Mensural time signatures},
1003 @ref{Time administration}.
1004
1005 Snippets:
1006 @rlsr{Rhythms}.
1007
1008 Internals Reference:
1009 @rinternals{TimeSignature},
1010 @rinternals{Timing_translator}.
1011
1012
1013 @node Upbeats
1014 @unnumberedsubsubsec Upbeats
1015
1016 @cindex anacrusis
1017 @cindex upbeat
1018 @cindex partial measure
1019 @cindex measure, partial
1020 @cindex pickup measure
1021 @cindex measure, change length
1022
1023 @funindex measurePosition
1024 @funindex \partial
1025 @funindex partial
1026
1027 Partial or pick-up measures, such as an anacrusis or upbeat, are
1028 entered using the @code{\partial} command, with the syntax
1029
1030 @example
1031 \partial @var{duration}
1032 @end example
1033
1034 where @code{duration} is the rhythmic length of the interval
1035 before the start of the first complete measure:
1036
1037 @lilypond[quote,verbatim,relative=2]
1038 \partial 4 e4 |
1039 a2. c,4 |
1040 @end lilypond
1041
1042 The partial measure can be any duration less than a full measure:
1043
1044 @lilypond[quote,verbatim,relative=2]
1045 \partial 8*3 c8 d e |
1046 a2. c,4 |
1047 @end lilypond
1048
1049 Internally, this is translated into
1050
1051 @example
1052 \set Timing.measurePosition = -@var{duration}
1053 @end example
1054
1055 The property @code{measurePosition} contains a rational number
1056 indicating how much of the measure has passed at this point.  Note
1057 that this is set to a negative number by the @code{\partial}
1058 command: i.e., @code{\partial 4} is internally translated to
1059 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1060
1061
1062 @seealso
1063 Music Glossary:
1064 @rglos{anacrusis}.
1065
1066 Notation Reference:
1067 @ref{Grace notes}.
1068
1069 Snippets:
1070 @rlsr{Rhythms}.
1071
1072 Internal Reference:
1073 @rinternals{Timing_translator}.
1074
1075
1076 @knownissues
1077
1078 The @code{\partial} command is intended to be used only at the
1079 beginning of a piece.  If you use it after the beginning, some
1080 odd warnings may occur.
1081
1082 @node Unmetered music
1083 @unnumberedsubsubsec Unmetered music
1084
1085 @cindex bar lines, turning off
1086 @cindex bar numbering, turning off
1087 @cindex cadenza
1088 @cindex unmetered music
1089
1090 @funindex \cadenzaOn
1091 @funindex cadenzaOn
1092 @funindex \cadenzaOff
1093 @funindex cadenzaOff
1094
1095 Bar lines and bar numbers are calculated automatically.  For
1096 unmetered music (some cadenzas, for example), this is not desirable.
1097 To turn off automatic calculation of bar lines and bar numbers,
1098 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1099 to turn them on again.
1100
1101 @lilypond[verbatim,relative=2,fragment]
1102 c4 d e d
1103 \cadenzaOn
1104 c4 c d8 d d f4 g4.
1105 \cadenzaOff
1106 \bar "|"
1107 d4 e d c
1108 @end lilypond
1109
1110 Bar numbering is resumed at the end of the cadenza as if the
1111 cadenza were not there:
1112
1113 @lilypond[verbatim,relative=2,fragment]
1114 % Show all bar numbers
1115 \override Score.BarNumber #'break-visibility = #all-visible
1116 c4 d e d
1117 \cadenzaOn
1118 c4 c d8 d d f4 g4.
1119 \cadenzaOff
1120 \bar "|"
1121 d4 e d c
1122 @end lilypond
1123
1124
1125 @predefined
1126 @code{\cadenzaOn},
1127 @code{\cadenzaOff}.
1128 @endpredefined
1129
1130
1131 @seealso
1132 Music Glossary:
1133 @rglos{cadenza}.
1134
1135 Notation Reference:
1136 @ref{Visibility of objects}.
1137
1138 Snippets:
1139 @rlsr{Rhythms}.
1140
1141
1142 @cindex cadenza line breaks
1143 @cindex cadenza page breaks
1144 @cindex unmetered music, line breaks
1145 @cindex unmetered music, page breaks
1146 @cindex breaks in unmetered music
1147 @cindex line breaks in cadenzas
1148 @cindex page breaks in cadenzas
1149 @cindex line breaks in unmetered music
1150 @cindex page breaks in unmetered music
1151
1152 @knownissues
1153
1154 LilyPond will insert line breaks and page breaks only at a
1155 bar line.  Unless the unmetered music ends before the end of the
1156 staff line, you will need to insert invisible bar lines with
1157
1158 @example
1159 \bar ""
1160 @end example
1161
1162 @noindent
1163 to indicate where breaks can occur.
1164
1165
1166 @node Polymetric notation
1167 @unnumberedsubsubsec Polymetric notation
1168
1169 @c This section necessarily uses \set
1170 @c This is acceptable  -td
1171
1172 @cindex double time signatures
1173 @cindex signatures, polymetric
1174 @cindex time signatures, polymetric
1175 @cindex time signatures, double
1176 @cindex polymetric signatures
1177 @cindex meter, polymetric
1178
1179 @funindex timeSignatureFraction
1180 @funindex \scaleDurations
1181 @funindex scaleDurations
1182 @funindex \times
1183 @funindex times
1184
1185 Polymetric notation is supported, either explicitly or by modifying
1186 the visible time signature symbol and scaling the note durations.
1187
1188 @strong{@i{Staves with different time signatures, equal measure lengths}}
1189
1190 This notation can be created by setting a common time signature
1191 for each staff but replacing the symbol manually by setting
1192 @code{timeSignatureFraction} to the desired fraction and scaling
1193 the printed durations in each staff to the common time
1194 signature; see @ref{Time signature}.  The scaling is done with
1195 @code{\scaleDurations}, which is used in a similar way to
1196 @code{\times}, but does not create a tuplet bracket; see
1197 @ref{Scaling durations}.
1198
1199 @cindex beaming in polymetric music
1200 @cindex beaming in polymetric meter
1201
1202 In this example, music with the time signatures of 3/4, 9/8, and
1203 10/8 are used in parallel.  In the second staff, shown durations
1204 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1205 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1206 It will often be necessary to insert beams manually, as the
1207 duration scaling affects the autobeaming rules.
1208
1209 @lilypond[quote,verbatim,fragment]
1210 \relative c' <<
1211   \new Staff {
1212     \time 3/4
1213     c4 c c |
1214     c c c |
1215   }
1216   \new Staff {
1217     \time 3/4
1218     \set Staff.timeSignatureFraction = #'(9 . 8)
1219     \scaleDurations #'(2 . 3)
1220     \repeat unfold 6 { c8[ c c] }
1221   }
1222   \new Staff {
1223     \time 3/4
1224     \set Staff.timeSignatureFraction = #'(10 . 8)
1225     \scaleDurations #'(3 . 5) {
1226       \repeat unfold 2 { c8[ c c] }
1227       \repeat unfold 2 { c8[ c] } |
1228       c4. c4. \times 2/3 { c8[ c c] } c4
1229     }
1230   }
1231 >>
1232 @end lilypond
1233
1234 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1235
1236 Each staff can be given its own independent time signature by
1237 moving the @code{Timing_translator} and the
1238 @code{Default_bar_line_engraver} to the @code{Staff} context.
1239
1240 @lilypond[quote,verbatim]
1241 \layout {
1242   \context {
1243     \Score
1244     \remove "Timing_translator"
1245     \remove "Default_bar_line_engraver"
1246   }
1247   \context {
1248     \Staff
1249     \consists "Timing_translator"
1250     \consists "Default_bar_line_engraver"
1251   }
1252 }
1253
1254 % Now each staff has its own time signature.
1255
1256 \relative c' <<
1257   \new Staff {
1258     \time 3/4
1259     c4 c c |
1260     c c c |
1261   }
1262   \new Staff {
1263     \time 2/4
1264     c4 c |
1265     c c |
1266     c c |
1267   }
1268   \new Staff {
1269     \time 3/8
1270     c4. |
1271     c8 c c |
1272     c4. |
1273     c8 c c |
1274   }
1275 >>
1276 @end lilypond
1277
1278 @snippets
1279
1280 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1281 {compound-time-signatures.ly}
1282
1283
1284 @seealso
1285 Music Glossary:
1286 @rglos{polymetric},
1287 @rglos{polymetric time signature},
1288 @rglos{meter}.
1289
1290 Notation Reference:
1291 @ref{Time signature},
1292 @ref{Scaling durations}.
1293
1294 Snippets:
1295 @rlsr{Rhythms}.
1296
1297 Internals Reference:
1298 @rinternals{TimeSignature},
1299 @rinternals{Timing_translator},
1300 @rinternals{Default_bar_line_engraver},
1301 @rinternals{Staff}.
1302
1303
1304 @knownissues
1305
1306 When using different time signatures in parallel, notes
1307 at the same moment will be be placed at the same horizontal
1308 location.  However, the bar lines in the different staves
1309 will cause the note spacing to be less regular in each of the
1310 individual staves than would be normal without the different
1311 time signatures.
1312
1313 @node Automatic note splitting
1314 @unnumberedsubsubsec Automatic note splitting
1315
1316 @cindex notes, splitting
1317 @cindex splitting notes
1318
1319 @funindex Note_heads_engraver
1320 @funindex Completion_heads_engraver
1321
1322 Long notes which overrun bar lines can be converted automatically
1323 to tied notes.  This is done by replacing the
1324 @code{Note_heads_engraver} with the
1325 @code{Completion_heads_engraver}.  In the following
1326 example, notes crossing the bar lines are split and tied.
1327
1328 @lilypond[quote,verbatim,relative=1]
1329 \new Voice \with {
1330   \remove "Note_heads_engraver"
1331   \consists "Completion_heads_engraver"
1332 }
1333
1334 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1335 @end lilypond
1336
1337 This engraver splits all running notes at the bar line, and
1338 inserts ties.  One of its uses is to debug complex scores: if the
1339 measures are not entirely filled, then the ties show exactly how
1340 much each measure is off.
1341
1342
1343 @seealso
1344 Music Glossary: @rglos{tie}
1345
1346 Learning Manual:
1347 @rlearning{Engravers explained},
1348 @rlearning{Adding and removing engravers}.
1349
1350 Snippets:
1351 @rlsr{Rhythms}.
1352
1353 Internals Reference:
1354 @rinternals{Note_heads_engraver},
1355 @rinternals{Completion_heads_engraver},
1356 @rinternals{Forbid_line_break_engraver}.
1357
1358
1359 @knownissues
1360
1361 Not all durations (especially those containing tuplets) can be
1362 represented exactly with normal notes and dots, but the
1363 @code{Completion_heads_engraver} will not insert tuplets.
1364
1365 The @code{Completion_heads_engraver} only affects notes; it does not
1366 split rests.
1367
1368
1369 @node Showing melody rhythms
1370 @unnumberedsubsubsec Showing melody rhythms
1371
1372 @cindex melody rhythms, showing
1373 @cindex rhythms, showing melody
1374
1375 Sometimes you might want to show only the rhythm of a melody.  This
1376 can be done with the rhythmic staff.  All pitches of notes on such a
1377 staff are squashed, and the staff itself has a single line
1378
1379 @lilypond[quote,relative=1,verbatim]
1380 <<
1381   \new RhythmicStaff {
1382     \new Voice = "myRhythm" {
1383       \time 4/4
1384       c4 e8 f g2
1385       r4 g g f
1386       g1
1387     }
1388   }
1389   \new Lyrics {
1390     \lyricsto "myRhythm" {
1391       This is my song
1392       I like to sing
1393     }
1394   }
1395 >>
1396 @end lilypond
1397
1398 @cindex guitar chord charts
1399 @cindex strumming rhythms, showing
1400 @cindex guitar strumming rhythms, showing
1401
1402 @funindex Pitch_squash_engraver
1403 @funindex \improvisationOn
1404 @funindex improvisationOn
1405 @funindex \improvisationOff
1406 @funindex improvisationOff
1407
1408 Guitar chord charts often show the strumming rhythms.  This can
1409 be done with the @code{Pitch_squash_engraver} and
1410 @code{\improvisationOn}.
1411
1412
1413 @lilypond[quote,verbatim]
1414 <<
1415   \new ChordNames {
1416     \chordmode {
1417       c1 f g c
1418     }
1419   }
1420
1421   \new Voice \with {
1422     \consists Pitch_squash_engraver
1423   } \relative c'' {
1424     \improvisationOn
1425     c4 c8 c c4 c8 c
1426     f4 f8 f f4 f8 f
1427     g4 g8 g g4 g8 g
1428     c4 c8 c c4 c8 c
1429   }
1430 >>
1431 @end lilypond
1432
1433
1434 @predefined
1435 @code{\improvisationOn},
1436 @code{\improvisationOff}.
1437 @endpredefined
1438
1439
1440 @snippets
1441
1442 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1443 {guitar-strum-rhythms.ly}
1444
1445
1446 @seealso
1447 Snippets:
1448 @rlsr{Rhythms}.
1449
1450 Internals Reference:
1451 @rinternals{RhythmicStaff},
1452 @rinternals{Pitch_squash_engraver}.
1453
1454
1455 @node Beams
1456 @subsection Beams
1457
1458 @menu
1459 * Automatic beams::
1460 * Setting automatic beam behavior::
1461 * Manual beams::
1462 * Feathered beams::
1463 @end menu
1464
1465 @node Automatic beams
1466 @unnumberedsubsubsec Automatic beams
1467
1468 By default, beams are inserted automatically:
1469
1470 @cindex beams, manual
1471 @cindex manual beams
1472 @cindex beams, setting rules for
1473 @cindex beams, custom rules for
1474
1475 @funindex \autoBeamOn
1476 @funindex autoBeamOn
1477 @funindex \autoBeamOff
1478 @funindex autoBeamOff
1479
1480 @lilypond[quote,verbatim,relative=2]
1481 \time 2/4 c8 c c c
1482 \time 6/8 c c c c8. c16 c8
1483 @end lilypond
1484
1485 If these automatic decisions are not satisfactory, beaming can be
1486 entered explicitly; see @ref{Manual beams}.  Beams @emph{must} be
1487 entered manually if beams are to be extended over rests.
1488
1489 If automatic beaming is not required, it may be turned off with
1490 @code{\autoBeamOff} and on with @code{\autoBeamOn}:
1491
1492 @lilypond[quote,relative=1,verbatim]
1493 c4 c8 c8. c16 c8. c16 c8
1494 \autoBeamOff
1495 c4 c8 c8. c16 c8.
1496 \autoBeamOn
1497 c16 c8
1498 @end lilypond
1499
1500 @cindex melismata, beams
1501 @cindex beams and melismata
1502
1503 @warning{If beams are used to indicate melismata in songs, then
1504 automatic beaming should be switched off with @code{\autoBeamOff}
1505 and the beams indicated manually.}
1506
1507 Beaming patterns that differ from the automatic defaults may be
1508 created, see @ref{Setting automatic beam behavior}.
1509
1510
1511 @predefined
1512 @code{\autoBeamOff},
1513 @code{\autoBeamOn}.
1514 @endpredefined
1515
1516
1517 @snippets
1518
1519 @cindex line breaks and beams
1520 @cindex beams and line breaks
1521
1522 @funindex breakable
1523
1524 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1525 {beams-across-line-breaks.ly}
1526
1527 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1528 {changing-beam-knee-gap.ly}
1529
1530
1531 @seealso
1532 Notation Reference:
1533 @ref{Manual beams},
1534 @ref{Setting automatic beam behavior}.
1535
1536 Installed Files:
1537 @file{scm/@/auto@/-beam@/.scm}.
1538
1539 Snippets:
1540 @rlsr{Rhythms}.
1541
1542 Internals Reference: @rinternals{Beam}.
1543
1544
1545 @knownissues
1546
1547 Automatically kneed cross-staff beams cannot be used together with
1548 hidden staves.  See @ref{Hiding staves}.
1549
1550 Beams can collide with note heads and accidentals in other voices
1551
1552
1553 @node Setting automatic beam behavior
1554 @unnumberedsubsubsec Setting automatic beam behavior
1555
1556
1557 @cindex automatic beams, tuning
1558 @cindex tuning automatic beaming
1559 @cindex automatic beam generation
1560 @cindex autobeam
1561 @cindex lyrics and beaming
1562
1563 @funindex autoBeaming
1564 @funindex autoBeamSettings
1565 @funindex (end * * * *)
1566 @funindex (begin * * * *)
1567 @funindex measureLength
1568 @funindex beatLength
1569 @funindex beatGrouping
1570 @funindex \time
1571 @funindex time
1572 @funindex \set
1573 @funindex set
1574
1575 There are two types of beaming rules:  @emph{beam-grouping}
1576 rules and @emph{beam-ending} rules.  Beam-grouping rules are the
1577 simplest, but are over-ridden by any beam-ending rules which apply.
1578
1579 The placement of automatic beams is determined by applying the
1580 following rules in order:
1581
1582 @itemize
1583
1584 @item If a manual beam is specified with @code{[..]} set the beam
1585 as specified, otherwise
1586
1587 @item if @code{\autoBeamOff} is in force do not beam, otherwise
1588
1589 @item if a beam-ending rule applies use it to determine the valid
1590 places where beams may end, otherwise
1591
1592 @item if a valid (see below) beat-grouping rule applies use it to
1593 group notes with beams, otherwise
1594
1595 @item use the value of @code{beatLength} to group notes with beams
1596
1597 @end itemize
1598
1599 @i{@strong{Modifying the grouping of beats}}
1600
1601 If there are no beam-ending rules defined for the beam duration of a
1602 particular beam in the time signature in use, its beaming is
1603 controlled by three context properties: @code{measureLength},
1604 @code{beatLength} and @code{beatGrouping}.  These properties may be
1605 set in the @code{Score}, @code{Staff} or @code{Voice} contexts to
1606 delimit their scope.  The default values are set while processing
1607 @code{\time} commands, so any @code{\set} commands to modify their
1608 value must be placed after all @code{\time} commands.
1609
1610 @warning{These three properties become effective for a particular
1611 beam @strong{only} if there are no beam-ending rules predefined for
1612 that beam's duration in the time signature in use, or if these
1613 beam-ending rules have all been reverted.}
1614
1615 These determine the beaming as follows:
1616
1617 Beams may begin anywhere (unless a beam is already active).  Beams
1618 end at a time determined by the values of @code{beatGrouping} and
1619 @code{beatLength}, as follows:
1620
1621 @itemize
1622
1623 @item If @code{beatGrouping} and @code{beatLength} are consistent
1624 with @code{measureLength}, @code{beatGrouping} is used to determine
1625 the end points of beams.
1626
1627 @item If @code{beatGrouping} and @code{beatLength} are inconsistent
1628 with @code{measureLength}, @code{beatLength} is used to determine
1629 the end points of beams.
1630
1631 @end itemize
1632
1633 By default the @code{measureLength} and @code{beatLength} are
1634 derived from the time signature set by the @code{\time} command.
1635 The @code{measureLength} is set to be exactly the same length as
1636 the measure length given by the time signature, and the
1637 @code{beatLength} is set to be the same as one over the denominator
1638 of the time signature.
1639
1640 The default value of @code{beatGrouping} is taken from a table in
1641 @file{scm/@/music@/-functions@/.scm}.  To find this, see
1642 @rlearning{Other sources of information}.  It defines the beat
1643 grouping for 3/8, 4/8, 5/8, 8/8, and all the common compound time
1644 signatures.
1645
1646 Both @code{measureLength} and @code{beatLength} are @i{moments},
1647 units of musical duration.  A quantity of type @i{moment} is
1648 created by the scheme function @code{ly:make-moment}.  For more
1649 information about this function, see @ref{Time administration}.
1650
1651 @code{beatGrouping} is a list of integers giving the number of
1652 beats in each group.
1653
1654 @snippets
1655
1656 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1657 {grouping-beats.ly}
1658
1659 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1660 {specifying-context-with-beatgrouping.ly}
1661
1662 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1663 {using-beatlength-and-beatgrouping.ly}
1664
1665 @funindex subdivideBeams
1666
1667 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1668 {sub-dividing-beams.ly}
1669
1670 @cindex measure groupings
1671 @cindex beats, grouping
1672 @cindex grouping beats
1673 @cindex measure sub-grouping
1674
1675 @funindex autoBeamSettings
1676 @funindex beam-limit
1677 @funindex beam-numerator
1678 @funindex beam-denominator
1679
1680
1681 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1682 {conducting-signs,-measure-grouping-signs.ly}
1683
1684
1685 @strong{@i{Modifying the beam end points}}
1686
1687 Beam-ending rules are required when beams of different durations are
1688 to end at different points within the measure.  For example, it may
1689 be desirable for eighth-note beams in 4/4 time to end only at the
1690 end of the measure or half-way through it, but for sixteenth-note
1691 beams to end at quarter note positions to avoid overly long beamed
1692 runs.  The rules work as follows:
1693
1694 Automatic beams can start on any note but can end at only a few
1695 positions within the measure, namely at positions specified by the
1696 properties in @code{autoBeamSettings}.  These properties consist of
1697 a list of rules defining where beams can end.  The default
1698 @code{autoBeamSettings} rules are defined in
1699 @file{scm/@/auto@/-beam@/.scm}.  To find this file, see
1700 @rlearning{Other sources of information}.
1701
1702 In order to add a rule to the list, use
1703
1704 @example
1705 #(override-auto-beam-setting
1706   '(beam-limit
1707     beam-numerator  beam-denominator
1708     time-signature-numerator time-signature-denominator)
1709   moment-numerator moment-denominator [context])
1710 @end example
1711
1712 @noindent
1713 where
1714
1715 @itemize
1716
1717 @item @code{beam-limit} is the type of automatic beam limit
1718 defined.  This can be either @code{begin} or @code{end} but
1719 only @code{end} is effective.
1720
1721 @item @code{beam-numerator/beam-denominator} is the beam duration
1722 to which the rule is to apply.  A beam is considered to have the
1723 duration of its shortest note.  Set @code{beam-numerator} and
1724 @code{beam-denominator} to @code{'*'} to have this rule apply to beams
1725 of any duration.
1726
1727 @funindex time-signature-numerator
1728 @funindex time-signature-denominator
1729
1730 @item @code{time-signature-numerator/time-signature-denominator}
1731 specifies the time signature to which this rule should apply.  If
1732 @code{time-signature-numerator} and @code{time-signature-denominator}
1733 are set to @code{'*'} this rule will apply in any time signature.
1734
1735 @funindex moment-numerator
1736 @funindex moment-denominator
1737
1738 @item @code{moment-numerator/moment-denominator} is the position
1739 in the bar at which the beam should end.
1740
1741 @funindex score-override-auto-beam-setting
1742 @funindex override-auto-beam-setting
1743
1744 @item @code{context} is optional, and it specifies the context at which
1745 the change should be made.  The default is @code{'Voice}.
1746
1747 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
1748 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
1749
1750 @end itemize
1751
1752 For example, if automatic beams should always end on the first quarter
1753 note, whatever the time signature or beam duration, use
1754
1755 @lilypond[quote,verbatim,relative=2]
1756 a8 a a a a a a a
1757 #(override-auto-beam-setting '(end * * * *) 1 4)
1758 a8 a a a a a a a
1759 @end lilypond
1760
1761 You can force the beam settings to take effect only on beams whose shortest
1762 note is a certain duration
1763
1764 @lilypond[quote,verbatim,relative=2]
1765 \time 2/4
1766 % end 1/16 beams for all time signatures at the 1/16 moment
1767 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
1768 a16 a a a a a a a |
1769 a32 a a a a16 a a a a a |
1770 % end 1/32 beams for all time signatures at the 1/16 moment
1771 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
1772 a32 a a a a16 a a a a a |
1773 @end lilypond
1774
1775 You can force the beam settings to take effect only in certain time
1776 signatures
1777
1778 @lilypond[quote,verbatim,relative=2]
1779 \time 5/8
1780 % end beams of all durations in 5/8 time signature at the 2/8 moment
1781 #(override-auto-beam-setting '(end * * 5 8) 2 8)
1782 c8 c d d d
1783 \time 4/4
1784 e8 e f f e e d d
1785 \time 5/8
1786 c8 c d d d
1787 @end lilypond
1788
1789 When multiple voices are used the @code{Staff} context must be
1790 specified if the beaming is to be applied to all voices in the
1791 staff:
1792
1793 @lilypond[quote,verbatim,relative=2]
1794 \time 7/8
1795 % rhythm 3-1-1-2
1796 % Context not specified - does not work correctly
1797 #(override-auto-beam-setting '(end * * 7 8) 3 8)
1798 #(override-auto-beam-setting '(end * * 7 8) 4 8)
1799 #(override-auto-beam-setting '(end * * 7 8) 5 8)
1800 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1801
1802 % Works correctly with context specified
1803 #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
1804 #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
1805 #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
1806 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1807 @end lilypond
1808
1809 @warning{If any unexpected beam behavior occurs, check the default
1810 automatic beam settings in @file{scm/@/auto@/-beam@/.scm} for
1811 possible interference, because the beam endings defined there will
1812 still apply in addition to your own.}
1813
1814 @funindex revert-auto-beam-setting
1815
1816 Any unwanted or conflicting default endings must be reverted for
1817 your time signature(s).  Existing default or user-defined
1818 beam-ending rules are removed by using
1819
1820 @example
1821 #(revert-auto-beam-setting
1822   '(beam-limit
1823     beam-numerator  beam-denominator
1824     time-signature-numerator time-signature-denominator)
1825   moment-numerator moment-denominator [context])
1826 @end example
1827
1828 @noindent
1829 @code{beam-limit}, @code{beam-numerator}, @code{beam-denominator},
1830 @code{time-signature-numerator}, @code{time-signature-denominator},
1831 @code{moment-numerator}, @code{moment-denominator} and @code{context}
1832 are the same as above.
1833
1834 @lilypond[quote,verbatim,relative=2]
1835 \time 4/4
1836 a16 a a a a a a a a a a a a a a a
1837 % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
1838 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
1839 a16 a a a a a a a a a a a a a a a
1840 @end lilypond
1841
1842 The rule in a @code{revert-auto-beam-setting} statement must exactly
1843 match the original rule.  That is, no wildcard expansion is taken into
1844 account.
1845
1846 @lilypond[quote,verbatim,relative=2]
1847 \time 1/4
1848 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
1849 a16 a a a
1850 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
1851 a a a a
1852 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
1853 a a a a
1854 @end lilypond
1855
1856 @snippets
1857
1858 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1859 {beam-grouping-in-7-8-time.ly}
1860
1861 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1862 {reverting-default-beam-endings.ly}
1863
1864 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1865 {beam-endings-in-score-context.ly}
1866
1867 @funindex \autoBeamOff
1868 @funindex autoBeamOff
1869 @funindex \autoBeamOn
1870 @funindex autoBeamOn
1871
1872 @predefined
1873 @code{\autoBeamOff},
1874 @code{\autoBeamOn}.
1875 @endpredefined
1876
1877
1878 @cindex beam, last in score
1879 @cindex beam, last in polyphonic voice
1880
1881 @knownissues
1882
1883 If a score ends while an automatic beam has not been ended and is
1884 still accepting notes, this last beam will not be typeset at all.
1885 The same holds for polyphonic voices, entered with @code{<<
1886 @dots{} \\ @dots{} >>}.  If a polyphonic voice ends while an
1887 automatic beam is still accepting notes, it is not typeset.
1888
1889
1890 @seealso
1891 Snippets:
1892 @rlsr{Rhythms}.
1893
1894
1895 @node Manual beams
1896 @unnumberedsubsubsec Manual beams
1897
1898 @cindex beams, manual
1899 @cindex manual beams
1900
1901 @funindex ]
1902 @funindex [
1903
1904 In some cases it may be necessary to override the automatic
1905 beaming algorithm.  For example, the autobeamer will not put beams
1906 over rests or bar lines, and in choral scores the beaming is
1907 often set to follow the meter of the lyrics rather than the
1908 notes. Such beams can be specified manually by
1909 marking the begin and end point with @code{[} and @code{]}
1910
1911 @lilypond[quote,relative=1,verbatim]
1912 {
1913   r4 r8[ g' a r8] r8 g[ | a] r8
1914 }
1915 @end lilypond
1916
1917
1918 @funindex \noBeam
1919 @funindex noBeam
1920
1921 Individual notes may be marked with @code{\noBeam} to prevent them
1922 from being beamed:
1923
1924 @lilypond[quote,verbatim,relative=2]
1925 \time 2/4 c8 c\noBeam c c
1926 @end lilypond
1927
1928 @funindex stemLeftBeamCount
1929 @funindex stemRightBeamCount
1930
1931 Even more strict manual control with the beams can be achieved by
1932 setting the properties @code{stemLeftBeamCount} and
1933 @code{stemRightBeamCount}.  They specify the number of beams to
1934 draw on the left and right side, respectively, of the next note.
1935 If either property is set, its value will be used only once, and
1936 then it is erased.  In this example, the last @code{f} is printed
1937 with only one beam on the left side, i.e., the eighth-note beam of
1938 the group as a whole.
1939
1940 @lilypond[quote,relative=2,verbatim]
1941 a8[ r16 f g a]
1942 a8[ r16
1943 \set stemLeftBeamCount = #2
1944 \set stemRightBeamCount = #1
1945 f
1946 \set stemLeftBeamCount = #1
1947 g a]
1948 @end lilypond
1949
1950
1951 @snippets
1952
1953 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1954 {flat-flags-and-beam-nibs.ly}
1955
1956 @node Feathered beams
1957 @unnumberedsubsubsec Feathered beams
1958
1959 @cindex beams, feathered
1960 @cindex feathered beams
1961
1962 @funindex \featherDurations
1963 @funindex featherDurations
1964 @funindex grow-direction
1965
1966 Feathered beams are used to indicate that a small group of notes
1967 should be played at an increasing (or decreasing) tempo, without
1968 changing the overall tempo of the piece.  The extent of the
1969 feathered beam must be indicated manually using @code{[} and
1970 @code{]}, and the beam feathering is turned on by specifying a
1971 direction to the @code{Beam} property @code{grow-direction}.
1972
1973 If the placement of the notes and the sound in the MIDI output is to
1974 reflect the ritardando or accelerando indicated by the feathered beam
1975 the notes must be grouped as a music expression delimited by braces
1976 and preceded by a @code{featherDurations} command which specifies
1977 the ratio between the durations of the first and last notes in the
1978 group.
1979
1980 The square brackets show the extent of the beam and the braces show
1981 which notes are to have their durations modified.  Normally these
1982 would delimit the same group of notes, but this is not required: the
1983 two commands are independent.
1984
1985 In the following example the eight 16th notes occupy exactly the
1986 same time as a half note, but the first note is one half as long
1987 as the last one, with the intermediate notes gradually
1988 lengthening.  The first four 32nd notes gradually speed up, while
1989 the last four 32nd notes are at a constant tempo.
1990
1991 @lilypond[relative=1,verbatim,quote]
1992 \override Beam #'grow-direction = #LEFT
1993 \featherDurations #(ly:make-moment 2 1)
1994 { c16[ c c c c c c c] }
1995 \override Beam #'grow-direction = #RIGHT
1996 \featherDurations #(ly:make-moment 2 3)
1997 { c32[ d e f] }
1998 % revert to non-feathered beams
1999 \override Beam #'grow-direction = #'()
2000 { g32[ a b c] }
2001 @end lilypond
2002
2003 @noindent
2004 The spacing in the printed output represents the
2005 note durations only approximately, but the MIDI output is exact.
2006
2007 @knownissues
2008
2009 The @code{\featherDurations} command only works with very short
2010 music snippets, and when numbers in the fraction are small.
2011
2012
2013 @seealso
2014 Snippets:
2015 @rlsr{Rhythms}.
2016
2017
2018 @node Bars
2019 @subsection Bars
2020
2021
2022 @menu
2023 * Bar lines::
2024 * Bar numbers::
2025 * Bar and bar number checks::
2026 * Rehearsal marks::
2027 @end menu
2028
2029 @node Bar lines
2030 @unnumberedsubsubsec Bar lines
2031
2032 @cindex bar lines
2033 @cindex measure lines
2034 @cindex closing bar lines
2035 @cindex bar lines, closing
2036 @cindex double bar lines
2037 @cindex bar lines, double
2038 @cindex repeat bars
2039
2040 @funindex \bar
2041 @funindex bar
2042
2043 Bar lines delimit measures, and are also used to indicate
2044 repeats.  Normally, simple bar lines are automatically inserted
2045 into the printed output at places based on the current time
2046 signature.
2047
2048 The simple bar lines inserted automatically can be changed to
2049 other types with the @code{\bar} command.  For example, a closing
2050 double bar line is usually placed at the end of a piece:
2051
2052 @lilypond[quote,relative=1,verbatim]
2053 e4 d c2 \bar "|."
2054 @end lilypond
2055
2056 It is not invalid if the final note in a measure does not
2057 end on the automatically entered bar line: the note is assumed
2058 to carry over into the next measure.  But if a long sequence
2059 of such carry-over measures appears the music can appear compressed
2060 or even flowing off the page.  This is because automatic line
2061 breaks happen only at the end of complete measures, i.e., where
2062 all notes end before the end of a measure.
2063
2064 @warning{An incorrect duration can cause line breaks to be
2065 inhibited, leading to a line of highly compressed music or
2066 music which flows off the page.}
2067
2068 @cindex line breaks
2069 @cindex bar lines, invisible
2070 @cindex measure lines, invisible
2071
2072 Line breaks are also permitted at manually inserted bar lines
2073 even within incomplete measures.  To allow a line break without
2074 printing a bar line, use
2075
2076 @example
2077 \bar ""
2078 @end example
2079
2080 @noindent
2081 This will insert an invisible bar line and allow (but not
2082 force) a line break to occur at this point.  The bar number
2083 counter is not increased.  To force a line break see
2084 @ref{Line breaking}.
2085
2086 @cindex manual bar lines
2087 @cindex manual measure lines
2088 @cindex bar lines, manual
2089 @cindex measure lines, manual
2090
2091 This and other special bar lines may be inserted manually at any
2092 point.  When they coincide with the end of a measure they replace the
2093 simple bar line which would have been inserted there automatically.
2094 When they do not coincide with the end of a measure the specified bar
2095 line is inserted at that point in the printed output.  Such insertions
2096 do not affect the calculation and placement of subsequent automatic
2097 bar lines.
2098
2099 Two types of simple bar lines and five types of double bar lines are available
2100 for manual insertion:
2101
2102 @lilypond[quote,relative=1,verbatim]
2103 f1 \bar "|" f \bar "." g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e
2104 @end lilypond
2105
2106 @noindent
2107 together with dotted and dashed bar lines:
2108
2109 @lilypond[quote,relative=1,verbatim]
2110 f1 \bar ":" g \bar "dashed" a
2111 @end lilypond
2112
2113 @noindent
2114 and five types of repeat bar line:
2115
2116 @lilypond[quote,relative=1,verbatim]
2117 f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d
2118 @end lilypond
2119
2120 Additionally, a bar line can be printed as a simple tick:
2121 @lilypond[quote,relative=1,verbatim]
2122 f1 \bar "'"
2123 @end lilypond
2124 However, as such ticks are typically used in Gregorian chant, it is preferable 
2125 to use @code{\divisioMinima} there instead, described in the section 
2126 @ref{Divisiones} in Gregorian chant.
2127
2128
2129 @cindex repeats
2130
2131 Although the bar line types signifying repeats may be inserted
2132 manually they do not in themselves cause LilyPond to recognize
2133 a repeated section.  Such repeated sections are better entered
2134 using the various repeat commands (see @ref{Repeats}), which
2135 automatically print the appropriate bar lines.
2136
2137 In addition, you can specify @code{"||:"}, which is equivalent to
2138 @code{"|:"} except at line breaks, where it gives a double bar
2139 line at the end of the line and a start repeat at the beginning of
2140 the next line.
2141
2142 @lilypond[quote,relative=2,verbatim]
2143 \override Score.RehearsalMark #'padding = #3
2144 c c c c
2145 \bar "||:"
2146 c c c c \break
2147 \bar "||:"
2148 c c c c
2149 @end lilypond
2150
2151 In scores with many staves, a @code{\bar} command in one staff is
2152 automatically applied to all staves.  The resulting bar lines are
2153 connected between different staves of a @code{StaffGroup},
2154 @code{PianoStaff}, or @code{GrandStaff}.
2155
2156 @lilypond[quote,fragment,verbatim]
2157 <<
2158   \new StaffGroup <<
2159     \new Staff {
2160       e'4 d'
2161       \bar "||"
2162       f' e'
2163     }
2164     \new Staff { \clef bass c4 g e g }
2165   >>
2166   \new Staff { \clef bass c2 c2 }
2167 >>
2168 @end lilypond
2169
2170
2171 @cindex default bar lines, changing
2172 @cindex bar lines, default, changing
2173
2174 @snippets
2175
2176 @funindex whichBar
2177 @funindex defaultBarType
2178 @funindex \bar
2179 @funindex bar
2180 @funindex bartype
2181
2182 The command @code{\bar }@var{bartype} is a shortcut for
2183 @code{\set Timing.whichBar = }@var{bartype}.  A bar line is
2184 created whenever the @code{whichBar} property is
2185 set.
2186
2187 The default bar type used for automatically inserted bar lines is
2188 @code{"|"}.  This may be changed at any time
2189 with @code{\set Timing.defaultBarType = }@var{bartype}.
2190
2191
2192 @seealso
2193 Notation Reference:
2194 @ref{Line breaking},
2195 @ref{Repeats},
2196 @ref{Grouping staves}.
2197
2198 Snippets:
2199 @rlsr{Rhythms}.
2200
2201 Internals Reference: @rinternals{BarLine} (created at
2202 @rinternals{Staff} level), @rinternals{SpanBar} (across
2203 staves), @rinternals{Timing_translator} (for Timing
2204 properties).
2205
2206
2207 @node Bar numbers
2208 @unnumberedsubsubsec Bar numbers
2209
2210 @cindex bar numbers
2211 @cindex measure numbers
2212 @cindex numbers, bar
2213 @cindex numbers, measure
2214
2215 @funindex currentBarNumber
2216
2217 Bar numbers are typeset by default at the start of every line except
2218 the first line.  The number itself is stored in the
2219 @code{currentBarNumber} property, which is normally updated
2220 automatically for every measure.  It may also be set manually:
2221
2222 @lilypond[verbatim,quote,fragment,relative=1]
2223 c1 c c c
2224 \break
2225 \set Score.currentBarNumber = #50
2226 c1 c c c
2227 @end lilypond
2228
2229 @cindex bar numbers, regular spacing
2230
2231 @funindex barNumberVisibility
2232 @funindex BarNumber
2233
2234 Bar numbers can be typeset at regular intervals instead of just at
2235 the beginning of every line.  To do this the default behavior
2236 must be overridden to permit bar numbers to be printed at places
2237 other than the start of a line.  This is controlled by the
2238 @code{break-visibility} property of @code{BarNumber}.  This takes
2239 three values which may be set to @code{#t} or @code{#f} to specify
2240 whether the corresponding bar number is visible or not.  The order
2241 of the three values is @code{end of line visible}, @code{middle of
2242 line visible}, @code{beginning of line visible}.  In the following
2243 example bar numbers are printed at all possible places:
2244
2245 @lilypond[verbatim,quote,relative=1]
2246 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2247 \set Score.currentBarNumber = #11
2248 % Permit first bar number to be printed
2249 \bar ""
2250 c1 | c | c | c
2251 \break
2252 c1 | c | c | c
2253 @end lilypond
2254
2255
2256 @snippets
2257
2258 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2259 {printing-the-bar-number-for-the-first-measure.ly}
2260
2261 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2262 {printing-bar-numbers-at-regular-intervals.ly}
2263
2264 @cindex measure number, format
2265 @cindex bar number, format
2266
2267 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2268 {printing-bar-numbers-inside-boxes-or-circles.ly}
2269
2270 @cindex bar number alignment
2271
2272 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2273 {aligning-bar-numbers.ly}
2274
2275 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2276 {removing-bar-numbers-from-a-score.ly}
2277
2278
2279 @seealso
2280 Snippets:
2281 @rlsr{Rhythms}.
2282
2283 Internals Reference: @rinternals{BarNumber}.
2284
2285
2286 @cindex bar number collision
2287 @cindex collision, bar number
2288
2289 @knownissues
2290
2291 Bar numbers may collide with the top of the
2292 @rinternals{StaffGroup} bracket, if there is one.  To solve
2293 this, the @code{padding} property of @rinternals{BarNumber} can
2294 be used to position the number correctly.
2295
2296
2297
2298 @node Bar and bar number checks
2299 @unnumberedsubsubsec Bar and bar number checks
2300
2301 @cindex bar check
2302 @cindex bar number check
2303 @cindex measure check
2304 @cindex measure number check
2305
2306 @funindex barCheckSynchronize
2307 @funindex |
2308
2309 Bar checks help detect errors in the entered durations.  A bar check
2310 may be entered using the bar symbol, @code{|}, at any place where a
2311 bar line is expected to fall.  If bar check lines are encountered at
2312 other places, a list of warnings is printed in the log file, showing
2313 the line numbers and lines in which the bar checks failed.  In the
2314 next example, the second bar check will signal an error.
2315
2316 @example
2317 \time 3/4 c2 e4 | g2 |
2318 @end example
2319
2320 Bar checks can also be used in lyrics, for example
2321
2322 @example
2323 \lyricmode @{
2324   \time 2/4
2325   Twin -- kle | Twin -- kle |
2326 @}
2327 @end example
2328
2329 An incorrect duration can result in a completely garbled score,
2330 especially if the score is polyphonic, so a good place to start
2331 correcting input is by scanning for failed bar checks and
2332 incorrect durations.
2333
2334 If successive bar checks are off by the same musical interval,
2335 only the first warning message is displayed.  This allows the
2336 warning to focus on the source of the timing error.
2337
2338
2339 @funindex |
2340 @funindex pipeSymbol
2341
2342 It is also possible to redefine the action taken when a bar check
2343 or pipe symbol, @code{|}, is encountered in the input, so that
2344 it does something other than a bar check.  This is done by
2345 assigning a music expression to @code{pipeSymbol}.
2346 In the following example @code{|} is set to insert a double bar
2347 line wherever it appears in the input, rather than checking
2348 for end of bar.
2349
2350 @lilypond[quote,verbatim]
2351 pipeSymbol = \bar "||"
2352 {
2353   c'2 c'2 |
2354   c'2 c'2
2355   c'2 | c'2
2356   c'2 c'2
2357 }
2358 @end lilypond
2359
2360 @funindex \barNumberCheck
2361 @funindex barNumberCheck
2362
2363 When copying large pieces of music, it can be helpful to check that
2364 the LilyPond bar number corresponds to the original that you are
2365 entering from.  This can be checked with @code{\barNumberCheck}, for
2366 example,
2367
2368 @verbatim
2369 \barNumberCheck #123
2370 @end verbatim
2371
2372 @noindent
2373 will print a warning if the @code{currentBarNumber} is not 123
2374 when it is processed.
2375
2376
2377 @seealso
2378 Snippets:
2379 @rlsr{Rhythms}.
2380
2381
2382 @node Rehearsal marks
2383 @unnumberedsubsubsec Rehearsal marks
2384
2385 @cindex rehearsal marks
2386 @cindex mark, rehearsal
2387
2388 @funindex \mark
2389 @funindex mark
2390
2391 To print a rehearsal mark, use the @code{\mark} command
2392
2393 @lilypond[quote,verbatim,relative=2]
2394 c1 \mark \default
2395 c1 \mark \default
2396 c1 \mark #8
2397 c1 \mark \default
2398 c1 \mark \default
2399 @end lilypond
2400
2401 @noindent
2402 The letter@tie{}@q{I} is skipped in accordance with engraving
2403 traditions.  If you wish to include the letter @q{I}, then use
2404
2405 @example
2406 \set Score.markFormatter = #format-mark-alphabet
2407 @end example
2408
2409 The mark is incremented automatically if you use @code{\mark
2410 \default}, but you can also use an integer argument to set the
2411 mark manually.  The value to use is stored in the property
2412 @code{rehearsalMark}.
2413
2414 @cindex rehearsal mark format
2415 @cindex rehearsal mark style
2416 @cindex style, rehearsal mark
2417 @cindex format, rehearsal mark
2418 @cindex mark, rehearsal, style
2419 @cindex mark, rehearsal, format
2420 @cindex rehearsal mark, manual
2421 @cindex mark, rehearsal, manual
2422 @cindex custom rehearsal mark
2423 @cindex manual rehearsal mark
2424
2425 The style is defined by the property @code{markFormatter}.  It is
2426 a function taking the current mark (an integer) and the current
2427 context as argument.  It should return a markup object.  In the
2428 following example, @code{markFormatter} is set to a pre-defined
2429 procedure.  After a few measures, it is set to a procedure that
2430 produces a boxed number.
2431
2432 @lilypond[quote,verbatim,relative=2]
2433 \set Score.markFormatter = #format-mark-numbers
2434 c1 \mark \default
2435 c1 \mark \default
2436 \set Score.markFormatter = #format-mark-box-numbers
2437 c1 \mark \default
2438 \set Score.markFormatter = #format-mark-circle-numbers
2439 c1 \mark \default
2440 \set Score.markFormatter = #format-mark-circle-letters
2441 c1
2442 @end lilypond
2443
2444 The file @file{scm/@/translation@/-functions@/.scm} contains the
2445 definitions of @code{format-mark-numbers} (the default format),
2446 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2447 @code{format-mark-box-letters}.  These can be used as inspiration
2448 for other formatting functions.
2449
2450 You may use @code{format-mark-barnumbers},
2451 @code{format-mark-box-barnumbers}, and
2452 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2453 incremented numbers or letters.
2454
2455 Other styles of rehearsal mark can be specified manually
2456
2457 @example
2458 \mark "A1"
2459 @end example
2460
2461 @noindent
2462 @code{Score.markFormatter} does not affect marks specified in this
2463 manner.  However, it is possible to apply a @code{\markup} to the
2464 string.
2465
2466 @example
2467 \mark \markup@{ \box A1 @}
2468 @end example
2469
2470 @cindex segno
2471 @cindex coda
2472 @cindex D.S. al Fine
2473 @cindex fermata
2474 @cindex music glyphs
2475 @cindex glyphs, music
2476
2477 @funindex \musicglyph
2478 @funindex musicglyph
2479
2480 Music glyphs (such as the segno sign) may be printed inside a
2481 @code{\mark}
2482
2483 @lilypond[quote,verbatim,relative=1]
2484 c1 \mark \markup { \musicglyph #"scripts.segno" }
2485 c1 \mark \markup { \musicglyph #"scripts.coda" }
2486 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2487 c1
2488 @end lilypond
2489
2490 @noindent
2491 See @ref{The Feta font}, for a list of symbols which may be
2492 printed with @code{\musicglyph}.
2493
2494 For common tweaks to the positioning of rehearsal marks, see
2495 @ref{Formatting text}.
2496
2497
2498 @seealso
2499 Notation Reference:
2500 @ref{The Feta font},
2501 @ref{Formatting text}.
2502
2503 Installed Files:
2504 @file{scm/@/translation@/-functions@/.scm} contains
2505 the definition of @code{format-mark-numbers} and
2506 @code{format-mark-letters}.  They can be used as inspiration for
2507 other formatting functions.
2508
2509 Snippets:
2510 @rlsr{Rhythms}.
2511
2512 Internals Reference: @rinternals{RehearsalMark}.
2513
2514
2515 @node Special rhythmic concerns
2516 @subsection Special rhythmic concerns
2517
2518
2519 @menu
2520 * Grace notes::
2521 * Aligning to cadenzas::
2522 * Time administration::
2523 @end menu
2524
2525 @node Grace notes
2526 @unnumberedsubsubsec Grace notes
2527
2528 @cindex ornaments
2529 @cindex grace notes
2530 @cindex appoggiatura
2531 @cindex acciaccatura
2532
2533 @funindex \grace
2534 @funindex grace
2535
2536 Grace notes are ornaments that are written out. Grace notes
2537 are printed in a smaller font and take up no logical time
2538 in a measure.
2539
2540 @lilypond[quote,relative=2,verbatim]
2541 c4 \grace c16 c4
2542 \grace { c16[ d16] } c2
2543 @end lilypond
2544
2545 Lilypond also supports two special types of grace notes, the
2546 @emph{acciaccatura}--an unmeasured grace note indicated by a slurred
2547 small note with a slashed stem--and the @emph{appoggiatura}, which
2548 takes a fixed fraction of the main note and appears in small print
2549 without a slash.
2550
2551 @lilypond[quote,relative=2,verbatim]
2552 \grace c8 b4
2553 \acciaccatura d8 c4
2554 \appoggiatura e8 d4
2555 \acciaccatura { g16[ f] } e4
2556 @end lilypond
2557
2558 The placement of grace notes is synchronized between different
2559 staves.  In the following example, there are two sixteenth grace
2560 notes for every eighth grace note
2561
2562 @lilypond[quote,relative=2,verbatim]
2563 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2564    \new Staff { c2 \grace { g8[ b] } c2 } >>
2565 @end lilypond
2566
2567 @cindex grace notes, following
2568
2569 @funindex \afterGrace
2570 @funindex afterGrace
2571
2572 If you want to end a note with a grace, use the @code{\afterGrace}
2573 command.  It takes two arguments: the main note, and the grace
2574 notes following the main note.
2575
2576 @lilypond[quote,verbatim,relative=2]
2577 c1 \afterGrace d1 { c16[ d] } c1
2578 @end lilypond
2579
2580 This will put the grace notes after a space lasting 3/4 of the
2581 length of the main note.  The default fraction 3/4 can be changed by
2582 setting @code{afterGraceFraction}.  The following example shows
2583 the results from setting the space at the default,  at 15/16, and
2584 finally at 1/2 of the main note.
2585
2586 @lilypond[quote,verbatim,relative=2]
2587 <<
2588   \new Staff {
2589     c1 \afterGrace d1 { c16[ d] } c1
2590   }
2591   \new Staff {
2592     #(define afterGraceFraction (cons 15 16))
2593     c1 \afterGrace d1 { c16[ d] } c1
2594   }
2595   \new Staff {
2596     #(define afterGraceFraction (cons 1 2))
2597     c1 \afterGrace d1 { c16[ d] } c1
2598   }
2599 >>
2600 @end lilypond
2601
2602 The space between the main note and the grace note may also be
2603 specified using spacers. The following example places the grace
2604 note after a space lasting 7/8 of the main note.
2605
2606 @lilypond[quote,verbatim,relative=2]
2607 \new Voice {
2608   << { d1^\trill_( }
2609      { s2 s4. \grace { c16[ d] } } >>
2610   c1)
2611 }
2612 @end lilypond
2613
2614 @cindex tweaking grace notes
2615 @cindex grace notes, tweaking
2616 @cindex grace notes, changing layout settings
2617
2618 A @code{\grace} music expression will introduce special
2619 typesetting settings, for example, to produce smaller type, and
2620 set directions.  Hence, when introducing layout tweaks to
2621 override the special settings, they should be placed inside
2622 the grace expression. The overrides should also be reverted
2623 inside the grace expression. Here, the grace note's default stem
2624 direction is overriden and then reverted.
2625
2626 @lilypond[quote,verbatim,relative=2]
2627 \new Voice {
2628   \acciaccatura {
2629     \stemDown
2630     f16->
2631     \stemNeutral
2632   }
2633   g4 e c2
2634 }
2635 @end lilypond
2636
2637
2638 @cindex stem, with slash
2639
2640
2641 @snippets
2642
2643 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2644 {using-grace-note-slashes-with-normal-heads.ly}
2645
2646 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2647 {tweaking-grace-layout-within-music.ly}
2648
2649 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2650 {redefining-grace-note-global-defaults.ly}
2651
2652 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2653 {positioning-grace-notes-with-floating-space.ly}
2654
2655
2656 @seealso
2657 Music Glossary:
2658 @rglos{grace notes},
2659 @rglos{acciaccatura},
2660 @rglos{appoggiatura}.
2661
2662 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2663
2664 Snippets: @rlsr{Rhythms}.
2665
2666 Internals Reference: @rinternals{GraceMusic}.
2667
2668
2669 @knownissues
2670
2671 @cindex acciaccatura, multi-note
2672 @cindex multi-note acciaccatura
2673 @cindex grace-note synchronization
2674
2675 A multi-note beamed @i{acciaccatura} is printed without a slash,
2676 and looks exactly the same as a multi-note beamed
2677 @i{appoggiatura}.
2678
2679 @c TODO Add link to LSR snippet to add slash when available
2680
2681 Grace note synchronization can also lead to surprises.  Staff
2682 notation, such as key signatures, bar lines, etc., are also
2683 synchronized.  Take care when you mix staves with grace notes and
2684 staves without, for example,
2685
2686 @lilypond[quote,relative=2,verbatim]
2687 <<
2688   \new Staff { e4 \bar "|:" \grace c16 d2. }
2689   \new Staff { c4 \bar "|:" d2. }
2690 >>
2691 @end lilypond
2692
2693 @noindent
2694 This can be remedied by inserting grace skips of the corresponding
2695 durations in the other staves.  For the above example
2696
2697 @lilypond[quote,relative=2,verbatim]
2698 <<
2699   \new Staff { e4 \bar "|:" \grace c16 d2. }
2700   \new Staff { c4 \bar "|:" \grace s16 d2. }
2701 >>
2702 @end lilypond
2703
2704 Grace sections should only be used within sequential music
2705 expressions.  Nesting or juxtaposing grace sections is not
2706 supported, and might produce crashes or other errors.
2707
2708 @node Aligning to cadenzas
2709 @unnumberedsubsubsec Aligning to cadenzas
2710
2711 @cindex cadenza
2712 @cindex cadenza, aligning to
2713 @cindex aligning to cadenza
2714
2715 In an orchestral context, cadenzas present a special problem: when
2716 constructing a score that includes a measured cadenza or other solo
2717 passage, all other instruments should skip just as many notes as the
2718 length of the cadenza, otherwise they will start too soon or too late.
2719
2720 One solution to this problem is to use the functions
2721 @code{mmrest-of-length} and @code{skip-of-length}.  These Scheme
2722 functions take a defined piece of music as an argument and generate a
2723 multi-measure rest or @code{\skip} exactly as long as the piece.
2724
2725 @lilypond[verbatim,quote]
2726 MyCadenza = \relative c' {
2727   c4 d8 e f g g4
2728   f2 g4 g
2729 }
2730
2731 \new GrandStaff <<
2732   \new Staff {
2733     \MyCadenza c'1
2734     \MyCadenza c'1
2735   }
2736   \new Staff {
2737     #(ly:export (mmrest-of-length MyCadenza))
2738     c'1
2739     #(ly:export (skip-of-length MyCadenza))
2740     c'1
2741   }
2742 >>
2743 @end lilypond
2744
2745
2746 @seealso
2747 Music Glossary:
2748 @rglos{cadenza}.
2749
2750 Snippets:
2751 @rlsr{Rhythms}.
2752
2753
2754 @node Time administration
2755 @unnumberedsubsubsec Time administration
2756
2757 @cindex time administration
2758 @cindex timing (within the score)
2759 @cindex music, unmetered
2760 @cindex unmetered music
2761
2762 @funindex currentBarNumber
2763 @funindex measurePosition
2764 @funindex measureLength
2765
2766 Time is administered by the @code{Timing_translator}, which by
2767 default is to be found in the @code{Score} context.  An alias,
2768 @code{Timing}, is added to the context in which the
2769 @code{Timing_translator} is placed.
2770
2771 The following properties of @code{Timing} are used
2772 to keep track of timing within the score.
2773
2774 @cindex bar number
2775 @cindex measure number
2776
2777 @table @code
2778 @item currentBarNumber
2779 The current measure number.  For an example showing the
2780 use of this property see @ref{Bar numbers}.
2781
2782 @item measureLength
2783 The length of the measures in the current time signature.  For a
2784 4/4 time this is@tie{}1, and for 6/8 it is 3/4.  Its value
2785 determines when bar lines are inserted and how automatic beams
2786 should be generated.
2787
2788 @item measurePosition
2789 The point within the measure where we currently are.  This
2790 quantity is reset by subtracting @code{measureLength} whenever
2791 @code{measureLength} is reached or exceeded.  When that happens,
2792 @code{currentBarNumber} is incremented.
2793
2794 @item timing
2795 If set to true, the above variables are updated for every time
2796 step.  When set to false, the engraver stays in the current
2797 measure indefinitely.
2798
2799 @end table
2800
2801 Timing can be changed by setting any of these variables
2802 explicitly.  In the next example, the default 4/4 time
2803 signature is printed, but @code{measureLength} is set to 5/4.
2804 At 4/8 through the third measure, the @code{measurePosition} is
2805 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2806 The next bar line then falls at 9/8 rather than 5/4.
2807
2808 @lilypond[quote,verbatim,relative=1]
2809 \set Score.measureLength = #(ly:make-moment 5 4)
2810 c1 c4
2811 c1 c4
2812 c4 c4
2813 \set Score.measurePosition = #(ly:make-moment 5 8)
2814 b4 b4 b8
2815 c4 c1
2816 @end lilypond
2817
2818 @noindent
2819 As the example illustrates, @code{ly:make-moment n m} constructs a
2820 duration of n/m of a whole note.  For example,
2821 @code{ly:make-moment 1 8} is an eighth note duration and
2822 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2823 notes.
2824
2825
2826 @seealso
2827 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2828
2829 Snippets:
2830 @rlsr{Rhythms}.
2831
2832 Internals Reference: @rinternals{Timing_translator},
2833 @rinternals{Score}
2834