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