]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/rhythms.itely
Split Rhythms away from *notation.
[lilypond.git] / Documentation / user / rhythms.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2
3 @node Rhythms
4 @section Rhythms
5
6 This section discusses rhythms, durations, and bars.
7
8 @menu
9 * Writing rhythms::             
10 * Writing rests::               
11 * Displaying rhythms::          
12 * Beams::                       
13 * Bars::                        
14 * Special rhythmic concerns::   
15 @end menu
16
17
18 @node Writing rhythms
19 @subsection Writing rhythms
20
21 @anchor{Durations}
22 @unnumberedsubsubsec Durations
23
24 @cindex duration
25 @funindex \longa
26 @funindex \breve
27 @funindex \maxima
28
29 In Note, Chord, and Lyrics mode, durations are designated by numbers and
30 dots: durations are entered as their reciprocal values.  For example, a
31 quarter note is entered using a @code{4} (since it is a 1/4 note), while
32 a half note is entered using a @code{2} (since it is a 1/2 note).  For
33 notes longer than a whole you must use the @code{\longa} and
34 @code{\breve} commands
35
36 @example
37 c'\breve
38 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
39 r\longa r\breve
40 r1 r2 r4 r8 r16 r32 r64 r64
41 @end example
42
43 @lilypond[quote]
44 \score {
45 \relative c'' {
46     a\breve*1/2 \autoBeamOff
47     a1 a2 a4 a8 a16 a32 a64 a64
48    \bar "empty"
49    \break
50     r\longa*1/4 r\breve *1/2
51     r1 r2 r4 r8 r16 r32 r64 r64
52   }
53   \layout {
54     ragged-right = ##t
55     indent=0\mm
56     \context {
57       \Score
58         \remove "Bar_number_engraver"
59     }
60     \context {
61       \Staff
62         \remove "Clef_engraver"
63         \override StaffSymbol #'transparent = ##t
64         \override TimeSignature #'transparent = ##t
65         \override BarLine #'transparent = ##t
66         \consists "Pitch_squash_engraver"
67     }
68   }
69 }
70 @end lilypond
71
72 If the duration is omitted then it is set to the previously entered
73 duration.  The default for the first note is a quarter note.
74
75 @lilypond[quote,ragged-right,verbatim,fragment]
76 { a a a2 a a4 a a1 a }
77 @end lilypond
78
79
80 @anchor{Augmentation dots}
81 @unnumberedsubsubsec Augmentation dots
82
83 @funindex .
84
85 To obtain dotted note lengths, simply add a dot (@samp{.}) to
86 the number.  Double-dotted notes are produced in a similar way.
87
88 @lilypond[quote,ragged-right,fragment,verbatim]
89 a'4 b' c''4. b'8 a'4. b'4.. c''8.
90 @end lilypond
91
92 @refcommands
93
94 Dots are normally moved up to avoid staff lines, except in polyphonic
95 situations.  The following commands may be used to force a particular
96 direction manually
97
98 @funindex \dotsUp
99 @code{\dotsUp},
100 @funindex \dotsDown
101 @code{\dotsDown},
102 @funindex \dotsNeutral
103 @code{\dotsNeutral}.
104
105 @seealso
106
107 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
108
109
110 @anchor{Tuplets}
111 @unnumberedsubsubsec Tuplets
112
113 @cindex tuplets
114 @cindex triplets
115 @funindex \times
116
117 Tuplets are made out of a music expression by multiplying all durations
118 with a fraction
119
120 @example
121 \times @var{fraction} @var{musicexpr}
122 @end example
123
124 @noindent
125 The duration of @var{musicexpr} will be multiplied by the fraction.
126 The fraction's denominator will be printed over the notes, optionally
127 with a bracket.  The most common tuplet is the triplet in which 3
128 notes have the length of 2, so the notes are 2/3 of their written
129 length
130
131 @lilypond[quote,ragged-right,fragment,verbatim]
132 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
133 @end lilypond
134
135 Tuplets may be nested, for example,
136
137 @lilypond[fragment,ragged-right,verbatim,relative=2]
138 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
139 \times 4/6 {
140   a4 a
141   \times 3/5 { a a a a a }
142 }
143 @end lilypond
144
145 @refcommands
146
147 @funindex \tupletUp
148 @code{\tupletUp},
149 @funindex \tupletDown
150 @code{\tupletDown},
151 @funindex \tupletNeutral
152 @code{\tupletNeutral}.
153
154
155 @commonprop
156
157 @funindex tupletNumberFormatFunction
158 @cindex tuplet formatting
159
160 The property @code{tupletSpannerDuration} specifies how long each
161 bracket should last.  With this, you can make lots of tuplets while
162 typing @code{\times} only once, thus saving lots of typing.  In the next
163 example, there are two triplets shown, while @code{\times} was only
164 used once
165
166 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
167 \set tupletSpannerDuration = #(ly:make-moment 1 4)
168 \times 2/3 { c8 c c c c c }
169 @end lilypond
170
171 @noindent
172 For more information about @code{make-moment}, see
173 @ref{Time administration}.
174
175 The format of the number is determined by the property @code{text} in
176 @code{TupletNumber}.  The default prints only the denominator, but if
177 it is set to the function @code{tuplet-number::calc-fraction-text},
178 @var{num}:@var{den} will be printed instead.
179
180 To avoid printing tuplet numbers, use
181
182 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
183 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
184 \override TupletNumber #'transparent = ##t
185 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
186 @end lilypond
187
188 Use the @code{\tweak} function to override nested tuplets beginning at the
189 same music moment.  In this example, @code{\tweak} specifies fraction
190 text for the
191 outer @code{TupletNumber} and denominator text for the @code{TupletNumber}
192 of the first of the three inner tuplets.
193
194 @lilypond[quote,ragged-right,verbatim]
195 \new Staff {
196   \tweak #'text #tuplet-number::calc-fraction-text
197   \times 4/3 {
198      \tweak #'text #tuplet-number::calc-denominator-text
199      \times 2/3 { c'8[ c'8 c'8] }
200      \times 2/3 { c'8[ c'8 c'8] }
201      \times 2/3 { c'8[ c'8 c'8] }
202   }
203 }
204 @end lilypond
205
206 Here @code{\tweak} and @code{\override} work together to specify
207 @code{TupletBracket} direction.  The first @code{\tweak} positions
208 the @code{TupletBracket} of the outer
209 tuplet above the staff.  The second @code{\tweak} positions the
210 @code{TupletBracket} of the first of the three inner tuplets below the
211 staff.  Note that this pair of @code{\tweak} functions affects only
212 the outer tuplet and the first of the three inner tuplets because only
213 those two tuplets begin at the same music moment.  We use @code{\override}
214 in the usual way to position the @code{TupletBrackets} of
215 the second and third of the inner tuplets below the staff.
216
217 @lilypond[quote,ragged-right,verbatim]
218 \new Staff {
219   \tweak #'text #tuplet-number::calc-fraction-text
220   \tweak #'direction #up
221   \times 4/3 {
222      \tweak #'direction #down
223      \times 2/3 { c'8[ c'8 c'8] }
224      \override TupletBracket #'direction = #down
225      \times 2/3 { c'8[ c'8 c'8] }
226      \times 2/3 { c'8[ c'8 c'8] }
227   }
228 }
229 @end lilypond
230
231 Tuplet brackets can be made to run to prefatory matter or
232 the next note
233
234 @lilypond[ragged-right]
235 \new RhythmicStaff {
236   \set tupletFullLength = ##t
237   \time 4/4
238   \times 4/5 {
239     c4 c1
240   }
241   \set tupletFullLengthNote = ##t
242   \time 2/4
243   \times 2/3 {
244     c4 c c 
245   }
246   \time 3/4
247   c4 
248 }
249 @end lilypond
250
251
252 @seealso
253
254 Program reference: @internalsref{TupletBracket},
255 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
256
257
258
259 @anchor{Scaling durations}
260 @unnumberedsubsubsec Scaling durations
261
262 You can alter the length of duration by a fraction @var{N/M}
263 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).  This
264 will not affect the appearance of the notes or rests produced.  These
265 may be combined such as @samp{*M*N}.
266
267 In the following example, the first three notes take up exactly two
268 beats, but no triplet bracket is printed.
269
270 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
271 \time 2/4
272 a4*2/3 gis4*2/3 a4*2/3
273 a4 a4 a4*2
274 b16*4 c4
275 @end lilypond
276
277
278 @seealso
279
280 This manual: @ref{Tuplets}.
281
282
283 @node Writing rests
284 @subsection Writing rests
285
286 @anchor{Rests}
287 @unnumberedsubsubsec Rests
288 @cindex Rests
289
290 @funindex \rest
291 @funindex r
292
293 Rests are entered like notes with the note name @code{r}
294
295 @lilypond[fragment,quote,ragged-right,verbatim]
296 r1 r2 r4 r8
297 @end lilypond
298
299 Whole bar rests, centered in middle of the bar,
300 must be done with multi-measure rests.  They can be used for a
301 single bar as well as many bars, and are discussed in
302 @ref{Multi measure rests}.
303
304 To explicitly specify a rest's vertical position, write a note
305 followed by @code{\rest}.  A rest will be placed in the position
306 where the note would appear,
307
308 @lilypond[fragment,quote,ragged-right,verbatim]
309 a'4\rest d'4\rest
310 @end lilypond
311
312 @noindent
313 This makes manual formatting of
314 polyphonic music much easier, since the automatic rest collision
315 formatter will leave these rests alone.
316
317 @seealso
318
319 Program reference: @internalsref{Rest}.
320
321
322 @anchor{Skips}
323 @unnumberedsubsubsec Skips
324
325 @cindex Skip
326 @cindex Invisible rest
327 @cindex Space note
328 @funindex \skip
329 @funindex s
330
331 An invisible rest (also called a @q{skip}) can be entered like a note
332 with note name @samp{s} or with @code{\skip @var{duration}}
333
334 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
335 a4 a4 s4 a4 \skip 1 a4
336 @end lilypond
337
338 The @code{s} syntax is only available in note mode and chord mode.  In
339 other situations, for example, when entering lyrics, you should use
340 the @code{\skip} command
341
342 @lilypond[quote,ragged-right,verbatim]
343 <<
344   \relative { a'2 a2 }
345   \new Lyrics \lyricmode { \skip 2 bla2 }
346 >>
347 @end lilypond
348
349 The skip command is merely an empty musical placeholder.  It does not
350 produce any output, not even transparent output.
351
352 The @code{s} skip command does create @internalsref{Staff} and
353 @internalsref{Voice} when necessary, similar to note and rest
354 commands.  For example, the following results in an empty staff.
355
356 @lilypond[quote,ragged-right,verbatim]
357 { s4 }
358 @end lilypond
359
360 The fragment @code{@{ \skip 4 @} } would produce an empty page.
361
362 @seealso
363
364 Program reference: @internalsref{SkipMusic}.
365
366
367 @anchor{Multi measure rests}
368 @unnumberedsubsubsec Multi measure rests
369
370 @cindex multi measure rests
371 @cindex full measure rests
372 @cindex Rests, multi measure
373 @cindex Rests, full measure
374 @cindex whole rests for a full measure
375 @funindex R
376
377 Rests for one full measure (or many bars) are entered using @samp{R}.  It
378 is specifically meant for full bar rests and for entering parts: the rest
379 can expand to fill a score with rests, or it can be printed as a single
380 multi-measure rest.  This expansion is controlled by the property
381 @code{Score.skipBars}.  If this is set to true, empty measures will not
382 be expanded, and the appropriate number is added automatically
383
384 @lilypond[quote,ragged-right,fragment,verbatim]
385 \time 4/4 r1 | R1 | R1*2 \time 3/4 R2. \time 2/4 R2 \time 4/4
386 \set Score.skipBars = ##t R1*17 R1*4
387 @end lilypond
388
389 The @code{1} in @code{R1} is similar to the duration notation used for
390 notes.  Hence, for time signatures other than 4/4, you must enter other
391 durations.  This can be done with augmentation dots or fractions
392
393 @lilypond[quote,ragged-right,fragment,verbatim]
394 \set Score.skipBars = ##t
395 \time 3/4
396 R2. | R2.*2
397 \time 13/8
398 R1*13/8
399 R1*13/8*12 |
400 \time 10/8 R4*5*4 |
401 @end lilypond
402
403 An @code{R} spanning a single measure is printed as either a whole rest
404 or a breve, centered in the measure regardless of the time signature.
405
406 If there are only a few measures of rest, LilyPond prints @q{church rests}
407 (a series of rectangles) in the staff.  To replace that with a simple
408 rest, use @code{MultiMeasureRest.expand-limit}.
409
410 @lilypond[quote,ragged-right,fragment,verbatim]
411 \set Score.skipBars = ##t
412 R1*2 | R1*5 | R1*9
413 \override MultiMeasureRest #'expand-limit = 1
414 R1*2 | R1*5 | R1*9
415 @end lilypond
416
417 @cindex text on multi-measure rest
418 @cindex script on multi-measure rest
419 @cindex fermata on multi-measure rest
420
421 Texts can be added to multi-measure rests by using the
422 @var{note}-@code{markup} syntax @ref{Text markup}.
423 A variable (@code{\fermataMarkup}) is provided for
424 adding fermatas
425
426 @lilypond[quote,ragged-right,verbatim,fragment]
427 \set Score.skipBars = ##t
428 \time 3/4
429 R2.*10^\markup { \italic "ad lib." }
430 R2.^\fermataMarkup
431 @end lilypond
432
433 Warning!  This text is created by @code{MultiMeasureRestText}, not
434 @code{TextScript}.
435
436 @lilypond[quote,ragged-right,verbatim,fragment]
437 \override TextScript #'padding = #5
438 R1^"low"
439 \override MultiMeasureRestText #'padding = #5
440 R1^"high"
441 @end lilypond
442
443 If you want to have text on the left end of a multi-measure rest,
444 attach the text to a zero-length skip note, i.e.,
445
446 @example
447 s1*0^"Allegro"
448 R1*4
449 @end example
450
451
452 @seealso
453
454 Program reference: @internalsref{MultiMeasureRestMusicGroup},
455 @internalsref{MultiMeasureRest}.
456
457 The layout object @internalsref{MultiMeasureRestNumber} is for the
458 default number, and @internalsref{MultiMeasureRestText} for user
459 specified texts.
460
461
462 @refbugs
463
464 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
465 over multi-measure rests.  And the pitch of multi-measure rests (or
466 staff-centered rests) can not be influenced.
467
468 @cindex condensing rests
469
470 There is no way to automatically condense multiple rests into a single
471 multi-measure rest.  Multi-measure rests do not take part in rest
472 collisions.
473
474 Be careful when entering multi-measure rests followed by whole
475 notes.  The following will enter two notes lasting four measures each
476 @example
477 R1*4 cis cis
478 @end example
479 When @code{skipBars} is set, the result will look OK, but the bar
480 numbering will be off.
481
482
483
484 @node Displaying rhythms
485 @subsection Displaying rhythms
486
487 @anchor{Time signature}
488 @unnumberedsubsubsec Time signature
489
490 @cindex Time signature
491 @cindex meter
492 @funindex \time
493
494 Time signature indicates the metrum of a piece: a regular pattern of
495 strong and weak beats.  It is denoted by a fraction at the start of the
496 staff.
497
498 The time signature is set with the @code{\time} command
499
500 @lilypond[quote,ragged-right,fragment,verbatim]
501 \time 2/4 c'2 \time 3/4 c'2.
502 @end lilypond
503
504 @commonprop
505
506 The symbol that is printed can be customized with the @code{style}
507 property.  Setting it to @code{#'()} uses fraction style for 4/4 and
508 2/2 time,
509
510 @lilypond[fragment,quote,ragged-right,verbatim]
511 \time 4/4 c'1
512 \time 2/2 c'1
513 \override Staff.TimeSignature #'style = #'()
514 \time 4/4 c'1
515 \time 2/2 c'1
516 @end lilypond
517
518 There are many more options for its layout.  See @ref{Ancient time
519 signatures}, for more examples.
520
521 @code{\time} sets the property @code{timeSignatureFraction},
522 @code{beatLength} and @code{measureLength} in the @code{Timing}
523 context, which is normally aliased to @internalsref{Score}.  The
524 property @code{measureLength} determines where bar lines should be
525 inserted, and how automatic beams should be generated.  Changing the
526 value of @code{timeSignatureFraction} also causes the symbol to be
527 printed.
528
529 More options are available through the Scheme function
530 @code{set-time-signature}.  In combination with the
531 @internalsref{Measure_grouping_engraver}, it will create
532 @internalsref{MeasureGrouping} signs.  Such signs ease reading
533 rhythmically complex modern music.  In the following example, the 9/8
534 measure is subdivided in 2, 2, 2 and 3.  This is passed to
535 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
536
537 @lilypond[quote,ragged-right,verbatim]
538 \score {
539   \relative c'' {
540     #(set-time-signature 9 8 '(2 2 2 3))
541     g8[ g] d[ d] g[ g] a8[( bes g]) |
542     #(set-time-signature 5 8 '(3 2))
543     a4. g4
544   }
545   \layout {
546     \context {
547       \Staff
548       \consists "Measure_grouping_engraver"
549     }
550   }
551 }
552 @end lilypond
553
554
555 @seealso
556
557 Program reference: @internalsref{TimeSignature}, and
558 @internalsref{Timing_translator}.
559
560 Examples: @lsr{contemporary,compound-time-signature.ly}.
561
562
563 @refbugs
564
565 Automatic beaming does not use the measure grouping specified with
566 @code{set-time-signature}.
567
568
569 @anchor{Upbeats}
570 @unnumberedsubsubsec Upbeats
571
572 @cindex anacrusis
573 @cindex upbeat
574 @cindex partial measure
575 @cindex measure, partial
576 @cindex shorten measures
577 @funindex \partial
578
579 Partial measures, such as an anacrusis or upbeat, are entered using the
580
581 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
582 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
583 @end lilypond
584
585 The syntax for this command is
586
587 @example
588 \partial @var{duration}
589 @end example
590
591 where @code{duration} is the rhythmic length to be added before
592 the next bar.
593
594 This is internally translated into
595
596 @example
597 \set Timing.measurePosition = -@var{length of duration}
598 @end example
599
600 The property @code{measurePosition} contains a rational number
601 indicating how much of the measure has passed at this point.  Note
602 that this is a negative number; @code{\partial 4} is internally
603 translated to mean @qq{there is a quarter note left in the bar.}
604
605
606 @refbugs
607
608 This command does not take into account grace notes at the start of
609 the music.  When a piece starts with graces notes in the pickup, then
610 the @code{\partial} should follow the grace notes
611
612 @lilypond[verbatim,quote,ragged-right,relative,fragment]
613 \grace f16
614 \partial 4
615 g4
616 a2 g2
617 @end lilypond
618
619 @code{\partial} is only intended to be used at the beginning of a
620 piece.  If you use it after the beginning, some odd warnings may
621 occur.
622
623
624 @anchor{Unmetered music}
625 @unnumberedsubsubsec Unmetered music
626
627 @cindex cadenza
628 @funindex \cadenzaOn
629 @funindex \cadenzaOff
630
631 Bar lines and bar numbers are calculated automatically.  For unmetered
632 music (cadenzas, for example), this is not desirable.  To turn off
633 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
634 and @code{\cadenzaOff}.
635
636 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
637 c4 d e d
638 \cadenzaOn
639 c4 c d8 d d f4 g4.
640 \cadenzaOff
641 \bar "|"
642 d4 e d c
643 @end lilypond
644
645
646 @refbugs
647
648 LilyPond will only insert line breaks and page breaks at a
649 barline.  Unless the unmetered music ends before the end of
650 the staff line, you will need to insert
651 invisible bar lines
652
653 @example
654 \bar ""
655 @end example
656
657 @noindent
658 to indicate where breaks can occur.
659
660
661 @anchor{Polymetric notation}
662 @unnumberedsubsubsec Polymetric notation
663
664 @cindex double time signatures
665 @cindex signatures, polymetric
666 @cindex polymetric signatures
667 @cindex meter, polymetric
668
669 Double time signatures are not supported explicitly, but they can be
670 faked.  In the next example, the markup for the time signature is
671 created with a markup text.  This markup text is inserted in the
672 @internalsref{TimeSignature} grob. See also
673 @lsr{contemporary,compound-time-signature}.
674
675 @lilypond[verbatim,ragged-right]
676 % create 2/4 + 5/8
677 tsMarkup =\markup {
678   \override #'(baseline-skip . 2) \number {
679     \column { "2" "4" }
680     \vcenter "+"
681     \bracket \column { "5" "8" }
682   }
683 }
684
685 {
686   \override Staff.TimeSignature #'stencil = #ly:text-interface::print
687   \override Staff.TimeSignature #'text = #tsMarkup
688   \time 3/2
689   c'2 \bar ":" c'4 c'4.
690 }
691 @end lilypond
692
693 Each staff can also have its own time signature.  This is done by
694 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
695 context.
696
697 @example
698 \layout @{
699   \context @{ \Score
700      \remove "Timing_translator"
701      \remove "Default_bar_line_engraver"
702   @}
703   \context @{
704     \Staff
705     \consists "Timing_translator"
706     \consists "Default_bar_line_engraver"
707   @}
708
709 @}
710 @end example
711
712
713 Now, each staff has its own time signature.
714 @example
715 <<
716   \new Staff @{
717     \time 3/4
718     c4 c c | c c c |
719   @}
720   \new Staff @{
721     \time 2/4
722     c4 c | c c | c c
723   @}
724   \new Staff @{
725     \time 3/8
726     c4. c8 c c c4. c8 c c
727   @}
728 >>
729 @end example
730
731 @lilypond[quote,ragged-right]
732 \layout{
733   \context{
734      \Score
735      \remove "Timing_translator"
736      \remove "Default_bar_line_engraver"
737     }
738   \context{ \Staff
739     \consists "Timing_translator"
740     \consists "Default_bar_line_engraver"
741   }
742 }
743
744 \relative c' <<
745   \new Staff {
746     \time 3/4
747     c4 c c | c c c |
748   }
749   \new Staff {
750     \time 2/4
751     c4 c | c c | c c
752   }
753   \new Staff {
754     \time 3/8
755     c4. c8 c c c4. c8 c c
756   }
757 >>
758 @end lilypond
759
760
761 A different form of polymetric notation is where note lengths have
762 different values across staves.
763
764 This notation can be created by setting a common time signature for
765 each staff but replacing it manually using
766 @code{timeSignatureFraction} to the desired fraction.  Then the printed
767 durations in each staff are scaled to the common time signature.
768 The latter is done with @code{\compressMusic}, which is used similar
769 to @code{\times}, but does not create a tuplet bracket. The syntax is
770 @example
771 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
772 @end example
773
774
775
776 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
777 used in parallel.  In the second staff, shown durations are multiplied by
778 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
779 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
780
781 @lilypond[quote,ragged-right,verbatim,fragment]
782 \relative c' { <<
783   \new Staff {
784     \time 3/4
785     c4 c c | c c c |
786   }
787   \new Staff {
788     \time 3/4
789     \set Staff.timeSignatureFraction = #'(9 . 8)
790     \compressMusic #'(2 . 3)
791       \repeat unfold 6 { c8[ c c] }
792   }
793   \new Staff {
794     \time 3/4
795     \set Staff.timeSignatureFraction = #'(10 . 8)
796     \compressMusic #'(3 . 5) {
797       \repeat unfold 2 { c8[ c c] }
798       \repeat unfold 2 { c8[ c] }
799       | c4. c4. \times 2/3 { c8 c c } c4
800     }
801   }
802 >> }
803 @end lilypond
804
805
806 @refbugs
807
808 When using different time signatures in parallel, the spacing is
809 aligned vertically, but bar lines distort the regular spacing.
810
811
812 @anchor{Automatic note splitting}
813 @unnumberedsubsubsec Automatic note splitting
814
815 Long notes can be converted automatically to tied notes.  This is done
816 by replacing the @internalsref{Note_heads_engraver} by the
817 @internalsref{Completion_heads_engraver}.
818 In the following examples, notes crossing the bar line are split and tied.
819
820 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
821 \new Voice \with {
822   \remove "Note_heads_engraver"
823   \consists "Completion_heads_engraver"
824 } {
825   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
826 }
827 @end lilypond
828
829 This engraver splits all running notes at the bar line, and inserts
830 ties.  One of its uses is to debug complex scores: if the measures are
831 not entirely filled, then the ties exactly show how much each measure
832 is off.
833
834 If you want to allow line breaking on the bar lines where
835 @internalsref{Completion_heads_engraver} splits notes, you must
836 also remove @internalsref{Forbid_line_break_engraver}.
837
838
839 @refbugs
840
841 Not all durations (especially those containing tuplets) can be
842 represented exactly with normal notes and dots, but the engraver will
843 not insert tuplets.
844
845 @code{Completion_heads_engraver} only affects notes; it does not split
846 rests.
847
848
849 @seealso
850
851 Program reference: @internalsref{Completion_heads_engraver}.
852
853
854
855
856 @node Beams
857 @subsection Beams
858
859 @anchor{Automatic beams}
860 @unnumberedsubsubsec Automatic beams
861
862 LilyPond inserts beams automatically
863
864 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
865 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
866 @end lilypond
867
868 When these automatic decisions are not good enough, beaming can be
869 entered explicitly.  It is also possible to define beaming patterns
870 that differ from the defaults.  See @ref{Setting automatic beam behavior},
871 for details.
872
873 Individual notes may be marked with @code{\noBeam} to prevent them
874 from being beamed
875
876 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
877 \time 2/4 c8 c\noBeam c c
878 @end lilypond
879
880
881 @seealso
882
883 Program reference: @internalsref{Beam}.
884
885
886 @anchor{Manual beams}
887 @unnumberedsubsubsec Manual beams
888
889 @cindex beams, manual
890 @funindex ]
891 @funindex [
892
893 In some cases it may be necessary to override the automatic beaming
894 algorithm.  For example, the autobeamer will not put beams over rests
895 or bar lines.  Such beams are specified manually by marking the begin
896 and end point with @code{[} and @code{]}
897
898 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
899 {
900   r4 r8[ g' a r8] r8 g[ | a] r8
901 }
902 @end lilypond
903
904
905 @commonprop
906
907 @funindex stemLeftBeamCount
908 @funindex stemRightBeamCount
909
910
911 LilyPond can automatically determine beaming patterns within a beam,
912 but this automatic behavior can sometimes produce odd results;
913 therefore the @code{stemLeftBeamCount} and @code{stemRightBeamCount} properties can
914 be used to override the defaults.  If
915 either property is set, its value will be used only once, and then it
916 is erased.
917
918 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
919 {
920    f8[ r16
921       f g a]
922    f8[ r16
923    \set stemLeftBeamCount = #1
924       f g a]
925 }
926 @end lilypond
927
928 The property @code{subdivideBeams} can be set in order to subdivide
929 all 16th or shorter beams at beat positions, as defined by the
930 @code{beatLength} property.
931
932 @lilypond[fragment,quote,relative=2,verbatim]
933 c16[ c c c c c c c]
934 \set subdivideBeams = ##t
935 c16[ c c c c c c c]
936 \set Score.beatLength = #(ly:make-moment 1 8)
937 c16[ c c c c c c c]
938 @end lilypond
939 @funindex subdivideBeams
940
941 @noindent
942 For more information about @code{make-moment}, see
943 @ref{Time administration}.
944
945 Line breaks are normally forbidden when beams cross bar lines.  This
946 behavior can be changed by setting @code{breakable}.
947
948 @funindex breakable
949
950 @cindex beams and line breaks
951 @cindex beams, kneed
952 @cindex kneed beams
953 @cindex auto-knee-gap
954
955 Kneed beams are inserted automatically when a large gap is detected
956 between the note heads.  This behavior can be tuned through the
957 @code{auto-knee-gap} object.
958
959
960 @refbugs
961
962 Automatically kneed cross-staff beams cannot be used together with
963 hidden staves.  See @ref{Hiding staves}.
964
965 @c Is this still true with skyline spacing stuff? -J.Mandereau
966 Beams do not avoid collisions with symbols around the notes, such as
967 texts and accidentals.
968
969
970 @anchor{Feathered beams}
971 @unnumberedsubsubsec Feathered beams
972
973 Feathered beams are printed by setting the @code{grow-direction}
974 property of a @code{Beam}.  The @code{\featherDurations} function
975 can be used to adjust note durations.
976
977 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
978 \override Beam #'grow-direction = #LEFT
979 \featherDurations #(ly:make-moment 5 4) 
980 {
981   c16[ c c c c c c]
982 }
983 @end lilypond
984
985 @refbugs
986
987 The @code{\featherDurations} command only works with very short
988 music snippets.
989
990
991 @node Bars
992 @subsection Bars
993
994
995 @anchor{Bar check}
996 @unnumberedsubsubsec Bar check
997
998 @cindex Bar check
999 @funindex barCheckSynchronize
1000 @funindex |
1001
1002 Bar checks help detect errors in the durations.  A bar check is
1003 entered using the bar symbol, @samp{|}.  Whenever it is encountered
1004 during interpretation, it should fall on a measure boundary.  If it
1005 does not, a warning is printed.  In the next example, the second bar
1006 check will signal an error
1007 @example
1008 \time 3/4 c2 e4 | g2 |
1009 @end example
1010
1011 Bar checks can also be used in lyrics, for example
1012
1013 @example
1014 \lyricmode @{
1015   \time 2/4
1016   Twin -- kle | Twin -- kle
1017 @}
1018 @end example
1019
1020 Failed bar checks are caused by entering incorrect
1021 durations.  Incorrect durations often completely garble up the score,
1022 especially if the score is polyphonic, so a good place to start correcting
1023 input is by scanning for failed bar checks and incorrect durations.
1024
1025 @funindex |
1026 @funindex pipeSymbol
1027
1028 It is also possible to redefine the meaning of @code{|}.  This is done
1029 by assigning a music expression to @code{pipeSymbol},
1030
1031 @lilypond[quote,ragged-right,verbatim]
1032 pipeSymbol = \bar "||"
1033
1034 { c'2 c' | c'2 c' }
1035 @end lilypond
1036
1037
1038 @anchor{Bar lines}
1039 @unnumberedsubsubsec Bar lines
1040
1041 @cindex Bar lines
1042 @funindex \bar
1043 @cindex measure lines
1044 @cindex repeat bars
1045
1046 Bar lines delimit measures, but are also used to indicate
1047 repeats.  Normally they are inserted automatically.  Line
1048 breaks may only happen on bar lines.
1049
1050 Special types of bar lines can be forced with the @code{\bar} command
1051
1052 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1053 c4 \bar "|:" c4
1054 @end lilypond
1055
1056 The following bar types are available
1057
1058 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1059
1060 In addition, you can specify @code{"||:"}, which is equivalent to 
1061 @code{"|:"} except at line breaks, where it gives a double bar line at
1062 the end of the line and a start repeat at the beginning of the next
1063 line. 
1064
1065 To allow a line break where there is no visible bar line, use
1066
1067 @example
1068 \bar ""
1069 @end example
1070
1071 @noindent
1072 This will insert an invisible bar line and allow line breaks at this
1073 point (without increasing the bar number counter).
1074
1075 In scores with many staves, a @code{\bar} command in one staff is
1076 automatically applied to all staves.  The resulting bar lines are
1077 connected between different staves of a @code{StaffGroup},
1078 @code{PianoStaff}, or @code{GrandStaff}.
1079
1080 @lilypond[quote,ragged-right,fragment,verbatim]
1081 <<
1082   \new StaffGroup <<
1083     \new Staff {
1084       e'4 d'
1085       \bar "||"
1086       f' e'
1087     }
1088     \new Staff { \clef bass c4 g e g }
1089   >>
1090   \new Staff { \clef bass c2 c2 }
1091 >>
1092 @end lilypond
1093
1094
1095 @commonprop
1096
1097 @funindex whichBar
1098 @funindex repeatCommands
1099 @funindex defaultBarType
1100
1101 The command @code{\bar }@var{bartype} is a short cut for doing
1102 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
1103 is set to a string, a bar line of that type is created.
1104
1105 A bar line is created whenever the @code{whichBar} property is set.
1106 At the start of a measure it is set to the contents of
1107 @code{Timing.defaultBarType}.  The contents of @code{repeatCommands} are
1108 used
1109 to override default measure bars.
1110
1111 You are encouraged to use @code{\repeat} for repetitions.  See
1112 @ref{Repeats}.
1113
1114
1115 @seealso
1116
1117 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1118
1119 Program reference: @internalsref{BarLine} (created at
1120 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1121
1122
1123 @anchor{Bar numbers}
1124 @unnumberedsubsubsec Bar numbers
1125
1126 @cindex Bar numbers
1127 @cindex measure numbers
1128 @funindex currentBarNumber
1129
1130 Bar numbers are printed by default at the start of the line.  The
1131 number itself is stored in the @code{currentBarNumber} property, which
1132 is normally updated automatically for every measure.
1133
1134 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1135 \repeat unfold 4 {c4 c c c} \break
1136 \set Score.currentBarNumber = #50
1137 \repeat unfold 4 {c4 c c c}
1138 @end lilypond
1139
1140 Bar numbers may only be printed at bar lines; to print a bar
1141 number at the beginning of a piece, an empty bar line must
1142 be added
1143
1144 @lilypond[verbatim,ragged-right,quote,fragment,relative]
1145 \set Score.currentBarNumber = #50
1146 \bar ""
1147 \repeat unfold 4 {c4 c c c} \break
1148 \repeat unfold 4 {c4 c c c}
1149 @end lilypond
1150
1151 Bar numbers can be typeset at regular intervals instead of at the
1152 beginning of each line.  This is illustrated in the following example,
1153 whose source is available as
1154 @lsr{staff,making-bar-numbers-appear-at-regular-intervals.ly}.
1155
1156 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
1157
1158 Bar numbers can be removed entirely by removing the Bar number
1159 engraver from the score.
1160
1161 @lilypond[verbatim,ragged-right,quote]
1162 \layout {
1163   \context {
1164     \Score
1165     \remove "Bar_number_engraver"
1166   }
1167 }
1168 \relative c''{
1169 c4 c c c \break
1170 c4 c c c
1171 }
1172 @end lilypond
1173
1174
1175 @seealso
1176
1177 Program reference: @internalsref{BarNumber}.
1178
1179 Examples: @lsrdir{staff}
1180
1181
1182 @refbugs
1183
1184 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
1185 there is one at the top.  To solve this, the
1186 @code{padding} property of @internalsref{BarNumber} can be
1187 used to position the number correctly.
1188
1189
1190 @anchor{Barnumber check}
1191 @unnumberedsubsubsec Barnumber check
1192
1193 When copying large pieces of music, it can be helpful to check that
1194 the LilyPond bar number corresponds to the original that you are
1195 entering from.  This can be checked with @code{\barNumberCheck}, for
1196 example,
1197
1198 @verbatim
1199 \barNumberCheck #123
1200 @end verbatim
1201
1202 @noindent
1203 will print a warning if the @code{currentBarNumber} is not 123 when it
1204 is processed.
1205
1206
1207 @anchor{Rehearsal marks}
1208 @unnumberedsubsubsec Rehearsal marks
1209
1210 @cindex Rehearsal marks
1211 @funindex \mark
1212
1213 To print a rehearsal mark, use the @code{\mark} command
1214
1215 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1216 c1 \mark \default
1217 c1 \mark \default
1218 c1 \mark #8
1219 c1 \mark \default
1220 c1 \mark \default
1221 @end lilypond
1222
1223 @noindent
1224 The letter@tie{}@q{I} is skipped in accordance with engraving traditions.
1225 If you wish to include the letter @q{I}, then use
1226
1227 @example
1228 \set Score.markFormatter = #format-mark-alphabet
1229 @end example
1230
1231 The mark is incremented automatically if you use @code{\mark
1232 \default}, but you can also use an integer argument to set the mark
1233 manually.  The value to use is stored in the property
1234 @code{rehearsalMark}.
1235
1236 The style is defined by the property @code{markFormatter}.  It is a
1237 function taking the current mark (an integer) and the current context
1238 as argument.  It should return a markup object.  In the following
1239 example, @code{markFormatter} is set to a canned procedure.  After a
1240 few measures, it is set to function that produces a boxed number.
1241
1242 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
1243 \set Score.markFormatter = #format-mark-numbers
1244 c1 \mark \default
1245 c1 \mark \default
1246 \set Score.markFormatter = #format-mark-box-numbers
1247 c1 \mark \default
1248 c1 \mark \default
1249 c1
1250 @end lilypond
1251
1252 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
1253 of @code{format-mark-numbers} (the default format),
1254 @code{format-mark-box-numbers},
1255 @code{format-mark-letters} and @code{format-mark-box-letters}.
1256 These can be used as inspiration for other formatting functions.
1257
1258 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
1259 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
1260 incremented numbers or letters.
1261
1262 Other styles of rehearsal mark can be specified manually
1263
1264 @example
1265 \mark "A1"
1266 @end example
1267
1268 @noindent
1269 @code{Score.markFormatter} does not affect marks specified in this manner.
1270 However, it is possible to apply a @code{\markup} to the string.
1271
1272 @example
1273 \mark \markup@{ \box A1 @}
1274 @end example
1275
1276 @cindex segno
1277 @cindex coda
1278 @cindex D.S al Fine
1279
1280 Music glyphs (such as the segno sign) may be printed inside
1281 a @code{\mark}
1282
1283 @lilypond[fragment,quote,ragged-right,verbatim,relative]
1284 c1 \mark \markup { \musicglyph #"scripts.segno" }
1285 c1 \mark \markup { \musicglyph #"scripts.coda" }
1286 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
1287 c1
1288 @end lilypond
1289
1290 @noindent
1291 See @ref{The Feta font}, for a list of symbols which may be
1292 printed with @code{\musicglyph}.
1293
1294 For common tweaks to the positioning of rehearsal marks, see @ref{Text marks}.
1295
1296 @seealso
1297
1298 This manual: @ref{Text marks}.
1299
1300 Program reference: @internalsref{RehearsalMark}.
1301
1302 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
1303 definition of @code{format-mark-numbers} and
1304 @code{format-mark-letters}.  They can be used as inspiration for other
1305 formatting functions.
1306
1307 Examples: @lsr{parts,rehearsal-mark-numbers.ly}
1308
1309
1310 @node Special rhythmic concerns
1311 @subsection Special rhythmic concerns
1312
1313
1314 @anchor{Grace notes}
1315 @unnumberedsubsubsec Grace notes
1316
1317 @funindex \grace
1318 @cindex ornaments
1319 @cindex grace notes
1320 @cindex appoggiatura
1321 @cindex acciaccatura
1322
1323 Grace notes are ornaments that are written out.  The most common ones
1324 are acciaccatura, which should be played as very short.  It is denoted
1325 by a slurred small note with a slashed stem.  The appoggiatura is a
1326 grace note that takes a fixed fraction of the main note, and is
1327 denoted as a slurred note in small print without a slash.  They
1328 are entered with the commands @code{\acciaccatura} and
1329 @code{\appoggiatura}, as demonstrated in the following example
1330
1331 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1332 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1333 \acciaccatura { g16[ f] } e4
1334 @end lilypond
1335
1336 Both are special forms of the @code{\grace} command.  By prefixing this
1337 keyword to a music expression, a new one is formed, which will be
1338 printed in a smaller font and takes up no logical time in a measure.
1339
1340 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1341 c4 \grace c16 c4
1342 \grace { c16[ d16] } c2 c4
1343 @end lilypond
1344
1345 @noindent
1346 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1347 @code{\grace} command does not start a slur.
1348
1349 @cindex timing, internal
1350
1351 Internally, timing for grace notes is done using a second, @q{grace}
1352 timing.  Every point in time consists of two rational numbers: one
1353 denotes the logical time, one denotes the grace timing.  The above
1354 example is shown here with timing tuples
1355
1356 @lilypond[quote,ragged-right]
1357 <<
1358   \relative c''{
1359     c4 \grace c16 c4 \grace {
1360     c16[ d16] } c2 c4
1361   }
1362   \new Lyrics \lyricmode {
1363     \override LyricText #'font-family = #'typewriter
1364
1365     \markup { (0,0) } 4
1366     \grace { \markup {
1367       ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1368     \markup { (\fraction 1 4 , 0 ) } 4
1369     \grace {
1370       \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1371       \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1372     }
1373     \markup { ( \fraction 2 4 , 0 ) }
1374   }
1375 >>
1376 @end lilypond
1377
1378 The placement of grace notes is synchronized between different staves.
1379 In the following example, there are two sixteenth grace notes for
1380 every eighth grace note
1381
1382 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1383 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1384    \new Staff { c4 \grace { g8[ b] } c4 } >>
1385 @end lilypond
1386
1387 @funindex \afterGrace
1388
1389 If you want to end a note with a grace, use the @code{\afterGrace}
1390 command.  It takes two arguments: the main note, and the grace notes
1391 following the main note.
1392
1393 @lilypond[ragged-right, verbatim,relative=2,fragment]
1394 c1 \afterGrace d1 { c16[ d] } c4
1395 @end lilypond
1396
1397 This will put the grace notes after a @q{space} lasting 3/4 of the
1398 length of the main note.  The fraction 3/4 can be changed by setting
1399 @code{afterGraceFraction}, ie.
1400
1401 @example
1402 #(define afterGraceFraction (cons 7 8))
1403 @end example
1404
1405 @noindent
1406 will put the grace note at 7/8 of the main note.
1407
1408 The same effect can be achieved manually by doing
1409
1410 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1411 \new Voice {
1412   << { d1^\trill_( }
1413      { s2 \grace { c16[ d] } } >>
1414   c4)
1415 }
1416 @end lilypond
1417
1418 @noindent
1419 By adjusting the duration of the skip note (here it is a half-note),
1420 the space between the main-note and the grace is adjusted.
1421
1422 A @code{\grace} music expression will introduce special typesetting settings,
1423 for example, to produce smaller type, and set directions.  Hence, when
1424 introducing layout tweaks, they should be inside the grace expression,
1425 for example,
1426
1427 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1428 \new Voice {
1429   \acciaccatura {
1430     \stemDown
1431     f16->
1432     \stemNeutral
1433   }
1434   g4
1435 }
1436 @end lilypond
1437
1438 @noindent
1439 The overrides should also be reverted inside the grace expression.
1440
1441 The layout of grace expressions can be changed throughout the music
1442 using the function @code{add-grace-property}.  The following example
1443 undefines the @code{Stem} direction for this grace, so that stems do not
1444 always point up.
1445
1446 @example
1447 \new Staff @{
1448   #(add-grace-property 'Voice 'Stem 'direction '())
1449   @dots{}
1450 @}
1451 @end example
1452
1453 @noindent
1454 Another option is to change the variables @code{startGraceMusic},
1455 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1456 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1457 @code{stopAppoggiaturaMusic}.  More information is in the file
1458 @file{ly/@/grace@/-init@/.ly}.
1459
1460 @noindent
1461 The slash through the stem in acciaccaturas can be obtained
1462 in other situations by @code{\override Stem  #'stroke-style = #"grace"}.
1463
1464
1465 @commonprop
1466
1467 Grace notes may be forced to use floating spacing,
1468
1469 @lilypond[relative=2,ragged-right]
1470 <<
1471   \override Score.SpacingSpanner #'strict-grace-spacing = ##t
1472   \new Staff {
1473      c'4
1474      \afterGrace
1475      c'4
1476      { c'16[ c'8 c'16] }
1477      c'4
1478   }  
1479   \new Staff {
1480      c'16[ c'16 c'16 c'16]
1481      c'16[ c'16 c'16 c'16]
1482      c'4
1483   }
1484 >>
1485 @end lilypond
1486
1487
1488 @seealso
1489
1490 Program reference: @internalsref{GraceMusic}.
1491
1492
1493 @refbugs
1494
1495 A score that starts with a @code{\grace} expression needs an explicit
1496 @code{\new Voice} declaration, otherwise the main note and the grace
1497 note end up on different staves.
1498
1499 Grace note synchronization can also lead to surprises.  Staff notation,
1500 such as key signatures, bar lines, etc., are also synchronized.  Take
1501 care when you mix staves with grace notes and staves without, for example,
1502
1503 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1504 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1505    \new Staff { c4 \bar "|:" d4 } >>
1506 @end lilypond
1507
1508 @noindent
1509 This can be remedied by inserting grace skips of the corresponding
1510 durations in the other staves. For the above example
1511
1512 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1513 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1514    \new Staff { c4 \bar "|:" \grace s16 d4 } >>
1515 @end lilypond
1516
1517 Grace sections should only be used within sequential music
1518 expressions.  Nesting or juxtaposing grace sections is not supported,
1519 and might produce crashes or other errors.
1520
1521
1522 @anchor{Aligning to cadenzas}
1523 @unnumberedsubsubsec Aligning to cadenzas
1524
1525 In an orchestral context, cadenzas present a special problem:
1526 when constructing a score that includes a cadenza, all other
1527 instruments should skip just as many notes as the length of the
1528 cadenza, otherwise they will start too soon or too late.
1529
1530 A solution to this problem are the functions @code{mmrest-of-length}
1531 and @code{skip-of-length}.  These Scheme functions take a piece of music
1532 as argument, and generate a @code{\skip} or multi-rest, exactly as
1533 long as the piece.  The use of @code{mmrest-of-length} is demonstrated
1534 in the following example.
1535
1536 @lilypond[verbatim,ragged-right,quote]
1537 cadenza = \relative c' {
1538   c4 d8 << { e f g } \\ { d4. } >>
1539   g4 f2 g4 g
1540 }
1541
1542 \new GrandStaff <<
1543   \new Staff { \cadenza c'4 }
1544   \new Staff {
1545     #(ly:export (mmrest-of-length cadenza))
1546     c'4
1547   }
1548 >>
1549 @end lilypond
1550
1551
1552 @anchor{Time administration}
1553 @unnumberedsubsubsec Time administration
1554
1555 @cindex Time administration
1556
1557 Time is administered by the @internalsref{Time_signature_engraver},
1558 which usually lives in the @internalsref{Score} context.  The
1559 bookkeeping deals with the following variables
1560
1561 @table @code
1562 @item currentBarNumber
1563 The measure number.
1564
1565 @item measureLength
1566 The length of the measures in the current time signature.  For a 4/4
1567 time this is@tie{}1, and for 6/8 it is 3/4.
1568
1569 @item measurePosition
1570 The point within the measure where we currently are.  This quantity
1571 is reset to@tie{}0 whenever it exceeds @code{measureLength}.  When that
1572 happens, @code{currentBarNumber} is incremented.
1573
1574 @item timing
1575 If set to true, the above variables are updated for every time
1576 step.  When set to false, the engraver stays in the current measure
1577 indefinitely.
1578 @end table
1579
1580 Timing can be changed by setting any of these variables explicitly.
1581 In the next example, the 4/4 time signature is printed, but
1582 @code{measureLength} is set to 5/4.  After a while, the measure is
1583 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1584 in the measure, so the next bar line will fall at 2/4 + 3/8.  The
1585 3/8 arises because 5/4 normally has 10/8, but we have manually
1586 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1587
1588 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1589 \set Score.measureLength = #(ly:make-moment 5 4)
1590 c1 c4
1591 c1 c4
1592 c4 c4
1593 \set Score.measurePosition = #(ly:make-moment 7 8)
1594 b8 b b
1595 c4 c1
1596 @end lilypond
1597
1598 @noindent
1599 As the example illustrates, @code{ly:make-moment n m} constructs a
1600 duration of n/m of a whole note.  For example, @code{ly:make-moment 1 8} is
1601 an eighth
1602 note duration and @code{ly:make-moment 7 16} is the duration of
1603 seven sixteenths notes.
1604
1605
1606 @anchor{Proportional notation (introduction)}
1607 @unnumberedsubsubsec Proportional notation (introduction)
1608 @cindex Proportional notation
1609
1610 See @ref{Proportional notation}.
1611
1612
1613 TODO: remove all this stuff?
1614
1615 Notes can be spaced proportionally to their time-difference by
1616 assigning a duration to @code{proportionalNotationDuration}
1617
1618 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1619 <<
1620   \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1621   \new Staff { c8[ c c c c c]  c4 c2 r2 }
1622   \new Staff { c2  \times 2/3 { c8 c c } c4 c1 }
1623 >>
1624 @end lilypond
1625
1626 Setting this property only affects the ideal spacing between
1627 consecutive notes.  For true proportional notation, the following
1628 settings are also required.
1629
1630 @itemize @bullet
1631
1632 @item True proportional notation requires that symbols are allowed to
1633 overstrike each other.  That is achieved by removing the
1634 @internalsref{Separating_line_group_engraver} from
1635 @internalsref{Staff} context.
1636
1637 @item Spacing influence of  prefatory matter (clefs, bar lines, etc.)
1638 is removed by setting the @code{strict-note-spacing} property to
1639 @code{#t} in @internalsref{SpacingSpanner} grob.
1640
1641 @item Optical spacing tweaks are switched by setting 
1642 @code{uniform-stretching} in @internalsref{SpacingSpanner} to true.
1643
1644
1645 @end itemize
1646
1647 @seealso
1648
1649 Examples: @lsr{spacing,proportional@/-spacing@/.ly}, 
1650 @lsr{spacing,proportional@/-strict@/-grace@/-notes@/.ly}, and
1651 @lsr{spacing,proportional@/-strict@/-notespacing@/.ly}
1652
1653 An example of strict proportional notation is in the
1654 example file @file{input/proportional.ly}.
1655
1656