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