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