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