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