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