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