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