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