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