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