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