]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/notation.itely
dada28ba7f21d9c737ccd3b8bb38b750ce2a5fdb
[lilypond.git] / Documentation / user / notation.itely
1 @c Note: -*-texinfo-*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8 @node Notation manual
9 @chapter Notation manual
10
11 This chapter describes all the different types of notation supported
12 by LilyPond.  It is intended as a reference for users that are already
13 somewhat familiar with LilyPond.
14
15 @menu
16 * Note entry::                  
17 * Easier music entry::          
18 * Staff notation::              
19 * Polyphony::                   
20 * Beaming::                     
21 * Accidentals::                 
22 * Expressive marks::            
23 * Repeats::                     
24 * Rhythmic music::              
25 * Piano music::                 
26 * Vocal music::                 
27 * Other instrument specific notation::  
28 * Tablatures::                  
29 * Popular music::               
30 * Orchestral music::            
31 * Formatting cue notes::        
32 * Ancient notation::            
33 * Contemporary notation::       
34 * Educational use::             
35 @end menu
36
37 @c FIXME: Note entry vs Music entry at top level menu is confusing.
38
39 @node Note entry
40 @section Note entry
41 @cindex Note entry
42
43 This section is about basic notation elements notes, rests and
44 related constructs, such as stems, tuplets and ties.
45
46 @menu
47 * Notes::                       
48 * Pitches::                     
49 * Chromatic alterations::       
50 * Micro tones::                 
51 * Chords::                      
52 * Rests::                       
53 * Skips::                       
54 * Durations::                   
55 * Augmentation dots::           
56 * Scaling durations::           
57 * Stems::                       
58 * Ties::                        
59 * Tuplets::                     
60 @end menu
61
62
63 @node Notes
64 @subsection Notes
65
66
67 A note is printed by specifying its pitch and then its duration,
68
69 @lilypond[quote,verbatim]
70 { cis'4 d'8 e'16 c'16 }
71 @end lilypond
72
73
74 @node Pitches
75 @subsection Pitches
76
77 @cindex Pitch names
78 @cindex Note specification
79 @cindex pitches
80 @cindex entering notes
81
82 The most common syntax for pitch entry is used for standard notes and
83 @code{\chords} modes.  In these modes, pitches may be designated by
84 names.  The notes are specified by the letters @code{a} through
85 @code{g}.  The octave is formed with notes ranging from @code{c}
86 to @code{b}.  The pitch @code{c} is an octave below middle C and the
87 letters span the octave above that C
88
89 @lilypond[fragment,verbatim,noindent]
90 \clef bass
91 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
92 @end lilypond
93
94 @cindex note names, Dutch
95
96 A sharp is formed by adding @code{-is} to the end of a pitch name and
97 a flat is formed by adding @code{-es}.  Double sharps and double flats
98 are obtained by adding @code{-isis} or @code{-eses}.  These
99 names are the Dutch note names.  In Dutch, @code{aes} is contracted to
100 @code{as}, but both forms are accepted.  Similarly, both
101 @code{es} and @code{ees} are accepted
102
103 @lilypond[fragment,quote,verbatim,relative=2]
104 ceses4
105 ces
106 c
107 cis 
108 cisis
109 @end lilypond
110
111 There are predefined sets of note names for various other languages.
112 To use them,  include the language specific init file.  For
113 example: @code{\include "english.ly"}.  The available language files
114 and the note names they define are
115
116 @anchor{note name}
117 @anchor{note names}
118 @example 
119                         Note Names               sharp       flat
120 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
121 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
122                                                -x (double)
123 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
124 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
125 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
126 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
127 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b 
128 espanol.ly     do  re  mi  fa  sol la  sib si  -s          -b 
129
130 @end example 
131
132 @cindex @code{'}
133 @cindex @code{,}
134
135
136
137 The optional octave specification takes the form of a series of
138 single quote (`@code{'}') characters or a series of comma
139 (`@code{,}') characters.  Each @code{'} raises the pitch by one
140 octave; each @code{,} lowers the pitch by an octave
141
142 @lilypond[quote,fragment,verbatim]
143 c' c'' es' g' as' gisis' ais'
144 @end lilypond
145
146 @c FIXME: we need this info (hide/unhide) somewhere in the manual, but this ain't the place.  -gp
147 @refcommands
148 Notes can be hidden and unhidden with the following commands
149
150 cindex @code{\hideNotes}
151 @code{\hideNotes}, 
152 @cindex @code{\unHideNotes}
153 @code{\unHideNotes}.
154
155
156 @seealso
157
158 Program reference: @internalsref{NoteEvent}, and @internalsref{NoteHead}.
159
160
161
162 @node Chromatic alterations
163 @subsection Chromatic alterations
164
165 Normally accidentals are printed automatically, but you may also
166 print them manually.  A reminder accidental
167 @cindex reminder accidental
168 @cindex @code{?}
169 can be forced by adding an exclamation mark @code{!}
170 after the pitch.  A cautionary accidental
171 @cindex cautionary accidental
172 @cindex parenthesized accidental
173 (i.e. an accidental within parentheses) can be obtained by adding the
174 question mark `@code{?}' after the pitch.
175
176 @lilypond[quote,fragment,verbatim]
177 cis' cis' cis'! cis'?
178 @end lilypond
179
180
181 @seealso
182
183 The automatic production of accidentals can be tuned in many
184 ways.  For more information, refer to @ref{Accidentals}.
185
186
187
188 @node Micro tones
189 @subsection Micro tones
190
191 Half-flats and half-sharps are formed by adding @code{-eh} and
192 @code{-ih}; the following is a series of Cs with increasing pitches
193
194 @cindex quarter tones
195 @cindex semi-flats, semi-sharps
196
197 @lilypond[verbatim,quote,relative=2,fragment]
198 { ceseh ceh cih cisih }
199 @end lilypond
200
201 Micro tones are also exported to the MIDI file 
202
203
204 @refbugs
205
206 There are no generally accepted standards for denoting three quarter
207 flats, so LilyPond's symbol does not conform to any standard.
208
209 @node Chords
210 @subsection Chords
211
212 A chord is formed by a enclosing a set of pitches in @code{<} and
213 @code{>}.  A chord may be followed by a duration, and a set of
214 articulations, just like simple notes
215
216 @lilypond[verbatim,fragment,quote,relative=1]
217 <c e g>4 <c>8
218 @end lilypond
219
220 @node Rests
221 @subsection Rests
222 @cindex Rests
223
224
225 @cindex @code{\rest}
226 @cindex @code{r}
227
228 Rests are entered like notes, with the note name @code{r}
229
230 @lilypond[fragment,quote,raggedright,verbatim]
231 r1 r2 r4 r8
232 @end lilypond
233
234 Whole bar rests, centered in middle of the bar,
235 must be done with multi-measure rests.  They are discussed in
236 @ref{Multi measure rests}.
237
238
239 A rest's vertical position may be explicitly specified by entering a
240 note with the @code{\rest} keyword appended.  This makes manual
241 formatting in polyphonic music easier.  Automatic rest collision
242 formatting will leave these rests alone
243
244 @lilypond[fragment,quote,raggedright,verbatim]
245 a'4\rest d'4\rest
246 @end lilypond
247
248 @seealso
249
250 Program reference: @internalsref{RestEvent}, and @internalsref{Rest}.
251
252
253 @c FIXME: naming.
254 @node Skips
255 @subsection Skips
256 @cindex Skip
257 @cindex Invisible rest
258 @cindex Space note
259
260 @cindex @code{\skip}
261 @cindex @code{s}
262 An invisible rest (also called a `skip') can be entered like a note
263 with note name `@code{s}' or with @code{\skip @var{duration}}
264
265 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
266 a4 a4 s4 a4 \skip 1 a4
267 @end lilypond
268
269 The @code{s} syntax is only available in note mode and chord mode.  In
270 other situations, for example, when entering lyrics, you should use
271 the @code{\skip} command
272
273 @lilypond[quote,raggedright,verbatim]
274 <<
275   \relative { a'2 a1 }
276   \new Lyrics \lyrics { \skip 2 bla1 }
277 >>
278 @end lilypond
279
280 The skip command is merely an empty musical placeholder.  It does not
281 produce any output, not even transparent output.
282
283 The @code{s} skip command does create @internalsref{Staff} and
284 @internalsref{Voice} when necessary, similar to note and rest
285 commands.  For example, the following results in an empty staff.
286
287 @lilypond[quote,raggedright,verbatim]
288 { s4 } 
289 @end lilypond
290
291 The fragment @code{@{ \skip 4 @} } would produce an empty page.
292
293 @seealso
294
295 Program reference: @internalsref{SkipEvent}, @internalsref{SkipMusic}.
296
297
298
299 @node Durations
300 @subsection Durations
301
302
303 @cindex duration
304 @cindex @code{\longa}
305 @cindex @code{\breve}
306 @cindex @code{\maxima}
307
308
309 In Note, Chord, and Lyrics mode, durations are designated by numbers
310 and dots: durations are entered as their reciprocal values.  For example,
311 a quarter note is entered using a @code{4} (since it is a 1/4 note), while
312 a half note is entered using a @code{2} (since it is a 1/2 note).  For notes
313 longer than a whole you must use variables
314
315 @example 
316 c'\breve  
317 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
318 r\longa r\breve  
319 r1 r2 r4 r8 r16 r32 r64 r64 
320 @end example 
321
322 @lilypond[quote,noindent]
323 \score {
324  \relative c'' {
325     a\breve*1/2  \autoBeamOff
326     a1 a2 a4 a8 a16 a32 a64 a64 
327    \bar "empty"
328    \break
329     r\longa*1/4 r\breve  *1/2
330     r1 r2 r4 r8 r16 r32 r64 r64 
331   }
332   \paper {
333     raggedright = ##t
334     \context {
335       \Staff
336         \remove "Clef_engraver"
337         \override StaffSymbol #'transparent = ##t 
338         \override TimeSignature #'transparent = ##t
339         \override BarLine #'transparent = ##t
340         \consists "Pitch_squash_engraver"
341     }
342   }
343 }
344 @end lilypond
345
346 If the duration is omitted then it is set to the previously entered
347 duration.  The default for the first note is a quarter note.
348
349 @lilypond[quote,raggedright,verbatim,fragment]
350 {
351 a a a2 a a4 a a1 a
352
353 @end lilypond
354
355
356
357 @node Augmentation dots
358 @subsection Augmentation dots
359
360 @cindex @code{.}
361 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
362 the number.  Double-dotted notes are produced in a similar way.
363
364 @lilypond[quote,fragment,verbatim]
365 a'4 b' c''4. b'8 a'4. b'4.. c''8.
366 @end lilypond
367
368 @refcommands
369
370 Dots are normally moved up to avoid staff lines, except in polyphonic
371 situations.  The following commands may be used to force a particular
372 direction manually
373
374 @cindex @code{\dotsUp}
375 @code{\dotsUp}, 
376 @cindex @code{\dotsDown}
377 @code{\dotsDown}, 
378 @cindex @code{\dotsBoth}
379 @code{\dotsBoth}.
380
381 @seealso
382
383 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}. 
384
385 @node Scaling durations
386 @subsection Scaling durations
387
388 You can alter the length of duration by a fraction @var{N/M}
389 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}).  This
390 will not affect the appearance of the notes or rests produced.
391
392 In the following example, the first three notes take up exactly two
393 beats, but no triplet bracket is printed.
394 @lilypond[quote,fragment,relative=2,verbatim]
395 \time 2/4
396 a4*2/3 gis4*2/3 a4*2/3
397 a4 a4 a4*2
398 b16*4 c4
399 @end lilypond
400
401
402 @seealso
403
404 This manual: @ref{Tuplets}
405
406
407 @c  TODO: I'm not certain that Stems belong here in the manual.  -gp
408 @node Stems
409 @subsection Stems
410
411 Whenever a note is found, a @internalsref{Stem} object is created
412 automatically.  For whole notes and rests, they are also created but
413 made invisible.
414
415 @refcommands
416
417 @cindex @code{\stemUp}
418 @code{\stemUp}, 
419 @cindex @code{\stemDown}
420 @code{\stemDown}, 
421 @cindex @code{\stemBoth}
422 @code{\stemBoth}. 
423
424
425 @node Ties
426 @subsection Ties
427
428 @cindex Tie
429 @cindex ties
430 @cindex @code{~}
431
432 A tie connects two adjacent note heads of the same pitch.  The tie in
433 effect extends the length of a note.  Ties should not be confused with
434 slurs, which indicate articulation, or phrasing slurs, which indicate
435 musical phrasing.  A tie is entered using the tilde symbol `@code{~}'
436
437 @lilypond[quote,fragment,verbatim]
438 e' ~ e' <c' e' g'> ~ <c' e' g'>
439 @end lilypond
440
441 When a tie is applied to a chord, all note heads whose pitches match
442 are connected.  When no note heads match, no ties will be created.
443
444 A tie is just a way of extending a note duration, similar to the
445 augmentation dot.  The following example shows two ways of notating
446 exactly the same concept
447 @c
448 @lilypond[quote,fragment,raggedright]
449 \time 3/4 c'2. c'2 ~ c'4
450 @end lilypond
451
452 @noindent
453 Ties are used either when the note crosses a bar line, or when dots
454 cannot be used to denote the rhythm.  When using ties, larger note
455 values should be aligned to subdivisions of the measure, eg.
456
457 @lilypond[fragment]
458 \relative {
459   r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4  
460 }
461 @end lilypond
462
463 If you need to tie a lot of notes over bars, it may be easier to use
464 automatic note splitting (see @ref{Automatic note splitting}).  This
465 mechanism automatically splits long notes, and ties them across bar
466 lines.
467
468 @refcommands
469
470
471 @cindex @code{\tieUp}
472 @code{\tieUp}, 
473 @cindex @code{\tieDown}
474 @code{\tieDown}, 
475 @cindex @code{\tieBoth}
476 @code{\tieBoth}, 
477 @cindex @code{\tieDotted}
478 @code{\tieDotted}, 
479 @cindex @code{\tieSolid}
480 @code{\tieSolid}.
481
482 @seealso 
483
484 In this manual: @ref{Automatic note splitting}.
485
486 Program reference: @internalsref{TieEvent}, @internalsref{Tie}.
487
488 @refbugs
489
490
491 Switching staves when a tie is active will not produce a slanted tie.
492
493 Formatting of ties is a difficult subject.  The results are often not
494 optimal. 
495
496 @node Tuplets
497 @subsection Tuplets
498
499 @cindex tuplets
500 @cindex triplets
501 @cindex @code{\times}
502
503 Tuplets are made out of a music expression by multiplying all durations
504 with a fraction
505
506 @cindex @code{\times}
507 @example
508 \times @var{fraction} @var{musicexpr}
509 @end example
510
511 @noindent
512 The duration of @var{musicexpr} will be multiplied by the fraction.
513 The fraction's denominator will be printed over the notes, optionally
514 with a bracket.  The most common tuplet is the triplet in which 3
515 notes have the length of 2, so the notes are 2/3 of their written
516 length
517
518 @lilypond[quote,fragment,verbatim]
519 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
520 @end lilypond
521
522 The property @code{tupletSpannerDuration} specifies how long each
523 bracket should last.  With this, you can make lots of tuplets while
524 typing @code{\times} only once, thus saving lots of typing.  In the next
525 example, there are two triplets shown, while @code{\times} was only
526 used once
527
528 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
529 \set tupletSpannerDuration = #(ly:make-moment 1 4)
530 \times 2/3 { c'8 c c c c c }
531 @end lilypond
532
533 The format of the number is determined by the property
534 @code{tupletNumberFormatFunction}.  The default prints only the
535 denominator, but if it is set to the Scheme function
536 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
537 instead.
538
539
540 @cindex @code{tupletNumberFormatFunction}
541 @cindex tuplet formatting 
542
543
544 @refcommands
545
546 @cindex @code{\tupletUp}
547 @code{\tupletUp}, 
548 @cindex @code{\tupletDown}
549 @code{\tupletDown}, 
550 @cindex @code{\tupletBoth}
551 @code{\tupletBoth}.
552
553 @seealso
554
555 User manual: @ref{Changing context properties on the fly} for the
556 @code{\set} command.
557
558
559 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
560
561 Examples: @inputfileref{input/regression,tuplet-nest.ly}.
562
563 @refbugs
564
565 Nested tuplets are not formatted automatically.  In this case, outer
566 tuplet brackets should be moved manually, which is demonstrated in
567 @inputfileref{input/regression,tuplet-nest.ly}.
568
569
570
571 @node Easier music entry
572 @section Easier music entry
573 @cindex Music entry
574
575 This section deals with tricks and features of the input language that
576 were added solely to help entering music and finding and correcting
577 mistakes.  There are also external tools that make debugging easier.
578 See @ref{Point and click} for more information.
579
580 It is also possible to enter and edit music using other programs, such as
581 GUI interfaces or MIDI sequencers.  Refer to the LilyPond
582 website for more information.
583
584
585 @menu
586 * Relative octaves::            
587 * Octave check::                
588 * Bar check::                   
589 * Skipping corrected music::    
590 * Automatic note splitting::    
591 @end menu
592
593
594
595
596 @node Relative octaves
597 @subsection Relative octaves
598 @cindex Relative
599 @cindex relative octave specification
600
601 Octaves are specified by adding @code{'} and @code{,} to pitch names.
602 When you copy existing music, it is easy to accidentally put a pitch
603 in the wrong octave and hard to find such an error.  The relative
604 octave mode prevents these errors by making the mistakes much
605 larger: a single error puts the rest of the piece off by one octave
606
607 @cindex @code{\relative}
608 @example
609   \relative @var{startpitch} @var{musicexpr}
610 @end example
611 or
612 @example
613   \relative @var{musicexpr}
614 @end example
615  
616 The octave of notes that appear in @var{musicexpr} are calculated as
617 follows: if no octave changing marks are used, the basic interval
618 between this and the last note is always taken to be a fourth or
619 less.  This distance is determined without regarding alterations; a
620 @code{fisis} following a @code{ceses} will be put above the
621 @code{ceses}.  In other words, a doubly-augmented fourth is considered
622 a smaller interval than a diminshed fifth, even though the fourth is
623 seven semitones while the fifth is only six semitones.
624
625 The octave changing marks @code{'} and @code{,} can be added to raise
626 or lower the pitch by an extra octave.  Upon entering relative mode,
627 an absolute starting pitch can be specified that will act as the
628 predecessor of the first note of @var{musicexpr}.  If no starting pitch
629 is specified, then middle C is used as a start.
630
631 Here is the relative mode shown in action
632 @lilypond[quote,fragment,raggedright,verbatim]
633 \relative c'' {
634   b c d c b c bes a 
635 }
636 @end lilypond
637
638 Octave changing marks are used for intervals greater than a fourth
639 @lilypond[quote,fragment,verbatim]
640 \relative c'' {
641   c g c f, c' a, e''
642 }
643 @end lilypond
644
645 If the preceding item is a chord, the first note of the chord is used
646 to determine the first note of the next chord
647
648 @lilypond[quote,fragment,verbatim]
649 \relative c' {
650   c <c e g> 
651   <c' e g>
652   <c, e' g>
653 }
654 @end lilypond
655
656 The pitch after the @code{\relative} contains a note name.
657
658
659 @c Perfect place for a "refwarning"!  -gp
660 @c @refwarning
661
662 The relative conversion will not affect @code{\transpose},
663 @code{\chords} or @code{\relative} sections in its argument.  To use
664 relative within transposed music, an additional @code{\relative} must
665 be placed inside @code{\transpose}.
666
667 @node Octave check
668 @subsection Octave check
669
670
671 Octave checks make octave errors easier to correct:  a note may be
672 followed by @code{=}@var{quotes} which indicates what its absolute
673 octave should be.  In the following example,
674 @example
675 \relative c'' @{ c='' b=' d,='' @}        
676 @end example
677
678 @noindent
679 @c take care with @code, adds confusing quotes.
680 the @code{d} will generate a warning, because a @code{d''} is expected
681 (because @code{b'} to @code{d''} is only a third), but a @code{d}' is
682 found.  In the output, the octave is corrected to be a @code{d''} and
683 the next note is calculated relative to @code{d''} instead of @code{d'}.
684
685
686
687 There is also a syntax that is separate from the notes.  The syntax
688
689 @example
690 \octave @var{pitch}
691 @end example
692
693
694 @c FIXME: what is the second sentence trying to say?  \octave check  -gp
695
696 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
697 quotes) in \relative mode.  If not, a warning is printed, and the
698 octave is corrected, for example, the first check is passed
699 successfully.  The second check fails with an error message.  The
700 octave is adjusted so the following notes are in the correct octave
701 once again.
702 @example
703 \relative c' @{
704   e
705   \octave a'
706   \octave b'
707 @}
708 @end example
709
710
711 The octave of a note following an octave check is determined with
712 respect to the note preceding it.  In the next fragment, the last note
713 is a @code{a'}, above middle C.  That means that the @code{\octave}
714 check passes successfully, so the check could be deleted without changing
715 the output of the piece.
716
717 @lilypond[quote,verbatim,fragment] 
718 \relative c' {
719   e
720   \octave b
721   a        
722 }
723 @end lilypond
724
725 @node Bar check
726 @subsection Bar check
727 @cindex Bar check
728
729 @cindex bar check
730 @cindex @code{barCheckSynchronize}
731 @cindex @code{|}
732
733 Bar checks help detect errors in the durations.  A bar check is
734 entered using the bar symbol, `@code{|}'.  Whenever it is encountered
735 during interpretation, it should fall on a measure boundary.  If it
736 does not, a warning is printed.  In the next example, the second bar
737 check will signal an error
738 @example
739 \time 3/4 c2 e4 | g2 | 
740 @end example
741
742 Bar checks can also be used in lyrics, for example 
743
744 @example
745 \lyrics @{
746   \time 2/4
747   Twin -- kle | Twin -- kle
748 @} 
749 @end example
750
751
752 @cindex @code{skipTypesetting}
753
754 Failed bar checks are caused by entering incorrect
755 durations.  Incorrect durations often completely garble up the score,
756 especially if the score is polyphonic, so a good place to start correcting
757 input is by scanning for failed bar checks and incorrect durations.  To
758 speed up this process, the @code{skipTypesetting} feature may be
759 used.  It is described in the next section.
760
761 @cindex @code{|}
762 @cindex @code{pipeSymbol}
763
764 It is also possible to redefine the meaning of @code{|}.  This is done
765 by assigning a music expression to @code{pipeSymbol},
766
767 @lilypond[quote,fragment,raggedright,verbatim]
768 pipeSymbol = \bar "||"
769
770 { c'2 c'2 | c'2 c'2 | }
771 @end lilypond 
772
773
774 @node Skipping corrected music
775 @subsection Skipping corrected music
776
777 The property @code{Score.skipTypesetting} can be used to switch on and
778 off typesetting completely during the interpretation phase.  When
779 typesetting is switched off, the music is processed much more
780 quickly.  This can be used to skip over the parts of a score that
781 have already been checked for errors
782
783 @lilypond[quote,fragment,raggedright,verbatim]
784 \relative c'' {
785   c8 d
786   \set Score.skipTypesetting = ##t
787   e e e e e e e e
788   \set Score.skipTypesetting = ##f
789   c d b bes a g c2 }
790 @end lilypond
791
792 In polyphonic music, @code{Score.skipTypesetting} will affect all
793 voices and staves, saving even more time.
794
795 @node Automatic note splitting
796 @subsection Automatic note splitting
797
798 Long notes can be converted automatically to tied notes.  This is done
799 by replacing the @internalsref{Note_heads_engraver} by the
800 @internalsref{Completion_heads_engraver}.
801 In the following examples, notes crossing the bar line are split and tied.
802
803
804 @lilypond[quote,fragment,verbatim,relative=1,raggedright]
805 \new Voice \with {
806   \remove "Note_heads_engraver"
807   \consists "Completion_heads_engraver"
808 } {
809   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 
810 }
811 @end lilypond
812
813 This engraver splits all running notes at the bar line, and inserts
814 ties.  One of its uses is to debug complex scores: if the measures are
815 not entirely filled, then the ties exactly show how much each measure
816 is off.
817
818 @refbugs
819
820 Not all durations (especially those containing tuplets) can be
821 represented exactly with normal notes and dots, but the engraver will
822 not insert tuplets.
823
824 @seealso
825
826 Examples: @inputfileref{input/regression,completion-heads.ly}.
827
828 @noindent
829
830 Program reference: @internalsref{Completion_heads_engraver}.
831
832
833 @node Staff notation
834 @section Staff notation
835
836 This section describes music notation that occurs on staff level,
837 such as key signatures, clefs and time signatures.
838
839 @cindex Staff notation
840
841 @menu
842 * Staff symbol::                
843 * Key signature::               
844 * Clef::                        
845 * Ottava brackets::             
846 * Time signature::              
847 * Partial measures::            
848 * Unmetered music::             
849 * Bar lines::                   
850 * Time administration::         
851 * Controlling formatting of prefatory matter::  
852 @end menu
853
854 @node Staff symbol
855 @subsection Staff symbol
856
857 @cindex adjusting staff symbol
858
859 Notes, dynamic signs, etc. are grouped
860 with a set of horizontal lines, into a staff (plural `staves').  In our
861 system, these lines are drawn using a separate layout object called
862 staff symbol.  
863
864
865 @cindex staff lines, setting number of
866 @cindex staff lines, setting thickness of
867 @cindex thickness of staff lines, setting 
868 @cindex number of staff lines, setting 
869
870 @seealso
871
872 Program reference: @internalsref{StaffSymbol}.
873
874 Examples: @inputfileref{input/test,staff-lines.ly},
875 @inputfileref{input/test,staff-size.ly}.
876
877 @refbugs
878
879 If a staff is ended halfway a piece, the staff symbol may not end
880 exactly on the bar line.
881
882
883 @node Key signature
884 @subsection Key signature
885 @cindex Key signature
886
887 @cindex @code{\key}
888
889 The key signature indicates the scale in which a piece is played.  It
890 is denoted by a set of alterations (flats or sharps) at the start of
891 the staff.
892
893
894 Setting or changing the key signature is done with the @code{\key}
895 command
896 @example
897   @code{\key} @var{pitch} @var{type}
898 @end example
899
900 @cindex @code{\minor}
901 @cindex @code{\major}
902 @cindex @code{\minor}
903 @cindex @code{\ionian}
904 @cindex @code{\locrian}
905 @cindex @code{\aeolian}
906 @cindex @code{\mixolydian}
907 @cindex @code{\lydian}
908 @cindex @code{\phrygian}
909 @cindex @code{\dorian}
910
911 Here, @var{type} should be @code{\major} or @code{\minor} to get
912 @var{pitch}-major or @var{pitch}-minor, respectively.
913 The standard mode names @code{\ionian},
914 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
915 @code{\phrygian}, and @code{\dorian} are also defined.
916
917 This command sets the context property
918 @internalsref{Staff}.@code{keySignature}.  Non-standard key signatures
919 can be specified by setting this property directly.
920
921 Accidentals and key signatures often confuse new users, because
922 unaltered notes get natural signs depending on the key signature.  For
923 more information, see @ref{More about pitches}.
924
925 @c   FIXME FIXME: check CVS logs to see what was supposed to happen to this
926 @c   part; CVS merge conflict occurred.
927 @c @refbugs
928
929 @c The ordering of a key cancellation is wrong when it is combined with
930 @c repeat bar lines.  The cancellation is also printed after a line break.
931
932 @seealso
933
934 Program reference: @internalsref{KeyChangeEvent},
935 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
936
937 @cindex @code{keySignature}
938
939
940 @node Clef
941 @subsection Clef
942 @cindex @code{\clef}
943
944 The clef indicates which lines of the staff correspond to which
945 pitches.
946
947
948 The clef can be set with the @code{\clef} command
949 @lilypond[quote,fragment,verbatim]
950 { c''2 \clef alto g'2 }
951 @end lilypond
952
953 Supported clef-names include
954 @c Moved standard clefs to the top /MB
955 @table @code
956 @cindex treble clef
957 @cindex violin clef
958 @item treble, violin, G, G2
959 G clef on 2nd line
960 @item alto, C
961 @cindex alto clef 
962  C clef on 3rd line
963 @item tenor
964 @cindex tenor clef 
965  C clef on 4th line. 
966 @item bass, F
967 @cindex bass clef
968  F clef on 4th line
969 @item french
970 @cindex french clef
971  G clef on 1st line, so-called French violin clef
972 @item soprano
973 @cindex soprano clef
974  C clef on 1st line
975 @item mezzosoprano
976 @cindex mezzosoprano clef
977  C clef on 2nd line
978 @item baritone
979 @cindex baritone clef
980  C clef on 5th line
981 @item varbaritone
982 @cindex varbaritone clef
983  F clef on 3rd line
984 @item subbass
985 @cindex subbass clef
986  F clef on 5th line
987 @item percussion
988  percussion clef
989 @item tab
990  tablature clef
991 @end table
992
993 By adding @code{_8} or @code{^8} to the clef name, the clef is
994 transposed one octave down or up, respectively, and @code{_15} and
995 @code{^15} transposes by two octaves.  The argument @var{clefname}
996 must be enclosed in quotes when it contains underscores or digits.  For
997 example,
998
999
1000 @cindex choral tenor clef  
1001 @lilypond[quote,verbatim,fragment,relative=1]
1002 \clef "G_8" c4
1003 @end lilypond
1004
1005 This command is equivalent to setting @code{clefGlyph},
1006 @code{clefPosition} (which controls the Y position of the clef),
1007 @code{centralCPosition} and @code{clefOctavation}.  A clef is printed
1008 when any of these properties are changed.  The following example shows
1009 possibilities when setting properties manually.
1010
1011 @lilypond[verbatim]
1012 {
1013   \set Staff.clefGlyph = #"clefs-F"
1014   \set Staff.clefPosition = #2
1015   c'4
1016   \set Staff.clefGlyph = #"clefs-G"
1017   c'4
1018   \set Staff.clefGlyph = #"clefs-C"
1019   c'4
1020   \set Staff.clefOctavation = #7 
1021   c'4
1022   \set Staff.clefOctavation = #0 
1023   \set Staff.clefPosition = #0
1024   c'4
1025   \clef "bass"
1026   c'4
1027 }
1028 @end lilypond
1029
1030
1031 @seealso
1032
1033 Program reference: @internalsref{Clef}.
1034
1035
1036
1037 @node Ottava brackets
1038 @subsection Ottava brackets
1039
1040 `Ottava' brackets introduce an extra transposition of an octave for
1041 the staff.  They are created by invoking the function
1042 @code{set-octavation}
1043
1044 @cindex ottava
1045 @cindex 15ma
1046 @cindex octavation
1047
1048 @lilypond[quote,verbatim,fragment]
1049 \relative c''' {
1050   a2 b
1051   #(set-octavation 1)
1052   a b 
1053   #(set-octavation 0)
1054   a b
1055 }
1056 @end lilypond
1057
1058 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1059 (for 15ma) as arguments.  Internally the function sets the properties
1060 @code{ottavation} (e.g. to @code{"8va"}) and
1061 @code{centralCPosition}.  For overriding the text of the bracket, set
1062 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1063
1064 @lilypond[verbatim]
1065 {
1066   #(set-octavation 1)
1067   \set Staff.ottavation = #"8"
1068   c'''
1069 }
1070 @end lilypond
1071
1072 @seealso
1073
1074 Program reference: @internalsref{OttavaBracket}.
1075
1076 Examples: @inputfileref{input/regression,ottava.ly},
1077 @inputfileref{input/regression,ottava-broken.ly}.
1078
1079 @refbugs
1080
1081 @code{set-octavation} will get confused when clef changes happen
1082 during an octavation bracket.
1083
1084
1085
1086
1087 @node Time signature
1088 @subsection Time signature
1089 @cindex Time signature
1090 @cindex meter
1091 @cindex @code{\time}
1092
1093 Time signature indicates the metrum of a piece: a regular pattern of
1094 strong and weak beats.  It is denoted by a fraction at the start of the
1095 staff.
1096
1097
1098 The time signature is set or changed by the @code{\time}
1099 command
1100 @lilypond[quote,fragment,verbatim]
1101 \time 2/4 c'2 \time 3/4 c'2. 
1102 @end lilypond
1103
1104 The symbol that is printed can be customized with the @code{style}
1105 property.  Setting it to @code{#'()} uses fraction style for 4/4 and
1106 2/2 time,
1107
1108 @lilypond[fragment,verbatim]
1109 \time 4/4 c'1
1110 \time 2/2 c'1
1111 \override TimeSignature #'style = #'()
1112 \time 4/4 c'1
1113 \time 2/2 c'1
1114 @end lilypond
1115
1116
1117
1118 There are many more options for its layout.  See @ref{Ancient time
1119 signatures} for more examples.
1120
1121
1122 This command sets the property @code{timeSignatureFraction},
1123 @code{beatLength} and @code{measureLength} in the @code{Timing}
1124 context, which is normally aliased to @internalsref{Score}.  The
1125 property @code{measureLength} determines where bar lines should be
1126 inserted, and how automatic beams should be generated.  Changing the
1127 value of @code{timeSignatureFraction} also causes the symbol to be
1128 printed.
1129
1130 More options are available through the Scheme function
1131 @code{set-time-signature}.  In combination with the
1132 @internalsref{Measure_grouping_engraver}, it will create
1133 @internalsref{MeasureGrouping} signs.  Such signs ease reading
1134 rhythmically complex modern music.  In the following example, the 9/8
1135 measure is subdivided in 2, 2, 2 and 3.  This is passed to
1136 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1137
1138 @lilypond[quote,raggedright,verbatim]
1139 \score {
1140   \relative c'' {
1141     #(set-time-signature 9 8 '(2 2 2 3))
1142     g8[ g] d[ d] g[ g] a8[( bes g]) | 
1143     #(set-time-signature 5 8 '(3 2))
1144     a4. g4
1145   }
1146   \paper {
1147     \context {
1148       \Staff
1149       \consists "Measure_grouping_engraver"
1150     }
1151   }
1152 }
1153 @end lilypond
1154
1155 @seealso
1156
1157 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1158
1159
1160 @refbugs
1161
1162 Automatic beaming does not use the measure grouping specified with
1163 @code{set-time-signature}.
1164
1165 @node Partial measures
1166 @subsection Partial measures
1167 @cindex Partial
1168 @cindex anacrusis
1169 @cindex partial measure
1170 @cindex measure, partial
1171 @cindex shorten measures
1172 @cindex @code{\partial}
1173
1174 Partial measures, for example in upsteps, are entered using the
1175 @code{\partial} command
1176 @lilypond[quote,fragment,verbatim,relative=2]
1177 \partial 16*5  c16 cis d dis e | a2. c,4 | b2
1178 @end lilypond
1179
1180 The syntax for this command is 
1181 @example
1182   \partial @var{duration} 
1183 @end example
1184 This is internally translated into
1185 @example
1186   \set Timing.measurePosition = -@var{length of duration}
1187 @end example
1188 @cindex @code{|}
1189 The property @code{measurePosition} contains a rational number
1190 indicating how much of the measure has passed at this point.
1191
1192 @refbugs
1193
1194 This command does not take into account grace notes at the start of
1195 the music.  When a piece starts with graces notes in the pickup, then
1196 the @code{\partial} should follow the grace notes
1197
1198 @lilypond[verbatim,relative,fragment]
1199 {
1200   \grace f16 
1201   \partial 4
1202   g4
1203   a2 g2 
1204 }
1205 @end lilypond
1206
1207
1208 @node Unmetered music
1209 @subsection Unmetered music
1210
1211 @cindex @code{\bar}
1212
1213 Bar lines and bar numbers are calculated automatically.  For unmetered
1214 music (e.g. cadenzas), this is not desirable.  By setting
1215 @code{Score.timing} to false, this automatic timing can be switched
1216 off.  Empty bar lines,
1217
1218 @example
1219   \bar ""
1220 @end example
1221
1222 @noindent
1223 indicate where line breaks can occur.
1224
1225 @refcommands
1226
1227 @cindex @code{\cadenzaOn}
1228 @code{\cadenzaOn}, 
1229 @cindex @code{\cadenzaOff}
1230 @code{\cadenzaOff}.
1231
1232
1233
1234
1235 @node Bar lines
1236 @subsection Bar lines
1237 @cindex Bar lines
1238
1239 @cindex @code{\bar}
1240 @cindex measure lines
1241 @cindex repeat bars
1242
1243
1244 Bar lines delimit measures, but are also used to indicate repeats.
1245 Normally, they are inserted automatically.  Line breaks may only
1246 happen on bar lines.
1247
1248 Special types of bar lines can be forced with the @code{\bar} command
1249 @c
1250 @lilypond[quote,relative=2,fragment,verbatim]
1251 c4 \bar "|:" c4
1252 @end lilypond
1253
1254 The following bar types are available
1255 @lilypondfile[]{bar-lines.ly}
1256
1257 For allowing line breaks, there is a special command,
1258 @example
1259   \bar ""
1260 @end example 
1261 This will insert an invisible bar line, and allow line breaks at this
1262 point.
1263
1264 In scores with many staves, a @code{\bar} command in one staff is
1265 automatically applied to all staves.  The resulting bar lines are
1266 connected between different staves of a @internalsref{StaffGroup}
1267 @c
1268 @lilypond[quote,fragment,verbatim]
1269 <<
1270   \context StaffGroup <<
1271     \new Staff {
1272       e'4 d'
1273       \bar "||"
1274       f' e'
1275     }
1276     \new Staff { \clef bass c4 g e g }
1277   >>
1278   \new Staff { \clef bass c2 c2 }
1279 >>
1280 @end lilypond
1281
1282
1283 The command @code{\bar }@var{bartype} is a short cut for doing
1284 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
1285 is set to a string, a bar line of that type is created.
1286
1287 A bar line is created whenever the @code{whichBar} property is set.
1288 At the start of a measure it is set to the contents of
1289 @code{defaultBarType}.  The contents of @code{repeatCommands} are used
1290 to override default measure bars.
1291
1292 @cindex @code{whichBar}
1293 @cindex @code{repeatCommands}
1294 @cindex @code{defaultBarType}
1295
1296 You are encouraged to use @code{\repeat} for repetitions.  See
1297 @ref{Repeats}.
1298
1299
1300
1301 @seealso
1302
1303 In this manual: @ref{Repeats}, @ref{System start delimiters}
1304
1305
1306 Program reference: @internalsref{BarLine} (created at
1307 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1308
1309 @cindex bar lines at start of system
1310 @cindex start of system
1311
1312
1313
1314 Examples: @inputfileref{input/test,bar-lines.ly},
1315
1316
1317 @node Time administration
1318 @subsection Time administration
1319
1320 Time is administered by the @internalsref{Time_signature_engraver},
1321 which usually lives in the @internalsref{Score} context.
1322 The bookkeeping deals with the following variables
1323
1324 @table @code
1325 @item currentBarNumber
1326  the measure number
1327 @item measureLength
1328   the length of the measures in the current time signature.  For a 4/4
1329   time this is 1, and for 6/8 it is 3/4.
1330 @item measurePosition
1331   the point within the measure where we currently are.  This quantity
1332   is reset to 0 whenever it exceeds @code{measureLength}.  When that happens,
1333   @code{currentBarNumber} is incremented.
1334 @item timing
1335  if set to true, the above variables are updated for every time
1336  step.  When set to false, the engraver stays in the current measure
1337  indefinitely.
1338 @end table
1339
1340 Timing can be changed by setting any of these variables explicitly.
1341 In the next example, the 4/4 time signature is printed, but
1342 @code{measureLength} is set to 5/4.  After a while, the measure is
1343 shortened by 1/8, by setting @code{measurePosition} to -3/8 at 2/4 in
1344 the measure, so the next bar line will fall at 2/4 + 3/8. 
1345
1346 @lilypond[verbatim]
1347 \relative {
1348   \set Score.measureLength = #(ly:make-moment 5 4)
1349   c1 c4
1350   c1 c4 
1351   c4 c4
1352   \set Score.measurePosition = #(ly:make-moment -3 8)
1353   b8 b b
1354   c4 c1
1355 }
1356 @end lilypond
1357
1358
1359 @node Controlling formatting of prefatory matter
1360 @subsection Controlling formatting of prefatory matter
1361
1362 TODO
1363
1364 @lilypond[verbatim]
1365 \transpose c c' {
1366         \override Staff.Clef  #'break-visibility = #end-of-line-visible
1367         \override Staff.KeySignature  #'break-visibility = #end-of-line-visible
1368         \set Staff.explicitClefVisibility = #end-of-line-visible
1369         \set Staff.explicitKeySignatureVisibility = #end-of-line-visible
1370
1371         % We want the time sig to take space, otherwise there is not
1372         % enough white at the start of the line.
1373         %
1374         
1375         \override Staff.TimeSignature  #'transparent = ##t
1376         \set Score.defaultBarType = #"empty"
1377         
1378         c1 d e f g a b c
1379         \key d \major
1380         \break
1381
1382         % see above.
1383         \time 4/4
1384         
1385         d e fis g a b cis d 
1386         \key g \major
1387         \break
1388         \time 4/4    
1389 }
1390 @end lilypond
1391
1392
1393 @node Polyphony
1394 @section Polyphony
1395 @cindex polyphony
1396
1397 The easiest way to enter fragments with more than one voice on a staff
1398 is to split chords using the separator @code{\\}.  You can use it for
1399 small, short-lived voices or for single chords
1400
1401 @cindex @code{\\}
1402
1403 @lilypond[quote,verbatim,fragment]
1404 \context Staff \relative c'' {
1405   c4 << { f d e  } \\ { b c2 } >>
1406   c4 << g' \\ b, \\  f' \\ d >>
1407 }
1408 @end lilypond
1409
1410 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1411 voices are sometimes called "layers" in other notation packages}
1412 @cindex layers
1413 to be instantiated.  They bear the names @code{"1"}, @code{"2"}, etc.  In
1414 each of these contexts, vertical direction of slurs, stems, etc. is set
1415 appropriately.
1416
1417 @cindex @code{\voiceOne}
1418 @cindex @code{\voiceFour}
1419
1420 This can also be done by instantiating @internalsref{Voice} contexts
1421 by hand, and using @code{\voiceOne}, up to @code{\voiceFour} to assign
1422 a stem directions and horizontal shift for each part
1423 @c
1424
1425 @lilypond[quote,raggedright,verbatim]
1426 \relative c''
1427 \context Staff <<
1428   \new Voice { \voiceOne cis2 b  }
1429   \new Voice { \voiceThree b4 ais ~ ais4 gis4 } 
1430   \new Voice { \voiceTwo fis4~  fis4 f ~ f  } >>
1431 @end lilypond
1432
1433 @noindent
1434 The command @code{\oneVoice} will revert back to the normal setting.
1435 @cindex @code{\oneVoice}
1436
1437
1438 Normally, note heads with a different number of dots are not merged, but
1439 when the object property @code{merge-differently-dotted} is set in
1440 the @internalsref{NoteCollision} object, they are merged
1441 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1442 \context Voice << {
1443   g8 g8 
1444   \override Staff.NoteCollision  
1445     #'merge-differently-dotted = ##t
1446   g8 g8
1447 } \\ { g8.[ f16] g8.[ f16] } >>
1448 @end lilypond
1449
1450 Similarly, you can merge half note heads with eighth notes, by setting
1451 @code{merge-differently-headed}
1452 @lilypond[quote,fragment,relative=2,verbatim]
1453 \context Voice << {
1454   c8 c4.
1455   \override Staff.NoteCollision
1456     #'merge-differently-headed = ##t
1457 c8 c4. } \\ { c2 c2 } >>
1458 @end lilypond
1459
1460 LilyPond also vertically shifts rests that are opposite of a stem,
1461 for example
1462
1463 @lilypond[quote,raggedright,fragment,verbatim]
1464 \context Voice << c''4 \\  r4 >>
1465 @end lilypond
1466
1467
1468 @refcommands
1469
1470
1471
1472 @cindex @code{\oneVoice}
1473 @code{\oneVoice}, 
1474 @cindex @code{\voiceOne}
1475 @code{\voiceOne}, 
1476 @cindex @code{\voiceTwo}
1477 @code{\voiceTwo}, 
1478 @cindex @code{\voiceThree}
1479 @code{\voiceThree}, 
1480 @cindex @code{\voiceFour}
1481 @code{\voiceFour}.
1482
1483
1484
1485 @cindex @code{\shiftOn}
1486 @code{\shiftOn}, 
1487 @cindex @code{\shiftOnn}
1488 @code{\shiftOnn}, 
1489 @cindex @code{\shiftOnnn}
1490 @code{\shiftOnnn}, 
1491 @cindex @code{\shiftOff}
1492 @code{\shiftOff}: these commands specify in what chords of the current
1493 voice should be shifted.  The outer voices (normally: voice one and
1494 two) have @code{\shiftOff}, while the inner voices (three and four)
1495 have @code{\shiftOn}.  @code{\shiftOnn} and @code{\shiftOnnn} define
1496 further shift levels.
1497
1498
1499 When LilyPond cannot cope, the @code{force-hshift}
1500 property of the @internalsref{NoteColumn} object and pitched rests can
1501 be used to override typesetting decisions.
1502
1503 @lilypond[verbatim,raggedright]
1504 \relative <<
1505 {
1506   <d g>
1507   <d g>
1508 } \\ {
1509   <b f'>
1510   \once \override NoteColumn  #'force-hshift = #1.7
1511   <b f'>
1512 } >> 
1513 @end lilypond
1514
1515
1516
1517 @seealso
1518
1519 Program reference: the objects responsible for resolving collisions are
1520 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1521
1522 Examples: 
1523 @inputfileref{input/regression,collision-dots.ly},
1524 @inputfileref{input/regression,collision-head-chords.ly},
1525 @inputfileref{input/regression,collision-heads.ly},
1526 @inputfileref{input/regression,collision-mesh.ly}, and
1527 @inputfileref{input/regression,collisions.ly}.
1528
1529
1530 @refbugs
1531
1532
1533 When using @code{merge-differently-headed} with an upstem eighth or a
1534 shorter note, and a downstem half note, the eighth note gets the wrong
1535 offset.
1536
1537 There is no support for clusters where the same note occurs with
1538 different accidentals in the same chord.  In this case, it is
1539 recommended to use enharmonic transcription, or to use special cluster
1540 notation (see @ref{Clusters}).
1541
1542 @node Beaming
1543 @section Beaming
1544
1545 Beams are used to group short notes into chunks that are aligned with
1546 the metrum.  They are inserted automatically
1547
1548 @lilypond[quote,fragment,verbatim,relative=2]
1549 \time 2/4 c8 c c c \time 6/8 c c c c8. c16  c8
1550 @end lilypond
1551
1552 When these automatic decisions are not good enough, beaming can be
1553 entered explicitly.  It is also possible to define beaming patterns
1554 that differ from the defaults.
1555
1556 Individual notes may be marked with @code{\noBeam}, to prevent them
1557 from being beamed
1558
1559 @lilypond[quote,fragment,verbatim,relative=2]
1560 \time 2/4 c8 c\noBeam c c
1561 @end lilypond
1562
1563
1564 @seealso
1565
1566 Program reference: @internalsref{Beam}. 
1567
1568
1569 @cindex Automatic beams
1570 @menu
1571 * Manual beams::                
1572 * Setting automatic beam behavior::  
1573 * Beam formatting::             
1574 @end menu
1575
1576 @node Manual beams
1577 @subsection Manual beams
1578 @cindex beams, manual
1579 @cindex @code{]}
1580 @cindex @code{[}
1581
1582 In some cases it may be necessary to override the automatic beaming
1583 algorithm.  For example, the autobeamer will not put beams over rests
1584 or bar lines.  Such beams are specified manually by marking the begin
1585 and end point with @code{[} and @code{]}
1586
1587 @lilypond[quote,fragment,relative=1,verbatim]
1588 {
1589   r4 r8[ g' a r8] r8 g[ | a] r8
1590 }
1591 @end lilypond
1592
1593 @cindex @code{stemLeftBeamCount}
1594
1595 Normally, beaming patterns within a beam are determined automatically.
1596 If necessary, the properties @code{stemLeftBeamCount} and
1597 @code{stemRightBeamCount} can be used to override the defaults.  If
1598 either property is set, its value will be used only once, and then it
1599 is erased
1600
1601 @lilypond[quote,fragment,relative=1,verbatim]
1602 {
1603   f8[ r16 f g a]
1604   f8[ r16 \set stemLeftBeamCount = #1 f g a]
1605 }
1606 @end lilypond
1607 @cindex @code{stemRightBeamCount}
1608
1609
1610 The property @code{subdivideBeams} can be set in order to subdivide
1611 all 16th or shorter beams at beat positions, as defined by the
1612 @code{beatLength} property.
1613
1614
1615 @lilypond[fragment,quote,relative=2,verbatim,noindent]
1616 c16[ c c c c c c c]
1617 \set subdivideBeams = ##t
1618 c16[ c c c c c c c]
1619 \set Score.beatLength = #(ly:make-moment 1 8)
1620 c16[ c c c c c c c]
1621 @end lilypond
1622 @cindex @code{subdivideBeams}
1623
1624 Normally, line breaks are forbidden when beams cross bar lines.  This
1625 behavior can be changed by setting @code{allowBeamBreak}.
1626
1627 @cindex @code{allowBeamBreak}
1628 @cindex beams and line breaks
1629
1630 @cindex beams, kneed
1631 @cindex kneed beams
1632 @cindex auto-knee-gap
1633
1634
1635 @seealso
1636
1637 User manual: @ref{Changing context properties on the fly} for the
1638 @code{\set} command
1639
1640
1641 @refbugs
1642
1643 @cindex Frenched staves
1644 Kneed beams are inserted automatically, when a large gap is detected
1645 between the note heads.  This behavior can be tuned through the object
1646
1647
1648 Automatically kneed cross-staff beams cannot be used together with
1649 hidden staves.  See @ref{Hiding staves}.
1650
1651 Beams do not avoid collisions with symbols around the notes, such as
1652 texts and accidentals.
1653
1654 @c FIXME.
1655
1656
1657 @node Setting automatic beam behavior
1658 @subsection Setting automatic beam behavior 
1659
1660 @cindex @code{autoBeamSettings}
1661 @cindex @code{(end * * * *)}
1662 @cindex @code{(begin * * * *)}
1663 @cindex automatic beams, tuning
1664 @cindex tuning automatic beaming
1665
1666 @c [TODO: use \applycontext]
1667
1668 In normal time signatures, automatic beams can start on any note but can
1669 only end in a few positions within the measure: beams can end on a beat,
1670 or at durations specified by the properties in
1671 @code{autoBeamSettings}.  The defaults for @code{autoBeamSettings}
1672 are defined in @file{scm/auto-beam.scm}.
1673
1674 The value of @code{autoBeamSettings} is changed with two functions,
1675 @example
1676   #(override-auto-beam-setting
1677      '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
1678      [@var{context}])
1679   #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m}))
1680 @end example
1681 Here, @var{be} is the symbol @code{begin} or @code{end}, and
1682 @var{context} is an optional context (default: @code{'Voice}).  It
1683 determines whether the rule applies to begin or end-points.  The
1684 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
1685 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
1686 to a time signature (wildcards `@code{* *}' may be entered to
1687 designate all time signatures), @var{a}/@var{b} is a duration.  By
1688 default, this command changes settings for the current voice.  It is
1689 also possible to adjust settings at higher contexts, by adding a
1690 @var{context} argument.
1691
1692 For example, if automatic beams should end on every quarter note, use
1693 the following
1694 @example
1695    #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1696 @end example
1697 Since the duration of a quarter note is 1/4 of a whole note, it is
1698 entered as @code{(ly:make-moment 1 4)}.
1699
1700 The same syntax can be used to specify beam starting points.  In this
1701 example, automatic beams can only end on a dotted quarter note
1702 @example
1703    #(override-auto-beam-setting '(end * * * *) 3 8)
1704 @end example
1705 In 4/4 time signature, this means that automatic beams could end only on
1706 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1707 3/8, has passed within the measure).
1708
1709 Rules can also be restricted to specific time signatures.  A rule that
1710 should only be applied in @var{N}/@var{M} time signature is formed by
1711 replacing the second asterisks by @var{N} and @var{M}.  For example, a
1712 rule for 6/8 time exclusively looks like
1713 @example
1714  #(override-auto-beam-setting '(begin * * 6 8) @dots{})
1715 @end example
1716
1717 If a rule should be to applied only to certain types of beams, use the
1718 first pair of asterisks.  Beams are classified according to the
1719 shortest note they contain.  For a beam ending rule that only applies
1720 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
1721 *)}.
1722
1723 @cindex automatic beam generation
1724 @cindex autobeam
1725 @cindex @code{autoBeaming}
1726 @cindex lyrics
1727
1728 If beams are used to indicate melismata in songs, then automatic
1729 beaming should be switched off.  This is done by setting
1730 @code{autoBeaming} to @code{#f}.
1731
1732 @refcommands
1733
1734 @cindex @code{\autoBeamOff}
1735 @code{\autoBeamOff}, 
1736 @cindex @code{\autoBeamOn}
1737 @code{\autoBeamOn}.
1738
1739
1740 @refbugs
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.  The
1744 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
1745 >>}.  If a polyphonic voice ends while an automatic beam is still
1746 accepting notes, it is not typeset.
1747
1748 The rules for ending a beam depend on the shortest note in a beam.
1749 So, while it is possible to have different ending rules for eight
1750 beams and sixteenth beams, a beam that contains both eight and
1751 sixteenth notes will use the rules for the sixteenth beam.
1752
1753 In the example below, the autobeamer makes eighth beams and sixteenth
1754 end at three eighths.  The third beam can only be corrected by
1755 specifying manual beaming.
1756
1757 @lilypond[quote,raggedright,fragment,relative=1]
1758 #(override-auto-beam-setting '(end * * * *) 3 8)
1759 % rather show case where it goes wrong
1760 %\time 12/8 c'8 c c c16 c c c c c c[ c c c] c8[ c] c4
1761 \time 12/8 c'8 c c c16 c c c c c c c c c c8 c c4
1762 @end lilypond
1763 It is not possible to specify beaming parameters that act differently in
1764 different parts of a measure.  This means that it is not possible to use
1765 automatic beaming in irregular meters such as @code{5/8}.
1766
1767 @node Beam formatting
1768 @subsection Beam formatting
1769
1770
1771 When a beam falls in the middle of the staff, the beams point normally
1772 down.  However, this behaviour can be altered with the
1773 @code{neutral-direction} property.
1774
1775
1776 @lilypond
1777 \relative c'' {
1778    b8[ b]
1779   \override Beam  #'neutral-direction = #-1
1780    b[ b]
1781   \override Beam  #'neutral-direction = #1
1782    b[ b]
1783 }
1784 @end lilypond
1785
1786 @node Accidentals
1787 @section Accidentals
1788 @cindex Accidentals
1789
1790 This section describes how to change the way that accidentals are
1791 inserted automatically before the running notes.
1792
1793 Common rules for typesetting accidentals have been canned in a
1794 function.  This function is called as follows
1795
1796 @cindex @code{set-accidental-style}
1797 @example
1798   #(set-accidental-style 'modern 'Voice)
1799 @end example
1800
1801 The function takes two arguments: a symbol that denotes the style (in
1802 the example, @code{modern}), and another symbol that denotes the
1803 context name (in this example, @code{Voice}).  If no context name is
1804 supplied, @code{Staff} is the default.
1805
1806 The following styles are supported
1807 @table @code
1808 @item default
1809       This is the default typesetting behavior.  It should correspond
1810       to 18th century common practice: Accidentals are
1811       remembered to the end of the measure in which they occur and
1812       only on their own octave.
1813
1814 @item voice
1815 @c
1816       The normal behavior is to remember the accidentals on
1817 Staff-level.  This variable, however, typesets accidentals
1818 individually for each voice.  Apart from that, the rule is similar to
1819 @code{code}.
1820
1821       As a result,
1822        accidentals from one voice do not get canceled in other
1823       voices, which is often unwanted result
1824       @c
1825 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
1826 \context Staff <<
1827   #(set-accidental-style 'voice)
1828   <<
1829     { es g } \\
1830     { c, e }
1831 >> >>
1832 @end lilypond
1833 @c
1834       The @code{voice} option should be used if the voices
1835 are to be read solely by individual musicians.  If the staff is to be
1836 used by one musician (e.g. a conductor) then 
1837 @code{modern} or @code{modern-cautionary}
1838 should be used instead.
1839
1840 @item modern
1841 @cindex @code{modern} style accidentals
1842       This rule corresponds to the common practice in the 20th
1843       century.
1844       This rule prints the same accidentals as @code{default},  but temporary
1845       accidentals also are canceled in other octaves.  Furthermore,
1846       in the same octave, they also get canceled in the following
1847       measure
1848
1849 @lilypond[quote,raggedright,fragment,verbatim]
1850 #(set-accidental-style 'modern)
1851 cis' c'' cis'2 | c'' c'
1852 @end lilypond
1853
1854 @item @code{modern-cautionary}
1855       @cindex @code{modern-cautionary}
1856      This rule is similar to @code{modern}, but the
1857      ``extra'' accidentals (the ones not typeset by
1858      @code{default}) are typeset as cautionary accidentals.
1859      They are printed in reduced size or with parentheses
1860 @lilypond[quote,raggedright,fragment,verbatim]
1861 #(set-accidental-style 'modern-cautionary)
1862 cis' c'' cis'2 | c'' c'
1863 @end lilypond
1864
1865       @cindex @code{modern-voice}
1866 @item modern-voice
1867 This rule is used for multivoice accidentals to be read both by musicians
1868 playing one voice and musicians playing all voices.  Accidentals are
1869 typeset for each voice, but they @emph{are} canceled across voices in
1870 the same @internalsref{Staff}.
1871
1872       @cindex @code{modern-voice-cautionary}
1873 @item modern-voice-cautionary
1874 This rule is the same as @code{modern-voice}, but with the extra
1875 accidentals (the ones not typeset by @code{voice}) typeset
1876 as cautionaries.  Even though all accidentals typeset by
1877 @code{default} @emph{are} typeset by this variable then
1878 some of them are typeset as cautionaries.
1879
1880 @item piano
1881       @cindex @code{piano} accidentals
1882 This rule reflects      20th century practice for piano notation.  Very similar to
1883       @code{modern} but accidentals also get canceled
1884       across the staves in the same @internalsref{GrandStaff} or
1885       @internalsref{PianoStaff}.
1886
1887 @item piano-cautionary
1888       @cindex @code{#(set-accidental-style 'piano-cautionary)}
1889       As @code{#(set-accidental-style 'piano)} but with the extra accidentals
1890       typeset as cautionaries.
1891
1892 @item no-reset
1893       @cindex @code{no-reset} accidental style
1894       @c
1895       This is the same as @code{default} but with accidentals lasting
1896       ``forever'' and not only until the next measure
1897 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1898 #(set-accidental-style 'no-reset)
1899 c1 cis cis c
1900 @end lilypond
1901
1902 @item forget
1903       This is sort of the opposite of @code{no-reset}: Accidentals
1904       are not remembered at all---and hence all accidentals are
1905       typeset relative to the key signature, regardless of what was
1906       before in the music
1907       
1908 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1909 #(set-accidental-style 'forget)
1910 \key d\major c4 c cis cis d d dis dis
1911 @end lilypond
1912 @end table
1913
1914
1915 @seealso
1916
1917 Program reference: @internalsref{Accidental_engraver},
1918 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
1919
1920
1921 @refbugs
1922
1923 Simultaneous notes are considered to be entered in sequential
1924 mode.  This means that in a chord the accidentals are typeset as if the
1925 notes in the chord happened once at a time - in the order in which
1926 they appear in the input file.
1927
1928 This is a problem when accidentals in a chord depend on each other,
1929 which does not happen for the default accidental style.  The problem
1930 can be solved by manually inserting @code{!} and @code{?}  for the
1931 problematic notes.
1932
1933
1934 @node Expressive marks
1935 @section Expressive marks
1936
1937
1938 @c todo: should change ordering
1939 @c where to put text spanners, metronome marks,
1940 @c fingering?
1941  
1942 @menu
1943 * Slurs::                       
1944 * Phrasing slurs::              
1945 * Breath marks::                
1946 * Metronome marks::             
1947 * Text spanners::               
1948 * Analysis brackets::           
1949 * Articulations::               
1950 * Running trills::              
1951 * Fingering instructions::      
1952 * Text scripts::                
1953 * Grace notes::                 
1954 * Glissando::                   
1955 * Dynamics::                    
1956 @end menu
1957
1958 @node Slurs
1959 @subsection Slurs
1960 @cindex Slurs
1961
1962 A slur indicates that notes are to be played bound or @emph{legato}.
1963
1964 They are entered using parentheses
1965 @lilypond[quote,relative=2,fragment,verbatim]
1966 f( g a) a8 b( a4 g2 f4)
1967 <c e>2( <b d>2)
1968 @end lilypond
1969
1970 The direction of a slur can be set with the
1971 generic commands
1972
1973 @example
1974   \override Slur #'direction = #UP
1975   \slurUp     % shortcut for the previous line 
1976 @end example
1977
1978 @noindent
1979 However, there is a convenient shorthand for forcing slur
1980 directions.  By adding @code{_} or @code{^} before the opening
1981 parentheses, the direction is also set.  For example,  
1982
1983 @lilypond[relative=2,verbatim,fragment]
1984    c4_( c)   c^( c)
1985 @end lilypond
1986
1987 Some composers write two slurs when they want legato chords.  This can
1988 be achieved in LilyPond, by setting @code{doubleSlurs},
1989
1990 @lilypond[verbatim,raggedright]
1991 \relative {
1992     \set doubleSlurs = ##t
1993     <c e>4 ( <d f> <c e> <d f> )
1994 }
1995 @end lilypond  
1996
1997  
1998 @refcommands
1999
2000
2001 @cindex @code{\slurUp}
2002 @code{\slurUp}, 
2003 @cindex @code{\slurDown}
2004 @code{\slurDown}, 
2005 @cindex @code{\slurBoth}
2006 @code{\slurBoth}, 
2007 @cindex @code{\slurDotted}
2008 @code{\slurDotted}, 
2009 @cindex @code{\slurSolid}
2010 @code{\slurSolid}.
2011
2012 @seealso
2013
2014 Program reference: @seeinternals{Slur}, and @internalsref{SlurEvent}.
2015
2016
2017 @node Phrasing slurs
2018 @subsection Phrasing slurs
2019
2020 @cindex phrasing slurs
2021 @cindex phrasing marks
2022
2023 A phrasing slur (or phrasing mark) connects chords and is used to
2024 indicate a musical sentence.  It is started using @code{\(} and @code{\)}
2025 respectively
2026
2027 @lilypond[quote,fragment,verbatim,relative=1]
2028 \time 6/4 c'\( d( e) f( e)  d\) 
2029 @end lilypond
2030
2031 Typographically, the phrasing slur behaves almost exactly like a
2032 normal slur.  However, they are treated as different objects.  A
2033 @code{\slurUp} will have no effect on a phrasing slur; instead, use
2034 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
2035 @code{\phrasingSlurBoth}.
2036
2037 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth}
2038 will only affect normal slurs and not phrasing slurs.
2039
2040 @refcommands
2041
2042 @cindex @code{\phrasingSlurUp}
2043 @code{\phrasingSlurUp}, 
2044 @cindex @code{\phrasingSlurDown}
2045 @code{\phrasingSlurDown}, 
2046 @cindex @code{\phrasingSlurBoth}
2047 @code{\phrasingSlurBoth}.
2048
2049 @seealso
2050
2051 Program reference: see also @internalsref{PhrasingSlur}, and
2052 @internalsref{PhrasingSlurEvent}.
2053
2054 @refbugs
2055
2056 Putting phrasing slurs over rests leads to spurious warnings.
2057
2058 @node Breath marks
2059 @subsection Breath marks
2060
2061 Breath marks are entered using @code{\breathe}
2062
2063
2064 @lilypond[quote,fragment,relative=1,verbatim]
2065 c'4 \breathe d4
2066 @end lilypond
2067
2068 The glyph of the breath mark can be tuned by overriding the
2069 @code{text} property of the @code{BreathingSign} layout object with
2070 any markup text.   For example,
2071 @lilypond[quote,fragment,verbatim,relative=1]
2072 c'4
2073 \override BreathingSign #'text
2074   = #(make-musicglyph-markup "scripts-rvarcomma")
2075 \breathe
2076 d4
2077 @end lilypond
2078
2079 @seealso 
2080
2081 Program reference: @internalsref{BreathingSign},
2082 @internalsref{BreathingSignEvent}.
2083
2084 Examples: @inputfileref{input/regression,breathing-sign.ly}.
2085
2086
2087 @node Metronome marks
2088 @subsection Metronome marks
2089
2090 @cindex Tempo
2091 @cindex beats per minute
2092 @cindex metronome marking
2093
2094 Metronome settings can be entered as follows
2095 @example 
2096  i \tempo @var{duration} = @var{per-minute} 
2097 @end example
2098
2099 In the MIDI output, they are interpreted as a tempo change, and in the
2100 paper output, a metronome marking is printed
2101 @cindex @code{\tempo}
2102 @lilypond[quote,fragment,verbatim]
2103 \tempo 8.=120 c''1
2104 @end lilypond
2105
2106 @seealso
2107
2108 Program reference: @internalsref{MetronomeChangeEvent}.
2109   
2110
2111
2112 @node Text spanners
2113 @subsection Text spanners
2114 @cindex Text spanners
2115
2116 Some performance indications, e.g. @i{rallentando} or @i{accelerando},
2117 are written as texts, and extended over many measures with dotted
2118 lines.  Such texts are created using text spanners: attach
2119 @code{\startTextSpan} and @code{\stopTextSpan} to the start and ending
2120 note of the spanner.
2121
2122 The string to be printed, as well as the style, is set through object
2123 properties
2124
2125 @lilypond[quote,fragment,relative=1,verbatim]
2126 \relative c' {
2127   c1 
2128   \override TextSpanner #'direction = #-1
2129   \override TextSpanner #'edge-text = #'("rall " . "")
2130   c2\startTextSpan b c\stopTextSpan a
2131 }
2132 @end lilypond
2133
2134
2135 @seealso
2136
2137 Internals @internalsref{TextSpanEvent},
2138 @internalsref{TextSpanner}.
2139
2140 Examples: @inputfileref{input/regression,text-spanner.ly}.
2141
2142
2143 @node Analysis brackets
2144 @subsection Analysis brackets
2145 @cindex brackets
2146 @cindex phrasing brackets
2147 @cindex musicological analysis
2148 @cindex note grouping bracket
2149
2150 Brackets are used in musical analysis to indicate structure in musical
2151 pieces.  LilyPond supports a simple form of nested horizontal brackets.
2152 To use this, add the @internalsref{Horizontal_bracket_engraver} to
2153 @internalsref{Staff} context.  A bracket is started with
2154 @code{\startGroup} and closed with @code{\stopGroup}
2155
2156 @lilypond[quote,raggedright,verbatim]
2157 \score {
2158   \relative c'' {  
2159     c4\startGroup\startGroup
2160     c4\stopGroup
2161     c4\startGroup
2162     c4\stopGroup\stopGroup
2163   }
2164   \paper {
2165     \context {
2166       \Staff \consists "Horizontal_bracket_engraver"
2167 }}}
2168 @end lilypond
2169
2170 @seealso
2171
2172 Program reference: @internalsref{HorizontalBracket},
2173 @internalsref{NoteGroupingEvent}.
2174
2175 Examples: @inputfileref{input/regression,note-group-bracket.ly}. 
2176
2177
2178 @node Articulations
2179 @subsection Articulations
2180 @cindex Articulations
2181
2182 @cindex articulations
2183 @cindex scripts
2184 @cindex ornaments
2185
2186 A variety of symbols can appear above and below notes to indicate
2187 different characteristics of the performance.  They are added to a note
2188 by adding a dash and the character signifying the
2189 articulation.  They are demonstrated here
2190
2191 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
2192
2193 The meanings of these shorthands can be changed.  See
2194 @file{ly/script-init.ly} for examples.
2195
2196
2197 The script is automatically placed, but the direction can be forced as
2198 well.  @code{_} will put them down, and @code{^} will put them up,
2199
2200
2201 @lilypond[quote,fragment,verbatim]
2202 c''4^^ c''4_^
2203 @end lilypond
2204
2205 Other symbols can be added using the syntax
2206 @var{note}@code{\}@var{name}, e.g. @code{c4\fermata}.  Again, they
2207 can be forced up or down using @code{^} and @code{_},
2208 e.g.
2209
2210 @lilypond[quote,verbatim,fragment,relative=2]
2211 c\fermata c^\fermata c_\fermata
2212 @end lilypond
2213
2214
2215
2216 @cindex accent
2217 @cindex marcato
2218 @cindex staccatissimo
2219 @cindex fermata
2220 @cindex stopped
2221 @cindex staccato
2222 @cindex portato
2223 @cindex tenuto
2224 @cindex upbow
2225 @cindex downbow
2226 @cindex foot marks
2227 @cindex organ pedal marks
2228 @cindex turn
2229 @cindex open
2230 @cindex flageolet
2231 @cindex reverseturn
2232 @cindex trill
2233 @cindex prall
2234 @cindex mordent
2235 @cindex prallprall
2236 @cindex prallmordent
2237 @cindex prall, up
2238 @cindex prall, down
2239 @cindex mordent
2240 @cindex thumb marking
2241 @cindex segno
2242 @cindex coda
2243 @cindex varcoda
2244
2245 Here is a chart showing all scripts available,
2246
2247 @lilypondfile[quote]{script-chart.ly}
2248
2249
2250 The vertical ordering of scripts is controlled with the
2251 @code{script-priority} property.  The lower this number, the closer it
2252 will be put to the note.  In this example, the
2253 @internalsref{TextScript} (the sharp symbol) first has the lowest
2254 priority, so it is put lowest in the first example.  In the second, the
2255 prall trill (the @internalsref{Script}) has the lowest, so it on the
2256 inside.  When two objects have the same priority, the order in which
2257 they are entered decides which one comes first.
2258
2259
2260 @lilypond[verbatim,raggedright]
2261 \relative g''{
2262     \once \override TextScript #'script-priority = #-100
2263     a4^\prall^\markup { \sharp }
2264     
2265     \once \override Script  #'script-priority = #-100
2266     a4^\prall^\markup { \sharp }
2267 }
2268 @end lilypond
2269
2270
2271
2272
2273 @seealso
2274
2275 Program reference: @internalsref{ScriptEvent}, and @internalsref{Script}.
2276
2277 @refbugs
2278
2279 These signs appear in the printed output but have no effect on the
2280 MIDI rendering of the music.
2281
2282
2283
2284 @node  Running trills
2285 @subsection Running trills
2286
2287 Long running trills are made with @code{\startTrillSpan} and
2288 @code{\stopTrillSpan},
2289
2290
2291 @lilypond[verbatim,raggedright]
2292 \relative \new Voice {
2293     << { c1 \startTrillSpan }
2294        { s2. \grace { d16[\stopTrillSpan e] } } >>
2295     c4 }
2296 @end lilypond
2297
2298 @refcommands
2299
2300 @code{\startTrillSpan},
2301 @cindex @code{\startTrillSpan}
2302 @code{\stopTrillSpan}.
2303 @cindex @code{\stopTrillSpan}
2304
2305 @seealso
2306
2307 Program reference: @internalsref{TrillSpanner},
2308 @internalsref{TrillSpanEvent}.
2309
2310 @node Fingering instructions
2311 @subsection Fingering instructions
2312
2313 @cindex fingering
2314
2315 Fingering instructions can be entered using
2316 @example
2317   @var{note}-@var{digit}
2318 @end example
2319 For finger changes, use markup texts
2320 @c
2321 @lilypond[quote,verbatim,raggedright,fragment]
2322 c'4-1 c'4-2 c'4-3 c'4-4
2323 c'^\markup { \finger "2-3" }
2324 @end lilypond
2325
2326 @cindex finger change
2327 @cindex scripts
2328 @cindex superscript
2329 @cindex subscript
2330
2331 You can use the thumb-script to indicate that a note should be
2332 played with the thumb (e.g. in cello music)
2333
2334 @lilypond[quote,verbatim,raggedright,fragment]
2335 <a'_\thumb a''-3>8 <b'_\thumb b''-3>
2336 @end lilypond
2337
2338 Fingerings for chords can also be added to individual notes
2339 of the chord by adding them after the pitches
2340 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2341 < c-1 e-2 g-3 b-5 >4
2342 @end lilypond
2343
2344 @noindent
2345 In this case, setting @code{fingeringOrientations} will put fingerings next
2346 to note heads
2347
2348 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2349 \set fingeringOrientations = #'(left down)
2350 <c-1 es-2 g-4 bes-5 > 4
2351 \set fingeringOrientations = #'(up right down)
2352 <c-1 es-2 g-4 bes-5 > 4
2353 @end lilypond
2354
2355 Using this feature, it is also possible to put fingering instructions
2356 very close to note heads in monophonic music,
2357
2358 @lilypond[verbatim,raggedright]
2359 {
2360   \set fingeringOrientations = #'(right)
2361   <es'-2>4
2362 }
2363 @end lilypond
2364
2365         
2366 @seealso
2367
2368 Program reference: @internalsref{FingerEvent}, and @internalsref{Fingering}.
2369
2370 Examples: @inputfileref{input/regression,finger-chords.ly}.
2371
2372 @node Text scripts
2373 @subsection Text scripts
2374 @cindex Text scripts
2375
2376 @cindex text items, non-empty
2377 @cindex non-empty texts
2378
2379 It is possible to place arbitrary strings of text or markup text (see
2380 @ref{Text markup}) above or below notes by using a string
2381 @code{c^"text"}.  By default, these indications do not influence the
2382 note spacing, but by using the command @code{\fatText}, the widths
2383 will be taken into account
2384 @c
2385 @lilypond[quote,fragment,raggedright,verbatim]
2386 \relative c' {
2387   c4^"longtext" \fatText c4_"longlongtext" c4
2388 }
2389 @end lilypond
2390
2391 More complex formatting may also be added to a note by using the
2392 markup command,
2393 @lilypond[fragment,raggedright,verbatim]
2394 {
2395   c'4^\markup { bla \bold bla }
2396 }
2397 @end lilypond
2398
2399 The @code{\markup} is described in more detail in
2400 @ref{Text markup}.
2401  
2402
2403 @refcommands
2404
2405 @cindex @code{\fatText}
2406 @code{\fatText}, 
2407 @cindex @code{\emptyText}
2408 @code{\emptyText}.
2409
2410 @seealso
2411
2412 In this manual: @ref{Text markup}.
2413
2414 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
2415
2416
2417
2418
2419 @node Grace notes
2420 @subsection Grace notes
2421
2422
2423 @c should have blurb about accaciatura / appogiatura
2424
2425 @cindex @code{\grace}
2426 @cindex ornaments
2427 @cindex grace notes
2428
2429 Grace notes are ornaments that are written out.  The most common ones
2430 are acciaccatura, which should be played as very short.  It is denoted
2431 by a slurred small note with a slashed stem.  The appoggiatura is a
2432 grace note that takes a fixed fraction of the main note, is and
2433 denoted as a slurred note in small print without a slash.
2434 They are entered with the commands @code{\acciaccatura} and
2435 @code{\appoggiatura}, as demonstrated in the following example
2436
2437
2438 @cindex appoggiatura
2439 @cindex acciaccatura
2440
2441 @lilypond[quote,relative=2,verbatim,fragment]
2442 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2443 \acciaccatura { g16[ f] } e4
2444 @end lilypond
2445
2446 Both are special forms of the @code{\grace} command.  By prefixing this
2447 keyword to a music expression, a new one is formed, which will be
2448 printed in a smaller font and takes up no logical time in a measure.
2449
2450 @lilypond[quote,relative=2,verbatim,fragment]
2451 c4 \grace c16 c4
2452 \grace { c16[ d16] } c2 c4
2453 @end lilypond
2454
2455 @noindent
2456 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2457 @code{\grace} command does not start a slur.
2458
2459 Internally, timing for grace notes is done using a second, `grace'
2460 time.  Every point in time consists of two rational numbers: one
2461 denotes the logical time, one denotes the grace timing.  The above
2462 example is shown here with timing tuples
2463
2464 @lilypond[quote,raggedright]
2465 <<
2466   \relative c''{ 
2467     c4 \grace c16  c4  \grace {
2468     c16[  d16] } c2 c4
2469   }
2470   \new Lyrics \lyrics {
2471     \override LyricText #'font-family = #'typewriter
2472     
2473     \markup { (0,0) } 4
2474     \grace { \markup {
2475       ( \fraction 1 4 ,  \fraction -1 16 ) } 16 }
2476     \markup { (\fraction 1 4 , 0 ) } 4
2477     \grace {
2478       \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2479       \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2480     } 
2481     \markup { ( \fraction 2 4 , 0 ) }
2482   }
2483 >>
2484 @end lilypond
2485
2486
2487 The placement of grace notes is synchronized between different staves.
2488 In the following example, there are two sixteenth graces notes for
2489 every eighth grace note
2490
2491 @lilypond[quote,relative=2,verbatim,fragment] 
2492 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2493    \new Staff { c4 \grace { g8[ b] } c4 } >>
2494 @end lilypond
2495
2496
2497
2498 If you want to end a note with a grace, the standard trick is to put
2499 the grace notes after a ``space note''
2500
2501 @lilypond[quote,fragment,verbatim,relative=2]
2502 \context Voice {
2503   << { d1^\trill_( }
2504      { s2 \grace { c16[ d] } } >>
2505   c4)
2506 }
2507 @end lilypond
2508
2509 @noindent
2510 By adjusting the duration of the skip note (here it is a half-note),
2511 the space between the main-note and the grace is adjusted.
2512
2513
2514 A @code{\grace} section will introduce special typesetting settings,
2515 for example, to produce smaller type, and set directions.  Hence, when
2516 introducing layout tweaks, they should be inside the grace section,
2517 for example,
2518 @lilypond[quote,fragment,verbatim,relative=2]
2519 \new Voice {
2520   \acciaccatura {
2521     \override Stem #'direction = #-1
2522     f16->
2523     \revert Stem #'direction
2524   }
2525   g4
2526 }
2527 @end lilypond
2528
2529 @noindent
2530 The overrides should also be reverted inside the grace section.
2531
2532 The layout of grace sections can be changed throughout the music using
2533 the function @code{add-grace-property}.  The following example
2534 undefines the Stem direction for this grace, so stems do not always
2535 point up.
2536
2537 @example
2538 \new Staff @{
2539    #(add-grace-property 'Voice 'Stem 'direction '())
2540    @dots{}
2541 @}
2542 @end example
2543
2544 @noindent
2545 Another option is to change the variables @code{startGraceMusic},
2546 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2547 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2548 @code{stopAppoggiaturaMusic}.  More information is in the file
2549 @file{ly/grace-init.ly}.
2550
2551
2552 @seealso
2553
2554 Program reference: @internalsref{GraceMusic}.
2555
2556 @refbugs
2557
2558 A score that starts with a @code{\grace} section needs an explicit
2559 @code{\context Voice} declaration, otherwise the main note and grace
2560 note end up on different staves.
2561
2562 Grace note synchronization can also lead to surprises.  Staff notation,
2563 such as key signatures, bar lines, etc. are also synchronized.  Take
2564 care when you mix staves with grace notes and staves without, for example,
2565
2566 @lilypond[quote,relative=2,verbatim,fragment]
2567 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2568    \new Staff { c4  \bar "|:"  d4 } >>
2569 @end lilypond
2570
2571 @noindent
2572 This can be remedied by inserting grace skips, for the above example
2573
2574 @example
2575 \new Staff @{ c4  \bar "|:"  \grace s16 d4 @} 
2576 @end example
2577
2578 Grace sections should only be used within sequential music
2579 expressions.  Nesting or juxtaposing grace sections is not supported,
2580 and might produce crashes or other errors.
2581
2582
2583 @node Glissando
2584 @subsection Glissando
2585 @cindex Glissando 
2586
2587 @cindex @code{\glissando}
2588
2589 A glissando is a smooth change in pitch.  It is denoted by a line or a
2590 wavy line between two notes.  It is requested by attaching 
2591 @code{\glissando} to a note
2592
2593 @lilypond[quote,fragment,relative=1,verbatim]
2594 c'\glissando c'
2595 @end lilypond
2596
2597 @seealso
2598
2599 Program reference: @internalsref{Glissando}, and @internalsref{GlissandoEvent}.
2600
2601 Example files: @file{input/regression,glissando.ly}
2602
2603  
2604
2605 @refbugs
2606
2607 Printing text over the line (such as @emph{gliss.}) is not supported.
2608
2609
2610 @node Dynamics
2611 @subsection Dynamics
2612 @cindex Dynamics
2613
2614
2615
2616 @cindex @code{\ppp}
2617 @cindex @code{\pp}
2618 @cindex @code{\p}
2619 @cindex @code{\mp}
2620 @cindex @code{\mf}
2621 @cindex @code{\f}
2622 @cindex @code{\ff}
2623 @cindex @code{\fff}
2624 @cindex @code{\ffff}
2625 @cindex @code{\fp}
2626 @cindex @code{\sf}
2627 @cindex @code{\sff}
2628 @cindex @code{\sp}
2629 @cindex @code{\spp}
2630 @cindex @code{\sfz}
2631 @cindex @code{\rfz}
2632
2633
2634 Absolute dynamic marks are specified using a command after a note
2635 @code{c4\ff}.  The available dynamic marks are @code{\ppp},
2636 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2637 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2638 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}
2639
2640 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2641 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2642 c2\sf c\rfz
2643 @end lilypond
2644
2645 @cindex @code{\<}
2646 @cindex @code{\>}
2647 @cindex @code{\"!}
2648
2649
2650
2651 A crescendo mark is started with @code{\<} and terminated with
2652 @code{\!}.  A decrescendo is started with @code{\>} and also terminated
2653 with @code{\!}.  Because these marks are bound to notes, if you must
2654 use spacer notes if multiple marks are needed during one note 
2655
2656 @lilypond[quote,fragment,verbatim]
2657 c''\< c''\! d''\> e''\! 
2658 << f''1 { s4 s4\< s4\! \> s4\! } >>
2659 @end lilypond
2660 This may give rise to very short hairpins.  Use @code{minimum-length}
2661 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2662 example
2663
2664 @example
2665  \override Staff.Hairpin #'minimum-length = #5
2666 @end example
2667
2668 You can also use a text saying @emph{cresc.} instead of hairpins.  Here
2669 is an example how to do it
2670
2671 @lilypond[quote,fragment,relative=2,verbatim]
2672 \setTextCresc
2673 c \< d e f\!
2674 \setHairpinCresc
2675 e\> d c b\!
2676 @end lilypond
2677
2678 @cindex crescendo
2679 @cindex decrescendo
2680
2681 You can also supply your own texts
2682 @lilypond[quote,fragment,relative=1,verbatim]
2683 \context Voice {
2684   \set crescendoText = \markup { \italic "cresc. poco" }
2685   \set crescendoSpanner = #'dashed-line
2686   a'2\< a a a\!\mf
2687 }
2688 @end lilypond
2689
2690 @cindex diminuendo
2691
2692
2693 @refcommands
2694
2695 @cindex @code{\dynamicUp}
2696 @code{\dynamicUp}, 
2697 @cindex @code{\dynamicDown}
2698 @code{\dynamicDown}, 
2699 @cindex @code{\dynamicBoth}
2700 @code{\dynamicBoth}.
2701
2702 @cindex direction, of dynamics
2703
2704 @seealso
2705
2706 Program reference: @internalsref{CrescendoEvent},
2707 @internalsref{DecrescendoEvent}, and
2708 @internalsref{AbsoluteDynamicEvent}.
2709
2710 Dynamics are @internalsref{DynamicText} and @internalsref{Hairpin}
2711 objects.  Vertical positioning of these symbols is handled by the
2712 @internalsref{DynamicLineSpanner} object.
2713
2714
2715 @node Repeats
2716 @section Repeats
2717
2718
2719 @cindex repeats
2720 @cindex @code{\repeat}
2721
2722
2723 Repetition is a central concept in music, and multiple notations exist
2724 for repetitions.  In LilyPond, most of these notations can be captured
2725 in a uniform syntax.  One of the advantages is that repeats entered in
2726 this way can be rendered in MIDI accurately.
2727
2728 The following types of repetition are supported
2729
2730 @table @code
2731 @item unfold
2732 Repeated music is fully written (played) out.  Useful for MIDI
2733 output, and entering repetitive music.
2734
2735 @item volta
2736 Repeats are not written out, but alternative endings (volte) are
2737 printed, left to right with brackets.  This is the standard notation
2738 for repeats with alternatives.
2739
2740 @ignore
2741 @item fold
2742 Alternative endings are written stacked.  This has limited use but may be
2743 used to typeset two lines of lyrics in songs with repeats, see
2744 @inputfileref{input,star-spangled-banner.ly}.
2745 @end ignore
2746
2747 @c tremolo, beamed
2748 @item tremolo
2749 Make tremolo beams.
2750
2751 @item percent
2752 Make beat or measure repeats.  These look like percent signs.
2753
2754 @end table  
2755
2756 @menu
2757 * Repeat syntax::               
2758 * Repeats and MIDI::            
2759 * Manual repeat commands::      
2760 * Tremolo repeats::             
2761 * Tremolo subdivisions::        
2762 * Measure repeats::             
2763 @end menu
2764
2765 @node Repeat syntax
2766 @subsection Repeat syntax
2767
2768
2769 LilyPond has one syntactic construct for specifying different types of
2770 repeats.  The syntax is
2771
2772 @example
2773   \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2774 @end example
2775
2776 If you have alternative endings, you may add
2777 @cindex @code{\alternative}
2778 @example
2779  \alternative @code{@{} @var{alternative1}
2780             @var{alternative2}
2781             @var{alternative3} @dots{} @code{@}}
2782 @end example
2783 where each @var{alternative} is a music expression.  If you do not
2784 give enough alternatives for all of the repeats, the first alternative
2785 is assumed to be played more than once.
2786
2787 Standard repeats are used like this
2788 @lilypond[quote,fragment,verbatim,relative=2]
2789 c1
2790 \repeat volta 2 { c4 d e f }
2791 \repeat volta 2 { f e d c }
2792 @end lilypond
2793
2794 With alternative endings
2795 @lilypond[quote,fragment,verbatim,relative=2]
2796 c1
2797 \repeat volta 2 {c4 d e f} 
2798 \alternative { {d2 d} {f f,} }
2799 @end lilypond
2800
2801
2802 @lilypond[quote,fragment,verbatim,relative=2]
2803 \context Staff {
2804   \partial 4
2805   \repeat volta 4 { e | c2 d2 | e2 f2 | }
2806   \alternative { { g4 g g } { a | a a a a | b2. } }
2807 }
2808 @end lilypond
2809
2810 It is possible to shorten volta brackets
2811 by setting @code{voltaSpannerDuration}.  In the next example, the
2812 bracket only lasts one measure, which is a duration of 3/4. 
2813
2814
2815
2816 @lilypond[verbatim,raggedright]
2817 \relative c''{
2818     \time 3/4
2819     c c c 
2820     \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2821     \repeat "volta" 5 { d d d  }
2822     \alternative { { e e e f f f }
2823     { g g g } }
2824 }
2825 @end lilypond
2826         
2827
2828 @seealso
2829
2830 Examples:
2831
2832 Brackets for the repeat are normally only printed over the topmost
2833 staff.  This can be adjusted by setting the @code{voltaOnThisStaff}
2834 property @inputfileref{input/regression,volta-multi-staff.ly},
2835 @inputfileref{input/regression,volta-chord-names.ly}
2836
2837
2838 @refbugs
2839
2840 A nested repeat like
2841
2842 @example 
2843 \repeat @dots{}
2844 \repeat @dots{}
2845 \alternative 
2846 @end example 
2847
2848 @noindent
2849 is ambiguous, since it is is not clear to which @code{\repeat} the
2850 @code{\alternative} belongs.  This ambiguity is resolved by always
2851 having the @code{\alternative} belong to the inner @code{\repeat}.
2852 For clarity, it is advisable to use braces in such situations.
2853 @cindex ambiguity
2854
2855
2856
2857 Timing information is not remembered at the start of an alternative,
2858 so after a repeat timing information must be reset by hand, for
2859 example by setting @code{Score.measurePosition} or entering
2860 @code{\partial}.  Similarly, slurs or ties are also not repeated.
2861
2862
2863
2864
2865 @node Repeats and MIDI
2866 @subsection Repeats and MIDI
2867
2868 @cindex expanding repeats
2869
2870 An advantage of the unified syntax for repeats, is that all repeats
2871 may be played out for the MIDI output.  This is achieved by
2872 applying the @code{\unfoldrepeats} music function.
2873
2874 @lilypond[verbatim,raggedright]
2875 \new Staff
2876   \unfoldrepeats {
2877     \repeat tremolo 8 {c'32 e' }
2878     \repeat percent 2 { c''8 d'' }
2879     \repeat volta 2 {c'4 d' e' f'} 
2880     \alternative {
2881       { g' a' a' g' }
2882       {f' e' d' c' }
2883     }
2884     \bar "|."
2885   }
2886 @end lilypond
2887
2888 When creating a score file using @code{\unfoldrepeats} for midi, then
2889 it is necessary to make two @code{\score} blocks.  One for MIDI, with
2890 unfolded repeats, and one for notation, eg.
2891
2892 @example
2893   \score @{
2894       @var{..music..}
2895       \paper @{ .. @}
2896   @} 
2897   \score @{
2898       \unfoldrepeats @var{..music..}
2899       \midi @{ .. @}
2900   @} 
2901 @end example
2902
2903 @node Manual repeat commands
2904 @subsection Manual repeat commands
2905
2906 @cindex @code{repeatCommands}
2907
2908 The property @code{repeatCommands} can be used to control the layout of
2909 repeats.  Its value is a Scheme list of repeat commands, where each repeat
2910 command can be
2911
2912 @table @asis
2913 @item @code{start-repeat},
2914   which prints a @code{|:} bar line;
2915 @item @code{end-repeat},
2916   which prints a @code{:|} bar line;
2917 @item @code{(volta @var{text})},
2918   which prints a volta bracket saying @var{text}: The text can be specified as
2919 a text string or as a markup text, see @ref{Text markup}.  Do not
2920 forget to change the font, as the default number font does not contain
2921 alphabetic characters;
2922 @item @code{(volta #f)}, which 
2923   stops a running volta bracket.
2924 @end table
2925
2926 @lilypond[quote,verbatim,fragment,relative=2]
2927 c4
2928   \set Score.repeatCommands = #'((volta "93") end-repeat)
2929 c4 c4
2930   \set Score.repeatCommands = #'((volta #f))
2931 c4 c4
2932 @end lilypond
2933
2934
2935
2936 @seealso
2937
2938 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2939 @internalsref{VoltaRepeatedMusic},
2940 @internalsref{UnfoldedRepeatedMusic}, and
2941 @internalsref{FoldedRepeatedMusic}.
2942
2943 @node Tremolo repeats
2944 @subsection Tremolo repeats
2945 @cindex tremolo beams
2946
2947 To place tremolo marks between notes, use @code{\repeat} with tremolo
2948 style
2949 @lilypond[quote,verbatim,raggedright]
2950   \context Voice \relative c' {
2951     \repeat "tremolo" 8 { c16 d16 }
2952     \repeat "tremolo" 4 { c16 d16 }    
2953     \repeat "tremolo" 2 { c16 d16 }
2954   }
2955 @end lilypond
2956
2957 Tremolo marks can also be put on a single note.  In this case, the
2958 note should not be surrounded by braces.
2959 @lilypond[quote,verbatim,raggedright]
2960 \repeat "tremolo" 4 c'16
2961 @end lilypond
2962
2963 Similar output is obtained using the tremolo subdivision, described in
2964 @ref{Tremolo subdivisions}.
2965
2966 @seealso
2967
2968 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2969
2970 Program reference: tremolo beams are @internalsref{Beam} objects.  Single stem
2971 tremolos are @internalsref{StemTremolo} objects.  The music expression is
2972 @internalsref{TremoloEvent}.
2973
2974 Example files: @inputfileref{input/regression,chord-tremolo.ly},
2975 @inputfileref{input/regression,stem-tremolo.ly}.
2976
2977 @node Tremolo subdivisions
2978 @subsection Tremolo subdivisions
2979 @cindex tremolo marks
2980 @cindex @code{tremoloFlags}
2981
2982 Tremolo marks can be printed on a single note by adding
2983 `@code{:}[@var{number}]' after the note.  The number indicates the
2984 duration of the subdivision, and it must be at least 8.  A
2985 @var{length} value of 8 gives one line across the note stem.  If the
2986 length is omitted, the last value (stored in @code{tremoloFlags}) is
2987 used
2988
2989 @lilypond[quote,verbatim,fragment]
2990 c'2:8 c':32 | c': c': |
2991 @end lilypond
2992
2993 @c [TODO : stok is te kort bij 32en]
2994
2995 @refbugs
2996
2997 Tremolos entered in this way do not carry over into the MIDI output.
2998
2999 @seealso
3000
3001 In this manual: @ref{Tremolo repeats}.
3002
3003 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
3004
3005 @node Measure repeats
3006 @subsection Measure repeats
3007
3008 @cindex percent repeats
3009 @cindex measure repeats
3010
3011 In the @code{percent} style, a note pattern can be repeated.  It is
3012 printed once, and then the pattern is replaced with a special sign.
3013 Patterns of one and two measures are replaced by percent-like signs,
3014 patterns that divide the measure length are replaced by slashes
3015
3016 @lilypond[quote,verbatim,raggedright]
3017 \new Voice {
3018   \repeat "percent" 4  { c'4 }
3019   \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
3020 }
3021 @end lilypond
3022
3023 @seealso
3024
3025 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
3026 @internalsref{PercentRepeatedMusic}, and
3027 @internalsref{DoublePercentRepeat}.
3028
3029
3030
3031 @node Rhythmic music
3032 @section Rhythmic music
3033
3034
3035 @menu
3036 * Showing melody rhythms::      
3037 * Entering percussion::         
3038 * Percussion staves::           
3039 @end menu
3040
3041
3042 @node Showing melody rhythms
3043 @subsection Showing melody rhythms
3044
3045 Sometimes you might want to show only the rhythm of a melody.  This
3046 can be done with the rhythmic staff.  All pitches of notes on such a
3047 staff are squashed, and the staff itself has a single line
3048
3049 @lilypond[quote,fragment,relative=1,verbatim]
3050 \context RhythmicStaff {
3051   \time 4/4
3052   c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
3053 }
3054 @end lilypond
3055
3056 @seealso
3057
3058 Program reference: @internalsref{RhythmicStaff}.
3059
3060 Examples: @inputfileref{input/regression,rhythmic-staff.ly}.
3061
3062
3063 @node Entering percussion
3064 @subsection Entering percussion
3065
3066 @cindex percussion
3067 @cindex drums
3068
3069
3070 Percussion notes may be entered in @code{\drums} mode, which is
3071 similar to the standard mode for entering notes.  Each piece of
3072 percussion has a full name and an abbreviated name, and both can be used
3073 in input files
3074
3075 @lilypond[quote,raggedright,verbatim]
3076 \new DrumStaff \drums {
3077   hihat hh bassdrum bd
3078 }
3079 @end lilypond
3080
3081 The complete list of drum names is in the init file
3082 @file{ly/drumpitch-init.ly}.
3083 @c TODO: properly document this.
3084
3085 @seealso
3086
3087 Program reference: @internalsref{DrumNoteEvent}.
3088
3089 @node Percussion staves
3090 @subsection Percussion staves
3091 @cindex percussion
3092 @cindex drums
3093
3094 A percussion part for more than one instrument typically uses a
3095 multi line staff where each position in the staff refers to one piece
3096 of percussion.
3097
3098
3099 To typeset the music, the notes must be interpreted in a
3100 @internalsref{DrumStaff} and @internalsref{DrumVoice} contexts
3101
3102 @c
3103 @lilypond[quote,raggedright,verbatim]
3104 up = \drums { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
3105 down = \drums { bassdrum4 snare8 bd r bd sn4 }
3106   \new DrumStaff <<
3107     \new DrumVoice { \voiceOne \up } 
3108     \new DrumVoice { \voiceTwo \down } 
3109   >>
3110 @end lilypond
3111
3112 The above example shows verbose polyphonic notation.  The short
3113 polyphonic notation, described in @ref{Polyphony}, can also be used if
3114 the @internalsref{DrumVoices} are instantiated by hand first.  For example, 
3115
3116 @lilypond[quote,fragment,verbatim] 
3117 \new DrumStaff <<
3118   \context DrumVoice = "1" {  s1 *2 }
3119   \context DrumVoice = "2" {  s1 *2 }
3120   \drums {
3121     bd4 sn4 bd4 sn4
3122     <<
3123       { \repeat unfold 16 hh16 }
3124       \\
3125       { bd4 sn4 bd4 sn4 }
3126     >>
3127   }   
3128 >>
3129 @end lilypond
3130
3131
3132 There are also other layout possibilities.  To use these, set the
3133 property @code{drumStyleTable} in context @internalsref{DrumVoice}.
3134 The following variables have been predefined
3135
3136 @table @code
3137 @item drums-style
3138 This is the default.  It typesets a typical drum kit on a five-line staff
3139
3140 @lilypond[quote,noindent]
3141 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
3142     bd sn ss tomh tommh tomml toml tomfh tomfl }
3143 mus = \drums  { cymc cyms cymr hh | hhc hho hhho hhp | \break cb hc
3144     bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
3145 \score {
3146     << \new DrumStaff\with {
3147             \remove Bar_engraver
3148             \remove Time_signature_engraver
3149             \override Stem #'transparent = ##t
3150             \override Stem #'Y-extent-callback = ##f
3151             minimumVerticalExtent = #'(-4.0 . 5.0)
3152     } \mus
3153         \context Lyrics \nam 
3154     >>
3155     \paper {
3156     %% need to do this, because of indented @itemize
3157     linewidth= 9 \cm 
3158     \context { \Score
3159     \override LyricText #'font-family = #'typewriter
3160     \override BarNumber #'transparent =##T
3161 }}}
3162 @end lilypond
3163
3164 The drum scheme supports six different toms.  When there fewer toms, simply
3165 select the toms that produce the desired result, i.e. to get toms on
3166 the three middle lines you use @code{tommh}, @code{tomml} and
3167 @code{tomfh}.
3168
3169 @item timbales-style
3170 This typesets timbales on a two line staff
3171
3172 @lilypond[quote,raggedright]
3173 nam = \lyrics { timh ssh timl ssl cb }
3174 mus = \drums  { timh ssh timl ssl cb s16 }
3175
3176 <<
3177         \context DrumStaff \with {
3178             \remove Bar_engraver
3179             \remove Time_signature_engraver
3180             \override Stem #'transparent = ##t
3181             \override Stem #'Y-extent-callback = ##f
3182             \override StaffSymbol #'line-count = #2
3183             \override StaffSymbol #'staff-space = #2
3184             minimumVerticalExtent = #'(-3.0 . 4.0)
3185             drumStyleTable = #timbales-style
3186         } \mus
3187         \context Lyrics {
3188             \override LyricText #'font-family = #'typewriter
3189
3190         \nam  }
3191 >>
3192 @end lilypond
3193 @item congas-style
3194 This typesets congas on a two line staff
3195
3196 @lilypond[quote,raggedright]
3197 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
3198 mus = \drums  { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
3199 <<
3200         \context DrumStaff\with {
3201             \remove Bar_engraver
3202             \remove Time_signature_engraver
3203             drumStyleTable = #congas-style
3204             \override StaffSymbol #'line-count = #2
3205             
3206             %% this sucks; it will lengthen stems.
3207             \override StaffSymbol #'staff-space = #2
3208             \override Stem #'transparent = ##t
3209             \override Stem #'Y-extent-callback = ##f
3210         } \mus
3211         \context Lyrics {
3212                     \override LyricText #'font-family = #'typewriter
3213 \nam  }
3214 >>
3215 @end lilypond
3216 @item bongos-style
3217 This typesets bongos on a two line staff
3218
3219 @lilypond[quote,raggedright]
3220 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
3221 mus = \drums  { boh boho bohm ssh bol bolo bolm ssl s16 }
3222 <<
3223         \context DrumStaff\with {
3224             \remove Bar_engraver
3225             \remove Time_signature_engraver
3226             \override StaffSymbol #'line-count = #2
3227             drumStyleTable = #bongos-style
3228            
3229             %% this sucks; it will lengthen stems.
3230             \override StaffSymbol #'staff-space = #2
3231             \override Stem #'transparent = ##t
3232             \override Stem #'Y-extent-callback = ##f
3233         } \mus
3234         \context Lyrics {
3235                     \override LyricText #'font-family = #'typewriter
3236 \nam  }
3237 >>
3238 @end lilypond
3239
3240 @item percussion-style
3241 to typeset all kinds of simple percussion on one line staves
3242 @lilypond[quote,raggedright]
3243 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
3244 mus = \drums  { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
3245 <<
3246         \context DrumStaff\with{
3247             \remove Bar_engraver
3248             drumStyleTable = #percussion-style
3249             \override StaffSymbol #'line-count = #1
3250             \remove Time_signature_engraver
3251             \override Stem #'transparent = ##t
3252             \override Stem #'Y-extent-callback = ##f
3253         } \mus
3254         \context Lyrics {
3255           \override LyricText #'font-family = #'typewriter
3256           \nam
3257         }
3258 >>
3259 @end lilypond
3260 @end table
3261
3262 If you do not like any of the predefined lists you can define your own
3263 list at the top of your file
3264
3265 @lilypond[quote,raggedright,verbatim]
3266 #(define mydrums '(
3267         (bassdrum     default   #f        -1)
3268         (snare        default   #f        0)
3269         (hihat        cross     #f        1)
3270         (pedalhihat   xcircle   "stopped" 2)
3271         (lowtom       diamond   #f       3)))
3272 up = \drums { hh8 hh hh hh hhp4 hhp }
3273 down = \drums { bd4 sn bd toml8 toml }
3274
3275 \new DrumStaff <<
3276     \set DrumStaff.drumStyleTable
3277        = #(alist->hash-table mydrums)
3278     \new DrumVoice { \voiceOne \up }
3279     \new DrumVoice { \voiceTwo \down }
3280 >>
3281 @end lilypond
3282
3283
3284 @seealso
3285
3286 Init files: @file{ly/drumpitch-init.ly}.
3287
3288 Program reference: @internalsref{DrumStaff}, @internalsref{DrumVoice}.
3289
3290 @refbugs
3291
3292 Because general MIDI does not contain rim shots, the sidestick is used
3293 for this purpose instead.
3294
3295 @node Piano music
3296 @section Piano music
3297
3298 Piano staves are two normal staves coupled with a brace.  The staves
3299 are largely independent, but sometimes voices can cross between the
3300 two staves.  The same notation is also used for harps and other key
3301 instruments.  The @internalsref{PianoStaff} is especially built to
3302 handle this cross-staffing behavior.  In this section we discuss the
3303 @internalsref{PianoStaff} and some other pianistic peculiarities.
3304
3305
3306 @menu
3307 * Automatic staff changes::     
3308 * Manual staff switches::       
3309 * Pedals::                      
3310 * Arpeggio::                    
3311 * Staff switch lines::          
3312 * Cross staff stems::           
3313 @end menu 
3314
3315 @refbugs
3316
3317 Dynamics are not centered, but workarounds do exist.  See
3318 @inputfileref{input/template,piano-dynamics.ly}.
3319
3320 @cindex cross staff stem
3321 @cindex stem, cross staff
3322 @cindex distance between staves in piano music
3323
3324 The distance between the two staves is the same for all systems in the
3325 score.  It is possible to override this per system, but it does require
3326 an arcane command incantation.  See
3327 @inputfileref{input/test,piano-staff-distance.ly}.
3328
3329
3330 @node Automatic staff changes
3331 @subsection Automatic staff changes
3332 @cindex Automatic staff changes
3333
3334 Voices can be made to switch automatically between the top and the bottom
3335 staff.  The syntax for this is
3336
3337 @quotation
3338 @example
3339   \autochange @dots{}@var{music}@dots{} 
3340 @end example
3341 @end quotation
3342
3343 @noindent
3344 This will create two staves inside the current PianoStaff, called
3345 @code{up} and @code{down}.  The lower staff will be in bass clef by
3346 default.
3347
3348 A @code{\relative} section that is outside of @code{\autochange} has
3349 no effect on the pitches of @var{music}, so, if necessary, put
3350 @code{\relative} inside @code{\autochange} like
3351
3352 @quotation
3353 @example
3354 \autochange \relative @dots{} @dots{}
3355 @end example
3356 @end quotation
3357
3358
3359 The autochanger switches on basis of pitch (middle C is the turning
3360 point), and it looks ahead skipping over rests to switch in
3361 advance.  Here is a practical example
3362         
3363 @lilypond[quote,verbatim,raggedright]
3364 \context PianoStaff
3365   \autochange \relative c'
3366   {
3367     g4 a b c d r4 a g
3368   }
3369 @end lilypond
3370
3371
3372 @seealso
3373
3374 In this manual: @ref{Manual staff switches}.
3375
3376 Program reference: @internalsref{AutoChangeMusic}.
3377
3378
3379
3380 @refbugs
3381
3382 The staff switches may not end up in optimal places.  For high
3383 quality output, staff switches should be specified manually.
3384
3385
3386 @code{\autochange} cannot be inside @code{\times}. 
3387
3388 Internally, the @code{\partcombine} interprets both arguments as
3389 @code{Voice}s named @code{one} and @code{two}, and then decides when
3390 the parts can be combined.  Consequently, if the arguments switch to
3391 differently named @internalsref{Voice} contexts, the events in those
3392 will be ignored.
3393
3394
3395 @node Manual staff switches
3396 @subsection Manual staff switches
3397
3398 @cindex manual staff switches
3399 @cindex staff switch, manual
3400
3401 Voices can be switched between staves manually, using the command
3402 @example
3403 \change Staff = @var{staffname} @var{music}
3404 @end example
3405
3406 @noindent
3407 The string @var{staffname} is the name of the staff.  It switches the
3408 current voice from its current staff to the Staff called
3409 @var{staffname}.  Typically @var{staffname} is @code{"up"} or
3410 @code{"down"}.  The @context{Staff} referred to must already exist, so
3411 usually the setup for a score will start with a setup of the staves,
3412
3413 @example
3414   <<
3415   \context Staff = up @{
3416     \skip 1 * 10  %@emph{ keep staff alive}
3417     @}
3418   \context Staff = down @{
3419     \skip 1 * 10  %@emph{idem}
3420     @}
3421   >>
3422 @end example 
3423
3424
3425 and the @context{Voice} is inserted afterwards
3426
3427 @example
3428   \context Staff = down
3429     \new Voice @{ @dots{} \change Staff = up @dots{} @}
3430 @end example
3431
3432
3433 @node Pedals
3434 @subsection Pedals
3435 @cindex Pedals
3436
3437 Pianos have pedals that alter the way sound is produced.  Generally, a
3438 piano has three pedals, sustain, una corda, and sostenuto.
3439
3440
3441 Piano pedal instruction can be expressed by attaching
3442 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
3443 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
3444 note or chord
3445
3446 @lilypond[quote,fragment,verbatim]
3447 c'4\sustainDown c'4\sustainUp
3448 @end lilypond
3449
3450 What is printed can be modified by setting @code{pedal@var{X}Strings},
3451 where @var{X} is one of the pedal types: @code{Sustain},
3452 @code{Sostenuto} or @code{UnaCorda}.  Refer to
3453 @internalsref{SustainPedal} in the program reference for more
3454 information.
3455
3456 Pedals can also be indicated by a sequence of brackets, by setting the
3457 @code{pedalSustainStyle} property to bracket objects
3458
3459 @lilypond[quote,fragment,verbatim,relative=2]
3460 \set Staff.pedalSustainStyle = #'bracket
3461 c\sustainDown d e
3462 b\sustainUp\sustainDown
3463 b g \sustainUp a \sustainDown \bar "|."
3464 @end lilypond
3465
3466 A third style of pedal notation is a mixture of text and brackets,
3467 obtained by setting the @code{pedalSustainStyle} style property to
3468 @code{mixed}
3469
3470 @lilypond[quote,fragment,verbatim,relative=2]
3471 \set Staff.pedalSustainStyle = #'mixed
3472 c\sustainDown d e
3473 b\sustainUp\sustainDown
3474 b g \sustainUp a \sustainDown \bar "|."
3475 @end lilypond
3476
3477 The default `*Ped.' style for sustain and damper pedals corresponds to
3478 style @code{#'text}.  The sostenuto pedal uses @code{mixed} style by
3479 default.
3480
3481 @lilypond[quote,fragment,verbatim,relative=2]
3482 c\sostenutoDown d e c, f g a\sostenutoUp
3483 @end lilypond
3484
3485 For fine-tuning of the appearance of a pedal bracket, the properties
3486 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
3487 @code{PianoPedalBracket} objects (see
3488 @internalsref{PianoPedalBracket} in the Program reference)  can be modified.  For example, the
3489 bracket may be extended to the right edge of the note head
3490
3491 @lilypond[quote,fragment,verbatim,relative=2]
3492 \override Staff.PianoPedalBracket  
3493    #'shorten-pair = #'(0 . -1.0)
3494 c\sostenutoDown d e c, f g a\sostenutoUp
3495 @end lilypond
3496
3497 @node Arpeggio
3498 @subsection Arpeggio
3499 @cindex Arpeggio
3500
3501 @cindex broken arpeggio
3502 @cindex @code{\arpeggio}
3503
3504 You can specify an arpeggio sign on a chord by attaching an
3505 @code{\arpeggio} to a chord
3506
3507
3508 @lilypond[quote,fragment,relative=1,verbatim]
3509 <c e g c>\arpeggio
3510 @end lilypond
3511
3512 When an arpeggio crosses staves, you attach an arpeggio to the chords
3513 in both staves, and set
3514 @internalsref{PianoStaff}.@code{connectArpeggios}
3515
3516 @lilypond[quote,fragment,relative=1,verbatim]
3517 \context PianoStaff <<
3518   \set PianoStaff.connectArpeggios = ##t
3519   \new Staff  { <c' e g c>\arpeggio }
3520   \new Staff { \clef bass  <c,, e g>\arpeggio }
3521 >>
3522 @end lilypond
3523
3524 The direction of the arpeggio is sometimes denoted by adding an
3525 arrowhead to the wiggly line
3526
3527 @lilypond[quote,fragment,relative=1,verbatim]
3528 \context Voice {
3529   \arpeggioUp
3530   <c e g c>\arpeggio
3531   \arpeggioDown
3532   <c e g c>\arpeggio
3533 }
3534 @end lilypond
3535
3536 A square bracket on the left indicates that the player should not
3537 arpeggiate the chord
3538
3539 @c todo: ugh, lousy typography.  Look for real example. --hwn
3540
3541 @lilypond[quote,fragment,relative=1,verbatim]
3542 \arpeggioBracket
3543 <c' e g c>\arpeggio
3544 @end lilypond
3545
3546 @refcommands
3547
3548 @cindex @code{\arpeggio}
3549 @code{\arpeggio},
3550 @cindex @code{\arpeggioUp}
3551 @code{\arpeggioUp},
3552 @cindex @code{\arpeggioDown}
3553 @code{\arpeggioDown},
3554 @cindex @code{\arpeggioBoth}
3555 @code{\arpeggioBoth},
3556 @cindex @code{\arpeggioBracket}
3557 @code{\arpeggioBracket}.
3558
3559 @seealso
3560
3561 Program reference: @internalsref{ArpeggioEvent},
3562 @internalsref{Arpeggio}.
3563
3564 @refbugs
3565
3566 It is not possible to mix connected arpeggios and unconnected
3567 arpeggios in one @internalsref{PianoStaff} at the same point in time.
3568
3569 @node Staff switch lines
3570 @subsection Staff switch lines
3571
3572
3573 @cindex follow voice
3574 @cindex staff switching
3575 @cindex cross staff
3576
3577 @cindex @code{followVoice}
3578
3579 Whenever a voice switches to another staff a line connecting the notes
3580 can be printed automatically.  This is switched on by setting
3581 @code{PianoStaff.followVoice} to true
3582
3583 @lilypond[quote,fragment,relative=1,verbatim]
3584 \context PianoStaff <<
3585   \set PianoStaff.followVoice = ##t
3586   \context Staff \context Voice {
3587     c1
3588     \change Staff=two
3589     b2 a
3590   }
3591  \context Staff=two { \clef bass \skip 1*2 }
3592 >>  
3593 @end lilypond
3594
3595 @seealso
3596
3597 Program reference: @internalsref{VoiceFollower}.
3598
3599 @refcommands
3600
3601 @cindex @code{\showStaffSwitch}
3602 @code{\showStaffSwitch}, 
3603 @cindex @code{\hideStaffSwitch}
3604 @code{\hideStaffSwitch}.
3605
3606
3607 @node Cross staff stems
3608 @subsection Cross staff stems
3609
3610 The chords which cross staves may be produced by increasing the length
3611 of the stem in the lower stave, so it reaches the stem in the upper
3612 stave, or vice versa.
3613
3614 @lilypond[raggedright,verbatim]
3615 stemExtend = \once \override Stem  #'length = #22
3616 noFlag = \once \override Stem  #'flag-style = #'no-flag
3617 \context PianoStaff <<
3618   \new Staff   {
3619     \stemDown \stemExtend
3620     f'4
3621     \stemExtend \noFlag
3622     f'8
3623   }
3624   \new Staff {
3625     \clef bass
3626     a4 a8
3627   }
3628 >>
3629 @end lilypond
3630
3631
3632 @node Vocal music
3633 @section Vocal music
3634
3635 There are three different issues when printing vocal music
3636
3637 @itemize @bullet
3638 @item
3639   Song texts must be entered as texts, not notes.  For example, for 
3640 lyrics, the input @code{a} should be interpreted as
3641 a one letter text, and not the note A.
3642 @item
3643   Song texts must be printed as text, and not as notes. 
3644 @item
3645   Song texts must be aligned with the notes of their melody
3646 @end itemize
3647
3648 The simplest solution to printing music uses the @code{\addlyrics}
3649 function to deal with these three problems in one go.  However, these
3650 three functions can be controlled separately, which is necessary
3651 for complex vocal music. 
3652
3653
3654 @menu
3655 * Setting simple songs::        
3656 * Entering lyrics::             
3657 * Hyphens and extenders::       
3658 * The Lyrics context::          
3659 * Flexibility in alignment::    
3660 * More stanzas::                
3661 * Ambitus::                     
3662 @end menu
3663
3664 @node Setting simple songs
3665 @subsection Setting simple songs
3666
3667 The easiest way to add lyrics to a melody is to append
3668 @cindex \addlyrics
3669 @example
3670   \addlyrics @{ @var{the lyrics} @} 
3671 @end example
3672
3673 @noindent
3674 to a melody.  Here is an example,
3675
3676 @lilypond[raggedright,verbatim]
3677 {
3678     \time 3/4 
3679     \relative { c2 e4 g2. }
3680     \addlyrics { play the game }
3681 }
3682 @end lilypond
3683
3684 More stanzas can be added by adding more
3685 @code{\addlyrics} sections 
3686
3687 @lilypond[raggedright,verbatim]
3688 {
3689   \time 3/4
3690   \relative {  c2 e4 g2. }
3691   \addlyrics { play the game } 
3692   \addlyrics { speel het spel } 
3693   \addlyrics { joue le jeu }
3694 }
3695 @end lilypond
3696
3697 @node Entering lyrics
3698 @subsection Entering lyrics
3699
3700
3701 @cindex lyrics
3702 @cindex @code{\lyrics}
3703 @cindex punctuation
3704
3705 Lyrics are entered in a special input mode.  This mode is is introduced
3706 by the keyword @code{\lyrics}.  In this mode you can enter lyrics,
3707 with punctuation and accents, and the input @code{a} is not parsed as
3708 a pitch, but rather as a one letter syllable.  Syllables are entered
3709 like notes, but with pitches replaced by text.  For example,
3710 @example
3711   \lyrics @{ Twin-4 kle4 twin- kle litt- le star2 @}
3712 @end example
3713
3714
3715 A word lyrics mode begins with an alphabetic character, and ends with
3716 any space or digit.  The following characters can be any character
3717 that is not a digit or white space.  One important consequence of this
3718 is that a word can end with @code{@}}.  The following example is
3719 usually a bug.  The syllable includes a @code{@}}, so the
3720 opening brace is not balanced
3721 @example
3722   \lyrics @{ twinkle@}
3723 @end example
3724
3725 @cindex @code{\property}, in @code{\lyrics}
3726 @noindent
3727 Similarly, a period following an alphabetic sequence, is included in
3728 the resulting string.  As a consequence, spaces must be inserted around
3729 property commands
3730 @example
3731   \override Score . LyricText #'font-shape = #'italic
3732 @end example
3733
3734 @cindex @code{_}
3735 @cindex spaces, in lyrics
3736 @cindex quotes, in lyrics
3737
3738 Any @code{_} character which appears in an unquoted word is converted
3739 to a space.  This provides a mechanism for introducing spaces into words
3740 without using quotes.  Quoted words can also be used in Lyrics mode to
3741 specify words that cannot be written with the above rules.  The
3742 following example incorporates double quotes
3743
3744 @example
3745   \lyrics @{ He said: "\"Let" my peo ple "go\"" @}
3746 @end example
3747
3748 This example is slightly academic, since it gives better looking
3749 results to use single quotes, @code{``} and @code{''}
3750 @example
3751   \lyrics @{ He said: ``Let my peo ple go'' @}
3752 @end example
3753
3754
3755 The full definition of a word start in Lyrics mode is somewhat more
3756 complex.
3757
3758 A word in Lyrics mode begins with: an alphabetic character, @code{_},
3759 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
3760 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
3761 any 8-bit character with ASCII code over 127, or a two-character
3762 combination of a backslash followed by one of @code{`}, @code{'},
3763 @code{"}, or @code{^}.
3764
3765
3766
3767 @seealso
3768
3769 Program reference: events @internalsref{LyricEvent}, and
3770 @internalsref{LyricText}.
3771
3772 @refbugs
3773
3774 The definition of lyrics mode is too complex.
3775
3776 @node Hyphens and extenders
3777 @subsection Hyphens and extenders
3778
3779 @cindex hyphens
3780
3781 Centered hyphens are entered as `@code{-}@code{-}' between syllables.
3782 The hyphen will have variable length depending on the space between
3783 the syllables and it will be centered between the syllables.
3784
3785 @cindex melisma
3786 @cindex extender
3787
3788 When a lyric is sung over many notes (this is called a melisma), this is
3789 indicated with a horizontal line centered between a syllable and the
3790 next one.  Such a line is called an extender line, and it is entered as
3791 @code{__}.
3792
3793
3794 @seealso
3795
3796 Program reference: @internalsref{HyphenEvent}, 
3797 @internalsref{ExtenderEvent}, @internalsref{LyricHyphen}, and
3798 @internalsref{LyricExtender}
3799
3800 Examples: @inputfileref{input/test,lyric-hyphen-retain.ly}.
3801
3802
3803
3804 @node The Lyrics context
3805 @subsection  The Lyrics context
3806
3807
3808 Lyrics are printed by interpreting them in a @internalsref{Lyrics} context
3809 @example
3810  \context Lyrics \lyrics @dots{}
3811 @end example
3812
3813 @cindex automatic syllable durations
3814 @cindex @code{\lyricsto}
3815 @cindex lyrics and melodies
3816
3817 This will place the lyrics according to the durations that were
3818 entered.  The lyrics can also be aligned under a given melody
3819 automatically.  In this case, it is no longer necessary to enter the
3820 correct duration for each syllable.  This is achieved by combining the
3821 melody and the lyrics with the @code{\lyricsto} expression
3822 @example
3823 \lyricsto @var{name} \new Lyrics @dots{} 
3824 @end example
3825
3826 This aligns the lyrics to the
3827 @c
3828 notes of the @internalsref{Voice} context called @var{name}, which has
3829 to exist.  Therefore, normally the @code{Voice} is specified first, and
3830 then the lyrics are specified with @code{\lyricsto}.  The command
3831 @code{\lyricsto} switches to @code{\lyrics} mode automatically, so the
3832 @code{\lyrics} keyword may be omitted.
3833
3834 For different or more complex orderings, the best way is to setup the
3835 hierarchy of staves and lyrics first, e.g.
3836 @example
3837 \context ChoirStaff  <<
3838   \context Lyrics = sopranoLyrics @{ s1 @}
3839   \context Voice = soprano @{ @emph{music} @}
3840   \context Lyrics = tenorLyrics @{ s1 @}
3841   \context Voice = tenor @{ @emph{music} @}
3842 >>
3843 @end example
3844 and then combine the appropriate melodies and lyric lines
3845 @example
3846   \lyricsto "soprano" \context Lyrics = sopranoLyrics
3847      @emph{the lyrics}
3848 @end example
3849
3850 @noindent
3851 The final input would resemble
3852
3853 @example
3854   << \context ChoirStaff  << @emph{setup the music}  >>
3855      \lyricsto "soprano" @emph{etc}
3856      \lyricsto "alto" @emph{etc}
3857      @emph{etc}
3858   >>
3859 @end example 
3860
3861
3862 The @code{\lyricsto} command detects melismata: it only puts one
3863 syllable under a tied or slurred group of notes.  If you want to force
3864 an unslurred group of notes to be a melisma, insert @code{\melisma}
3865 after the first note of the group, and @code{\melismaEnd} after the
3866 last one, e.g.
3867
3868 @lilypond[quote,relative=2,raggedright,fragment,verbatim]
3869 <<
3870   \context Voice = "lala" {
3871     \time 3/4
3872     f4 g8
3873     \melisma 
3874     f e f
3875     \melismaEnd
3876     e2
3877   }
3878   \lyricsto "lala" \new Lyrics {
3879     la di __ daah 
3880   }
3881 >>
3882 @end lilypond
3883
3884 In addition, notes are considered a melisma if they are manually
3885 beamed, and automatic beaming (see @ref{Setting automatic beam
3886 behavior}) is switched off.
3887
3888 @ignore
3889
3890 @c nonformation:
3891
3892 The criteria for deciding melismata can
3893 be tuned with the property @code{melismaBusyProperties}.  See
3894 @internalsref{Melisma_translator} in the program reference for more
3895 information.
3896
3897 @end ignore
3898
3899 Lyrics can also be entered without @code{\lyricsto}.  In this case the
3900 durations of each syllable must be entered explicitly, for example,
3901
3902 @verbatim
3903   play2 the4 game2.
3904   sink2 or4 swim2.  
3905 @end verbatim
3906
3907 The alignment to a melody can be specified with the
3908 @code{associatedVoice} property,
3909
3910 @verbatim
3911   \set associatedVoice = #"lala"
3912 @end verbatim 
3913
3914 @noindent
3915 The value of the property (here: @code{"lala"}) should be the name of
3916 a @internalsref{Voice} context.  Without this setting, extender lines
3917 will not be formatted properly.
3918
3919 Here is an example demonstrating manual lyric durations,
3920
3921 @lilypond[relative=1,verbatim,fragment]
3922 << \context Voice = melody {
3923      \time 3/4
3924      c2 e4 g2.
3925   } 
3926   \new Lyrics \lyrics {
3927     \set associatedVoice = #"melody"
3928     play2 the4 game2.
3929   }  >>
3930 @end lilypond
3931
3932 @cindex SATB
3933 @cindex choral score
3934
3935 A complete example of a SATB score setup is in the file
3936 @inputfileref{input/template,satb.ly}.
3937
3938
3939 @refcommands
3940
3941 @code{\melisma}, @code{\melismaEnd}
3942 @cindex @code{\melismaEnd}
3943 @cindex @code{\melisma}
3944
3945 @seealso
3946
3947 Program reference: @internalsref{LyricCombineMusic},
3948 @internalsref{Lyrics}, @internalsref{Melisma_translator}.
3949
3950 Examples: @inputfileref{input/template,satb.ly},
3951 @inputfileref{input/regression,lyric-combine-new.ly},
3952 @c TODO: make separate section for melismata 
3953 @inputfileref{input/test,lyrics-melisma-variants.ly}.
3954 @inputfileref{input/test,lyrics-melisma-faster.ly}.
3955  
3956 @refbugs
3957
3958 Melismata are not detected automatically, and extender lines must be
3959 inserted by hand.
3960
3961
3962 @c TODO: document \new Staff << Voice \lyricsto >> bug
3963
3964 @node Flexibility in alignment
3965 @subsection Flexibility in alignment
3966
3967
3968 Often, different stanzas of one song are put to one melody in slightly
3969 differing ways.  Such variations can still be captured with
3970 @code{\lyricsto}.
3971
3972 One possibility is that the text has a melisma in one stanza, but
3973 multiple syllables in another one.  One solution is to make the faster
3974 voice ignore the melisma.  This is done by setting
3975 @code{ignoreMelismata} in the Lyrics context.
3976
3977 There has one tricky aspect.  The setting for @code{ignoreMelismata}
3978 must be set one syllable @emph{before} the non-melismatic syllable
3979 in the text, as shown here,
3980
3981 @lilypond[verbatim,raggedright]
3982 <<
3983     \relative \context Voice = "lahlah" {
3984         \set Staff.autoBeaming = ##f 
3985         c4
3986         \slurDotted
3987         f8.[( g16])
3988         a4
3989     }
3990     \new Lyrics \lyricsto "lahlah" {
3991         more slow -- ly
3992     }
3993     \new Lyrics \lyricsto "lahlah" {
3994         \set ignoreMelismata = ##t % applies to "fas"
3995         go fas -- ter
3996         \unset ignoreMelismata
3997         still
3998     }
3999 >>
4000 @end lilypond
4001
4002
4003 The @code{ignoreMelismata} applies to the syllable ``fas'', so it
4004 should bev entered before ``go''.
4005
4006 The reverse is also possible: making a lyric line slower than the
4007 standard.  This can be achieved by insert @code{\skip}s into the
4008 lyrics.  For every @code{\skip}, the text will be delayed another note.
4009 For example,
4010
4011 @lilypond[verbatim,raggedright]
4012 \relative { c c g' }
4013 \addlyrics {
4014   twin -- \skip 4
4015   kle
4016 }
4017 @end lilypond
4018
4019 More complex variations in text underlay are possible.  It is possible
4020 to switch the melody for a line of lyrics during the text.  This is
4021 done by setting the @code{associatedVoice} property.  In the example 
4022
4023 @lilypond[raggedright]
4024 <<
4025     \relative \context Voice = "lahlah" {
4026         \set Staff.autoBeaming = ##f 
4027         c4
4028         <<
4029             \context Voice = alternative {
4030                 \voiceOne
4031                 \times 2/3 {
4032
4033                     % show associations clearly.
4034                     \override NoteColumn #'force-hshift = #-3
4035                     f8 f g
4036                 }
4037             }
4038             {
4039                 \voiceTwo
4040                 f8.[ g16]
4041                 \oneVoice
4042           } >>
4043         a8( b) c
4044
4045     }
4046     \new Lyrics \lyricsto "lahlah" {
4047         Ju -- ras -- sic Park
4048     }
4049     \new Lyrics \lyricsto "lahlah" {
4050
4051         % Tricky: need to set associatedVoice
4052         % one syllable too soon! 
4053         \set associatedVoice = alternative % applies to "ran"
4054         Ty --
4055         ran  --
4056         no --
4057         \set associatedVoice = lahlah % applies to "rus"
4058         sau -- rus Rex
4059     } >>
4060 @end lilypond
4061
4062 @noindent
4063 the text for the first stanza is set to a melody called ``lahlah'',
4064
4065 @verbatim
4066     \new Lyrics \lyricsto "lahlah" {
4067         Ju -- ras -- sic Park
4068     }
4069 @end verbatim 
4070
4071
4072 The second stanza initially is set to the @code{lahlah} context, but
4073 for the syllable ``ran'', it switches to a different melody.
4074 This is achieved with
4075 @example
4076         \set associatedVoice = alternative
4077 @end example
4078
4079 @noindent
4080 Here, @code{alternative} is the name of the @code{Voice} context
4081 containing the triplet.
4082
4083 Again, the command must be one syllable too early, before ``Ty'' in
4084 this case.
4085
4086 @verbatim
4087     \new Lyrics \lyricsto "lahlah" {
4088         \set associatedVoice = alternative % applies to "ran"
4089         Ty --
4090         ran  --
4091         no --
4092         \set associatedVoice = lahlah % applies to "rus"
4093         sau -- rus Rex
4094     }
4095 @end verbatim 
4096
4097 @noindent
4098 The underlay is switched back to the starting situation by assigning
4099 @code{lahlah} to @code{associatedVoice}.
4100
4101
4102
4103
4104 @node More stanzas
4105 @subsection More stanzas
4106
4107 @cindex phrasing, in lyrics
4108
4109
4110 @cindex stanza number
4111 @cindex singer's names
4112 @cindex name of singer 
4113
4114 Stanza numbers can be added by setting @code{stanza}, e.g.
4115
4116 @lilypond[quote,verbatim,relative=2,fragment]
4117 \new Voice {
4118     \time 3/4 g2 e4 a2 f4 g2.
4119 } \addlyrics {
4120      \set stanza = "1. "
4121      Hi, my name is Bert.
4122 } \addlyrics {
4123      \set stanza = "2. "
4124      Oh, che -- ri, je t'aime
4125 }
4126 @end lilypond
4127
4128 These numbers are put just before the start of first syllable.
4129
4130 Names of singers can also be added.  They are printed at the start of
4131 the line, just like instrument names.  They are created by setting
4132 @code{vocalName}.  A short version may be entered as @code{vocNam}.
4133
4134
4135 @lilypond[fragment,quote,verbatim,relative=2]
4136 \new Voice {
4137     \time 3/4 g2 e4 a2 f4 g2.
4138 } \addlyrics {
4139      \set vocalName = "Bert "
4140      Hi, my name is Bert.
4141 } \addlyrics {
4142      \set vocalName = "Ernie "
4143      Oh, che -- ri, je t'aime
4144 }
4145 @end lilypond
4146
4147 @seealso
4148
4149 Program reference: Layout objects @internalsref{LyricText} and
4150 @internalsref{VocalName}.  Music expressions
4151 @internalsref{LyricEvent}.
4152
4153
4154
4155 @node Ambitus
4156 @subsection Ambitus
4157 @cindex ambitus
4158
4159 The term @emph{ambitus} denotes a range of pitches for a given voice
4160 in a part of music.  It also may denote the pitch range that a musical
4161 instrument is capable of playing.  Ambits are printed on vocal parts,
4162 so performers can easily determine it meets their capabilities.
4163
4164 It denoted at the beginning of a piece near the initial clef.  The
4165 range is graphically specified by two note heads, that represent the
4166 minimum and maximum pitch.  To print such ambits, add the
4167 @internalsref{Ambitus_engraver} to the @internalsref{Voice} context,
4168 for example,
4169
4170 @example
4171   \paper @{
4172     \context @{
4173       \Voice
4174       \consists Ambitus_engraver
4175     @}
4176   @}
4177 @end example
4178
4179 This results in the following output
4180
4181 @lilypond[quote,raggedright]
4182   \paper {
4183     \context {
4184       \Staff
4185       \consists Ambitus_engraver
4186     }
4187   }
4188
4189   \relative \new Staff {
4190     as'' c e2 cis,2
4191   }
4192 @end lilypond
4193
4194 If you have multiple voices in a single staff, and you want a single
4195 ambitus per staff rather than per each voice, add the
4196 @internalsref{Ambitus_engraver} to the @internalsref{Staff} context
4197 rather than to the @internalsref{Voice} context.  Here is an example,
4198
4199 @lilypond[verbatim,raggedright] 
4200 \new Staff <<
4201     \new Voice \with {
4202         \consists "Ambitus_engraver"
4203     } \relative c'' {
4204         \override Ambitus #'X-offset-callbacks
4205         =  #(list (lambda (grob axis) -1.0))
4206         \voiceOne
4207         c4 a d e f2
4208     }
4209     \new Voice \with {
4210         \consists "Ambitus_engraver"
4211     } \relative c' {
4212         \voiceTwo
4213         es4 f g as b2
4214     }
4215 >>
4216 @end lilypond
4217
4218 @noindent
4219 This example uses one advanced feature,
4220
4221 @example
4222         \override Ambitus #'X-offset-callbacks
4223         =  #(list (lambda (grob axis) -1.0))
4224 @end example
4225
4226 @noindent
4227 This code moves the ambitus to the left.  The same effect could have
4228 been achieved with @code{extra-offset}, but then the formatting system
4229 would not reserve space for the moved object. 
4230
4231 @seealso
4232
4233 Program reference: @internalsref{Ambitus},
4234 @internalsref{AmbitusLine}, @internalsref{AmbitusNoteHead},
4235 @internalsref{AmbitusAccidental}.
4236
4237 Examples:  @inputfileref{input/regression,ambitus.ly}.
4238
4239 @refbugs
4240
4241 There is no collision handling in the case of multiple per-voice
4242 ambitus.
4243
4244 @node Other instrument specific notation, Tablatures, Vocal music, Notation manual
4245 @section Other instrument specific notation
4246
4247 @menu
4248 * Harmonic notes::              
4249 @end menu
4250
4251 @node Harmonic notes,  , Other instrument specific notation, Other instrument specific notation
4252 @subsection Harmonic notes
4253
4254 @cindex artificial harmonics
4255 @cindex harmonics
4256
4257 Artificial harmonics are notated with a different notehead style.  They
4258 are entered by 
4259 marking the harmonic pitch with @code{\harmonic}.
4260
4261 @lilypond[raggedright,verbatim]
4262 {
4263  <c' g'\harmonic>4
4264 }
4265 @end lilypond
4266
4267
4268 @node Tablatures, Popular music, Other instrument specific notation, Notation manual
4269 @section Tablatures
4270
4271 @cindex tablature
4272 @cindex guitar tablature
4273
4274 Tablature notation is used for notating music for plucked string
4275 instruments.  Pitches are not denoted with note heads, but by
4276 indicating on which string and fret a note must be played.  LilyPond
4277 offers limited support for tablature.
4278
4279 @menu
4280 * Tablatures basic::            
4281 * Non-guitar tablatures::       
4282 @end menu
4283
4284 @node Tablatures basic, Non-guitar tablatures, Tablatures, Tablatures
4285 @subsection Tablatures basic
4286 @cindex Tablatures basic
4287
4288 The string number associated to a note is given as a backslash
4289 followed by a number, e.g. @code{c4\3} for a C quarter on the third
4290 string.  By default, string 1 is the highest one, and the tuning
4291 defaults to the standard guitar tuning (with 6 strings).  The notes
4292 are printed as tablature, by using @internalsref{TabStaff} and
4293 @internalsref{TabVoice} contexts
4294
4295 @lilypond[quote,fragment,verbatim]
4296  \context TabStaff {
4297   a,4\5 c'\2 a\3 e'\1
4298   e\4 c'\2 a\3 e'\1
4299 }
4300 @end lilypond
4301
4302 @cindex @code{minimumFret}
4303 @cindex fret
4304
4305 When no string is specified, the first string that does not give a
4306 fret number less than @code{minimumFret} is selected.  The default
4307 value for @code{minimumFret} is 0
4308
4309
4310 @example
4311 e16 fis gis a b4
4312 \set TabStaff.minimumFret = #8
4313 e16 fis gis a b4
4314 @end example
4315 @lilypond[quote,noindent,raggedright]
4316 frag =  {
4317   \key e \major
4318   e16 fis gis a b4
4319   \set TabStaff.minimumFret = #8
4320   e16 fis gis a b4
4321 }
4322   \context StaffGroup <<
4323     \context Staff { \clef "G_8" \frag }
4324     \context TabStaff { \frag }
4325   >>
4326 @end lilypond
4327
4328 @seealso
4329
4330 Program reference: @internalsref{TabStaff}, @internalsref{TabVoice}, and
4331 @internalsref{StringNumberEvent}.
4332
4333 @refbugs
4334
4335 Chords are not handled in a special way, and hence the automatic
4336 string selector may easily select the same string to two notes in a
4337 chord.
4338
4339
4340 @node Non-guitar tablatures,  , Tablatures basic, Tablatures
4341 @subsection Non-guitar tablatures
4342 @cindex Non-guitar tablatures
4343
4344 You can change the number of strings, by setting the number of lines
4345 in the @internalsref{TabStaff}. 
4346
4347 You can change the tuning of the strings.  A string tuning is given as
4348 a Scheme list with one integer number for each string, the number
4349 being the pitch (measured in semitones relative to middle C) of an
4350 open string.  The numbers specified for @code{stringTuning} are the
4351 numbers of semitones to subtract or add, starting the specified pitch
4352 by default middle C, in string order.  In the next example,
4353 @code{stringTunings} is set for the pitches e, a, d, and g
4354
4355 @lilypond[quote,fragment,verbatim]
4356   \context TabStaff <<
4357     \set TabStaff.stringTunings = #'(-5 -10 -15 -20)
4358     
4359      {
4360       a,4 c' a e' e c' a e'
4361     }
4362   >> 
4363 @end lilypond
4364
4365 @refbugs
4366
4367 No guitar special effects have been implemented.
4368
4369 @seealso
4370
4371 Program reference: @internalsref{Tab_note_heads_engraver}.
4372
4373
4374 @node Popular music, Orchestral music, Tablatures, Notation manual
4375 @section Popular music 
4376
4377
4378
4379 @menu
4380 * Chord names::                 
4381 * Chords mode::                 
4382 * Printing chord names::        
4383 * Improvisation::               
4384 @end menu
4385
4386 @node Chord names, Chords mode, Popular music, Popular music
4387 @subsection Chord names
4388 @cindex Chords
4389
4390 LilyPond has support for both printing chord names.  Chords may be
4391 entered in musical chord notation, i.e. @code{< .. >}, but they can
4392 also be entered by name.  Internally, the chords are represented as a
4393 set of pitches, so they can be transposed
4394
4395
4396 @lilypond[quote,verbatim,raggedright]
4397 twoWays = \transpose c c' {
4398   \chords {
4399     c1 f:sus4 bes/f
4400   }
4401   <c e g>
4402   <f bes c'>
4403   <f bes d'>
4404 }
4405
4406   << \context ChordNames \twoWays
4407      \context Voice \twoWays >> 
4408 @end lilypond
4409
4410 This example also shows that the chord printing routines do not try to
4411 be intelligent.  The last chord (@code{f bes d}) is not interpreted as
4412 an inversion.
4413
4414
4415 @menu
4416 * Chords mode::                 
4417 * Printing chord names::        
4418 @end menu
4419
4420
4421 @node Chords mode
4422 @subsection Chords mode
4423 @cindex Chords mode
4424
4425 In chord mode sets of pitches (chords) are entered with common names.
4426 A chord is entered by the root, which is entered like a common pitch
4427
4428 @lilypond[quote,fragment,verbatim,relative=2]
4429 \chords { es4. d8 c2 }
4430 @end lilypond
4431
4432 @noindent
4433 The mode is introduced by the keyword @code{\chords}.
4434
4435 @cindex chord entry
4436 @cindex chord mode
4437
4438 Other chords may be entered by suffixing a colon, and introducing a
4439 modifier, and optionally, a number
4440 @c
4441 @lilypond[quote,fragment,verbatim]
4442 \chords { e1:m e1:7 e1:m7  }
4443 @end lilypond
4444 The first number following the root is taken to be the `type' of the
4445 chord, thirds are added to the root until it reaches the specified
4446 number
4447 @lilypond[quote,fragment,verbatim]
4448 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
4449 @end lilypond
4450
4451 @cindex root of chord
4452 @cindex additions, in chords
4453 @cindex removals, in chords
4454
4455 More complex chords may also be constructed adding separate steps
4456 to a chord.  Additions are added after the number following
4457 the colon, and are separated by dots
4458 @c
4459 @lilypond[quote,verbatim,fragment]
4460 \chords { c:5.6 c:3.7.8 c:3.6.13 }
4461 @end lilypond
4462 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
4463 to the number
4464 @lilypond[quote,verbatim,fragment]
4465 \chords { c:7+ c:5+.3-  c:3-.5-.7- }
4466 @end lilypond
4467 Removals are specified similarly, and are introduced by a caret.  They
4468 must come after the additions
4469 @lilypond[quote,verbatim,fragment]
4470 \chords { c^3 c:7^5 c:9^3.5 }
4471 @end lilypond
4472
4473 Modifiers can be used to change pitches.  The following modifiers are
4474 supported
4475 @table @code
4476 @item m
4477   is the minor chord.  This modifier lowers the 3rd and (if present) the 7th step.
4478 @item dim
4479   is the diminished chord.  This modifier lowers the 3rd, 5th and (if present)
4480   the 7th step.
4481 @item aug
4482   is the augmented chord.  This modifier raises the 5th step.
4483 @item maj
4484   is the major 7th chord.  This modifier raises the 7th step if present.  
4485 @item sus
4486   is the suspended 4th or 2nd.  This modifier removes the 3rd
4487 step.  Append either @code{2} or @code{4} to add the 2nd or 4th step to
4488 the chord.
4489 @end table
4490 Modifiers can be mixed with additions
4491 @lilypond[quote,verbatim,fragment]
4492 \chords { c:sus4 c:7sus4 c:dim7 c:m6 } 
4493 @end lilypond
4494
4495 @cindex modifiers, in chords. 
4496 @cindex @code{aug}
4497 @cindex @code{dim}
4498 @cindex @code{maj}
4499 @cindex @code{sus}
4500 @cindex @code{m}
4501
4502 Since an unaltered 11 does not sound good when combined with an
4503 unaltered 3, the 11 is removed in this case (unless it is added
4504 explicitly)
4505 @c
4506 @lilypond[quote,fragment,verbatim]
4507 \chords { c:13 c:13.11 c:m13 }
4508 @end lilypond
4509
4510 @cindex @code{/}
4511
4512 An inversion (putting one pitch of the chord on the bottom), as well
4513 as bass notes, can be specified by appending
4514 @code{/}@var{pitch} to the chord
4515 @lilypond[quote,fragment,verbatim]
4516 \chords { c1 c/g c/f }
4517 @end lilypond
4518 @cindex @code{/+}
4519
4520 A bass note can be added instead of transposed out of the chord,
4521 by using  @code{/+}@var{pitch}.
4522
4523 @lilypond[quote,fragment,verbatim]
4524 \chords { c1 c/+g c/+f }
4525 @end lilypond
4526
4527 Chords is a mode similar to @code{\lyrics} etc.  Most
4528 of the commands continue to work, for example, @code{r} and
4529 @code{\skip} can be used to insert rests and spaces, and property
4530 commands may be used to change various settings.
4531
4532
4533
4534 @refbugs
4535
4536 Each step can only be present in a chord once.  The following
4537 simply produces the augmented chord, since @code{5+} is interpreted
4538 last
4539 @cindex clusters
4540 @lilypond[quote,verbatim,fragment]
4541 \chords { c:5.5-.5+ }
4542 @end lilypond
4543
4544
4545 @node Printing chord names
4546 @subsection Printing chord names
4547
4548 @cindex printing chord names
4549 @cindex chord names
4550 @cindex chords
4551
4552 For displaying printed chord names, use the @internalsref{ChordNames} context.
4553 The chords may be entered either using the notation
4554 described above, or directly using @code{<} and @code{>}
4555
4556 @lilypond[quote,verbatim,raggedright]
4557 scheme =  {
4558   \chords {a1 b c} <d' f' a'>  <e' g' b'>
4559 }
4560
4561  <<
4562     \context ChordNames \scheme
4563     \context Staff \scheme
4564 >>
4565 @end lilypond
4566
4567 You can make the chord changes stand out by setting
4568 @internalsref{ChordNames}.@code{chordChanges} to true.  This will only
4569 display chord names when there is a change in the chords scheme and at
4570 the start of a new line
4571
4572 @lilypond[quote,verbatim,linewidth=9\cm]
4573 scheme = \chords {
4574   c1:m c:m \break c:m c:m d
4575 }
4576  <<
4577     \context ChordNames {
4578       \set chordChanges = ##t
4579       \scheme }
4580     \context Staff \transpose c c' \scheme
4581 >>
4582 @end lilypond
4583
4584 The previous examples all show chords over a staff.  This is not
4585 necessary.  Chords may also be printed separately.  It may be necessary
4586 to add @internalsref{Volta_engraver} and @internalsref{Bar_engraver}
4587 for showing repeats.
4588
4589 @lilypond[raggedright,verbatim]
4590 \new ChordNames \with {
4591         \override BarLine #'bar-size = #4
4592         voltaOnThisStaff = ##t
4593         \consists Bar_engraver
4594         \consists "Volta_engraver"
4595
4596 \repeat volta 2 \chords {
4597         f1:maj f:7 bes:7
4598         c:maj  
4599 } \alternative {
4600   es e
4601 }
4602 @end lilypond
4603
4604
4605 The default chord name layout is a system for Jazz music, proposed by
4606 Klaus Ignatzek (see @ref{Literature list}).  It can be tuned through the
4607 following properties
4608
4609 @table @code
4610 @cindex @code{chordNameExceptions}
4611 @item chordNameExceptions
4612 This is a list that contains the chords that have special formatting.
4613 For an example of tuning this property, see
4614 @inputfileref{input/regression,chord-name-exceptions.ly}.
4615 @cindex exceptions, chord names.
4616
4617
4618 @cindex @code{majorSevenSymbol}
4619 @item majorSevenSymbol
4620 This property contains the markup object used for the 7th step, when
4621 it is major.  Predefined options are @code{whiteTriangleMarkup} and
4622 @code{blackTriangleMarkup}.  See
4623 @inputfileref{input/regression,chord-name-major7.ly} for an example.
4624
4625 @cindex @code{chordNameSeparator}
4626 @item chordNameSeparator
4627 Different parts of a chord name are normally separated by a
4628 slash.  By setting @code{chordNameSeparator}, you can specify other
4629 separators, e.g.
4630 @lilypond[quote,fragment,verbatim]
4631 \context ChordNames \chords {
4632   c:7sus4
4633   \set chordNameSeparator
4634     = \markup { \typewriter "|" }
4635   c:7sus4
4636 }
4637 @end lilypond
4638
4639 @cindex @code{chordRootNamer}
4640 @item chordRootNamer
4641 The root of a chord is usually printed as a letter with an optional
4642 alteration.  The transformation from pitch to letter is done by this
4643 function.  Special note names (for example, the German ``H'' for a
4644 B-chord) can be produced by storing a new function in this property.
4645
4646 @cindex @code{chordNoteNamer}
4647 @item chordNoteNamer
4648 The default is to print single pitch, e.g. the bass note, using the
4649 @code{chordRootNamer}.  The @code{chordNoteNamer} property can be set
4650 to a specialized function to change this behavior.  For example, the
4651 base can be printed in lower case.
4652
4653 @end table
4654
4655 The predefined variables @code{\germanChords},
4656 @code{\semiGermanChords} set these variables.  The effect is
4657 demonstrated here,
4658
4659 @lilypondfile[]{chord-names-german.ly}
4660
4661 There are also two other chord name schemes implemented: an alternate
4662 Jazz chord notation, and a systematic scheme called Banter chords.  The
4663 alternate jazz notation is also shown on the chart in @ref{Chord name
4664 chart}.  Turning on these styles is described in the input file
4665 @inputfileref{input/test,chord-names-jazz.ly}.
4666
4667 @cindex Banter
4668 @cindex jazz chords
4669 @cindex chords, jazz  
4670
4671
4672 @refcommands
4673
4674 @cindex @code{\germanChords}
4675 @code{\germanChords}, 
4676 @cindex @code{\semiGermanChords}
4677 @code{\semiGermanChords}.
4678
4679
4680
4681
4682 @seealso
4683
4684 Examples: @inputfileref{input/regression,chord-name-major7.ly},
4685 @inputfileref{input/regression,chord-name-exceptions.ly},
4686 @inputfileref{input/test,chord-names-jazz.ly},
4687 @inputfileref{input/test,chords-without-melody.ly}.
4688
4689
4690 Init files: @file{scm/chords-ignatzek.scm}, and @file{scm/chord-entry.scm}.
4691
4692
4693 @refbugs
4694
4695 Chord names are determined solely from the list of pitches.  Chord
4696 inversions are not identified, and neither are added bass notes.  This
4697 may result in strange chord names when chords are entered with the
4698 @code{< .. >} syntax.
4699
4700
4701 @node Improvisation
4702 @subsection Improvisation
4703
4704 Improvisation is sometimes denoted with slashed note heads.  Such note
4705 heads can be created by adding a @internalsref{Pitch_squash_engraver}
4706 to the @internalsref{Staff} or @internalsref{Voice} context.  Then, the
4707 following command
4708
4709 @example
4710     \set squashedPosition = #0
4711     \override NoteHead  #'style = #'slash
4712 @end example
4713
4714 @noindent
4715 switches on the slashes.
4716
4717 There are shortcuts @code{\improvisationOn} (and an accompanying
4718 @code{\improvisationOff}) for this command sequence.  They are used in
4719 the following example
4720
4721 @lilypond[verbatim,raggedright]
4722 \new Staff \with {
4723   \consists Pitch_squash_engraver
4724 } \transpose c c' {
4725   e8 e g a a16(bes)(a8) g \improvisationOn
4726   e8
4727   ~e2~e8 f4 fis8
4728   ~fis2 \improvisationOff a16(bes) a8 g e
4729 }
4730 @end lilypond
4731
4732
4733
4734 @node Orchestral music
4735 @section Orchestral music
4736
4737 @cindex  Writing parts
4738
4739 Orchestral music involves some special notation, both in the full
4740 score and the individual parts.  This section explains how to tackle
4741 some common problems in orchestral music.
4742
4743
4744
4745 @menu
4746 * System start delimiters::     
4747 * Aligning to cadenzas::        
4748 * Rehearsal marks::             
4749 * Bar numbers::                 
4750 * Instrument names::            
4751 * Transpose::                   
4752 * Instrument transpositions::   
4753 * Multi measure rests::         
4754 * Automatic part combining::    
4755 * Hiding staves::               
4756 * Different editions from one source::  
4757 * Quoting other voices::        
4758 @end menu
4759
4760 @node System start delimiters
4761 @subsection  System start delimiters
4762
4763 Polyphonic scores consist of many staves.  These staves can be
4764 constructed in three different ways
4765 @itemize @bullet
4766 @item The group is started with a brace at the left, and bar lines are
4767 connected.  This is done with the @internalsref{GrandStaff} context.
4768
4769 @lilypond[verbatim]
4770 \new GrandStaff
4771 \relative <<
4772   \new Staff { c1 c }
4773   \new Staff { c c }
4774 >>
4775 @end lilypond 
4776
4777
4778 @item The group is started with a bracket, and bar lines are connected.  This is done with the
4779 @internalsref{StaffGroup} context
4780
4781 @lilypond[verbatim]
4782 \new GrandStaff
4783 \relative <<
4784   \new Staff { c1 c }
4785   \new Staff { c c }
4786 >>
4787 @end lilypond 
4788
4789
4790 @item The group is started with a vertical line.  Bar lines are not
4791 connected.  This is the default for the score.
4792
4793 @lilypond[verbatim]
4794 \relative <<
4795   \new Staff { c1 c }
4796   \new Staff { c c }
4797 >>
4798 @end lilypond 
4799
4800 @end itemize
4801
4802 @cindex Staff, multiple
4803 @cindex bracket, vertical
4804 @cindex brace, vertical
4805 @cindex grand staff
4806 @cindex staff group
4807
4808
4809 @seealso
4810
4811 The bar lines at the start of each system are
4812 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
4813 @internalsref{SystemStartBracket}.  Only one of these types is created
4814 in every context, and that type is determined by the property
4815 @code{systemStartDelimiter}.
4816
4817 @node Aligning to cadenzas
4818 @subsection Aligning to cadenzas
4819
4820
4821 In an orchestral context, cadenzas present a special problem:
4822 when constructing a score that includes a cadenza, all other
4823 instruments should skip just as many notes as the length of the
4824 cadenza, otherwise they will start too soon or too late. 
4825
4826 A solution to this problem are the functions @code{mmrest-of-length}
4827 and @code{skip-of-length}.  These Scheme functions take a piece music
4828 as argument, and generate a @code{\skip} or multi rest, exactly as
4829 long as the piece.  The use of @code{mmrest-of-length} is demonstrated
4830 in the following example. 
4831
4832 @lilypond[verbatim,raggedright] 
4833 cadenza =  \relative c' {
4834     c4 d8 << { e f g } \\ { d4. } >>
4835     g4 f2 g4 g
4836 }
4837     
4838 \new GrandStaff <<
4839   \new Staff { \cadenza c'4 } 
4840   \new Staff {
4841     #(ly:export (mmrest-of-length cadenza))
4842     c'4
4843   }
4844 >>
4845 @end lilypond
4846
4847
4848
4849
4850
4851 @node Rehearsal marks
4852 @subsection Rehearsal marks
4853 @cindex Rehearsal marks
4854 @cindex mark
4855 @cindex @code{\mark}
4856
4857 To print a rehearsal mark, use the @code{\mark} command
4858
4859 @lilypond[quote,fragment,verbatim,relative=1]
4860 {
4861   c1 \mark \default
4862   c1 \mark \default
4863   c1 \mark #8 
4864   c1 \mark \default
4865   c1 \mark \default
4866 }
4867 @end lilypond
4868
4869 @noindent
4870 (The letter I is skipped in accordance with engraving traditions.)
4871
4872 @c FIXME - should make that tunable.
4873
4874 The mark is incremented automatically if you use @code{\mark
4875 \default}, but you can also use an integer argument to set the mark
4876 manually.  The value to use is stored in the property
4877 @code{rehearsalMark}.
4878
4879 The style is defined by the property @code{markFormatter}.  It is a
4880 function taking the current mark (an integer) and the current context
4881 as argument.  It should return a markup object.  In the following
4882 example, @code{markFormatter} is set to a canned procedure.  After a
4883 few measures, it is set to function that produces a boxed number. 
4884
4885 @lilypond[quote,verbatim,fragment,relative=2]
4886 \set Score.markFormatter = #format-mark-numbers 
4887 c1 \mark \default
4888 c1 \mark \default
4889 \set Score.markFormatter
4890    = #(lambda (mark context)
4891        (make-bold-markup
4892         (make-box-markup (number->string mark))))
4893 c1 \mark \default
4894 c1 \mark \default
4895 @end lilypond
4896
4897 The file @file{scm/translation-functions.scm} contains the definitions
4898 of @code{format-mark-numbers} (the default format) and
4899 @code{format-mark-letters}.  These can be used as inspiration for other
4900 formatting functions.
4901
4902
4903 @cindex coda on bar line
4904 @cindex segno on bar line
4905 @cindex fermata on bar line
4906 @cindex bar lines, symbols on
4907
4908 The @code{\mark} command can also be used to put signs like coda,
4909 segno and fermatas on a bar line.  Use @code{\markup} to
4910 to access the appropriate symbol
4911
4912 @lilypond[quote,fragment,verbatim,relative=2]
4913 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
4914 c1
4915 @end lilypond
4916
4917 In the case of a line break, marks must also be printed at the end of
4918 the line, and not at the beginning.  Use the following to force that
4919 behavior
4920 @example
4921 \override Score.RehearsalMark  
4922   #'break-visibility = #begin-of-line-invisible
4923 @end example
4924
4925 @cindex fermatas
4926 @cindex coda
4927 @cindex segno
4928 @cindex bar lines, putting symbols on 
4929
4930 @seealso
4931
4932 Program reference: @internalsref{MarkEvent}, @internalsref{RehearsalMark}.
4933
4934 Init files: @file{scm/translation-functions.scm} contains the
4935 definition of @code{format-mark-numbers} and
4936 @code{format-mark-letters}.  They can be used as inspiration for other
4937 formatting functions.
4938
4939 Examples: @inputfileref{input/regression,rehearsal-mark-letter.ly},
4940
4941 @inputfileref{input/regression,rehearsal-mark-number.ly}.
4942
4943
4944 @node Bar numbers
4945 @subsection Bar numbers
4946
4947
4948 @cindex bar numbers
4949 @cindex measure numbers
4950 @cindex @code{currentBarNumber}
4951
4952 Bar numbers are printed by default at the start of the line.  The
4953 number itself is stored in the @code{currentBarNumber} property, which
4954 is normally updated automatically for every measure.
4955
4956 Bar numbers can be typeset at regular intervals instead of at the
4957 beginning of each line.  This is illustrated in the following example,
4958 whose source is available as
4959 @inputfileref{input/test,bar-number-regular-interval.ly}
4960
4961 @lilypondfile[quote]{bar-number-regular-interval.ly}
4962
4963 @seealso
4964
4965 Program reference: @internalsref{BarNumber}.
4966
4967 Examples: @inputfileref{input/test,bar-number-every-five-reset.ly},
4968 and @inputfileref{input/test,bar-number-regular-interval.ly}.
4969
4970 @refbugs
4971
4972 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
4973 there is one at the top.  To solve this, the
4974 @code{padding} property of @internalsref{BarNumber} can be
4975 used to position the number correctly.
4976
4977 @node Instrument names
4978 @subsection Instrument names
4979
4980 In an orchestral score, instrument names are printed left side of the
4981 staves.
4982
4983 This can be achieved by setting @internalsref{Staff}.@code{instrument}
4984 and @internalsref{Staff}.@code{instr}.  This will print a string before
4985 the start of the staff.  For the first start, @code{instrument} is
4986 used, for the next ones @code{instr} is used.
4987
4988 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
4989 \set Staff.instrument = "Ploink "
4990 \set Staff.instr = "Plk "
4991 c1
4992 \break
4993 c''
4994 @end lilypond
4995
4996 You can also use markup texts to construct more complicated instrument
4997 names, for example
4998
4999 @lilypond[quote,fragment,verbatim,raggedright]
5000  {
5001   \set Staff.instrument = \markup {
5002     \column < "Clarinetti" { "in B"
5003       \smaller \flat } > }
5004    { c''1 }
5005 }
5006 @end lilypond
5007
5008 For longer instrument names, it may be useful to increase the
5009 @code{indent} setting in the @code{\paper} block.
5010
5011 @seealso
5012
5013 Program reference: @internalsref{InstrumentName}.
5014
5015 @refbugs
5016
5017 When you put a name on a grand staff or piano staff the width of the
5018 brace is not taken into account.  You must add extra spaces to the end of
5019 the name to avoid a collision.
5020
5021 @node Transpose
5022 @subsection Transpose
5023 @cindex Transpose
5024 @cindex transposition of pitches
5025 @cindex @code{\transpose}
5026
5027 A music expression can be transposed with @code{\transpose}.  The
5028 syntax is
5029 @example
5030 \transpose @var{from} @var{to} @var{musicexpr}
5031 @end example
5032
5033 This means that @var{musicexpr} is transposed by the interval between
5034 the pitches @var{from} and @var{to}: any note with pitch @code{from}
5035 is changed to @code{to}.
5036
5037
5038 For example, consider a piece written in the key of  D major.  If
5039 this piece is a little too low for its performer, it can be
5040 transposed up to E major with
5041 @example
5042 \transpose d e @dots{}
5043 @end example
5044
5045 Consider a part written for violin (a C instrument).  If
5046 this part is to be played on the A clarinet, the following
5047 transposition will produce the appropriate part
5048
5049 @example
5050 \transpose a c @dots{}
5051 @end example   
5052
5053 @code{\transpose} distinguishes between enharmonic pitches: both
5054 @code{\transpose c cis} or @code{\transpose c des} will transpose up
5055 half a tone.  The first version will print sharps and the second
5056 version will print flats
5057
5058 @lilypond[quote,raggedright,verbatim]
5059 mus = { \key d \major cis d fis g }
5060 \context Staff {
5061   \clef "F" \mus
5062   \clef "G"
5063   \transpose c g' \mus
5064   \transpose c f' \mus
5065 }
5066 @end lilypond
5067
5068
5069 @seealso
5070
5071 Program reference: @internalsref{TransposedMusic}, and
5072 @internalsref{UntransposableMusic}.
5073
5074 @refbugs
5075
5076 If you want to use both @code{\transpose} and @code{\relative},
5077 you must put @code{\transpose} outside of @code{\relative}, since
5078 @code{\relative} will have no effect music that appears inside a
5079 @code{\transpose}.
5080
5081 @node Instrument transpositions
5082 @subsection Instrument transpositions
5083
5084 The key of a transposing instrument can also be specified.  This
5085 applies to many wind instruments, for example, clarinets (B-flat, A and
5086 E-flat), horn (F) and trumpet (B-flat, C, D and E-flat).
5087
5088
5089 The transposition is entered after the keyword @code{\transposition}
5090
5091 @example
5092   \transposition bes   %%  B-flat clarinet
5093 @end example
5094
5095 This command sets the property @code{instrumentTransposition}.  The value of
5096 this property is used for MIDI output and quotations.  It does not
5097 affect how notes are printed in the current staff.
5098
5099 @cindex transposition, MIDI
5100 @cindex transposition, instrument
5101
5102
5103 @node Multi measure rests
5104 @subsection Multi measure rests
5105 @cindex multi measure rests
5106 @cindex Rests, multi measure
5107
5108 @cindex @code{R}
5109
5110 Multi measure rests are entered using `@code{R}'.  It is specifically
5111 meant for full bar rests and for entering parts: the rest can expand
5112 to fill a score with rests, or it can be printed as a single
5113 multimeasure rest.  This expansion is controlled by the property
5114 @code{Score.skipBars}.  If this is set to true, empty measures will not
5115 be expanded, and the appropriate number is added automatically
5116
5117 @lilypond[quote,fragment,verbatim]
5118  \time 4/4 r1 | R1 | R1*2
5119  \set Score.skipBars = ##t R1*17  R1*4
5120 @end lilypond
5121
5122 The @code{1} in @code{R1} is similar to the duration notation used for
5123 notes.  Hence, for time signatures other than 4/4, you must enter other
5124 durations.  This can be done with augmentation dots or fractions
5125
5126 @lilypond[quote,fragment,verbatim]
5127 \set Score.skipBars = ##t
5128 \time 3/4
5129 R2. | R2.*2
5130 \time 13/8
5131 R1*13/8
5132 R1*13/8*12 |
5133 \time 10/8 R4*5*4 |
5134 @end lilypond
5135
5136 An @code{R} spanning a single measure is printed as either a whole rest
5137 or a breve, centered in the measure regardless of the time signature.
5138
5139 @cindex text on multi-measure rest
5140 @cindex script on multi-measure rest
5141 @cindex fermata on multi-measure rest
5142
5143 Texts can be added to multi-measure rests by using the
5144 @var{note}-@code{markup} syntax (see @ref{Text markup}).  In this case, the number is
5145 replaced.  If you need both texts and the number, you must add the
5146 number by hand.  A variable (@code{\fermataMarkup}) is provided for
5147 adding fermatas
5148
5149
5150 @lilypond[quote,verbatim,fragment]
5151   \time 3/4
5152   R2._\markup { "Ad lib" }
5153   R2.^\fermataMarkup
5154 @end lilypond
5155
5156 If you want to have a text on the left end of a multi-measure rest,
5157 attach the text to a zero-length skip note, i.e.
5158
5159 @example
5160   s1*0^"Allegro"
5161   R1*4 
5162 @end example
5163
5164
5165 @cindex whole rests for a full measure 
5166
5167 @seealso
5168
5169 Program reference: @internalsref{MultiMeasureRestEvent},
5170 @internalsref{MultiMeasureTextEvent},
5171 @internalsref{MultiMeasureRestMusicGroup}, and
5172 @internalsref{MultiMeasureRest}.
5173
5174 The layout object @internalsref{MultiMeasureRestNumber} is for the
5175 default number, and @internalsref{MultiMeasureRestText} for user
5176 specified texts.
5177
5178 @refbugs
5179
5180 It is not possible to use fingerings (e.g. @code{R1-4}) to put numbers
5181 over multi-measure rests.
5182
5183 @cindex condensing rests
5184
5185 There is no way to automatically condense multiple rests into a single
5186 multimeasure rest.  Multi measure rests do not take part in rest
5187 collisions.
5188
5189 Be careful when entering multimeasure rests followed by whole
5190 notes.  The following will enter two notes lasting four measures each
5191 @example
5192  R1*4 cis cis 
5193 @end example
5194 When @code{skipBars} is set, the result will look OK, but the bar
5195 numbering will be off.
5196
5197 @node Automatic part combining
5198 @subsection Automatic part combining
5199 @cindex automatic part combining
5200 @cindex part combiner
5201
5202
5203 Automatic part combining is used to merge two parts of music onto a
5204 staff.  It is aimed at typesetting orchestral scores.  When the two
5205 parts are identical for a period of time, only one is shown.  In
5206 places where the two parts differ, they are typeset as separate
5207 voices, and stem directions are set automatically.  Also, solo and
5208 @emph{a due} parts are identified and can be marked.
5209
5210 The syntax for part combining is
5211
5212 @example
5213   \partcombine @var{musicexpr1} @var{musicexpr2}
5214 @end example
5215
5216
5217
5218 The following example demonstrates the basic functionality of the part
5219 combiner: putting parts on one staff, and setting stem directions and
5220 polyphony
5221
5222 @lilypond[quote,verbatim,raggedright,fragment]
5223 \new Staff \partcombine
5224   \relative g' { g g a( b) c c r r }
5225   \relative g' { g g r4 r e e g g }
5226 @end lilypond
5227
5228 The first @code{g} appears only once, although it was
5229 specified twice (once in each part).  Stem, slur and tie directions are
5230 set automatically, depending whether there is a solo or unisono.  The
5231 first part (with context called @code{one}) always gets up stems, and
5232 `solo', while the second (called @code{two}) always gets down stems and
5233 `Solo II'.
5234
5235 If you just want the merging parts, and not the textual markings, you
5236 may set the property @code{printPartCombineTexts} to false
5237
5238 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
5239 \new Staff <<
5240   \set Staff.printPartCombineTexts = ##f
5241   \partcombine
5242     \relative g' { g a( b) r }
5243     \relative g' { g r4 r f }
5244 >>
5245 @end lilypond
5246
5247
5248 Both arguments to @code{\partcombine} will be interpreted as
5249 @internalsref{Voice} contexts.  If using relative octaves,
5250 @code{\relative} should be specified for both music expressions, i.e.
5251
5252 @example
5253 \partcombine
5254   \relative @dots{} @var{musicexpr1}
5255   \relative @dots{} @var{musicexpr2}
5256 @end example
5257
5258 @noindent
5259 A @code{\relative} section that is outside of @code{\partcombine} has
5260 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
5261
5262 @seealso
5263
5264 Program reference: @internalsref{PartCombineMusic},
5265 @internalsref{SoloOneEvent}, and
5266 @internalsref{SoloTwoEvent}, and
5267 @internalsref{UnisonoEvent}.
5268
5269 @refbugs
5270
5271 When @code{printPartCombineTexts} is set, when the two voices play the
5272 same notes on and off, the part combiner may typeset @code{a2} more
5273 than once in a measure.
5274
5275 @code{\partcombine} cannot be inside @code{\times}. 
5276
5277 @code{\partcombine} cannot be inside @code{\relative}. 
5278
5279 Internally, the @code{\partcombine} interprets both arguments as
5280 @code{Voice}s named @code{one} and @code{two}, and then decides when
5281 the parts can be combined.  Consequently, if the arguments switch to
5282 differently named @internalsref{Voice} contexts, the events in those
5283 will be ignored.
5284
5285 @node Hiding staves
5286 @subsection Hiding staves
5287
5288 @cindex Frenched scores
5289 @cindex Hiding staves
5290
5291 In orchestral scores, staff lines that only have rests are usually
5292 removed.  This saves some space.  This style is called `French Score'.
5293 For @internalsref{Lyrics}, 
5294 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
5295 switched on by default.  When these line of these contexts turn out
5296 empty after the line-breaking process, they are removed.
5297
5298 For normal staves, a specialized @internalsref{Staff} context is
5299 available, which does the same: staves containing nothing (or only
5300 multi measure rests) are removed.  The context definition is stored in
5301 @code{\RemoveEmptyStaffContext} variable.  Observe how the second staff
5302 in this example disappears in the second line
5303
5304
5305 @lilypond[quote,verbatim]
5306 \paper {
5307   \context { \RemoveEmptyStaffContext }
5308 }
5309
5310 {
5311   \relative c' <<
5312     \new Staff { e4 f g a \break c1 }
5313     \new Staff { c4 d e f \break R1 }
5314   >>
5315 }
5316 @end lilypond
5317
5318 The first system shows all staves in full.  If empty staves should be
5319 removed from the first system too, set @code{remove-first} to false in
5320 @internalsref{RemoveEmptyVerticalGroup}.
5321
5322 Another application is making ossia sections, i.e. alternative
5323 melodies on a separate piece of staff, with help of a Frenched
5324 staff.  See @inputfileref{input/test,ossia.ly} for an example.
5325
5326
5327 @node Different editions from one source
5328 @subsection Different editions from one source
5329
5330 The @code{\tag} command marks music expressions with a name.  These
5331 tagged expressions can be filtered out later.  With this mechanism it
5332 is possible to make different versions of the same music source.
5333
5334 In the following example, we see two versions of a piece of music, one
5335 for the full score, and one with cue notes for the instrumental part
5336
5337 @example
5338   c1
5339   <<
5340     \tag #'part <<
5341       R1 \\
5342       @{
5343         \set fontSize = #-1
5344         c4_"cue" f2 g4 @} 
5345     >>
5346     \tag #'score R1
5347   >>
5348   c1
5349 @end example
5350
5351 The same can be applied to articulations, texts, etc.: they are
5352 made by prepending
5353 @example
5354         -\tag #@var{your-tag} 
5355 @end example
5356 to an articulation, for example, 
5357 @example
5358     c1-\tag #'part ^4
5359 @end example
5360
5361 This defines a note with a conditional fingering indication.
5362
5363 By applying the @code{remove-tag} function, tagged expressions can be
5364 filtered.  For example,
5365 @example
5366 <<
5367   @var{the music}
5368   \applymusic #(remove-tag 'score) @var{the music}
5369   \applymusic #(remove-tag 'part) @var{the music}
5370 >>
5371 @end example
5372 would yield
5373
5374 @lilypondfile[quote]{tag-filter.ly}
5375
5376 The argument of the @code{\tag} command should be a symbol, or a list
5377 of symbols, for example,
5378 @example
5379   \tag #'(original-part transposed-part) @dots{}
5380 @end example
5381
5382 @seealso
5383
5384 Examples: @inputfileref{input/regression,tag-filter.ly}.
5385
5386
5387 @node Quoting other voices
5388 @subsection Quoting other voices
5389
5390 With quotations, fragments of other parts can be inserted into a part
5391 directly.  Before a part can be quoted, it must be marked especially as
5392 quotable.  This is done with code @code{\addquote} command.
5393
5394 @example
5395 \addquote @var{name} @var{music}
5396 @end example
5397
5398
5399 @noindent
5400 Here, @var{name} is an identifying string.  The @var{music} is any kind
5401 of music.  This is an example of @code{\addquote}
5402
5403 @verbatim
5404 \addquote clarinet \relative c' {
5405   f4 fis g gis
5406 }
5407 @end verbatim
5408
5409 This command must be entered at toplevel, i.e.  outside any music
5410 blocks.
5411
5412 After calling @code{\addquote}, the quotation may then be done with
5413 @code{\quote},
5414
5415 @example
5416 \quote @var{name} @var{duration}  
5417 @end example
5418
5419 During a part, a piece of music can be quoted with the @code{\quote}
5420 command. 
5421   
5422 @example
5423 \quote clarinet 2.
5424 @end example
5425
5426 This would cite three quarter notes (@code{2.} is a dotted half note)
5427 of the previously added @code{clarinet} voice.
5428
5429 More precisely, it takes the current time-step of the part being
5430 printed, and extracts the notes at the corresponding point of the
5431 @code{\addquote}d voice.  Therefore, the argument to @code{\addquote}
5432 should be the entire part of the voice to be quoted, including any
5433 rests at the beginning. 
5434
5435 Quotations take into account the transposition of both source and target
5436 instruments, if they are specified using the @code{\transposition} command.
5437
5438 @lilypond[quote,raggedright,verbatim]
5439 \addquote clarinet \relative c' {
5440   \transposition bes
5441   f4 fis g gis
5442 }
5443
5444 {
5445   e'8 f'8 \quote clarinet 2
5446 }
5447 @end lilypond
5448
5449 @refbugs
5450
5451 Only the contents of the first @internalsref{Voice} occurring in an
5452 @code{\addquote} command will be considered for quotation, so
5453 @var{music} can not contain @code{\new} and @code{\context Voice}
5454 statements that would switch to a different Voice.
5455
5456
5457 @seealso
5458
5459 In this manual: @ref{Instrument transpositions}.
5460
5461 Examples: @inputfileref{input/regression,quote.ly}
5462 @inputfileref{input/regression,quote-transposition.ly}
5463
5464 Program reference: @internalsref{QuoteMusic}.
5465
5466 @node Formatting cue notes
5467 @section Formatting cue notes
5468
5469
5470 The previous section deals with inserting notes from another
5471 voice.  When making a part, these notes need to be specially formatted.
5472 Here is an example of formatted cue notes
5473
5474 @lilypond[verbatim]
5475 smaller = {
5476     \set fontSize = #-1
5477     \override Stem  #'length = #5.5
5478     \override Beam  #'thickness = #0.384
5479     \override Beam  #'space-function =
5480     #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
5481 }
5482
5483 {
5484     \set Staff.instrument = #"Horn in F"
5485     \set Score.skipBars = ##t
5486     R1*21
5487     << {
5488             \once \override Staff.MultiMeasureRest  #'staff-position = #-6
5489             R1
5490         }
5491         \new Voice {
5492             s2
5493             \clef tenor
5494             \smaller
5495             r8^"Bsn." c'8  f'8[ f'8]
5496             \clef treble
5497         }
5498     >>
5499     c'8^"Horn" cis'
5500     eis'4 fis'4
5501 }
5502 @end lilypond
5503
5504
5505 There are a couple of points to take care of:
5506
5507 @itemize @bullet
5508 @item
5509 The multi rest of the original part should be moved up or down during
5510 the cue.
5511 @item
5512 Cue notes have smaller font sizes.
5513 @item
5514 When cued notes have a clef change relative to the original part, the
5515 clef should be restored after the cue section.  This minimizes
5516 confusion for the reader,
5517 @item
5518 When the original part starts, this should be marked with the name of
5519 the instrument, in this case ``Horn.''   Of course, the cue part is
5520 marked with the instrument playing the cue.
5521 @end itemize
5522  
5523
5524
5525 @node Ancient notation
5526 @section Ancient notation
5527
5528 @cindex Vaticana, Editio
5529 @cindex Medicaea, Editio
5530 @cindex hufnagel
5531 @cindex Petrucci
5532 @cindex mensural
5533
5534 Support for ancient notation includes features for mensural notation
5535 and Gregorian Chant notation.  There is also limited support for
5536 figured bass notation.
5537
5538 Many graphical objects provide a @code{style} property, see
5539 @itemize @bullet
5540 @item
5541 @ref{Ancient note heads},
5542 @item
5543 @ref{Ancient accidentals},
5544 @item
5545 @ref{Ancient
5546 rests},
5547 @item
5548 @ref{Ancient clefs},
5549 @item
5550 @ref{Ancient flags}
5551 @item
5552 @ref{Ancient time signatures}.
5553 @end itemize
5554
5555 By manipulating such a grob property, the typographical appearance of
5556 the affected graphical objects can be accommodated for a specific
5557 notation flavor without need for introducing any new notational
5558 concept.
5559
5560 Other aspects of ancient notation can not that easily be expressed as
5561 in terms of just changing a style property of a graphical object.
5562 Therefore, some notational concepts are introduced specifically for
5563 ancient notation,
5564
5565 @itemize @bullet
5566 @item
5567 @ref{Custodes},
5568 @item
5569 @ref{Divisiones},
5570 @item
5571 @ref{Ligatures}, 
5572 @item
5573 @ref{Figured bass}.
5574 @end itemize
5575
5576 @menu
5577 * Ancient note heads::          
5578 * Ancient accidentals::         
5579 * Ancient rests::               
5580 * Ancient clefs::               
5581 * Ancient flags::               
5582 * Ancient time signatures::     
5583 * Custodes::                    
5584 * Divisiones::                  
5585 * Ligatures::                   
5586 * Vaticana style contexts::     
5587 * Figured bass::                
5588 @end menu
5589
5590 If this all is too much of documentation for you, and you just want to
5591 dive into typesetting without worrying too much about the details on
5592 how to customize a context, you may have a look at the predefined
5593 contexts (see @ref{Vaticana style contexts}).  Use them to set up
5594 predefined style-specific voice and staff contexts, and directly go
5595 ahead with the note entry.
5596
5597 @node Ancient note heads
5598 @subsection Ancient note heads
5599
5600 @cindex note heads
5601
5602
5603 For ancient notation, a note head style other than the @code{default}
5604 style may be chosen.  This is accomplished by setting the @code{style}
5605 property of the NoteHead object to @code{baroque}, @code{neomensural}
5606 or @code{mensural}.  The @code{baroque} style differs from the
5607 @code{default} style only in using a square shape for @code{\breve}
5608 note heads.  The @code{neomensural} style differs from the
5609 @code{baroque} style in that it uses rhomboidal heads for whole notes
5610 and all smaller durations.  Stems are centered on the note heads.
5611 This style is in particular useful when transcribing mensural music,
5612 e.g. for the incipit.  The @code{mensural} style finally produces note
5613 heads that mimic the look of note heads in historic printings of the
5614 16th century.
5615
5616 The following example demonstrates the @code{neomensural} style
5617
5618 @lilypond[quote,fragment,raggedright]
5619 \set Score.skipBars = ##T 
5620 \override NoteHead #'style = #'neomensural
5621 a'\longa a'\breve a'1 a'2 a'4 a'8 a'16
5622 @end lilypond
5623
5624 When typesetting a piece in Gregorian Chant notation, the
5625 @internalsref{Gregorian_ligature_engraver} will automatically select
5626 the proper note heads, such there is no need to explicitly set the
5627 note head style.  Still, the note head style can be set e.g.@: to
5628 @code{vaticana_punctum} to produce punctum neumes.  Similarly, a
5629 @internalsref{Mensural_ligature_engraver} is used to automatically
5630 assemble mensural ligatures.  See @ref{Ligatures} for how ligature
5631 engravers work.
5632
5633 @seealso
5634
5635 Examples: @inputfileref{input/regression,note-head-style.ly} gives an
5636 overview over all available note head styles.
5637
5638
5639 @node Ancient accidentals
5640 @subsection Ancient accidentals
5641
5642 @cindex accidentals
5643
5644
5645 Use the @code{style} property of grob @internalsref{Accidental} to
5646 select ancient accidentals.   Supported styles are
5647 @code{mensural}, @code{vaticana}, @code{hufnagel} and @code{medicaea}.
5648
5649 @lilypond[quote,raggedright,staffsize=26]
5650 \score {
5651     {
5652         \fatText
5653         s
5654         ^\markup {
5655             \column <
5656                 "vaticana" 
5657                 { " " \musicglyph #"accidentals-vaticana-1"
5658                   " " \musicglyph #"accidentals-vaticana0" }
5659             >
5660             \column <
5661                 "medicaea"
5662                 { " " \musicglyph #"accidentals-medicaea-1" }
5663             >
5664             \column <
5665                 "hufnagel"
5666                 { " " \musicglyph #"accidentals-hufnagel-1" }
5667             >
5668             \column <
5669                 "mensural"
5670                 { " " \musicglyph #"accidentals-mensural-1"
5671                   " " \musicglyph #"accidentals-mensural1" }
5672             >
5673         }
5674     }
5675     \paper {
5676         raggedright = ##t 
5677         interscoreline = 1
5678         \context {
5679             \Score
5680             \remove "Bar_number_engraver"
5681         }
5682         \context{
5683             \Staff
5684             \remove "Clef_engraver"
5685             \remove "Key_engraver"
5686             \remove "Time_signature_engraver"
5687             \remove "Staff_symbol_engraver"
5688             minimumVerticalExtent = ##f
5689         }
5690     }
5691 }
5692 @end lilypond
5693
5694 As shown, not all accidentals are supported by each style.  When
5695 trying to access an unsupported accidental, LilyPond will switch to a
5696 different style, as demonstrated in
5697 @inputfileref{input/test,ancient-accidentals.ly}.
5698
5699 Similarly to local accidentals, the style of the key signature can be
5700 controlled by the @code{style} property of the
5701 @internalsref{KeySignature} grob.
5702
5703 @seealso
5704
5705 In this manual: @ref{Pitches}, @ref{Chromatic alterations} and
5706 @ref{Accidentals} give a general introduction into the use of
5707 accidentals.  @ref{Key signature} gives a general introduction into
5708 the use of key signatures.
5709
5710 Program reference: @internalsref{KeySignature}.
5711
5712 Examples: @inputfileref{input/test,ancient-accidentals.ly}.
5713
5714 @node Ancient rests
5715 @subsection Ancient rests
5716
5717 @cindex rests
5718
5719
5720 Use the @code{style} property of grob @internalsref{Rest} to select
5721 ancient accidentals.   Supported styles are @code{classical},
5722 @code{neomensural} and @code{mensural}.  @code{classical} differs
5723 from the @code{default} style only in that the quarter rest looks like
5724 a horizontally mirrored 8th rest.  The @code{neomensural} style suits
5725 well for e.g. the incipit of a transcribed mensural piece of music.
5726 The @code{mensural} style finally mimics the appearance of rests as
5727 in historic prints of the 16th century.
5728
5729 The following example demonstrates the @code{neomensural} style
5730
5731 @lilypond[quote,fragment,raggedright]
5732 \override Rest #'style = #'neomensural
5733 \set Score.skipBars = ##t 
5734 r\longa r\breve r1 r2 r4 r8 r16
5735 @end lilypond
5736
5737 There are no 32th and 64th rests specifically for the mensural or
5738 neo-mensural style.  Instead, the rests from the default style will be
5739 taken.  See @inputfileref{input/test,rests.ly} for a chart of all
5740 rests.
5741
5742 There are no rests in Gregorian Chant notation; instead, it uses
5743 @ref{Divisiones}.
5744
5745 @seealso
5746
5747 In this manual: @ref{Rests} gives a general introduction into the use of rests.
5748
5749
5750 @node Ancient clefs
5751 @subsection Ancient clefs
5752
5753 @cindex clefs
5754
5755
5756 LilyPond supports a variety of clefs, many of them ancient.
5757
5758 The following table shows all ancient clefs that are supported via the
5759 @code{\clef} command.  Some of the clefs use the same glyph, but
5760 differ only with respect to the line they are printed on.  In such
5761 cases, a trailing number in the name is used to enumerate these clefs.
5762 Still, you can manually force a clef glyph to be typeset on an
5763 arbitrary line, as described in @ref{Clef}.  The note printed to the
5764 right side of each clef in the example column denotes the @code{c'}
5765 with respect to that clef.
5766
5767 @multitable @columnfractions   .4 .4 .2
5768
5769 @item
5770 @b{Description} @tab
5771 @b{Supported Clefs} @tab
5772 @b{Example}
5773
5774 @item
5775 modern style mensural C clef @tab
5776 @code{neomensural_c1}, @code{neomensural_c2},
5777 @code{neomensural_c3}, @code{neomensural_c4} @tab
5778 @lilypond[fragment,quote,relative=1,notime]
5779
5780 \clef "neomensural_c2" c
5781 @end lilypond
5782
5783 @item
5784 petrucci style mensural C clefs, for use on different staff lines
5785 (the examples shows the 2nd staff line C clef).
5786
5787 @tab
5788 @code{petrucci_c1}
5789 @code{petrucci_c2}
5790 @code{petrucci_c3}
5791 @code{petrucci_c4}
5792 @code{petrucci_c5}
5793
5794 @tab
5795 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5796
5797 \clef "petrucci_c2" c
5798 @end lilypond
5799
5800 @item
5801 petrucci style mensural F clef @tab
5802 @code{petrucci_f} @tab
5803 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5804
5805 \clef "petrucci_f" c
5806 @end lilypond
5807
5808 @item
5809 petrucci style mensural G clef @tab
5810 @code{petrucci_g} @tab
5811 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5812
5813 \clef "petrucci_g" c
5814 @end lilypond
5815
5816 @item
5817 historic style mensural C clef @tab
5818 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
5819 @code{mensural_c4} @tab
5820 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5821
5822 \clef "mensural_c2" c
5823 @end lilypond
5824
5825 @item
5826 historic style mensural F clef @tab
5827 @code{mensural_f} @tab
5828 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5829
5830 \clef "mensural_f" c
5831 @end lilypond
5832
5833 @item
5834 historic style mensural G clef @tab
5835 @code{mensural_g} @tab
5836 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5837
5838 \clef "mensural_g" c
5839 @end lilypond
5840
5841 @item
5842 Editio Vaticana style do clef @tab
5843 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3} @tab
5844 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5845     \override Staff.StaffSymbol   #'line-count = #4
5846
5847 \clef "vaticana_do2" c
5848 @end lilypond
5849
5850 @item
5851 Editio Vaticana style fa clef @tab
5852 @code{vaticana_fa1}, @code{vaticana_fa2} @tab
5853 @lilypond[quote,relative=1,notime,indent=0.0\mm,fragment]
5854     \override Staff.StaffSymbol   #'line-count = #4
5855
5856 \clef "vaticana_fa2" c
5857 @end lilypond
5858
5859 @item
5860 Editio Medicaea style do clef @tab
5861 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3} @tab
5862 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5863     \override Staff.StaffSymbol   #'line-count = #4
5864
5865 \clef "medicaea_do2" c
5866 @end lilypond
5867
5868 @item
5869 Editio Medicaea style fa clef @tab
5870 @code{medicaea_fa1}, @code{medicaea_fa2} @tab
5871 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5872     \override Staff.StaffSymbol   #'line-count = #4
5873
5874 \clef "medicaea_fa2" c
5875 @end lilypond
5876
5877 @item
5878 historic style hufnagel do clef @tab
5879 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3} @tab
5880 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5881     \override Staff.StaffSymbol   #'line-count = #4
5882
5883 \clef "hufnagel_do2" c
5884 @end lilypond
5885
5886 @item
5887 historic style hufnagel fa clef @tab
5888 @code{hufnagel_fa1}, @code{hufnagel_fa2} @tab
5889 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5890     \override Staff.StaffSymbol   #'line-count = #4
5891
5892 \clef "hufnagel_fa2" c
5893 @end lilypond
5894
5895 @item
5896 historic style hufnagel combined do/fa clef @tab
5897 @code{hufnagel_do_fa} @tab
5898 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5899 \clef "hufnagel_do_fa" c
5900 @end lilypond
5901
5902 @end multitable
5903
5904
5905
5906 @emph{Modern style} means ``as is typeset in contemporary editions of
5907 transcribed mensural music''.
5908
5909 @emph{Petrucci style} means ``inspired by printings published by the
5910 famous engraver Petrucci (1466-1539)''.
5911
5912 @emph{Historic style} means ``as was typeset or written in historic
5913 editions (other than those of Petrucci)''.
5914
5915 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
5916
5917 Petrucci used C clefs with differently balanced left-side vertical
5918 beams, depending on which staff line it is printed.
5919
5920 @seealso
5921
5922 In this manual: see @ref{Clef}.
5923
5924 @refbugs
5925
5926 The mensural g clef is mapped to the Petrucci g clef.
5927
5928
5929
5930 @node Ancient flags
5931 @subsection Ancient flags
5932
5933 @cindex flags
5934
5935
5936 Use the @code{flag-style} property of grob @internalsref{Stem} to
5937 select ancient flags.  Besides the @code{default} flag style,
5938  only @code{mensural} style is supported
5939
5940 @lilypond[quote,fragment,raggedright,verbatim]
5941 \override Stem #'flag-style = #'mensural
5942 \override Stem #'thickness = #1.0
5943 \override NoteHead #'style = #'mensural
5944 \autoBeamOff
5945 c'8 d'8 e'8 f'8 c'16 d'16 e'16 f'16 c'32 d'32 e'32 f'32 s8
5946 c''8 d''8 e''8 f''8 c''16 d''16 e''16 f''16 c''32 d''32 e''32 f''32
5947 @end lilypond
5948
5949 Note that the innermost flare of each mensural flag always is
5950 vertically aligned with a staff line.  If you do not like this
5951 behavior, you can set the @code{adjust-if-on-staffline} property of
5952 grob @internalsref{Stem} to @code{##f}.  Then, the vertical position
5953 of the end of each flare is different between notes on staff lines and
5954 notes between staff lines
5955
5956 @lilypond[quote,fragment,raggedright]
5957 \override Stem #'flag-style = #'mensural
5958 \override Stem #'thickness = #1.0
5959 \override Stem #'adjust-if-on-staffline = ##f
5960 \override NoteHead #'style = #'mensural
5961 \autoBeamOff
5962 c'8 d'8 e'8 f'8 c'16 d'16 e'16 f'16 c'32 d'32 e'32 f'32 s8
5963 c''8 d''8 e''8 f''8 c''16 d''16 e''16 f''16 c''32 d''32 e''32 f''32
5964 @end lilypond
5965
5966 There is no particular flag style for neo-mensural notation.  Hence,
5967 when typesetting the incipit of a transcribed piece of mensural
5968 music, the default flag style should be used.  There are no flags in
5969 Gregorian Chant notation.
5970
5971
5972 @node Ancient time signatures
5973 @subsection Ancient time signatures
5974
5975 @cindex time signatures
5976
5977
5978 There is limited support for mensural time signatures.   The
5979 glyphs are hard-wired to particular time fractions.  In other words,
5980 to get a particular mensural signature glyph with the @code{\time n/m}
5981 command, @code{n} and @code{m} have to be chosen according to the
5982 following table
5983
5984 @lilypond[quote]
5985 \paper {
5986     indent = 0.0
5987     raggedright = ##t
5988     \context {
5989         \Staff
5990         \remove Staff_symbol_engraver
5991         \remove Clef_engraver
5992         \remove Time_signature_engraver
5993     }
5994 } {
5995     \set Score.timing = ##f
5996     \set Score.barAlways = ##t
5997     s_\markup { "$\\backslash$time 4/4" }
5998      ^\markup { "       " \musicglyph #"timesig-neomensural4/4" }
5999     s
6000     s_\markup { "$\\backslash$time 2/2" }
6001      ^\markup { "       " \musicglyph #"timesig-neomensural2/2" }
6002     s
6003     s_\markup { "$\\backslash$time 6/4" }
6004      ^\markup { "       " \musicglyph #"timesig-neomensural6/4" }
6005     s
6006     s_\markup { "$\\backslash$time 6/8" }
6007      ^\markup { "       " \musicglyph #"timesig-neomensural6/8" }
6008     \break
6009     s_\markup { "$\\backslash$time 3/2" }
6010      ^\markup { "       " \musicglyph #"timesig-neomensural3/2" }
6011     s
6012     s_\markup { "$\\backslash$time 3/4" }
6013      ^\markup { "       " \musicglyph #"timesig-neomensural3/4" }
6014     s
6015     s_\markup { "$\\backslash$time 9/4" }
6016      ^\markup { "       " \musicglyph #"timesig-neomensural9/4" }
6017     s
6018     s_\markup { "$\\backslash$time 9/8" }
6019      ^\markup { "       " \musicglyph #"timesig-neomensural9/8" }
6020     \break
6021     s_\markup { "$\\backslash$time 4/8" }
6022      ^\markup { "       " \musicglyph #"timesig-neomensural4/8" }
6023     s
6024     s_\markup { "$\\backslash$time 2/4" }
6025      ^\markup { "       " \musicglyph #"timesig-neomensural2/4" }
6026     \break
6027 }
6028 @end lilypond
6029
6030 Use the @code{style} property of grob @internalsref{TimeSignature} to
6031 select ancient time signatures.  Supported styles are
6032 @code{neomensural} and @code{mensural}.  The above table uses the
6033 @code{neomensural} style.  This style is appropriate for the
6034 incipit of transcriptions of mensural pieces.  The @code{mensural}
6035 style mimics the look of historical printings of the 16th century.
6036
6037 The following examples shows the differences in style,
6038 @lilypond[raggedright]
6039 {
6040   \time 2/2
6041   c1^\markup { \hspace #-2.0 \typewriter default }
6042
6043   \override Staff.TimeSignature #'style = #'numbered  
6044   \time 2/2
6045   c1^\markup { \hspace #-2.0 \typewriter numbered }
6046
6047   \override Staff.TimeSignature #'style = #'mensural
6048   \time 2/2
6049   c1^\markup { \hspace #-2.0 \typewriter mensural }
6050   
6051   \override Staff.TimeSignature #'style = #'neomensural
6052   \time 2/2
6053   c1^\markup { \hspace #-2.0 \typewriter neomensural }
6054   \override Staff.TimeSignature #'style = #'single-digit
6055   \time 2/2
6056   c1^\markup { \hspace #-2.0 \typewriter single-digit }
6057 }
6058 @end lilypond
6059
6060 @seealso
6061
6062 This manual: @ref{Time signature} gives a general introduction into
6063 the use of time signatures.
6064
6065 @refbugs
6066
6067 Ratios of note durations do not change with the time signature.  For
6068 example, the ratio of 1 brevis = 3 semibrevis (tempus perfectum) must
6069 be made by hand, by setting
6070
6071 @example
6072   breveTP = #(ly:make-duration -1 0 3 2)
6073   @dots{}
6074   @{ c\breveTP f1 @}
6075 @end example
6076
6077 @noindent
6078 This sets @code{breveTP} to 3/2 times 2 = 3 times a whole note. 
6079
6080 The @code{old6/8alt} symbol (an alternate symbol for 6/8) is not
6081 addressable with @code{\time}.  Use a @code{\markup} instead
6082
6083 @node Custodes
6084 @subsection Custodes
6085
6086 @cindex custos
6087 @cindex custodes
6088
6089 A @emph{custos} (plural: @emph{custodes}; Latin word for `guard') is a
6090 symbol that appears at the end of a staff.  It anticipates the pitch
6091 of the first note(s) of the following line thus helping the performer
6092 to manage line breaks during performance.
6093
6094 Custodes were frequently used in music notation until the 17th
6095 century.  Nowadays, they have survived only in a few particular forms
6096 of musical notation such as contemporary editions of Gregorian chant
6097 like the @emph{editio vaticana}.  There are different custos glyphs
6098 used in different flavors of notational style.
6099
6100 For typesetting custodes, just put a @internalsref{Custos_engraver} into the
6101 @internalsref{Staff} context when declaring the @code{\paper} block,
6102 as shown in the following example
6103
6104 @example
6105 \paper @{
6106   \context @{
6107      \Staff
6108      \consists Custos_engraver
6109      Custos \override #'style = #'mensural
6110   @}
6111 @}
6112 @end example
6113
6114 The result looks like this
6115
6116 @lilypond[quote,raggedright]
6117 \score {
6118      {
6119         a'1
6120         \override Staff.Custos #'style = #'mensural
6121         \break
6122         g'
6123     }
6124     \paper {
6125         \context {
6126             \Staff
6127             \consists Custos_engraver
6128         }
6129     }
6130 }
6131 @end lilypond
6132
6133 The custos glyph is selected by the @code{style} property.  The styles
6134 supported are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
6135 @code{mensural}.  They are demonstrated in the following fragment
6136
6137 @lilypond[quote]
6138 \score {
6139        \new Lyrics    \lyrics {
6140         \markup {
6141             \column <
6142                 \typewriter                "vaticana" 
6143                 { " " \musicglyph #"custodes-vaticana-u0" }
6144             > }
6145         \markup {    \column <
6146                 \typewriter                "medicaea"
6147                 { " " \musicglyph #"custodes-medicaea-u0" }
6148             >}
6149             \markup {
6150             \column <
6151                 \typewriter                "hufnagel"
6152                 { " " \musicglyph #"custodes-hufnagel-u0" }
6153             >}
6154             \markup {
6155             \column <
6156                 \typewriter                "mensural"
6157                 { " " \musicglyph #"custodes-mensural-u0" }
6158             >}
6159         }
6160     
6161     \paper {
6162         raggedright = ##t 
6163         }      
6164 }
6165 @end lilypond
6166
6167 @seealso
6168
6169 Program reference: @internalsref{Custos}.
6170
6171 Examples: @inputfileref{input/regression,custos.ly}.
6172
6173
6174 @node Divisiones
6175 @subsection Divisiones
6176
6177 @cindex divisio
6178 @cindex divisiones
6179 @cindex finalis
6180
6181 A @emph{divisio} (plural: @emph{divisiones}; Latin word for
6182 `division') is a staff context symbol that is used to structure
6183 Gregorian music into phrases and sections.  The musical meaning of
6184 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
6185 can be characterized as short, medium and long pause, somewhat like
6186 the breathmarks from @ref{Breath marks}.  The @emph{finalis} sign not
6187 only marks the end of a chant, but is also frequently used within a
6188 single antiphonal/responsorial chant to mark the end of each section.
6189
6190
6191 To use divisiones, include the file @code{gregorian-init.ly}.  It
6192 contains definitions that you can apply by just inserting
6193 @code{\divisioMinima}, @code{\divisioMaior}, @code{\divisioMaxima},
6194 and @code{\finalis} at proper places in the input.  Some editions use
6195 @emph{virgula} or @emph{caesura} instead of divisio minima.
6196 Therefore, @code{gregorian-init.ly} also defines @code{\virgula} and
6197 @code{\caesura}
6198
6199 @lilypondfile[quote,raggedright]{divisiones.ly}
6200
6201 @refcommands
6202
6203 @cindex @code{\virgula}
6204 @code{\virgula},
6205 @cindex @code{\caesura}
6206 @code{\caesura},
6207 @cindex @code{\divisioMinima}
6208 @code{\divisioMinima},
6209 @cindex @code{\divisioMaior}
6210 @code{\divisioMaior},
6211 @cindex @code{\divisioMaxima}
6212 @code{\divisioMaxima},
6213 @cindex @code{\finalis}
6214 @code{\finalis}.
6215
6216 @seealso
6217
6218 In this manual: @ref{Breath marks}.
6219
6220 Program reference: @internalsref{BreathingSign}, @internalsref{BreathingSignEvent}.
6221
6222 Examples: @inputfileref{input/test,divisiones.ly}.
6223
6224 @node Ligatures
6225 @subsection Ligatures
6226
6227 @cindex Ligatures
6228
6229 @c TODO: Should double check if I recalled things correctly when I wrote
6230 @c down the following paragraph by heart.
6231
6232 A ligature is a graphical symbol that represents at least two distinct
6233 notes.  Ligatures originally appeared in the manuscripts of Gregorian
6234 chant notation to denote ascending or descending sequences of notes.
6235
6236 Ligatures are entered by enclosing them in @code{\[} and @code{\]}.
6237 Some ligature styles may need additional input syntax specific for
6238 this particular type of ligature.  By default, the
6239 @internalsref{LigatureBracket} engraver just puts a square bracket
6240 above the ligature
6241
6242 @lilypond[quote,raggedright,verbatim]
6243 \transpose c c' {
6244     \[ g c a f d' \]
6245     a g f
6246     \[ e f a g \]
6247 }
6248 @end lilypond
6249
6250 To select a specific style of ligatures, a proper ligature engraver
6251 has to be added to the @internalsref{Voice} context, as explained in
6252 the following subsections.   Only white mensural ligatures
6253 are supported with certain limitations.
6254
6255
6256
6257 @refbugs
6258
6259 Ligatures need special spacing that has not yet been implemented.  As
6260 a result, there is too much space between ligatures most of the time,
6261 and line breaking often is unsatisfactory.  Also, lyrics do not
6262 correctly align with ligatures.
6263
6264 Accidentals must not be printed within a ligature, but instead need to
6265 be collected and printed in front of it.
6266
6267 Augmentum dots within ligatures are not handled correctly.
6268
6269
6270 @menu
6271 * White mensural ligatures::    
6272 * Gregorian square neumes ligatures::  
6273 @end menu
6274
6275 @node White mensural ligatures
6276 @subsubsection White mensural ligatures
6277
6278 @cindex Mensural ligatures
6279 @cindex White mensural ligatures
6280
6281 There is limited support for white mensural ligatures.  
6282
6283 To engrave white mensural ligatures, in the paper block the
6284 @internalsref{Mensural_ligature_engraver} has to be put into the
6285 @internalsref{Voice} context, and remove the
6286 @internalsref{Ligature_bracket_engraver}
6287
6288 @example
6289     \paper @{
6290         \context @{
6291             \Voice
6292             \remove Ligature_bracket_engraver
6293             \consists Mensural_ligature_engraver
6294         @}
6295     @}
6296 @end example
6297
6298 There is no additional input language to describe the shape of a
6299 white mensural ligature.  The shape is rather determined solely from
6300 the pitch and duration of the enclosed notes.  While this approach may
6301 take a new user a while to get accustomed, it has the great advantage
6302 that the full musical information of the ligature is known internally.
6303 This is not only required for correct MIDI output, but also allows for
6304 automatic transcription of the ligatures.
6305
6306 For example,
6307
6308 @example
6309         \set Score.timing = ##f
6310         \set Score.defaultBarType = "empty"
6311         \override NoteHead #'style = #'neomensural
6312         \override Staff.TimeSignature   #'style = #'neomensural
6313         \clef "petrucci_g"
6314         \[ g\longa c\breve a\breve f\breve d'\longa \]
6315         s4
6316         \[ e1 f1 a\breve g\longa \]
6317 @end example
6318 @lilypond[quote,raggedright]
6319 \score {
6320     \transpose c c' {
6321         \set Score.timing = ##f
6322         \set Score.defaultBarType = "empty"
6323         \override NoteHead #'style = #'neomensural
6324         \override Staff.TimeSignature   #'style = #'neomensural
6325         \clef "petrucci_g"
6326         \[ g\longa c\breve a\breve f\breve d'\longa \]
6327         s4
6328         \[ e1 f1 a\breve g\longa \]
6329     }
6330     \paper {
6331         \context {
6332             \Voice
6333             \remove Ligature_bracket_engraver
6334             \consists Mensural_ligature_engraver
6335         }
6336     }
6337 }
6338 @end lilypond
6339
6340 Without replacing @internalsref{Ligature_bracket_engraver} with
6341 @internalsref{Mensural_ligature_engraver}, the same music transcribes
6342 to the following
6343
6344 @lilypond[quote,raggedright]
6345 \transpose c c' {
6346         \set Score.timing = ##f
6347         \set Score.defaultBarType = "empty"
6348         \override NoteHead #'style = #'neomensural
6349         \override Staff.TimeSignature   #'style = #'neomensural
6350         \clef "petrucci_g"
6351         \[ g\longa c\breve a\breve f\breve d'\longa \]
6352         s4
6353         \[ e1 f1 a\breve g\longa \]
6354 }
6355 @end lilypond
6356
6357 @refbugs
6358
6359 The implementation is experimental.  It may output strange warnings,
6360 incorrect results, and might even crash on more complex ligatures.
6361
6362 @node Gregorian square neumes ligatures
6363 @subsubsection Gregorian square neumes ligatures
6364
6365 @cindex Square neumes ligatures
6366 @cindex Gregorian square neumes ligatures
6367
6368 There is limited support for Gregorian square neumes notation
6369 (following the style of the Editio Vaticana).  Core ligatures can
6370 already be typeset, but essential issues for serious typesetting are
6371 still lacking, such as (among others) horizontal alignment of multiple
6372 ligatures, lyrics alignment and proper accidentals handling.
6373
6374
6375 The following table contains the extended neumes table of the 2nd
6376 volume of the Antiphonale Romanum (@emph{Liber Hymnarius}), published
6377 1983 by the monks of Solesmes.
6378
6379 @multitable @columnfractions .4 .2 .2 .2
6380
6381 @item
6382 @b{Neuma aut@*Neumarum Elementa} @tab
6383 @b{Figurae@*Rectae} @tab
6384 @b{Figurae@*Liquescentes Auctae} @tab
6385 @b{Figurae@*Liquescentes Deminutae}
6386
6387 @c TODO: \paper block is identical in all of the below examples.
6388 @c Therefore, it should somehow be included rather than duplicated all
6389 @c the time. --jr
6390
6391 @c why not make identifiers in ly/engraver-init.ly? --hwn
6392
6393 @c Because it's just used to typeset plain notes without
6394 @c a staff for demonstration purposes rather than something
6395 @c special of Gregorian chant notation. --jr
6396
6397 @item
6398 @code{1. Punctum}
6399 @tab
6400 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.5\cm]
6401 \include "gregorian-init.ly"
6402 \score {
6403     \transpose c c' {
6404         % Punctum
6405         \[ b \]
6406         \noBreak s^\markup {"a"} \noBreak
6407
6408         % Punctum Inclinatum
6409         \[ \inclinatum b \]
6410         \noBreak s^\markup {"b"}
6411     }
6412 \paper { \neumeDemoPaper }}
6413 @end lilypond
6414 @tab
6415 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.5\cm]
6416 \include "gregorian-init.ly"
6417 \score {
6418      \transpose c c' {
6419         % Punctum Auctum Ascendens
6420         \[ \auctum \ascendens b \]
6421         \noBreak s^\markup {"c"} \noBreak
6422
6423         % Punctum Auctum Descendens
6424         \[ \auctum \descendens b \]
6425         \noBreak s^\markup {"d"} \noBreak
6426
6427         % Punctum Inclinatum Auctum
6428         \[ \inclinatum \auctum b \]
6429         \noBreak s^\markup {"e"}
6430     }
6431 \paper { \neumeDemoPaper }}
6432 @end lilypond
6433 @tab
6434 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6435 \include "gregorian-init.ly"
6436 \score {
6437      \transpose c c' {
6438         % Punctum Inclinatum Parvum
6439         \[ \inclinatum \deminutum b \]
6440         \noBreak s^\markup {"f"}
6441     }
6442 \paper { \neumeDemoPaper }}
6443 @end lilypond
6444
6445 @item
6446 @code{2. Virga}
6447 @tab
6448 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6449 \include "gregorian-init.ly"
6450 \score {
6451      \transpose c c' {
6452         % Virga
6453         \[ \virga b \]
6454         \noBreak s^\markup {"g"}
6455     }
6456 \paper { \neumeDemoPaper }}
6457 @end lilypond
6458 @tab
6459 @tab
6460
6461 @item
6462 @code{3. Apostropha vel Stropha}
6463 @tab
6464 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6465 \include "gregorian-init.ly"
6466 \score {
6467      \transpose c c' {
6468         % Stropha
6469         \[ \stropha b \]
6470         \noBreak s^\markup {"h"}
6471     }
6472 \paper { \neumeDemoPaper }}
6473 @end lilypond
6474 @tab
6475 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6476 \include "gregorian-init.ly"
6477 \score {
6478      \transpose c c' {
6479         % Stropha Aucta
6480         \[ \stropha \auctum b \]
6481         \noBreak s^\markup {"i"}
6482     }
6483 \paper { \neumeDemoPaper }}
6484 @end lilypond
6485 @tab
6486
6487 @item
6488 @code{4. Oriscus}
6489 @tab
6490 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6491 \include "gregorian-init.ly"
6492 \score {
6493      \transpose c c' {
6494         % Oriscus
6495         \[ \oriscus b \]
6496         \noBreak s^\markup {"j"}
6497     }
6498 \paper { \neumeDemoPaper }}
6499 @end lilypond
6500 @tab
6501 @tab
6502
6503 @item
6504 @code{5. Clivis vel Flexa}
6505 @tab
6506 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6507 \include "gregorian-init.ly"
6508 \score {
6509      \transpose c c' {
6510         % Clivis vel Flexa
6511         \[ b \flexa g \]
6512         s^\markup {"k"}
6513     }
6514 \paper { \neumeDemoPaper }}
6515 @end lilypond
6516 @tab
6517 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.0\cm]
6518 \include "gregorian-init.ly"
6519 \score {
6520      \transpose c c' {
6521         % Clivis Aucta Descendens
6522         \[ b \flexa \auctum \descendens g \]
6523         \noBreak s^\markup {"l"} \noBreak
6524
6525         % Clivis Aucta Ascendens
6526         \[ b \flexa \auctum \ascendens g \]
6527         \noBreak s^\markup {"m"}
6528     }
6529 \paper { \neumeDemoPaper }}
6530 @end lilypond
6531 @tab
6532 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6533 \include "gregorian-init.ly"
6534 \score {
6535      \transpose c c' {
6536         % Cephalicus
6537         \[ b \flexa \deminutum g \]
6538         s^\markup {"n"}
6539     }
6540 \paper { \neumeDemoPaper }}
6541 @end lilypond
6542
6543 @item
6544 @code{6. Podatus vel Pes}
6545 @tab
6546 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6547 \include "gregorian-init.ly"
6548 \score {
6549      \transpose c c' {
6550         % Podatus vel Pes
6551         \[ g \pes b \]
6552         s^\markup {"o"}
6553     }
6554 \paper { \neumeDemoPaper }}
6555 @end lilypond
6556 @tab
6557 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.0\cm]
6558 \include "gregorian-init.ly"
6559 \score {
6560      \transpose c c' {
6561         % Pes Auctus Descendens
6562         \[ g \pes \auctum \descendens b \]
6563         \noBreak s^\markup {"p"} \noBreak
6564
6565         % Pes Auctus Ascendens
6566         \[ g \pes \auctum \ascendens b \]
6567         \noBreak s^\markup {"q"}
6568     }
6569 \paper { \neumeDemoPaper }}
6570 @end lilypond
6571 @tab
6572 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6573 \include "gregorian-init.ly"
6574 \score {
6575      \transpose c c' {
6576         % Epiphonus
6577         \[ g \pes \deminutum b \]
6578         s^\markup {"r"}
6579     }
6580 \paper { \neumeDemoPaper }}
6581 @end lilypond
6582
6583 @item
6584 @code{7. Pes Quassus}
6585 @tab
6586 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6587 \include "gregorian-init.ly"
6588 \score {
6589      \transpose c c' {
6590         % Pes Quassus
6591         \[ \oriscus g \pes \virga b \]
6592         s^\markup {"s"}
6593     }
6594 \paper { \neumeDemoPaper }}
6595 @end lilypond
6596 @tab
6597 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6598 \include "gregorian-init.ly"
6599 \score {
6600      \transpose c c' {
6601         % Pes Quassus Auctus Descendens
6602         \[ \oriscus g \pes \auctum \descendens b \]
6603         s^\markup {"t"}
6604     }
6605 \paper { \neumeDemoPaper }}
6606 @end lilypond
6607 @tab
6608
6609 @item
6610 @code{8. Quilisma Pes}
6611 @tab
6612 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6613 \include "gregorian-init.ly"
6614 \score {
6615      \transpose c c' {
6616         % Quilisma Pes
6617         \[ \quilisma g \pes b \]
6618         s^\markup {"u"}
6619     }
6620 \paper { \neumeDemoPaper }}
6621 @end lilypond
6622 @tab
6623 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6624 \include "gregorian-init.ly"
6625 \score {
6626      \transpose c c' {
6627         % Quilisma Pes Auctus Descendens
6628         \[ \quilisma g \pes \auctum \descendens b \]
6629         s^\markup {"v"}
6630     }
6631 \paper { \neumeDemoPaper }}
6632 @end lilypond
6633 @tab
6634
6635 @item
6636 @code{9. Podatus Initio Debilis}
6637 @tab
6638 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6639 \include "gregorian-init.ly"
6640 \score {
6641      \transpose c c' {
6642         % Pes Initio Debilis
6643         \[ \deminutum g \pes b \]
6644         s^\markup {"w"}
6645     }
6646 \paper { \neumeDemoPaper }}
6647 @end lilypond
6648 @tab
6649 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6650 \include "gregorian-init.ly"
6651 \score {
6652      \transpose c c' {
6653         % Pes Auctus Descendens Initio Debilis
6654         \[ \deminutum g \pes \auctum \descendens b \]
6655         s^\markup {"x"}
6656     }
6657 \paper { \neumeDemoPaper }}
6658 @end lilypond
6659 @tab
6660
6661 @item
6662 @code{10. Torculus}
6663 @tab
6664 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6665 \include "gregorian-init.ly"
6666 \score {
6667      \transpose c c' {
6668         % Torculus
6669         \[ a \pes b \flexa g \]
6670         s^\markup {"y"}
6671     }
6672 \paper { \neumeDemoPaper }}
6673 @end lilypond
6674 @tab
6675 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6676 \include "gregorian-init.ly"
6677 \score {
6678      \transpose c c' {
6679         % Torculus Auctus Descendens
6680         \[ a \pes b \flexa \auctum \descendens g \]
6681         s^\markup {"z"}
6682     }
6683 \paper { \neumeDemoPaper }}
6684 @end lilypond
6685 @tab
6686 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6687 \include "gregorian-init.ly"
6688 \score {
6689      \transpose c c' {
6690         % Torculus Deminutus
6691         \[ a \pes b \flexa \deminutum g \]
6692         s^\markup {"A"}
6693     }
6694 \paper { \neumeDemoPaper }}
6695 @end lilypond
6696
6697 @item
6698 @code{11. Torculus Initio Debilis}
6699 @tab
6700 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6701 \include "gregorian-init.ly"
6702 \score {
6703      \transpose c c' {
6704         % Torculus Initio Debilis
6705         \[ \deminutum a \pes b \flexa g \]
6706         s^\markup {"B"}
6707     }
6708 \paper { \neumeDemoPaper }}
6709 @end lilypond
6710 @tab
6711 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6712 \include "gregorian-init.ly"
6713 \score {
6714      \transpose c c' {
6715         % Torculus Auctus Descendens Initio Debilis
6716         \[ \deminutum a \pes b \flexa \auctum \descendens g \]
6717         s^\markup {"C"}
6718     }
6719 \paper { \neumeDemoPaper }}
6720 @end lilypond
6721 @tab
6722 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6723 \include "gregorian-init.ly"
6724 \score {
6725      \transpose c c' {
6726         % Torculus Deminutus Initio Debilis
6727         \[ \deminutum a \pes b \flexa \deminutum g \]
6728         s^\markup {"D"}
6729     }
6730 \paper { \neumeDemoPaper }}
6731 @end lilypond
6732
6733 @item
6734 @code{12. Porrectus}
6735 @tab
6736 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6737 \include "gregorian-init.ly"
6738 \score {
6739      \transpose c c' {
6740         % Porrectus
6741         \[ a \flexa g \pes b \]
6742         s^\markup {"E"}
6743     }
6744 \paper { \neumeDemoPaper }}
6745 @end lilypond
6746 @tab
6747 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6748 \include "gregorian-init.ly"
6749 \score {
6750      \transpose c c' {
6751         % Porrectus Auctus Descendens
6752         \[ a \flexa g \pes \auctum \descendens b \]
6753         s^\markup {"F"}
6754     }
6755 \paper { \neumeDemoPaper }}
6756 @end lilypond
6757 @tab
6758 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6759 \include "gregorian-init.ly"
6760 \score {
6761      \transpose c c' {
6762         % Porrectus Deminutus
6763         \[ a \flexa g \pes \deminutum b \]
6764         s^\markup {"G"}
6765     }
6766 \paper { \neumeDemoPaper }}
6767 @end lilypond
6768
6769 @item
6770 @code{13. Climacus}
6771 @tab
6772 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6773 \include "gregorian-init.ly"
6774 \score {
6775      \transpose c c' {
6776         % Climacus
6777         \[ \virga b \inclinatum a \inclinatum g \]
6778         s^\markup {"H"}
6779     }
6780     \paper { \neumeDemoPaper }
6781 }
6782 @end lilypond
6783 @tab
6784 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6785 \include "gregorian-init.ly"
6786 \score {
6787      \transpose c c' {
6788         % Climacus Auctus
6789         \[ \virga b \inclinatum a \inclinatum \auctum g \]
6790         s^\markup {"I"}
6791     }
6792 \paper { \neumeDemoPaper }}
6793 @end lilypond
6794 @tab
6795 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6796 \include "gregorian-init.ly"
6797 \score {
6798      \transpose c c' {
6799         % Climacus Deminutus
6800         \[ \virga b \inclinatum a \inclinatum \deminutum g \]
6801         s^\markup {"J"}
6802     }
6803 \paper { \neumeDemoPaper }}
6804 @end lilypond
6805
6806 @item
6807 @code{14. Scandicus}
6808 @tab
6809 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6810 \include "gregorian-init.ly"
6811 \score {
6812      \transpose c c' {
6813         % Scandicus
6814         \[ g \pes a \virga b \]
6815         s^\markup {"K"}
6816     }
6817 \paper { \neumeDemoPaper }}
6818 @end lilypond
6819 @tab
6820 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6821 \include "gregorian-init.ly"
6822 \score {
6823      \transpose c c' {
6824         % Scandicus Auctus Descendens
6825         \[ g \pes a \pes \auctum \descendens b \]
6826         s^\markup {"L"}
6827     }
6828 \paper { \neumeDemoPaper }}
6829 @end lilypond
6830 @tab
6831 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6832 \include "gregorian-init.ly"
6833 \score {
6834      \transpose c c' {
6835         % Scandicus Deminutus
6836         \[ g \pes a \pes \deminutum b \]
6837         s^\markup {"M"}
6838     }
6839 \paper { \neumeDemoPaper }}
6840 @end lilypond
6841
6842 @item
6843 @code{15. Salicus}
6844 @tab
6845 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6846 \include "gregorian-init.ly"
6847 \score {
6848      \transpose c c' {
6849         % Salicus
6850         \[ g \oriscus a \pes \virga b \]
6851         s^\markup {"N"}
6852     }
6853 \paper { \neumeDemoPaper }}
6854 @end lilypond
6855 @tab
6856 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6857 \include "gregorian-init.ly"
6858 \score {
6859      \transpose c c' {
6860         % Salicus Auctus Descendens
6861         \[ g \oriscus a \pes \auctum \descendens b \]
6862         s^\markup {"O"}
6863     }
6864 \paper { \neumeDemoPaper }}
6865 @end lilypond
6866 @tab
6867
6868 @item
6869 @code{16. Trigonus}
6870 @tab
6871 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6872 \include "gregorian-init.ly"
6873 \score {
6874    \transpose c c' {
6875     % Trigonus
6876     \[ \stropha b \stropha b \stropha a \]
6877     s^\markup {"P"}
6878   }
6879   \paper { \neumeDemoPaper }
6880 }
6881 @end lilypond
6882 @tab
6883 @tab
6884
6885 @end multitable
6886
6887
6888 Unlike most other neumes notation systems, the input language for
6889 neumes does not reflect the typographical appearance, but is designed
6890 to focus on musical meaning.  For example, @code{\[ a \pes b
6891 \flexa g \]} produces a Torculus consisting of three Punctum heads,
6892 while @code{\[ a \flexa g \pes b \]} produces a Porrectus with a
6893 curved flexa shape and only a single Punctum head.  There is no
6894 command to explicitly typeset the curved flexa shape; the decision of
6895 when to typeset a curved flexa shape is based on the musical
6896 input.  The idea of this approach is to separate the musical aspects
6897 of the input from the notation style of the output.  This way, the
6898 same input can be reused to typeset the same music in a different
6899 style of Gregorian chant notation.
6900
6901 The following table shows the code fragments that produce the
6902 ligatures in the above neumes table.  The letter in the first column
6903 in each line of the below table indicates to which ligature in the
6904 above table it refers.  The second column gives the name of the
6905 ligature.  The third column shows the code fragment that produces this
6906 ligature, using @code{g}, @code{a} and @code{b} as example pitches.
6907
6908 @multitable @columnfractions .1 .4 .5
6909
6910 @item
6911 @b{#} @tab
6912 @b{Name} @tab
6913 @b{Input Language}
6914
6915 @item
6916 a @tab
6917 Punctum @tab
6918 @code{\[ b \]}
6919
6920 @item
6921 b @tab
6922 Punctum Inclinatum @tab
6923 @code{\[ \inclinatum b \]}
6924
6925 @item
6926 c @tab
6927 Punctum Auctum Ascendens @tab
6928 @code{\[ \auctum \ascendens b \]}
6929
6930 @item
6931 d @tab
6932 Punctum Auctum Descendens @tab
6933 @code{\[ \auctum \descendens b \]}
6934
6935 @item
6936 e @tab
6937 Punctum Inclinatum Auctum @tab
6938 @code{\[ \inclinatum \auctum b \]}
6939
6940 @item
6941 f @tab
6942 Punctum Inclinatum Parvum @tab
6943 @code{\[ \inclinatum \deminutum b \]}
6944
6945 @item
6946 g @tab
6947 Virga @tab
6948 @code{\[ \virga b \]}
6949
6950 @item
6951 h @tab
6952 Stropha @tab
6953 @code{\[ \stropha b \]}
6954
6955 @item
6956 i @tab
6957 Stropha Aucta @tab
6958 @code{\[ \stropha \auctum b \]}
6959
6960 @item
6961 j @tab
6962 Oriscus @tab
6963 @code{\[ \oriscus b \]}
6964
6965 @item
6966 k @tab
6967 Clivis vel Flexa @tab
6968 @code{\[ b \flexa g \]}
6969
6970 @item
6971 l @tab
6972 Clivis Aucta Descendens @tab
6973 @code{\[ b \flexa \auctum \descendens g \]}
6974
6975 @item
6976 m @tab
6977 Clivis Aucta Ascendens @tab
6978 @code{\[ b \flexa \auctum \ascendens g \]}
6979
6980 @item
6981 n @tab
6982 Cephalicus @tab
6983 @code{\[ b \flexa \deminutum g \]}
6984
6985 @item
6986 o @tab
6987 Podatus vel Pes @tab
6988 @code{\[ g \pes b \]}
6989
6990 @item
6991 p @tab
6992 Pes Auctus Descendens @tab
6993 @code{\[ g \pes \auctum \descendens b \]}
6994
6995 @item
6996 q @tab
6997 Pes Auctus Ascendens @tab
6998 @code{\[ g \pes \auctum \ascendens b \]}
6999
7000 @item
7001 r @tab
7002 Epiphonus @tab
7003 @code{\[ g \pes \deminutum b \]}
7004
7005 @item
7006 s @tab
7007 Pes Quassus @tab
7008 @code{\[ \oriscus g \pes \virga b \]}
7009
7010 @item
7011 t @tab
7012 Pes Quassus Auctus Descendens @tab
7013 @code{\[ \oriscus g \pes \auctum \descendens b \]}
7014
7015 @item
7016 u @tab
7017 Quilisma Pes @tab
7018 @code{\[ \quilisma g \pes b \]}
7019
7020 @item
7021 v @tab
7022 Quilisma Pes Auctus Descendens @tab
7023 @code{\[ \quilisma g \pes \auctum \descendens b \]}
7024
7025 @item
7026 w @tab
7027 Pes Initio Debilis @tab
7028 @code{\[ \deminutum g \pes b \]}
7029
7030 @item
7031 x @tab
7032 Pes Auctus Descendens Initio Debilis @tab
7033 @code{\[ \deminutum g \pes \auctum \descendens b \]}
7034
7035 @item
7036 y @tab
7037 Torculus @tab
7038 @code{\[ a \pes b \flexa g \]}
7039
7040 @item
7041 z @tab
7042 Torculus Auctus Descendens @tab
7043 @code{\[ a \pes b \flexa \auctum \descendens g \]}
7044
7045 @item
7046 A @tab
7047 Torculus Deminutus @tab
7048 @code{\[ a \pes b \flexa \deminutum g \]}
7049
7050 @item
7051 B @tab
7052 Torculus Initio Debilis @tab
7053 @code{\[ \deminutum a \pes b \flexa g \]}
7054
7055 @item
7056 C @tab
7057 Torculus Auctus Descendens Initio Debilis @tab
7058 @code{\[ \deminutum a \pes b \flexa \auctum \descendens g \]}
7059
7060 @item
7061 D @tab
7062 Torculus Deminutus Initio Debilis @tab
7063 @code{\[ \deminutum a \pes b \flexa \deminutum g \]}
7064
7065 @item
7066 E @tab
7067 Porrectus @tab
7068 @code{\[ a \flexa g \pes b \]}
7069
7070 @item
7071 F @tab
7072 Porrectus Auctus Descendens @tab
7073 @code{\[ a \flexa g \pes \auctum \descendens b \]}
7074
7075 @item
7076 G @tab
7077 Porrectus Deminutus @tab
7078 @code{\[ a \flexa g \pes \deminutum b \]}
7079
7080 @item
7081 H @tab
7082 Climacus @tab
7083 @code{\[ \virga b \inclinatum a \inclinatum g \]}
7084
7085 @item
7086 I @tab
7087 Climacus Auctus @tab
7088 @code{\[ \virga b \inclinatum a \inclinatum \auctum g \]}
7089
7090 @item
7091 J @tab
7092 Climacus Deminutus @tab
7093 @code{\[ \virga b \inclinatum a \inclinatum \deminutum g \]}
7094
7095 @item
7096 K @tab
7097 Scandicus @tab
7098 @code{\[ g \pes a \virga b \]}
7099
7100 @item
7101 L @tab
7102 Scandicus Auctus Descendens @tab
7103 @code{\[ g \pes a \pes \auctum \descendens b \]}
7104
7105 @item
7106 M @tab
7107 Scandicus Deminutus @tab
7108 @code{\[ g \pes a \pes \deminutum b \]}
7109
7110 @item
7111 N @tab
7112 Salicus @tab
7113 @code{\[ g \oriscus a \pes \virga b \]}
7114
7115 @item
7116 O @tab
7117 Salicus Auctus Descendens @tab
7118 @code{\[ g \oriscus a \pes \auctum \descendens b \]}
7119
7120 @item
7121 P @tab
7122 Trigonus @tab
7123 @code{\[ \stropha b \stropha b \stropha a \]}
7124
7125 @end multitable
7126
7127 @refcommands
7128
7129 The following head prefixes are supported
7130
7131 @cindex @code{\virga}
7132 @code{\virga},
7133 @cindex @code{\stropha}
7134 @code{\stropha},
7135 @cindex @code{\inclinatum}
7136 @code{\inclinatum},
7137 @cindex @code{\auctum}
7138 @code{\auctum},
7139 @cindex @code{\descendens}
7140 @code{\descendens},
7141 @cindex @code{\ascendens}
7142 @code{\ascendens},
7143 @cindex @code{\oriscus}
7144 @code{\oriscus},
7145 @cindex @code{\quilisma}
7146 @code{\quilisma},
7147 @cindex @code{\deminutum}
7148 @code{\deminutum}.
7149
7150 Head prefixes can be accumulated, though restrictions apply.  For
7151 example, either @code{\descendens} or @code{\ascendens} can be applied
7152 to a head, but not both to the same head.
7153
7154 @cindex @code{\pes}
7155 @cindex @code{\flexa}
7156 Two adjacent heads can be tied together with the @code{\pes} and
7157 @code{\flexa} infix commands for a rising and falling line of melody,
7158 respectively.
7159
7160
7161
7162 @node Vaticana style contexts
7163 @subsection Vaticana style contexts
7164
7165 @cindex VaticanaVoiceContext
7166 @cindex VaticanaStaffContext
7167
7168 The predefined @code{VaticanaVoiceContext} and
7169 @code{VaticanaStaffContext} can be used to engrave a piece of
7170 Gregorian Chant in the style of the Editio Vaticana.  These contexts
7171 initialize all relevant context properties and grob properties to
7172 proper values, so you can immediately go ahead entering the chant, as
7173 the following excerpt demonstrates
7174
7175 @lilypond[quote,raggedright,verbatim,noindent]
7176 \include "gregorian-init.ly"
7177 \score {
7178   <<
7179     \context VaticanaVoice = "cantus" {
7180       \override Score.BarNumber #'transparent = ##t
7181        {
7182         \[ c'\melisma c' \flexa a \]
7183         \[ a \flexa \deminutum g\melismaEnd \]
7184         f \divisioMinima
7185         \[ f\melisma \pes a c' c' \pes d'\melismaEnd \]
7186         c' \divisioMinima \break
7187         \[ c'\melisma c' \flexa a \]
7188         \[ a \flexa \deminutum g\melismaEnd \] f \divisioMinima
7189       }
7190     }
7191     \lyricsto "cantus" \new Lyrics {
7192       San- ctus, San- ctus, San- ctus
7193     }
7194   >>
7195 }
7196 @end lilypond
7197
7198 @node Figured bass
7199 @subsection Figured bass
7200
7201 @cindex Basso continuo
7202
7203 @c TODO: musicological blurb about FB
7204
7205
7206 LilyPond has limited support for figured bass
7207
7208 @lilypond[quote,verbatim,fragment]
7209 <<
7210   \context Voice  { \clef bass dis4  c d ais }
7211   \context FiguredBass \figures {
7212     < 6 >4 < 7 >8 < 6+ [_!] >
7213     < 6 >4 <6 5 [3+] >
7214   }
7215 >>
7216 @end lilypond
7217
7218 The support for figured bass consists of two parts: there is an input
7219 mode, introduced by @code{\figures}, where you can enter bass figures
7220 as numbers, and there is a context called @internalsref{FiguredBass} that
7221 takes care of making @internalsref{BassFigure} objects.
7222
7223 In figures input mode, a group of bass figures is delimited by
7224 @code{<} and @code{>}.  The duration is entered after the @code{>}
7225 @example
7226 <4 6>
7227 @end example
7228 @lilypond[quote,fragment]
7229 \context FiguredBass
7230 \figures { <4 6> }
7231 @end lilypond
7232
7233 Accidentals are added when you append @code{-}, @code{!}  and @code{+}
7234 to the numbers
7235
7236 @example
7237 <4- 6+ 7!>
7238 @end example
7239 @lilypond[quote,fragment]
7240 \context FiguredBass
7241 \figures { <4- 6+ 7!> }
7242 @end lilypond
7243
7244 Spaces or dashes may be inserted by using @code{_}.  Brackets are
7245 introduced with @code{[} and @code{]}
7246
7247 @example
7248 < [4 6] 8 [_! 12]>
7249 @end example
7250 @lilypond[quote,fragment]
7251 \context FiguredBass
7252 \figures { < [4 6] 8 [_! 12]> }
7253 @end lilypond
7254
7255 Although the support for figured bass may superficially resemble chord
7256 support, it works much simpler.  The @code{\figures} mode simply
7257 stores the numbers , and @internalsref{FiguredBass} context prints
7258 them as entered.  There is no conversion to pitches, and no
7259 realizations of the bass are played in the MIDI file.
7260
7261 Internally, the code produces markup texts.  You can use any of the
7262 markup text properties to override formatting.  For example, the
7263 vertical spacing of the figures may be set with @code{baseline-skip}.
7264
7265 @seealso
7266
7267 Program reference: @internalsref{BassFigureEvent} music, @internalsref{BassFigure} object, 
7268 and @internalsref{FiguredBass} context.
7269
7270 @refbugs
7271
7272 Slash notation for alterations is not supported.
7273
7274 @node Contemporary notation
7275 @section Contemporary notation
7276
7277 In the 20th century, composers have greatly expanded the musical
7278 vocabulary.  With this expansion, many innovations in musical notation
7279 have been tried.  The book ``Music Notation in the 20th century'' by
7280 Kurt Stone gives a comprehensive overview (see @ref{Literature
7281 list}).  In general, the use of new, innovative notation makes a piece
7282 harder to understand and perform and its use should therefore be
7283 avoided.  For this reason, support for contemporary notation in
7284 LilyPond is limited.
7285
7286
7287 @menu
7288 * Polymetric notation::         
7289 * Clusters::                    
7290 * Special fermatas::            
7291 * Feathered beams::             
7292 @end menu
7293
7294 @node Polymetric notation
7295 @subsection Polymetric notation
7296
7297 Double time signatures are not supported explicitly, but they can be
7298 faked.  In the next example, the markup for the time signature is
7299 created with a markup text.  This markup text is inserted in the
7300 @internalsref{TimeSignature} grob.
7301
7302 @lilypond[verbatim,raggedright]
7303
7304 % create 2/4 + 5/8
7305 tsMarkup =\markup  {
7306     \number { 
7307       \column < "2" "4" >
7308       \musicglyph #"scripts-stopped" 
7309       \bracket \column < "5" "8" >
7310     }
7311 }
7312
7313 {
7314   \override Staff.TimeSignature  #'print-function = #Text_item::print
7315   \override Staff.TimeSignature  #'text = #tsMarkup
7316   \time 3/2
7317   c'2  \bar ":" c'4 c'4.
7318 }
7319 @end lilypond
7320
7321 Each staff can also have its own time signature.  This is done by
7322 moving the @internalsref{Timing_engraver} to @internalsref{Staff}
7323 context.
7324
7325 @verbatim
7326 \paper{
7327     \context{
7328         \Score
7329         \remove "Timing_engraver"
7330     }
7331     \context{
7332         \Staff
7333         \consists "Timing_engraver"
7334     }
7335 }       
7336 @end verbatim
7337
7338
7339 Now, each staff has its own time signature.
7340 @verbatim
7341 <<
7342     \new Staff {
7343         \time 3/4
7344         c4 c c | c c c |
7345     }
7346
7347     \new Staff {
7348         \time 2/4
7349         c4 c | c c | c c
7350     }
7351     \new Staff {
7352         \time 3/8
7353         c4. c8 c c c4. c8 c c
7354     }
7355 >>
7356 @end verbatim
7357
7358 @lilypond[raggedright]
7359 \paper{
7360     \context{
7361         \Score
7362         \remove "Timing_engraver"
7363     }
7364     \context{
7365         \Staff
7366         \consists "Timing_engraver"
7367     }
7368 }       
7369
7370 \relative c'  <<
7371     \new Staff {
7372         \time 3/4
7373         c4 c c | c c c |
7374     }
7375
7376     \new Staff {
7377         \time 2/4
7378         c4 c | c c | c c
7379     }
7380     \new Staff {
7381         \time 3/8
7382         c4. c8 c c c4. c8 c c
7383     }
7384 >>
7385 @end lilypond
7386
7387
7388 A different form of polymetric notation is where note lengths have
7389 different values across staves.
7390
7391 This notation can be created by setting a common time signature for
7392 each staff but replacing it manually using
7393 @code{timeSignatureFraction} to the desired fraction.  Then the printed
7394 durations in each staff are scaled to the common time signature.
7395 The latter is done with @code{\compressmusic}, which is similar to
7396 @code{\times}, but does not create a tuplet bracket.
7397
7398
7399 In this example, music with the time signatures of 3/4, 9/8 and 10/8 are
7400 used in parallel.  In the second staff, shown durations are multiplied by 
7401 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are 
7402 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
7403
7404 @lilypond[raggedright,verbatim]
7405 \relative c'  <<
7406     \new Staff {
7407         \time 3/4
7408         c4 c c | c c c |
7409     }
7410     \new Staff {
7411         \time 3/4
7412         \set Staff.timeSignatureFraction = #'(9 . 8)
7413         \compressmusic #'(2 . 3)
7414           \repeat unfold 6 { c8[ c c] }
7415     }
7416     \new Staff {
7417         \time 3/4
7418         \set Staff.timeSignatureFraction = #'(10 . 8)
7419         \compressmusic #'(3 . 5)
7420           { \repeat unfold 2 { c8[ c c] }
7421             \repeat unfold 2 { c8[  c] }
7422             |  c4. c4. \times 2/3 { c8 c c } c4  }
7423     }
7424 >>
7425 @end lilypond
7426
7427
7428
7429
7430 @refbugs
7431
7432 When using different time signatures in parallel, the spacing is
7433 aligned vertically, but bar lines distort the regular spacing.
7434
7435
7436
7437 @node Clusters
7438 @subsection Clusters
7439
7440 @cindex cluster
7441
7442 A cluster indicates a continuous range of pitches to be played.  They
7443 can be denoted as the envelope of a set of notes.  They are entered by
7444 applying the function @code{makeClusters} to a sequence of
7445 chords, e.g.
7446 @c
7447 @lilypond[quote,verbatim]
7448 \relative c'' 
7449   \makeClusters { <c e > <b f'> }
7450 @end lilypond
7451
7452 The following example (from
7453 @inputfileref{input/regression,cluster.ly}) shows what the result
7454 looks like
7455
7456 @lilypondfile[quote]{cluster.ly}
7457
7458 Ordinary notes and clusters can be put together in the same staff,
7459 even simultaneously.  In such a case no attempt is made to
7460 automatically avoid collisions between ordinary notes and clusters.
7461
7462 @seealso
7463
7464 Program reference: @internalsref{ClusterSpanner},
7465 @internalsref{ClusterSpannerBeacon},
7466 @internalsref{Cluster_spanner_engraver}, and
7467 @internalsref{ClusterNoteEvent}.
7468
7469 Examples: @inputfileref{input/regression,cluster.ly}.
7470
7471 @refbugs
7472
7473 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
7474 accurately.  Use @code{<g a>8 <e a>8} instead.
7475
7476
7477
7478 @node Special fermatas
7479 @subsection Special Fermatas
7480
7481 @cindex fermatas, special
7482
7483 In contemporary music notation, special fermata symbols denote breaks
7484 of differing lengths.  The following fermatas are supported
7485
7486 @lilypond[quote,raggedright]
7487 <<
7488     \oldaddlyrics  {
7489       b'
7490       ^\shortfermata
7491       _\shortfermata
7492       r
7493       b'
7494       ^\fermata
7495       _\fermata
7496
7497       r
7498       b'
7499       ^\longfermata
7500       _\longfermata
7501
7502       r
7503       b'
7504       ^\verylongfermata
7505       _\verylongfermata
7506     r
7507     }
7508     \context Lyrics \lyrics {
7509       \override LyricText #'font-family = #'typewriter
7510       "shortfermata" "fermata"  "longfermata" "verylongfermata"
7511     }
7512 >>
7513 @end lilypond
7514
7515 See @ref{Articulations} for general instructions how to apply scripts
7516 such as fermatas to notes.
7517
7518 @node Feathered beams
7519 @subsection Feathered beams
7520
7521 Feathered beams are not supported natively, but they can be faked by
7522 forcing two beams to overlap.  Here is an example,
7523
7524 @lilypond[raggedright]
7525 \relative \new Staff <<
7526     \new Voice
7527     {
7528         \stemUp
7529         \once \override Voice.Beam #'positions = #'(0 . 0.5)
7530         c8[ c c c c ]
7531     }
7532     \new Voice {
7533         \stemUp
7534         \once \override Voice.Beam #'positions = #'(0 . -0.5) 
7535         c[ c c c c]
7536     }
7537 >>
7538 @end lilypond
7539
7540
7541
7542 @node Educational use
7543 @section Educational use
7544
7545 @menu
7546 * Balloon help::                
7547 * Blank music paper::           
7548 * Notation for excercises::     
7549 * Easy Notation note heads::    
7550 @end menu
7551
7552 @node Balloon help
7553 @subsection Balloon help
7554
7555 Elements of notation can be marked and named with the help of a square
7556 balloon.  The primary purpose of this feature is to explain notation.
7557
7558 The following example demonstrates its use.
7559
7560 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
7561 \context Voice
7562 \applyoutput
7563    #(add-balloon-text 'NoteHead "heads, or tails?"
7564     '(1 . -3))
7565 c8
7566 @end lilypond
7567
7568 @noindent
7569 The function @code{add-balloon-text} takes the name of a grob, the
7570 label to print, and the position where to put the label relative to 
7571 the object.  In the above example, the text ``heads or tails?'' ends 
7572 3 spaces below and 1 space to the right of the marked head.
7573
7574 @cindex balloon
7575 @cindex notation, explaining
7576
7577 @seealso
7578
7579 Program reference: @internalsref{text-balloon-interface}.
7580
7581 Examples: @inputfileref{input/regression,balloon.ly}.
7582
7583
7584
7585
7586 @node Blank music paper
7587 @subsection Blank music paper
7588
7589 A blank music paper can be produced also by using invisible notes, and
7590 removing @code{Bar_number_engraver}.
7591
7592
7593 @lilypond
7594 emptymusic =  {
7595   \repeat unfold 2 % Change this for more lines. 
7596   { s1\break }
7597   \bar "|."
7598 }
7599 \new Score \with {
7600     \override TimeSignature #'transparent = ##t
7601     defaultBarType = #""
7602     \remove Bar_number_engraver
7603 } <<
7604         \context Staff \emptymusic
7605         \context TabStaff \emptymusic
7606 >>
7607 @end lilypond
7608
7609
7610 @node Notation for excercises
7611 @subsection Notation for excercises
7612
7613 @cindex Blank Notes
7614
7615 Invisible (or transparent) notes can be useful, when weird tricks are
7616 needed; especially, a slur cannot be attach to a rest or spacer rest.
7617
7618
7619 @lilypond
7620 blanknotes = { \override NoteHead  #'transparent = ##t
7621                \override Stem  #'transparent = ##t }
7622 unblanknotes = { \revert NoteHead #'transparent
7623                  \revert Stem #'transparent }
7624
7625
7626 \relative c'' {
7627     c4 d4 
7628     \blanknotes e4 f4   \unblanknotes
7629     g4 a 
7630 }
7631 @end lilypond
7632
7633
7634 @node Easy Notation note heads
7635 @subsection Easy Notation note heads
7636
7637 @cindex easy notation
7638 @cindex Hal Leonard
7639
7640 The `easy play' note head includes a note name inside the head.  It is
7641 used in music for beginners
7642
7643 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
7644 \setEasyHeads
7645 c'2 e'4 f' | g'1
7646 @end lilypond
7647
7648 The command @code{\setEasyHeads} overrides settings for the
7649 @internalsref{NoteHead} object.  To make the letters readable, it has
7650 to be printed in a large font size.  To print with a larger font, see
7651 @ref{Setting global staff size}.
7652
7653 @refcommands
7654
7655 @cindex @code{\setEasyHeads}
7656 @code{\setEasyHeads}
7657