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