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