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