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