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