]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/refman.itely
4a8652b6f52ee5185c1e94ba91cfb32261d5d5a7
[lilypond.git] / Documentation / user / refman.itely
1
2 @c Note:
3 @c
4 @c A menu is needed before every deeper *section nesting of @nodes
5 @c Run M-x texinfo-all-menus-update
6 @c to automagically fill in these menus
7 @c before saving changes
8
9
10 @ignore
11  TODO:
12
13    fix all FIXMEs
14
15    Rhythm staff (clef, x-notehead)
16
17    postscript, scheme output?
18
19    (links to?) using/existance of ly2dvi, lilypond-book
20
21 @end ignore
22
23
24 @c .{Reference Manual}
25
26 @node Reference Manual
27 @chapter Reference Manual
28
29 This document describes GNU LilyPond and its input format. This document
30 has been revised for LilyPond 1.3.125
31
32
33
34 @menu
35 * Overview::                    
36 * Repeats::                     
37 * Note entry::                  
38 * Music notation::              
39 * Polyphony::                   
40 * Spanners::                    
41 * Piano music::                 
42 * Lyrics::                      
43 * Chords::                      
44 * Writing parts::               
45 * Custodes::                    
46 * Page layout::                 
47 * Sound::                       
48 * Music entry::                 
49 * Engravers::                   
50 * Syntactic details::           
51 * Unsorted::                    
52 @end menu
53
54 @c . {Overview}
55 @node Overview
56 @section Overview
57
58
59 The purpose of LilyPond is explained informally by the term `music
60 typesetter'.  This is not a fully correct name: not only does the
61 program print musical symbols, it also makes esthetic decisions.  All
62 symbols and their placement is @emph{generated} from a high-level
63 musical description.  In other words, LilyPond would be best described
64 by `music compiler' or `music to notation compiler'.
65
66 Internally, LilyPond is written in a mixture of Scheme and C++. Most of
67 the algorithms and low-level routines are written in C++, but these low
68 level components are glued together using Scheme data
69 structures. LilyPond is linked to GUILE, GNU's Scheme library for
70 extension.
71
72 When lilypond is run to typeset sheet music, the following happens:
73
74 @itemize @bullet
75 @item GUILE Initialization: various scheme files are read
76 @item parsing: first standard .ly initialization  files are read, and
77 then the user @file{.ly} file is read.
78 @item interpretation: the music in the file is processed "in playing
79 order", i.e. in the same order as your eyes scan sheet music, and in the
80 same order that you hear the notes play.
81
82 @item typesetting:
83 in this step, the results of the interpretation, a typesetting
84 specification, is solved.
85
86 @item the visible results ("virtual ink") is written to the output file.
87 @end itemize
88
89 These stages, involve data of a specific type: during parsing,
90 @strong{Music} objects are created.  During the interpretation,
91 @strong{context} is constructed, and with this context af network of
92 @strong{graphical objects} (``grobs'') is created. The grobs contain
93 unknown variables, and the network forms a set of equations. After
94 solving the equations and filling in these variables, the printed output
95 (in the form of @strong{molecules}) is written to an output file.
96
97 These threemanship of tasks (parsing, translating, typesetting) and
98 data-structures (music, context, graphical objects) permeates the entire
99 design of the program.  This manual is ordered in terms of user
100 tasks. With each concept will be explained to which of the three parts
101 it belongs.
102
103 LilyPond input can be classified into three types:
104 @itemize @bullet
105   @item musical expressions: a musical expression is some combination of
106 rest, notes, lyrics
107   @item output definitions: recipes for translating those musical
108 expressions into performances (MIDI) or graphics (eg. PostScript).
109
110   @item declarations: by declaring and naming musical expressions, you
111 can enter and edit them in manageable chunks.
112 @end itemize
113
114
115
116
117 @c .  {Repeats}
118 @node Repeats
119 @section Repeats
120
121
122 @cindex repeats
123 @cindex @code{\repeat}
124
125 In order to specify repeats, use the @code{\repeat}
126 keyword.  Since repeats look and sound differently when played or
127 printed, there are a few different variants of repeats.
128
129 @table @asis
130 @item unfolded  
131 Repeated music is fully written (played) out.  Useful for MIDI
132 output.
133
134 @item volta  
135 This is the normal notation: Repeats are not written out, but
136 alternative endings (voltas) are printed, left to right.
137
138 @item folded  
139 Alternative endings are written stacked.  Which is unfortunately not
140 practical for anything right now.
141
142 @item tremolo
143 Make tremolo beams.
144 @end table  
145
146 @menu
147 * Repeat syntax::               
148 * Manual repeat commands::      
149 * Tremolo repeats::             
150 * Tremolo subdivision::         
151 @end menu
152
153 @node Repeat syntax
154 @subsection Repeat syntax
155
156 The syntax for repeats is
157
158 @example
159   \repeat @var{variant} @var{repeatcount} @var{repeatbody}
160 @end example
161
162 If you have alternative endings, you may add
163
164 @cindex @code{\alternative}
165 @example
166  \alternative @code{@{} @var{alternative1}
167             @var{alternative2}
168             @var{alternative3} @dots{} @code{@}}
169 @end example
170
171 where each @var{alternative} is a Music expression.
172
173 Normal notation repeats are used like this:
174
175 @quotation
176
177 @lilypond[fragment,verbatim]
178   c'1
179   \repeat volta 2 { c'4 d' e' f' }
180   \repeat volta 2 { f' e' d' c' }
181 @end lilypond
182 @end quotation
183
184 With alternative endings:
185
186 @quotation
187
188 @lilypond[fragment,verbatim]
189   c'1
190   \repeat volta 2 {c'4 d' e' f'} 
191   \alternative { {d'2 d'} {f' f} }
192 @end lilypond
193 @end quotation
194
195 Folded repeats look like this:@footnote{Folded repeats offer little
196 more over simultaneous music.  However, it is to be expected that
197 more functionality -- especially for the MIDI backend -- will be
198 implemented at some point in the future.}
199
200 @quotation
201
202 @lilypond[fragment,verbatim]
203   c'1
204   \repeat fold 2 {c'4 d' e' f'} 
205   \alternative { {d'2 d'} {f' f} }
206
207 @end lilypond
208 @end quotation
209
210
211 If you don't give enough alternatives for all of the repeats, then
212 the first alternative is assumed to be repeated often enough to equal
213 the specified number of repeats.
214
215 @quotation
216 @lilypond[fragment,verbatim]
217 \context Staff {
218   \relative c' {
219     \partial 4;
220     \repeat volta 3 { e | c2 d2 | e2 f2 | }
221     \alternative { { g4 g g } { a | a a a a | b2. } }
222   }
223 }
224
225 @end lilypond
226 @end quotation
227
228
229 As you can see, LilyPond doesn't remember the timing information, nor
230 are slurs or ties repeated, so you have to reset timing information
231 after a repeat, eg using bar-checks, @code{Score.measurePosition} or
232 @code{\partial}. We hope to fix this after 1.4.
233
234 It is possible to nest @code{\repeat}, although it probably is only
235 meaningful for unfolded repeats.
236
237 @node Manual repeat commands
238 @subsection Manual repeat commands
239
240 @cindex @code{repeatCommands}
241
242 The property @code{repeatCommands} can be used to control the layout of
243 repeats. Its value is a Scheme list of repeat commands, where each repeat
244 command can be
245
246 @table @code
247 @item 'start-repeat
248  Print a |: bar line
249 @item 'stop-repeat
250  Print a :| bar line
251 @item (volta . @var{text})
252   Print a volta bracket saying @var{text}.
253 @item (volta . #f)
254   Stop a running volta bracket
255 @end table
256
257 @lilypond[verbatim, fragment]
258  c''4
259     \property Score.repeatCommands = #'((volta "93") end-repeat)
260  c4 c4
261     \property Score.repeatCommands = #'((volta #f))
262  c4 c4
263 @end lilypond
264
265
266 @node Tremolo repeats
267 @subsection Tremolo repeats
268 @cindex tremolo beams
269
270 To place tremolo marks between notes, use @code{\repeat} with tremolo
271 style.  
272 @lilypond[verbatim,center]
273 \score { 
274   \context Voice \notes\relative c' {
275     \repeat "tremolo" 8 { c16 d16 }
276     \repeat "tremolo" 4 { c16 d16 }    
277     \repeat "tremolo" 2 { c16 d16 }
278     \repeat "tremolo" 4 c16
279   }
280   \paper {
281     linewidth = 40*\staffspace;
282   }  
283 }
284 @end lilypond
285
286 @node Tremolo subdivision
287 @subsection Tremolo subdivision
288 @cindex tremolo marks
289 @cindex @code{tremoloFlags}
290
291 Tremolo marks can be printed on a single note by adding
292 `@code{:}[@var{length}]' after the note.  The length must be at least 8.
293 A @var{length} value of 8 gives one line across the note stem.  If the
294 length is omitted, then the last value is used, or the value of the
295 @code{tremoloFlags} property if there was no last value.
296
297 @lilypond[verbatim,fragment,center]
298   c'2:8 c':32
299 @end lilypond
300
301 Tremolos in this style do not carry over into the MIDI output.
302
303 Using this mechanism pays off when you entering many tremolos, since the
304 default argument saves a lot of typing.
305
306
307 @c . {Note entry}
308 @node Note entry
309 @section Note entry
310 @cindex Note entry
311
312 @menu
313 * Notes mode::                  
314 * Pitches::                     
315 * Defining pitch names::        
316 * Durations::                   
317 * Notes::                       
318 * Rests::                       
319 * Skip::                        
320 @end menu
321
322 @c .  {Notes mode}
323 @node Notes mode
324 @subsection Notes mode
325
326 @cindex note mode
327
328 @cindex @code{\notes}
329 Note mode is introduced by the keyword
330 @code{\notes}.  In Note mode, words can only
331 contain alphabetic characters.  If @code{word} is encountered,
332 LilyPond first checks for a notename of @code{word}.  If no
333 notename is found, then @code{word} is treated as a string.
334
335 Since combinations of numbers and dots are used for indicating
336 durations, it is not possible to enter real numbers in this mode.
337
338 @cindex Notes mode
339
340 @c .  {Pitches}
341 @node Pitches
342 @subsection Pitches
343
344 @cindex Pitch names
345 @cindex Note specification
346 @cindex pitches
347 @cindex entering notes
348
349 The verbose syntax for pitch specification is
350
351 @cindex @code{\pitch}
352 @example
353   \pitch @var{scmpitch}
354 @end example
355
356 @var{scmpitch} is a pitch scheme object, see @ref{Pitch data type}.
357
358 In Note and Chord mode, pitches may be designated by names.  The default
359 names are the Dutch note names.  The notes are specified by the letters
360 @code{c} through @code{b}, where @code{c} is an octave below middle C
361 and the letters span the octave above that C.  In Dutch,
362 @cindex note names, Dutch
363 a sharp is formed by adding @code{-is} to the end of a pitch name.  A
364 flat is formed by adding @code{-es}. Double sharps and double flats are
365 obtained by adding @code{-isis} or @code{-eses}.  @code{aes} and
366 @code{ees} are contracted to @code{as} and @code{es} in Dutch, but both
367 forms will be accepted.
368
369 LilyPond has predefined sets of notenames for various other languages.
370 To use them, simply include the language specific init file.  For
371 example: @code{\include "english.ly"}.  The available language files and
372 the names they define are:
373
374 @example 
375                         Note Names               sharp       flat
376 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
377 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
378 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
379 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
380 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
381 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
382 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b 
383 @end example 
384
385 @cindex @code{'}
386 @cindex @code{,}
387
388
389
390
391 The optional octave specification takes the form of a series of
392 single quote (`@code{'}') characters or a series of comma
393 (`@code{,}') characters.  Each @code{'} raises the pitch by one
394 octave; each @code{,} lowers the pitch by an octave.
395
396 @lilypond[fragment,verbatim,center]
397   c' d' e' f' g' a' b' c''
398 @end lilypond
399
400 @lilypond[fragment,verbatim,center]
401   cis' dis' eis' fis' gis' ais' bis'
402 @end lilypond
403
404 @lilypond[fragment,verbatim,center]
405   ces' des' es' fes' ges' as' bes'
406 @end lilypond
407
408 @lilypond[fragment,verbatim,center]
409   cisis' eisis' gisis' aisis' beses'
410 @end lilypond
411
412 @lilypond[fragment,verbatim,center]
413   ceses' eses' geses' ases' beses'
414 @end lilypond
415
416
417 @c .  {Defining pitch names}
418 @node Defining pitch names
419 @subsection Defining pitch names
420
421 @cindex defining pitch names
422 @cindex pitch names, defining 
423
424 Note names and chord modifiers can be customised for nationalities.  The
425 syntax is as follows.
426
427 @cindex @code{\pitchnames}
428 @cindex @code{\chordmodifiers}
429 @example
430    \pitchnames @var{scheme-alist}
431    \chordmodifiers @var{scheme-alist}
432 @end example
433
434 See @file{ly/nederlands.ly} and @file{ly/chord-modifiers.ly} for
435 specific examples how to do this.  Some national note names have been
436 provided, among others: Norwegian, Swedish, German, Italian, Catalan,
437 French, Dutch and English.
438
439
440 @c .  {Durations}
441 @node Durations
442 @subsection Durations
443
444
445 @cindex duration
446 @cindex @code{\duration}
447
448 The syntax for an verbose duration specification is
449 @example
450  \duration @var{scmduration}
451 @end example
452
453 In Note, Chord, and Lyrics mode, durations may be designated by numbers
454 and dots: durations are entered as their reciprocal values.  For notes
455 longer than a whole note, use identifiers.
456
457 @quotation
458
459 @example 
460 c'\longa c'\breve  
461 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 
462 r\longa r\breve  
463 r1 r2 r4 r8 r16 r32 r64 r64 
464 @end example 
465
466
467 @lilypond[]
468 \score {
469   \notes \relative c'' {
470     a\longa a\breve  \autoBeamOff
471     a1 a2 a4 a8 a16 a32 a64 a64 
472     r\longa r\breve  
473     r1 r2 r4 r8 r16 r32 r64 r64 
474   }
475   \paper {
476     \translator {
477       \StaffContext
478         \remove "Clef_engraver";
479         \remove "Staff_symbol_engraver";
480         \remove "Time_signature_engraver";
481         \consists "Pitch_squash_engraver";
482     }
483   }
484 }
485 @end lilypond
486 @end quotation
487
488 As you  can see, the longa is not printed. To get a longa note head, you
489 have to use a different style of note heads. See [TODO].
490
491 If the duration is omitted then it is set equal to the previous duration
492 entered.  At the start of parsing there is no previous duration, so then
493 a quarter note is assumed.  The duration can be followed by a dot
494 (`@code{.}')  to obtain dotted note lengths.
495 @cindex @code{.}
496
497 @lilypond[fragment,verbatim,center]
498   a'4. b'4.
499 @end lilypond
500 @cindex @code{r}
501 @cindex @code{s}
502
503 You can alter the length of duration by writing `@code{*}@var{fraction}'
504 after it.  This will not affect the appearance of note heads or rests.
505
506 @c . {Notes}
507 @node Notes
508 @subsection Notes
509
510 A note specification has the form
511
512 @example
513   @var{pitch}[@var{octavespec}][!][?][@var{duration}]
514 @end example
515
516
517 LilyPond will determine what accidentals to typeset depending on the key
518 and context, so alteration refer to what note is heard, not to whether
519 accidentals are printed.  A reminder accidental
520 @cindex reminder accidental
521 @cindex @code{?}
522 can be forced by adding an exclamation mark @code{!} after the pitch.
523 A cautionary accidental,
524 @cindex cautionary accidental
525
526 i.e., an accidental within parentheses can be obtained by adding the
527 question mark `@code{?}' after the pitch.
528
529 @lilypond[fragment,verbatim,center]
530   cis' d' e' cis'  c'? d' e' c'!
531 @end lilypond
532
533
534 @c .  {Rests}
535 @node  Rests
536 @subsection Rests
537 @cindex Rests
538
539 Rests are entered like notes, with note name `@code{r}'.
540 There is also a note name
541 `@code{s}', which produces a space of the specified
542 duration.
543
544
545 @c .  {Skip}
546 @node Skip
547 @subsection Skip
548 @cindex Skip
549
550
551 @example
552   \skip @var{duration} @code{;}
553 @end example
554 @cindex @code{\skip}
555
556 Skips the amount of time specified by @var{duration}.  If no other
557 music is played, a gap will be left for the skipped time with no
558 notes printed.  It works in Note Mode or Lyrics Mode.  In Note mode,
559 this has the same effect as the spacer rest.
560
561
562
563 @c . {Music notation}
564 @node Music notation
565 @section Music notation
566 @cindex Music notation
567 @menu
568 * Key::                         
569 * Time signature::              
570 @end menu
571
572 @c .  {Key}
573 @node Key
574 @subsection Key
575 @cindex Key
576
577 @cindex @code{\key}
578
579 @example
580   @code{\key} @var{pitch} @var{type} @code{;}
581 @end example
582 @cindex @code{\minor}
583 @cindex @code{\major}
584 @cindex @code{\minor}
585 @cindex @code{\ionian}
586 @cindex @code{\locrian}
587 @cindex @code{\aeolian}
588 @cindex @code{\mixolydian}
589 @cindex @code{\lydian}
590 @cindex @code{\phrygian}
591 @cindex @code{\dorian}
592
593 Change the key signature.  @var{type} should be @code{\major} or
594 @code{\minor} to get @var{pitch}-major or @var{pitch}-minor,
595 respectively.  The second argument is optional; the default is major
596 keys.  The @var{\context} argument can also be given as an integer,
597 which tells the number of semitones that should be added to the pitch
598 given in the subsequent @code{\key} commands to get the corresponding
599 major key, e.g., @code{\minor} is defined as 3.  The standard mode names
600 @code{\ionian}, @code{\locrian}, @code{\aeolian}, @code{\mixolydian},
601 @code{\lydian}, @code{\phrygian}, and @code{\dorian} are also defined.
602
603 This command sets @code{Staff.keySignature}.
604
605
606
607 @cindex @code{keySignature}
608
609 @c .   {Clef changes}
610 @subsubsection Clef changes
611 @cindex @code{\clef}
612 @example
613   \clef @var{clefname} @code{;}
614 @end example
615
616 Short-cut for
617
618 @example
619   \property Staff.clefGlyph = @var{symbol associated with clefname} 
620   \property Staff.clefPosition = @var{clef Y-position for clefname}
621   \property Staff.clefOctavation = @var{extra pitch of clefname}
622 @end example
623
624 Supported clef-names include 
625
626 @itemize @bullet
627 @item treble, violin, G, G2: G clef on 2nd line
628 @item french: G clef on 1st line
629 @item soprano: C clef on 1st line
630 @item mezzosoprano: C clef on 2nd line
631 @item alto: C clef on 3rd line
632 @item tenor: C clef on 4th line
633 @item baritone: C clef on 5th line
634 @item varbaritone: F clef on 3rd line
635 @item bass, F: F clef on 4th line
636 @item subbass: F clef on 5th line
637 @item percussion: percussion clef
638 @end itemize
639
640 [todo: ancient clefs]
641
642 Supported associated symbols (for Staff.clefGlyph) are:
643
644 @itemize @bullet
645 @item clefs-C: modern style C clef
646 @item clefs-F: modern style F clef
647 @item clefs-G: modern style G clef
648 @item clefs-vaticana_do: Editio Vaticana style do clef
649 @item clefs-vaticana_fa: Editio Vaticana style fa clef
650 @item clefs-medicaea_do: Editio Medicaea style do clef
651 @item clefs-medicaea_fa: Editio Medicaea style fa clef
652 @item clefs-mensural1_c: modern style mensural C clef
653 @item clefs-mensural2_c: historic style small mensural C clef
654 @item clefs-mensural3_c: historic style big mensural C clef
655 @item clefs-mensural1_f: historic style traditional mensural F clef
656 @item clefs-mensural2_f: historic style new mensural F clef
657 @item clefs-mensural_g: historic style mensural G clef
658 @item clefs-hufnagel_do: historic style hufnagel do clef
659 @item clefs-hufnagel_fa: historic style hufnagel fa clef
660 @item clefs-hufnagel_do_fa: historic style hufnagel combined do/fa clef
661 @item clefs-percussion: modern style percussion clef
662 @end itemize
663
664 @emph{Modern style} means "as is typeset in current editions".
665 @emph{Historic style} means "as was typeset or written in contemporary
666 historic editions".  @emph{Editio XXX style} means "as is/was printed in
667 Editio XXX".
668
669 @c .  {Time signature}
670 @node Time signature
671 @subsection Time signature
672 @cindex Time signature
673 @cindex meter
674 @cindex @code{\time}
675
676 @example
677   \time @var{numerator}@code{/}@var{denominator} @code{;}
678 @end example
679
680 A short-cut for doing
681 @example
682      \property Score.timeSignatureFraction = #'(@var{numerator} . @var{denominator})
683 @end example
684
685 See the documentation of @code{timeSignatureFraction}
686
687
688 @c .   {Partial}
689 @subsubsection Partial
690 @cindex Partial
691 @cindex anacrusis
692 @cindex upstep
693 @cindex partial measure
694 @cindex measure, partial
695 @cindex shorten measures
696 @cindex @code{\partial}
697 @example
698   \partial @var{duration} @code{;}
699 @end example
700
701 Short cut for 
702
703 @example
704   \property Score.measurePosition = @var{length of duration}
705 @end example
706 @cindex @code{|}
707
708 See the documentation of @code{measurePosition}.
709
710
711 @c .   {Polyphony}
712 @node Polyphony
713 @section Polyphony
714 @cindex Polyphony
715
716 [todo : collisiosn, rest-collisinos, voiceX identifiers, how to
717 which  contexts to instantiate.]
718
719
720 @table @code
721 @cindex @code{\shiftOff}  
722   @item @code{\shiftOff}
723     Disable horizontal shifting of note heads that collide. 
724
725 @cindex @code{\shiftOn}  
726   @item @code{\shiftOn}
727     Enable note heads that collide with other note heads to be
728     shifted horiztonally. Also @code{\shiftOnn} and @code{\shiftOnnn}
729 set different shift values.
730
731 @cindex @code{\stemBoth}  
732   @item @code{\stemBoth}
733     Allow stems, beams, and slurs to point either upwards or
734     downwards, decided automatically by LilyPond.
735
736 @cindex @code{\stemDown}  
737   @item @code{\stemDown}
738     Force stems, beams, and slurs to point down.
739
740 @cindex @code{\stemUp}  
741   @item @code{\stemUp}
742     Force stems, beams and slurs to point up.
743 @end table
744
745 @c .  {Spanners}
746 @node Spanners
747 @section Spanners
748 @cindex Spanners
749
750 @menu
751 * Beam::                        
752 * Slur ::                       
753 * Phrasing slur::               
754 * Ornaments::                   
755 * Grace notes::                 
756 * Bar check::                   
757 @end menu
758
759
760
761 @c .   {Beam}
762 @node Beam
763 @subsection Beams
764
765 @cindex beams
766
767 @c .    {Automatic beams}
768 @subsubsection Automatic beams
769
770
771 @cindex automatic beam generation
772 @cindex autobeam
773 @cindex @code{Voice.noAutoBeaming}
774
775 LilyPond will group flagged notes and generate beams autmatically, where
776 appropriate.
777
778 This feature can be disabled by setting the @code{Voice.noAutoBeaming}
779 property to true, which you may find necessary for the melody that goes
780 with lyrics, eg.  Automatic beaming can easily be overridden for
781 specific cases by specifying explicit beams. This is discussed in the
782 next subsubsection.
783
784
785
786 @cindex @code{Voice.autoBeamSettings}
787 @cindex @code{(end * * * *)}
788 @cindex @code{(begin * * * *)}
789
790 A large number of Voice properties are used to decide how to generate
791 beams.  Their default values appear in @file{scm/auto-beam.scm}.  In
792 general, beams can begin anywhere, but their ending location is
793 significant.  Beams can end on a beat, or at durations specified by the
794 properties in @code{Voice.autoBeamSettings}.  To end beams every quarter
795 note, for example, you could set the property @code{(end * * * *)} to
796 @code{(make-moment 1 4)}.  To end beams at every three eighth notes you
797 would set it to @code{(make-moment 1 8)}.  The same syntax can be used
798 to specify beam starting points using @code{(begin * * * *)}, eg:
799 @quotation
800 @example
801 \property Voice.autoBeamSettings \override
802     #'(end * * * *) = #(make-moment 1 4)
803 \property Voice.autoBeamSettings \override
804     #'(begin * * * *) = #(make-moment 1 8)
805 @end example
806 @end quotation
807
808 To allow different settings for different time signatures, instead of
809 the first two asterisks @code{* *} you can specify a time signature; use
810 @code{(end N M * *)} to restrict the definition to
811 `@var{N}@code{/}@var{M}' time.  For example, to specify beams ending
812 only for 6/8 time you would use the property @code{(end 6 8 * *)}.
813
814 To allow different endings for notes of different durations, instead of
815 th last two asterisks you can specify a duration; use @code{(end * * N
816 M)} to restrict the definition to beams that contain notes of
817 `@var{N}@code{/}@var{M}' duration.
818
819 For example, to specify beam endings for beams that contain 32nd notes,
820 you would use @code{(end * * 1 32)}.
821
822
823
824 @c .    {Manual beams}
825 @cindex Automatic beams
826 @subsubsection Manual beams
827 @cindex beams, manual
828 @cindex @code{]}
829 @cindex @code{[}
830
831 In some cases it may be necessary to override LilyPond's automatic
832 beaming algorithm.  For example, the auto beamer will not beam over
833 rests or bar lines, so if you want that, specify the begin and end point
834 manually using @code{[} and @code{]}:
835
836 @quotation
837 @lilypond[fragment,relative,verbatim]
838   \context Staff {
839     r4 [r8 g'' a r8] r8 [g | a] r8
840   }
841 @end lilypond
842
843
844 @cindex @code{stemLeftBeamCount}
845
846 If you have specific wishes for the number of beams, you can fully
847 control the number of beams through the properties
848 y@code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount}.
849
850 @lilypond[fragment,relative,verbatim]
851   \context Staff {
852     [f'8 r16 f g a]
853     [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
854   }
855 @end lilypond
856 @end quotation
857 @cindex @code{stemRightBeamCount}
858
859
860 @c .    {Adjusting beams}
861 @unnumberedsubsubsec Adjusting beams
862 @cindex Adjusting beams
863
864 FIXME
865
866
867         
868
869 @c .   {Slur}
870 @node Slur 
871 @subsection Slur
872 @cindex slur
873
874 @menu
875 * Slur attachments::            
876 @end menu
877
878 A slur connects chords and is used to indicate legato.  Slurs avoid
879 crossing stems.  A slur is started with @code{(} and stopped with
880 @code{)}.  The starting @code{(} appears to the right of the first note
881 in the slur.  The terminal @code{)} appears to the left of the last note
882 in the slur.  This makes it possible to put a note in slurs from both
883 sides:
884
885 @lilypond[fragment,verbatim,center]
886   f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
887 @end lilypond
888
889 @c .    {Adjusting slurs}
890 @unnumberedsubsubsec Adjusting slurs
891
892
893 @node Slur attachments
894 @subsubsection Slur attachments
895
896 The ending of a slur should whenever possible be attached to a note
897 head.  Only in some instances where beams are involved, LilyPond may
898 attach a slur to a stem end.  In some cases, you may want to override
899 LilyPond's decision, e.g., to attach the slur to the stem end.  This can
900 be done through @code{Voice.Slur}'s grob-property @code{attachment}:
901
902
903 @quotation
904 @lilypond[fragment,relative,verbatim]
905   \property Voice.Slur \set #'direction = #1
906   \property Voice.Stem \set #'length = #5.5
907   g''8(g)g4
908   \property Voice.Slur \set #'attachment = #'(stem . stem)
909   g8(g)g4
910 @end lilypond
911 @end quotation
912
913 Similarly, slurs can be attached to note heads even when beams are
914 involved:
915
916 @quotation
917 @lilypond[fragment,relative,verbatim]
918   \property Voice.Slur \set #'direction = #1
919   \property Voice.Slur \set #'attachment = #'(head . head)
920   g''16()g()g()g()d'()d()d()d
921 @end lilypond
922 @end quotation
923
924 If a slur would strike through a stem or beam, LilyPond will move the
925 slur away vertically (upward or downward).  In some cases, this may
926 cause ugly slurs that you may want to correct:
927
928 @quotation
929 @lilypond[fragment,relative,verbatim]
930   \property Voice.Stem \set #'direction = #1
931   \property Voice.Slur \set #'direction = #1
932   d'32( d'4 )d8..
933   \property Voice.Slur \set #'attachment = #'(stem . stem)
934   d,32( d'4 )d8..
935 @end lilypond
936 @end quotation
937
938 LilyPond will increase the curvature of a slur trying to stay free of
939 note heads and stems.  However, if the curvature would increase too much,
940 the slur will be reverted to its default shape.  This decision is based
941 on @code{Voice.Slur}'s grob-property @code{beautiful} value.  In some
942 cases, you may find ugly slurs beautiful, and tell LilyPond so by
943 increasing the @code{beautiful} value:
944
945 [hoe  gedefd?? wat betekent beautiful = X?]
946
947 @quotation
948 @lilypond[verbatim]
949 \score {
950   \notes \context PianoStaff <
951     \time 6/4;
952     \context Staff=up { s1 * 6/4 }
953     \context Staff=down <
954       \clef bass;
955       \autochange Staff \context Voice
956         \notes \relative c {
957           d,8( a' d f a d f d a f d )a
958         }
959     >
960   >
961   \paper {
962     linewidth = -1.;
963     \translator {
964       \VoiceContext
965       Slur \override #'beautiful = #5.0
966       Slur \override #'direction = #1
967       Stem \override #'direction = #-1
968       autoBeamSettings \override #'(end * * * *)
969         = #(make-moment 1 2)
970     }
971     \translator {
972       \PianoStaffContext
973       VerticalAlignment \override #'threshold = #'(5 . 5)
974     }
975   }
976 }
977 @end lilypond
978 @end quotation
979
980 @cindex Adusting slurs
981
982
983
984 @c .   {Phrasing slur}
985 @node Phrasing slur
986 @subsection Phrasing slur
987 @cindex phrasing slur
988 @cindex phrasing mark
989
990 A phrasing slur (or phrasing mark) connects chords and is used to
991 indicate a musical sentence.  Phrasing slurs avoid crossing stems.  A
992 phrasing slur is started with @code{\(} and stopped with @code{\)}.  The
993 starting @code{\(} appears to the right of the first note in the
994 phrasing slur.  The terminal @code{\)} appears to the left of the last
995 note in the phrasing slur.
996
997 @lilypond[fragment,verbatim,center,relative]
998   \time 6/4; c''\((d)e f(e)\)d
999 @end lilypond
1000
1001
1002 @c .   {Tie}
1003 @menu
1004 * Tie::                         
1005 * Tuplets::                     
1006 * Text spanner::                
1007 * Ottava::                      
1008 * Span requests::               
1009 @end menu
1010
1011 @node Tie
1012 @subsubsection Tie
1013
1014 @cindex Tie
1015 @cindex ties
1016 @cindex @code{~}
1017
1018 A tie connects two adjacent note heads of the same pitch.  When used
1019 with chords, it connects all of the note heads whose pitches match.
1020 Ties are indicated using the tilde symbol `@code{~}'.
1021 If you try to tie together chords which have no common pitches, a
1022 warning message will appear and no ties will be created.
1023
1024 @lilypond[fragment,verbatim,center]
1025   e' ~ e' <c' e' g'> ~ <c' e' g'>
1026 @end lilypond
1027
1028 [sparseTies]
1029
1030
1031 @c .   {Tuplets}
1032 @node Tuplets
1033 @subsubsection Tuplets
1034 @cindex Tuplets
1035 @cindex Times 
1036
1037 Tuplets are made out of a music expression by multiplying their duration
1038 with a fraction.
1039
1040 @cindex @code{\times}
1041 @example
1042   \times @var{fraction} @var{musicexpr}
1043 @end example
1044
1045 The duration of @var{musicexpr} will be multiplied by the fraction. 
1046 In print, the fraction's denominator will be printed over the notes,
1047 optionally with a bracket.  The most common tuplet is the triplet in
1048 which 3 notes have the length of 2, so the notes are 2/3 of
1049 their written length:
1050
1051 @lilypond[fragment,verbatim,center]
1052   g'4 \times 2/3 {c'4 c' c'} d'4 d'4
1053 @end lilypond
1054
1055 [todo: document tupletSpannerDuration]
1056
1057
1058
1059 @c .   {Text spanner}
1060 @node Text spanner
1061 @subsubsection Text spanner
1062 @cindex Text spanner
1063
1064 @c .   {Ottava}
1065 @node Ottava
1066 @subsubsection Ottava
1067 @cindex Ottava
1068 @unnumberedsubsubsec Ottava
1069
1070 [move to trick. Not a supported feature.]
1071
1072 @lilypond[fragment,relative,verbatim]
1073   a'''' b c a
1074   \property Voice.TextSpanner \set #'type = #'dotted-line
1075   \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1076   \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1077   \property Staff.centralCPosition = #-13
1078   a\spanrequest \start "text" b c a \spanrequest \stop "text"
1079 @end lilypond
1080
1081
1082
1083 @c .   {Span requests}
1084 @node Span requests
1085 @subsubsection Span requests
1086 @cindex Span requests
1087
1088 @cindex @code{\spanrequest}
1089
1090 @example
1091   \spanrequest @var{startstop} @var{type}
1092 @end example
1093 @cindex @code{\start}
1094 @cindex @code{\stop}
1095
1096 Define a spanning request. The @var{startstop} parameter is either -1
1097 (@code{\start}) or 1 (@code{\stop}) and @var{type} is a string that
1098 describes what should be started.  Supported types are @code{crescendo},
1099 @code{decrescendo}, @code{beam}, @code{slur}.  [FIXME: many more] This
1100 is an internal command.  Users should use the shorthands which are
1101 defined in the initialization file @file{spanners.ly}.
1102
1103 You can attach a (general) span request to a note using
1104
1105 @lilypond[fragment,verbatim,center]
1106   c'4-\spanrequest \start "slur"
1107   c'4-\spanrequest \stop "slur"
1108 @end lilypond
1109
1110 The slur syntax with parentheses is a shorthand for this.
1111
1112
1113 @c .  {Ornaments}
1114 @node Ornaments
1115 @subsection Ornaments
1116 @cindex Ornaments
1117 @menu
1118 * Articulation::                
1119 * Text scripts::                
1120 @end menu
1121
1122 @c .   {Articulation}
1123 @node Articulation
1124 @subsubsection Articulation
1125 @cindex Articulation
1126
1127 @cindex articulations
1128 @cindex scripts
1129 @cindex ornaments
1130
1131 A variety of symbols can appear above and below notes to indicate
1132 different characteristics of the performance.  These symbols can be
1133 added to a note with `@var{note}@code{-\}@var{name}'.  Numerous symbols
1134 are defined in @file{script.ly} and @file{script.scm}.  Symbols can be
1135 forced to appear above or below the note by writing
1136 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1137 respectively.  Here is a chart showing symbols above notes, with the
1138 name of the corresponding symbol appearing underneath.
1139
1140 @lilypond[]
1141
1142   \score {
1143     < \notes {
1144         \property Score.LyricSyllable \override #'font-family =
1145 #'typewriter
1146         \property Score.LyricSyllable \override #'font-shape = #'upright
1147         c''-\accent      c''-\marcato      c''-\staccatissimo c''-\fermata 
1148         c''-\stopped     c''-\staccato     c''-\tenuto        c''-\upbow
1149         c''-\downbow     c''^\lheel        c''-\rheel         c''^\ltoe
1150         c''-\rtoe        c''-\turn         c''-\open          c''-\flageolet
1151         c''-\reverseturn c''-\trill        c''-\prall         c''-\mordent
1152         c''-\prallprall  c''-\prallmordent c''-\upprall       c''-\downprall
1153         c''-\thumb       c''-\segno        c''-\coda
1154       }
1155       \context Lyrics \lyrics {
1156         accent__      marcato__      staccatissimo__ fermata
1157         stopped__     staccato__     tenuto__        upbow
1158         downbow__     lheel__        rheel__         ltoe
1159         rtoe__        turn__         open__          flageolet
1160         reverseturn__ trill__        prall__         mordent
1161         prallprall__  prallmordent__ uprall__        downprall
1162         thumb__       segno__        coda
1163       }
1164     >
1165     \paper {
1166       linewidth = 5.875\in;          
1167       indent    = 0.0;
1168     }
1169   }
1170
1171 @end lilypond
1172
1173 @c .   {Text scripts}
1174 @node Text scripts
1175 @subsubsection Text scripts
1176 @cindex Text scripts
1177
1178 In addition, it is possible to place arbitrary strings of text or markup
1179 text (see @ref{Text markup}) above or below notes by using a string
1180 instead of an identifier: @code{c^"text"}.  It is possible to use @TeX{}
1181 commands, but this should be avoided because this makes it impossible
1182 for LilyPond to compute the exact length of the string, which may lead
1183 to collisions.  Also, @TeX{} commands won't work with direct postscript
1184 output.  Fingerings can be placed by simply using digits.  All of these
1185 note ornaments appear in the printed output but have no effect on the
1186 MIDI rendering of the music.
1187
1188 @c .    {Fingerings}
1189 @unnumberedsubsubsec Fingerings
1190 @cindex Fingerings
1191
1192 To save typing, fingering instructions (digits 0 to 9 are
1193 supported) and single characters shorthands exist for a few
1194 common symbols
1195
1196 @lilypond[]
1197   \score {
1198     \notes \context Voice {
1199       \property Voice.TextScript \set #'font-family = #'typewriter
1200       \property Voice.TextScript \set #'font-shape = #'upright
1201       c''4-._"c-."      s4
1202       c''4--_"c-{}-"    s4
1203       c''4-+_"c-+"      s4
1204       c''4-|_"c-|"      s4
1205       c''4->_"c->"      s4
1206       c''4-^_"c-\\^{ }" s4
1207       c''4-1_"c-1"      s4
1208       c''4-2_"c-2"      s4
1209       c''4-3_"c-3"      s4
1210       c''4-4_"c-4"      s4
1211     }
1212     \paper {
1213       linewidth = 5.875 \in;
1214       indent    = 0.0;
1215     }
1216   }
1217
1218 @end lilypond
1219
1220
1221 @cindex @code{\textscript}
1222
1223 @example
1224
1225   \textscript @var{text} @var{style}
1226 @end example
1227
1228 Defines a text to be printed over or under a note.  @var{style} is a
1229 string that may be one of @code{roman}, @code{italic}, @code{typewriter}, 
1230 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1231
1232 You can attach a general textscript request using this syntax:
1233
1234 @quotation
1235
1236 @example 
1237 c4-\textscript "6" "finger"
1238 c4-\textscript "foo" "normal" 
1239 @end example 
1240
1241 @end quotation
1242
1243 This is equivalent to @code{c4-6 c4-"foo"}.  
1244
1245 @cindex @code{\script}
1246 @cindex scripts
1247 @cindex superscript
1248 @cindex subscript
1249
1250 @example
1251   \script @var{alias}
1252 @end example
1253
1254 Prints a symbol above or below a note.  The argument is a string which
1255 points into the script-alias table defined in @file{scm/script.scm}.
1256 Usually the @code{\script} keyword is not used directly.  Various
1257 helpful identifier definitions appear in @file{script.ly}.
1258
1259 For information on how to add scripts, consult @file{scm/script.scm}.
1260
1261
1262
1263
1264 @c .   {Grace notes}
1265 @node Grace notes
1266 @subsection Grace notes
1267
1268
1269
1270
1271
1272
1273
1274 @cindex Grace music
1275 @cindex @code{\grace}
1276 @cindex ornaments
1277 @cindex grace notes
1278 @cindex @code{graceAlignPosition}
1279
1280 @example
1281   \grace @var{musicexpr}
1282 @end example
1283
1284 A grace note expression has duration 0; the next real note is
1285 assumed to be the main note.
1286
1287 You cannot have the grace note after the main note, in terms of
1288 duration, and main notes, but you can typeset the grace notes to the
1289 right of the main note using the property
1290 @code{graceAlignPosition}.
1291 @cindex @code{flagStyle}
1292
1293 When grace music is interpreted, a score-within-a-score is set up:
1294 @var{musicexpr} has its own time bookkeeping, and you could (for
1295 example) have a separate time signature within grace notes.  While in
1296 this score-within-a-score, you can create notes, beams, slurs, etc.
1297 Unbeamed eighth notes and shorter by default have a slash through the
1298 stem.  This behavior can be controlled with the
1299 @code{flagStyle} property.
1300
1301 @quotation
1302 @lilypond[fragment,verbatim]
1303 \relative c'' {
1304   \grace c8 c4 \grace { [c16 c16] } c4
1305   \grace { \property Grace.flagStyle = "" c16 } c4
1306 }
1307
1308 @end lilypond
1309 @end quotation
1310
1311
1312 At present, nesting @code{\grace} notes is not supported. The following
1313 may cause run-time errors:
1314 @example
1315   @code{\grace @{ \grace c32 c16 @} c4}
1316 @end example
1317 Since the meaning of such a construct is unclear, we don't consider
1318 this a loss.  Similarly, juxtaposing two @code{\grace} sections is
1319 syntactically valid, but makes no sense and may cause runtime errors.
1320
1321 Ending a staff or score with grace notes may also generate a run-time
1322 error, since there will be no main note to attach the grace notes to.
1323
1324 The present implementation is not robust and generally kludgy. We expect
1325 it to change after LilyPond 1.4. Syntax changes might also be
1326 implemented.
1327
1328
1329
1330
1331
1332
1333
1334 @c .   {Stem tremolo}
1335 @menu
1336 * Glissando ::                  
1337 * Dynamics::                    
1338 * Crescendo and Decrescendo::   
1339 * Bar lines::                   
1340 * Breath marks::                
1341 @end menu
1342
1343
1344
1345 @c .   {Glissando}
1346 @node Glissando 
1347 @subsubsection Glissando
1348 @cindex Glissando 
1349
1350 @cindex @code{\glissando}
1351
1352 A glissando line can be requested by attaching a @code{\glissando} to a
1353 note:
1354
1355 @quotation
1356 @lilypond[fragment,relative,verbatim]
1357   c'' \glissando c'
1358 @end lilypond
1359 @end quotation
1360
1361 Printing of an additional text (such as @emph{gliss.}) must be done
1362 manually.
1363
1364
1365
1366 @c .   {Dynamics}
1367 @node Dynamics
1368 @subsubsection Dynamics
1369 @cindex Dynamics
1370
1371
1372
1373 @cindex @code{\ppp}
1374 @cindex @code{\pp}
1375 @cindex @code{\p}
1376 @cindex @code{\mp}
1377 @cindex @code{\mf}
1378 @cindex @code{\f}
1379 @cindex @code{\ff}
1380 @cindex @code{\fff}
1381 @cindex @code{\ffff}
1382 @cindex @code{\fp}
1383 @cindex @code{\sf}
1384 @cindex @code{\sff}
1385 @cindex @code{\sp}
1386 @cindex @code{\spp}
1387 @cindex @code{\sfz}
1388 @cindex @code{\rfz}
1389
1390
1391
1392
1393
1394
1395 Dynamic marks are specified by using an identifier after a note:
1396 @code{c4-\ff}.  The available dynamic marks are:
1397 @code{\ppp}, @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f},
1398 @code{\ff}, @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf},
1399 @code{\sff}, @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
1400
1401 @c .   {Crescendo and Decrescendo}
1402 @node Crescendo and Decrescendo
1403 @subsubsection Crescendo and Decrescendo
1404
1405 @cindex Crescendo and Decrescendo
1406 @cindex crescendo
1407 @cindex @code{\cr}
1408 @cindex @code{\rc}
1409 @cindex @code{\decr}
1410 @cindex @code{\rced}
1411 @cindex @code{\<}
1412 @cindex @code{\>}
1413 @cindex @code{\"!}
1414
1415
1416
1417 A crescendo mark is started with @code{\cr} and terminated with
1418 @code{\rc}, the textual reverse of @code{cr}.  A decrescendo mark is
1419 started with @code{\decr} and terminated with @code{\rced}.  There are
1420 also shorthands for these marks.  A crescendo can be started with
1421 @code{\<} and a decrescendo can be started with @code{\>}.  Either one
1422 can be terminated with @code{\!}.  Note that @code{\!}  must go before
1423 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
1424 after the last note.  Because these marks are bound to notes, if you
1425 want to get several marks during one note, you must use spacer notes.
1426
1427 @lilypond[fragment,verbatim,center]
1428   c'' \< \! c''   d'' \decr e'' \rced 
1429   < f''1 { s4 \< \! s2 \> \! s4 } >
1430 @end lilypond
1431
1432 You can also use a text saying @emph{cresc.} instead of hairpins. Here
1433 is an example how to do it:
1434
1435 @lilypond[fragment,relative,verbatim]
1436   \context Voice {
1437     \property Voice.crescendoText = "cresc."
1438     \property Voice.crescendoSpanner = #'dashed-line
1439     a''2\mf\< a a \!a 
1440   }
1441 @end lilypond
1442
1443
1444
1445 @c .   {Bar lines}
1446 @node Bar lines
1447 @subsubsection Bar lines
1448 @cindex Bar lines
1449
1450 @cindex @code{\bar}
1451 @cindex measure lines
1452 @cindex repeat bars
1453
1454 @example
1455   \bar @var{bartype};
1456 @end example
1457
1458 This is a short-cut for doing
1459 @example
1460   \property Score.whichBar = @var{bartype} 
1461 @end example
1462
1463 You are encouraged to use @code{\repeat} for repetitions.  See
1464 @ref{Repeats}, and the documentation of @code{whichBar} in
1465 @ref{(lilypond-internals)LilyPond context properties}.
1466
1467
1468 [FIXME]
1469
1470 @c .   {Breath marks}
1471 @node Breath marks
1472 @subsubsection Breath marks
1473 @cindex Breath marks
1474
1475
1476
1477 @c .  {Bar check}
1478 @node Bar check
1479 @subsection Bar check
1480 @cindex Bar check
1481
1482 @cindex bar check
1483 @cindex @code{barCheckNoSynchronize}
1484 @cindex @code{|}
1485
1486
1487 Whenever a bar check is encountered during interpretation, a warning
1488 message is issued if it doesn't fall at a measure boundary.  This can
1489 help you find errors in the input.  Depending on the value of
1490 @code{barCheckNoSynchronize}, the beginning of the measure will be
1491 relocated, so this can also be used to shorten measures.
1492
1493 A bar check is entered using the bar symbol, @code{|}
1494
1495
1496
1497
1498
1499
1500
1501
1502 @c . {Piano music}
1503 @node Piano music
1504 @section Piano music
1505 @menu
1506 * Automatic staff changes::     
1507 * Manual staff switches::       
1508 * Pedals::                      
1509 * Arpeggio::                    
1510 * Follow Thread::               
1511 @end menu 
1512
1513
1514 @c .   {Automatic staff changes}
1515 @node Automatic staff changes
1516 @subsection Automatic staff changes
1517 @cindex Automatic staff changes
1518
1519 [\autochange]
1520
1521 @node Manual staff switches
1522 @subsection Manual staff switches
1523
1524 @cindex manual staff switches
1525 @cindex staff switch, manual
1526
1527 @cindex @code{\translator}
1528 @example
1529   \translator @var{contexttype} = @var{name}
1530 @end example
1531
1532 A music expression indicating that the context which is a direct
1533 child of the a context of type @var{contexttype} should be shifted to
1534 a context of type @var{contexttype} and the specified name.
1535
1536 Usually this is used to switch staffs in Piano music, e.g.
1537
1538 @example
1539   \translator Staff = top @var{Music}
1540 @end example
1541
1542
1543 @c .   {Pedals}
1544 @node Pedals
1545 @subsection Pedals
1546 @cindex Pedals
1547
1548 [todo]
1549
1550
1551 @c .   {Arpeggio}
1552 @node Arpeggio
1553 @subsection Arpeggio
1554 @cindex Arpeggio
1555
1556 @cindex broken arpeggio
1557 @cindex @code{\arpeggio}
1558
1559 You can specify an arpeggio sign on a chord by attaching an
1560 @code{\arpeggio} to a note of the chord.
1561
1562
1563 @quotation
1564 @lilypond[fragment,relative,verbatim]
1565   \context Voice <c'\arpeggio e g c>
1566 @end lilypond
1567 @end quotation
1568
1569 When an arpeggio crosses staffs in piano music, you attach an arpeggio
1570 to the chords in both staffs, and set
1571 @code{PianoStaff.connectArpeggios}. LilyPond will connect the arpeggios
1572 in both staffs.
1573
1574 @quotation
1575 @lilypond[fragment,relative,verbatim]
1576   \context PianoStaff <
1577     \property PianoStaff.connectArpeggios = ##t
1578     \context Voice = one  { <c''\arpeggio e g c> }
1579     \context Voice = other { \clef bass;  <c,,\arpeggio e g>}
1580   >  
1581 @end lilypond
1582 @end quotation
1583
1584
1585
1586 @c .    {Follow Thread}
1587 @node Follow Thread
1588 @subsection Follow Thread
1589 @cindex follow thread
1590 @cindex staff switching
1591 @cindex cross staff
1592
1593 [todo: different name, eg. voice line ? ]
1594
1595 @cindex @code{followThread}
1596
1597 Whenever a voice switches to another staff a line connecting the notes
1598 can be printed automatically. This is enabled if the property
1599 @code{PianoStaff.followThread} is set to true:
1600
1601 @quotation
1602 @lilypond[fragment,relative,verbatim]
1603   \context PianoStaff <
1604     \property PianoStaff.followThread = ##t
1605     \context Staff \context Voice {
1606       c'1
1607       \translator Staff=two
1608       b2 a
1609     }
1610     \context Staff=two {\clef bass; \skip 1*2;}
1611   >  
1612 @end lilypond
1613 @end quotation
1614
1615
1616 @c . {Lyrics}
1617 @node Lyrics
1618 @section Lyrics
1619
1620
1621 @menu
1622 * Lyrics mode::                 
1623 * Printing lyrics::             
1624 * Automatic syllable durations::  
1625 @end menu
1626
1627 @c .  {Lyrics mode}
1628 @node Lyrics mode
1629 @subsection Lyrics mode
1630 @cindex Lyrics mode
1631
1632 @cindex lyric mode
1633 @cindex @code{\lyrics}
1634
1635 Lyrics mode is introduced by the keyword @code{\lyrics}.  This mode has
1636 rules that make it easy to include punctuation and diacritical marks in
1637 words: The purpose of Lyrics mode is that you can enter lyrics in @TeX{}
1638 format or a standard encoding without needing quotes.  The precise
1639 definition of this mode is ludicrous, and this will remain so until the
1640 authors of LilyPond acquire a deeper understanding of character
1641 encoding, or someone else steps up to fix this.
1642
1643 A word in Lyrics mode begins with: an alphabetic character, @code{_},
1644 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
1645 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
1646 any 8-bit character with ASCII code over 127, or a two-character
1647 combination of a backslash followed by one of @code{`}, @code{'},
1648 @code{"}, or @code{^}.
1649
1650 Subsequent characters of a word can be any character that is not a digit
1651 and not white space.  One important consequence of this is that a word
1652 can end with `@code{@}}', which may be confusing. However, LilyPond will
1653 issue a warning.  Any @code{_} character which appears in an unquoted
1654 word is converted to a space.  This provides a mechanism for introducing
1655 spaces into words without using quotes.  Quoted words can also be used
1656 in Lyrics mode to specify words that cannot be written with the above
1657 rules.  Here are some examples.  Not all of these words are printable by
1658 @TeX{}.
1659
1660 @example 
1661 Ah!             % a word
1662 2B_||_!2B       % not a word because it starts with a digit
1663 ``Hello''       % not a word because it starts with `
1664 _ _ _ _         % 4 words, each one a space 
1665 @end example 
1666
1667 Since combinations of numbers and dots are used for indicating
1668 durations, you can not enter real numbers in this mode.
1669
1670 @cindex lyrics expressions
1671
1672 Syllables are entered like notes, with pitches replaced by text.  For
1673 example, @code{Twin-4 kle4 twin-4 kle4} enters four syllables, each
1674 with quarter note duration.  Note that the hyphen has no special
1675 meaning for lyrics, and does not introduce special symbols.  See
1676 section @ref{Lexical modes} for a description of what is interpreted as
1677 lyrics.
1678
1679 Spaces can be introduced into a lyric either by using quotes
1680 (@code{"}) or by using an underscore without quotes: @code{He_could4
1681 not4}.  All unquoted underscores are converted to spaces.  Printing
1682 lyrics is discussed in the next section.
1683
1684
1685 @c .  {Printing lyrics}
1686 @node Printing lyrics
1687 @subsection Printing lyrics
1688 @cindex lyrics
1689
1690
1691 Lyric syllables must be interpreted within a @code{Lyrics} context for
1692 printing them. Here is a full example:
1693
1694 @quotation
1695 @lilypond[verbatim]
1696 \score {
1697   <
1698     \notes \transpose c'' {
1699       c d e c | c d e c |
1700       e f g2 | e4 f g2 \bar "|.";
1701     }
1702     \context Lyrics \lyrics { 
1703       Va-4 der Ja- cob Va- der Ja- cob
1704       Slaapt gij nog?2 Slaapt4 gij nog?2
1705     }
1706   >
1707 }
1708
1709 @end lilypond
1710 @end quotation
1711
1712
1713
1714
1715 @cindex extender
1716 @cindex lyric extender
1717
1718 You may want a continuous line after the syllables to show melismata. 
1719 To achieve this effect, add a @code{__} lyric as a separate word
1720 after the lyric to be extended.  This will create an extender, a line
1721 that extends over the entire duration of the lyric.  This line will
1722 run all the way to the start of the next lyric, so you may want to
1723 shorten it by using a blank lyric (using @code{_}).
1724
1725 @quotation
1726
1727 @lilypond[verbatim]
1728 \score {
1729   <
1730     \notes \relative c'' {
1731       a4 () b () c () d | c () d () b () a | c () d () b () a
1732     }
1733     \context Lyrics \lyrics {
1734       foo1 __ | bar2. __ _4 | baz1 __
1735     }
1736   >
1737 }
1738
1739 @end lilypond
1740 @end quotation
1741
1742 @cindex Lyric hyphen
1743
1744 If you want to have hyphens centered between syllables (rather than
1745 attached to the end of the first syllable) you can use the special
1746 `@code{-}@code{-}' lyric as a separate word between syllables.  This
1747 will result in a hyphen which length varies depending on the space
1748 between syllables, and which will be centered between the syllables. 
1749 For example:
1750
1751 @quotation
1752
1753 @lilypond[verbatim]
1754 \score {
1755   <
1756     \notes \transpose c'' {
1757       c d e c | c d e c |
1758       e f g2 | e4 f g2 \bar "|.";
1759     }
1760     \context Lyrics \lyrics {
1761       Va4 -- der Ja -- cob | Va -- der Ja -- cob |
1762       Slaapt gij nog?2 | Slaapt4 gij nog?2
1763     }
1764   >
1765 }
1766
1767 @end lilypond
1768 @end quotation
1769
1770
1771 @c .  {Automatic syllable durations}
1772 @node Automatic syllable durations
1773 @subsection Automatic syllable durations
1774 @cindex Automatic syllable durations
1775
1776
1777 [explain automatic phrasing]
1778 @cindex automatic lyric durations
1779 @cindex @code{\addlyrics}
1780
1781 If you have lyrics that are set to a melody, you can import the rhythm
1782 of that melody into the lyrics using @code{\addlyrics}.  The syntax for
1783 this is
1784 @example
1785   \addlyrics @var{musicexpr1 musicexpr2}
1786 @end example
1787
1788 This means that both @var{musicexpr1} and @var{musicexpr2} are
1789 interpreted, but that every non-command atomic music expression
1790 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1791 of @var{musicexpr1}.
1792 @cindex @code{automaticMelismata}
1793
1794 If the property @code{automaticMelismata} is set in the
1795 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1796 notes.
1797
1798 @quotation
1799 @lilypond[verbatim,fragment]
1800 \addlyrics
1801 \transpose c'' {
1802   \property Voice.automaticMelismata = ##t
1803   c8 () cis d8. e16 f2
1804 }
1805 \context Lyrics \lyrics {
1806  do4 re mi fa }
1807 @end lilypond
1808 @end quotation
1809
1810 You should use a single rhythm melody, and single rhythm lyrics (a
1811 constant duration is the obvious choice).  If you do not, you will get
1812 undesired effects when using multiple stanzas:
1813
1814 @quotation
1815 @lilypond[verbatim,fragment]
1816 \addlyrics
1817 \transpose c'' {
1818   c8 () cis d8. e16 f2
1819 }
1820 \context Lyrics \lyrics
1821 < { do4 re mi fa }
1822   { do8 re mi fa } >
1823
1824 @end lilypond
1825 @end quotation
1826
1827 It is valid (but probably not very useful) to use notes instead of
1828 lyrics for @var{musicexpr2}.
1829
1830
1831
1832 @c . {Chords}
1833 @node Chords
1834 @section Chords
1835 @cindex Chords
1836
1837 [chords vs. simultaneous music]
1838
1839 @menu
1840 * Chords mode::                 
1841 * Entering named chords::       
1842 * Printing named chords::       
1843 @end menu
1844
1845 @c .  {Chords mode}
1846 @node Chords mode
1847 @subsection Chords mode
1848 @cindex Chords mode
1849
1850 Chord mode is introduced by the keyword
1851 @code{\chords}.  It is similar to Note mode, but
1852 words are also looked up in a chord modifier table (containing
1853 @code{maj}, @code{dim}, etc).
1854
1855 Since combinations of numbers and dots are used for indicating
1856 durations, you can not enter real numbers in this mode.  Dashes
1857 and carets are used to indicate chord additions and subtractions,
1858 so scripts can not be entered in Chord mode.
1859
1860 @c .  {Entering named chords}
1861 @node Entering named chords
1862 @subsection Entering named chords
1863 @cindex Chords names
1864
1865 Chord names are a way to generate simultaneous music expressions that
1866 correspond with traditional chord names.  It can only be used in
1867 Chord mode (see section @ref{Lexical modes}).
1868
1869 @example
1870
1871   @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1872 @end example
1873
1874 @var{tonic} should be the tonic note of the chord, and @var{duration}
1875 is the chord duration in the usual notation.  There are two kinds of
1876 modifiers.  One type is @emph{chord additions}, which are obtained by
1877 listing intervals separated by dots.  An interval is written by its
1878 number with an optional @code{+} or @code{-} to indicate raising or
1879 lowering by half a step.  Chord additions has two effects: It adds
1880 the specified interval and all lower odd numbered intervals to the
1881 chord, and it may lower or raise the specified interval.  Intervals
1882 must be separated by a dot (@code{.}).
1883
1884
1885 Throughout these examples, chords have been shifted around the staff
1886 using @code{\transpose}.
1887
1888
1889 @quotation
1890
1891 @lilypond[fragment,verbatim]
1892 \transpose c'' {
1893   \chords {
1894     c1  c:3-       c:7     c:8
1895     c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1896   }
1897 }
1898
1899 @end lilypond
1900 @end quotation
1901
1902 @cindex @code{aug}
1903 @cindex @code{dim}
1904 @cindex @code{maj}
1905 @cindex @code{sus}
1906
1907 The second type of modifier that may appear after the @code{:} is a
1908 named modifier.  Named modifiers are listed in the file
1909 @file{chord-modifiers.ly}.  The available modifiers are @code{m} and
1910 @code{min} which lower the 3rd half a step, `@code{aug}' which
1911 raises the 5th, `@code{dim}' which lowers the 5th,
1912 `@code{maj}' which adds a raised 7th, and `@code{sus}'
1913 which replaces the 5th with a 4th.
1914
1915 @quotation
1916
1917 @lilypond[fragment,verbatim]
1918 \transpose c'' {
1919   \chords {
1920     c1:m c:min7 c:maj c:aug c:dim c:sus
1921   }
1922 }
1923
1924 @end lilypond
1925 @end quotation
1926  
1927
1928 Chord subtractions are used to eliminate notes from a chord.  The
1929 notes to be subtracted are listed after a @code{^} character,
1930 separated by dots.
1931
1932 @lilypond[fragment,verbatim,center]
1933   \transpose c'' {
1934     \chords {
1935       c1^3 c:7^5.3 c:8^7
1936     }
1937   }
1938 @end lilypond 
1939 @cindex @code{/}
1940
1941 Chord inversions can be specified by appending `@code{/}' and
1942 the name of a single note to a chord.  This has the effect of
1943 lowering the specified note by an octave so it becomes the lowest
1944 note in the chord.  If the specified note is not in the chord, a
1945 warning will be printed.
1946
1947 @lilypond[fragment,verbatim,center]
1948   \transpose c''' {
1949     \chords {
1950       c1 c/e c/g c:7/e
1951     }
1952   }
1953
1954 @end lilypond 
1955 @cindex @code{/+}
1956
1957 Bass notes can be added by `@code{/+}' and
1958 the name of a single note to a chord.  This has the effect of
1959 adding the specified note to the chord, lowered by an octave,
1960 so it becomes the lowest note in the chord.
1961
1962 @lilypond[fragment,verbatim,center]
1963   \transpose c''' {
1964     \chords {
1965       c1 c/+c c/+g c:7/+b
1966     }
1967   }
1968
1969 @end lilypond 
1970
1971 The most interesting application is printing  chord names, which is
1972 explained in the next subsection.
1973
1974 You should not combine @code{\relative} with named chords. [FIXME]
1975
1976 @c .  {Printing named chords}
1977 @node Printing named chords
1978 @subsection Printing named chords
1979
1980
1981
1982
1983
1984 @cindex printing chord names
1985 @cindex chord names
1986 @cindex chords
1987 @cindex @code{ChordNames}
1988 @cindex @code{ChordNameVoice}
1989
1990 For displaying printed chord names, use the @code{ChordNames} and
1991 @code{ChordNameVoice} contexts.  The chords may be entered either using
1992 the notation described above, or directly using simultaneous music.
1993
1994 @quotation
1995 @lilypond[verbatim]
1996 scheme = \notes {
1997   \chords {a1 b c} <d f g>  <e g b>
1998 }
1999 \score {
2000   \notes<
2001     \context ChordNamesVoice \scheme
2002     \context Staff \transpose c'' \scheme
2003   >
2004   \paper { linewidth = -1.; }
2005 }
2006 @end lilypond
2007 @end quotation
2008
2009 You can make the chord changes stand out more by setting property
2010 @code{ChordNames.chordChanges} to true.  This will only display chord
2011 names when there's a change in the chords scheme, but always display the
2012 chord name after a line break:
2013
2014 @c bug
2015 @quotation
2016 @lilypond[verbatim]
2017 scheme = \chords {
2018   c1:m \break c:m c:m c:m d
2019 }
2020
2021 \score {
2022   \notes <
2023     \context ChordNames \scheme
2024     \context Staff \transpose c'' \scheme
2025   >
2026   \paper{
2027     linewidth = 40 * \staffspace;
2028     \translator {
2029       \ChordNamesContext
2030       chordChanges = ##t
2031     }
2032   }
2033 }
2034 @end lilypond
2035 @end quotation
2036
2037
2038
2039 LilyPond examines chords specified as lists of notes to determine a
2040 name to give the chord. LilyPond will not try to
2041 identify chord inversions or added base, which may result in strange
2042 chord names when chords are entered as a list of pitches:
2043
2044 @quotation
2045 @lilypond[verbatim,center]
2046 scheme = \notes {
2047   <c'1 e' g'>
2048   <e' g' c''>
2049   <e e' g' c''>
2050 }
2051
2052 \score {
2053   <
2054     \context ChordNamesVoice \scheme
2055     \context Staff \scheme
2056   >
2057   \paper { linewidth = -1.; }
2058 }
2059 @end lilypond
2060 @end quotation
2061
2062 To specify chord inversions, append @code{/<notename>}.  To specify an
2063 added bass note, append @code{/+<notename}:
2064
2065 @quotation
2066 @lilypond[verbatim,center]
2067 scheme = \chords {
2068   d1 d/a d/+gis
2069 }
2070
2071 \score {
2072   \notes <
2073     \context ChordNames \scheme
2074     \context Staff \transpose c'' \scheme
2075   >
2076   \paper { linewidth = -1.; }
2077 }
2078 @end lilypond
2079 @end quotation
2080
2081 The chord names that LilyPond should print are fully customizable.  The
2082 code to print chord names is written in Scheme. It can be found in
2083 @file{scm/chord-name.scm}.  Chord names are based on Banter style
2084 naming, which is unambiguous and has a logical structure.  Typical
2085 American style chord names are implemented as a variation on Banter
2086 names, they can be selected by setting property @code{ChordName.style}
2087 to @code{american}:
2088
2089 @quotation
2090 @lilypond[verbatim]
2091 \include "english.ly"
2092
2093 scheme = \chords {
2094   c         % Major triad
2095   cs:m      % Minor triad
2096   df:m5-    % Diminished triad
2097   c:5^3     % Root-fifth chord
2098   c:4^3     % Suspended fourth triad
2099   c:5+      % Augmented triad
2100   c:2^3     % "2" chord
2101   c:m5-.7-  % Diminished seventh
2102   c:7+      % Major seventh
2103   c:7.4^3   % Dominant seventh suspended fourth
2104   c:5+.7    % Augmented dominant seventh
2105   c:m5-.7   % "Half" diminished seventh
2106   c:5-.7    % Dominant seventh flat fifth
2107   c:5-.7+   % Major seventh flat fifth
2108   c:m7+     % Minor-major seventh
2109   c:m7      % Minor seventh
2110   c:7       % Dominant seventh
2111   c:6       % Major sixth
2112   c:m6      % Minor sixth
2113   c:9^7     % Major triad w/added ninth
2114   c:6.9^7   % Six/Nine chord
2115   c:9       % Dominant ninth 
2116   c:7+.9    % Major ninth
2117   c:m7.9    % Minor ninth
2118 }
2119
2120 \score {
2121   \notes <
2122     \context ChordNames \scheme
2123     \context Staff \transpose c'' \scheme
2124   >
2125   \paper {
2126     \translator { 
2127       \ChordNamesContext
2128       ChordName \override #'word-space = #1 
2129       ChordName \override #'style = #'american
2130     }
2131   }
2132 }
2133 @end lilypond
2134 @end quotation
2135
2136 Similarly, Jazz style chord names are implemented as a variation on
2137 American style names:
2138 @quotation
2139 @lilypond[verbatim]
2140 scheme = \chords {
2141   % major chords
2142   c
2143   c:6           % 6 = major triad with added sixth
2144   c:maj         % triangle = maj
2145   c:6.9^7       % 6/9 
2146   c:9^7         % add9
2147
2148   % minor chords
2149   c:m           % m = minor triad
2150   c:m.6         % m6 = minor triad with added sixth
2151   c:m.7+        % m triangle = minor major seventh chord
2152   c:3-.6.9^7    % m6/9 
2153   c:m.7         % m7
2154   c:3-.9        % m9
2155   c:3-.9^7      % madd9
2156
2157   % dominant chords
2158   c:7           % 7 = dominant
2159   c:7.5+        % +7 = augmented dominant
2160   c:7.5-        % 7b5 = hard diminished dominant
2161   c:9           % 7(9)
2162   c:9-          % 7(b9)
2163   c:9+          % 7(#9)
2164   c:13^9.11     % 7(13)
2165   c:13-^9.11    % 7(b13)
2166   c:13^11       % 7(9,13)
2167   c:13.9-^11    % 7(b9,13)
2168   c:13.9+^11    % 7(#9,13)
2169   c:13-^11      % 7(9,b13)
2170   c:13-.9-^11   % 7(b9,b13)
2171   c:13-.9+^11   % 7(#9,b13)
2172
2173   % half diminished chords
2174   c:m5-.7               % slashed o = m7b5
2175   c:9.3-.5-     % o/7(pure 9)
2176
2177   % diminished chords
2178   c:m5-.7-      % o = diminished seventh chord
2179 }
2180
2181 \score {
2182   \notes <
2183     \context ChordNames \scheme
2184     \context Staff \transpose c'' \scheme
2185   >
2186   \paper {
2187     \translator { 
2188       \ChordNamesContext
2189       ChordName \override #'word-space = #1 
2190       ChordName \override #'style = #'jazz
2191     }
2192   }
2193 }
2194 @end lilypond
2195 @end quotation
2196
2197 @node Writing parts
2198 @section Writing parts
2199
2200 @c .  {Transpose}
2201 @menu
2202 * Rehearsal marks::             
2203 * Instrument names::            
2204 * Transpose::                   
2205 * Multi measure rests::         
2206 @end menu
2207
2208 [TODO:
2209
2210 partcombine
2211
2212 rehearsal marks
2213
2214 tranposing midi property.
2215
2216 instrument names
2217
2218
2219
2220 @c .   {Rehearsal marks}
2221 @node Rehearsal marks
2222 @subsection Rehearsal marks
2223 @cindex Rehearsal marks
2224 @cindex mark
2225 @cindex @code{\mark}
2226 @cindex @code{Mark_engraver}
2227
2228 @example
2229   \mark @var{unsigned};
2230   \mark @var{string};
2231   \mark ; 
2232 @end example
2233
2234 With this command, you can print a rehearsal mark above the system. You
2235 can provide a number, a string or a markup text as argument. If there is
2236 no argument, the property @code{rehearsalMark} is used and automatically
2237 incremented.
2238
2239 @lilypond[fragment,verbatim]
2240 \relative c'' {
2241   c1 \mark "A2";
2242   c1 \mark ; 
2243   c1 \mark ; 
2244   c1 \mark "12";
2245   c1 \mark #'(music "scripts-segno") ;
2246   c1
2247 }
2248 @end lilypond
2249
2250 @node Instrument names
2251 @subsection Instrument names
2252
2253 You can specify an instrument name for a staff by setting
2254 @code{Staff.instrument} and @code{Staff.instr}. This will print a string
2255 before the start of the staff. For the first start, @code{instrument} is
2256 used, for the next ones @code{instr} is used.
2257
2258 @lilypond[verbatim]
2259 \score { \notes {
2260   \property Staff.instrument = "instr " { c''4 } }
2261   \paper { linewidth = -1.;
2262     \translator { \StaffContext
2263     \consists "Instrument_name_engraver"; } } }
2264 @end lilypond
2265
2266 This requires  that you add the @code{Instrument_name_engraver} to the
2267 staff context.
2268
2269
2270 @node Transpose
2271 @subsection Transpose
2272 @cindex Transpose
2273 @cindex transposition of pitches
2274 @cindex @code{\transpose}
2275
2276 A music expression can be transposed with @code{\transpose}.  The syntax
2277 is
2278 @example
2279   \transpose @var{pitch} @var{musicexpr}
2280 @end example
2281
2282 This means that middle C in @var{musicexpr} is transposed to
2283 @var{pitch}.
2284
2285 @code{\transpose} distinguishes between enharmonic pitches: both
2286 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
2287 a tone.  The first version will print sharps and the second version
2288 will print flats.
2289
2290 @quotation
2291 @lilypond[fragment,verbatim]
2292 \context Staff {
2293   \clef "F";
2294   { \key e \major; c d e f }
2295   \clef "G";
2296   \transpose des'' { \key e \major; c d e f }
2297   \transpose cis'' { \key e \major; c d e f }
2298 }
2299
2300 @end lilypond
2301 @end quotation
2302
2303 If you want to use both @code{\transpose} and @code{\relative}, then
2304 you must use @code{\transpose} first.  @code{\relative} will have no
2305 effect music that appears inside a @code{\transpose}.
2306
2307
2308 @c .  {Multi measure rests}
2309 @node  Multi measure rests
2310 @subsection Multi measure rests
2311 @cindex Multi measure rests
2312
2313 @cindex @code{R}
2314
2315 Multi measure rests are entered using `@code{R}'. It is specifically
2316 meant for entering parts: the rest can expand to fill a score with
2317 rests, or it can be printed as a single multimeasure rest This expansion
2318 is controlled by the property @code{Score.skipBars}. If this is set to true,
2319 Lily will not expand empty measures, and the appropriate number is added
2320 automatically.
2321
2322 @lilypond[fragment,verbatim]
2323  \time 3/4; R2.*2 \property Score.skipBars = ##t R2.*17  R2.*4
2324 @end lilypond
2325
2326 Currently, there is  no way to condense multiple rests into a single
2327 multimeasure rest.
2328
2329 @cindex condensing rests
2330
2331 @c . {Custodes}
2332 @node Custodes
2333 @section Custodes
2334 @cindex Custos
2335 @cindex Custodes
2336
2337 A @emph{custos} (plural: @emph{custodes}; latin word for "guard") is a
2338 staff context symbol that appears at the end of a staff line.  It
2339 anticipates the pitch of the first note(s) of the following line and
2340 thus helps the player or singer to manage line breaks during
2341 performance, thus enhancing readability of a score.
2342
2343 @quotation
2344 @lilypond[verbatim]
2345 \score {
2346   \notes { c'1 d' e' d' \break c' d' e' d' }
2347   \paper {
2348     \translator {
2349       \StaffContext
2350       \consists Custos_engraver;
2351       Custos \override #'style = #'mensural;
2352     }
2353   }
2354 }
2355 @end lilypond
2356 @end quotation
2357
2358 Custodes were frequently used in music notation until the 16th century.
2359 There were different appearences for different notation styles.
2360 Nowadays, they have survived only in special forms of musical notation
2361 such as via the editio vaticana dating back to the beginning of the 20th
2362 century.
2363
2364 For typesetting custodes, just put a @code{Custos_engraver} into the
2365 @code{StaffContext} when declaring the @code{\paper} block.  In this
2366 block, you can also globally control the appearance of the custos symbol
2367 by setting the custos @code{style} property.  Currently supported styles
2368 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
2369 @code{mensural}.
2370
2371 @quotation
2372 \paper @{
2373   \translator @{
2374       \StaffContext
2375       \consists Custos_engraver;
2376       Custos \override #'style = #'mensural;
2377   @}
2378 @}
2379 @end quotation
2380
2381 The property can also be set locally, for example in a @code{\notes}
2382 block:
2383
2384 @quotation
2385 \notes @{
2386   \property Staff.Custos \override #'style = #'vaticana
2387   c'1 d' e' d' \break c' d' e' d'
2388 @}
2389 @end quotation
2390
2391 @c . {Page layout}
2392 @node Page layout
2393 @section Page layout
2394 @cindex Page layout
2395
2396 @menu
2397 * Paper block::                 
2398 * Paper variables::             
2399 * Font Size::                   
2400 * Paper size::                  
2401 * Line break::                  
2402 * Page break::                  
2403 @end menu
2404
2405 @c .  {Paper block}
2406 @node Paper block
2407 @subsection Paper block
2408 @cindex Paper block
2409
2410 The most important output definition is the @code{\paper} block, for
2411 music notation.  The syntax is
2412
2413 @example
2414   @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2415 @end example
2416
2417 where each of the items is one of
2418
2419 @itemize @bullet
2420   @item  An assignment.  The assignment must be terminated by a
2421        semicolon.  
2422
2423   @item  A context definition.  See section @ref{Context definitions} for
2424        more information on context definitions.
2425
2426   @item  \stylesheet  declaration.  Its syntax is
2427        @example
2428                 \stylesheet @var{alist}
2429        @end example
2430
2431         See @file{font.scm} for details of @var{alist}.
2432 @end itemize
2433
2434 @c .  {Paper variables}
2435 @node Paper variables
2436 @subsection Paper variables 
2437 @cindex Paper variables
2438
2439 The paper block has some variables you may want to use or change:
2440
2441 @table @code
2442 @cindex @code{indent}
2443   @item @code{indent}  
2444     The indentation of the first line of music.
2445 @cindex @code{staffspace}
2446
2447   @item @code{staffspace}
2448     The distance between two staff lines, calculated from the center
2449     of the lines.  You should use either this or @code{stafflinethickness}
2450     as a unit for distances you modify.
2451   
2452 @cindex @code{linewidth}
2453   @item @code{linewidth}  
2454     Sets the width of the lines.
2455
2456 If set to a negative value, a single
2457     unjustified line is produced.
2458
2459 @cindex @code{textheight}
2460
2461   @item @code{textheight}  
2462     Sets the total height of the music on each page. Only used by
2463     ly2dvi.
2464 @cindex @code{interscoreline}
2465
2466   @item @code{interscoreline}  
2467     Sets the spacing between the score lines. Defaults to 16 pt.
2468 @cindex @code{interscorelinefill}
2469
2470   @item @code{interscorelinefill}  
2471     If set to a positive number, the distance between the score 
2472     lines will stretch in order to fill the full page. In that
2473     case @code{interscoreline} specifies the minimum spacing.
2474     Defaults to 0.
2475 @cindex @code{stafflinethickness}
2476
2477   @item @code{stafflinethickness}  
2478     Determines the thickness of staff lines, and also acts as a scaling
2479     parameter for other line thicknesses.
2480 @end table
2481
2482
2483
2484 @c .  {Font size}
2485 @node Font Size
2486 @subsection Font size
2487 @cindex font size
2488
2489 The Feta font provides musical symbols at six different sizes.  These
2490 fonts are 11 point, 13 point, 16 point, 20 point,
2491 23 point, and 26 point.  The point size of a font is the
2492 height of the five lines in a staff when displayed in the font.
2493
2494 Definitions for these sizes are the files @file{paperSZ.ly}, where
2495 @code{SZ} is one of 11, 13, 16, 20, 23 and 26.  If you include any of
2496 these files, the identifiers @code{paperEleven}, @code{paperThirteen},
2497 @code{paperSixteen}, @code{paperTwenty}, @code{paperTwentythree}, and
2498 @code{paperTwentysix} are defined respectively.  The default
2499 @code{\paper} block is also set.
2500
2501 The font definitions are generated using a Scheme function. For more
2502 details, see the file @file{font.scm}.
2503
2504
2505
2506 @c .  {Paper size}
2507 @node Paper size
2508 @subsection Paper size
2509 @cindex Paper size
2510
2511 @cindex paper size
2512 @cindex page size
2513 @cindex @code{papersize}
2514
2515 To change the paper size, you must first set the
2516 @code{papersize} variable at top level.  Set it to
2517 the strings @code{a4}, @code{letter}, or @code{legal}.  After this
2518 specification, you must set the font as described above.  If you want
2519 the default font, then use the 20 point font.  The new paper size will
2520 not take effect if the font is not loaded and selected afterwards.
2521
2522 @example
2523         papersize = "a4"
2524         \include "paper16.ly"
2525
2526         \score @{
2527                 ...
2528                 \paper @{ \paperSixteen @}
2529         @}
2530 @end example
2531
2532 The file "paper16.ly" will now include a file named @file{a4.ly}, which
2533 will set the paper variables @code{hsize} and @code{vsize} (used by
2534 @code{ly2dvi})
2535
2536
2537
2538
2539
2540
2541
2542 @c .  {Line break}
2543 @node Line break
2544 @subsection Line break
2545
2546 @cindex line breaks
2547 @cindex breaking lines
2548
2549 Line breaks are normally computed automatically. They are chosen such
2550 that the resulting spacing has low variation, and looks neither cramped
2551 nor loose.
2552
2553 Occasionally you might want to override the automatic breaks; you can do
2554 this by specifying @code{\break}. This will force a line break at this
2555 point. Do remember that line breaks can only occur at places where there
2556 are barlines.  If you want to have a line break where there is no
2557 barline, you can force a barline by entering @code{\bar "";}.
2558
2559 Similarly, @code{\noBreak} forbids a  line break at a certain point.
2560
2561 @cindex @code{\penalty}
2562
2563 The @code{\break} and @code{\noBreak} commands are defined in terms of
2564 the penalty command:
2565 @example
2566   \penalty @var{int} @code{;}
2567 @end example
2568
2569 This imposes   encourages or discourages LilyPond to make a line break
2570 at this point.
2571
2572 @strong{Warning} do not use @code{\penalty} directly. It is rather
2573 kludgy, and slated for rewriting.
2574
2575 @c .  {Page break}
2576 @node Page break
2577 @subsection Page break
2578
2579 @cindex page breaks
2580 @cindex breaking pages
2581
2582
2583 Page breaks are normally computed by @TeX{}, so they are not under direct
2584 control.  However, you can insert a commands into the @file{.tex} output to
2585 instruct @TeX{} where to break pages. For more details, see  the
2586 example file @file{input/test/between-systems.ly}
2587
2588 [or -> Tricks? ]
2589
2590
2591
2592
2593
2594
2595 @c . {Sound}
2596 @node Sound
2597 @section Sound
2598 @cindex Sound
2599 @menu
2600 * MIDI block::                  
2601 * MIDI instrument names::       
2602 * Tempo::                       
2603 @end menu
2604
2605 @c .  {MIDI block}
2606 @node MIDI block
2607 @subsection MIDI block
2608 @cindex MIDI block
2609
2610
2611 The MIDI block is analogous to the paper block, but it is somewhat
2612 simpler.  The @code{\midi} block can contain:
2613 @cindex MIDI block
2614
2615 @itemize @bullet
2616   @item  a @code{\tempo} definition
2617   @item  context definitions
2618 @end itemize
2619
2620 Assignments in the @code{\midi} block are not allowed.
2621
2622
2623
2624 @cindex context definition
2625
2626 Context definitions follow precisely the same syntax as within the
2627 \paper block.  Translation modules for sound are called performers.
2628 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2629
2630
2631 @c .  {MIDI instrument names}
2632 @node MIDI instrument names
2633 @subsection MIDI instrument names
2634 @cindex instrument names
2635 @cindex @code{Staff.midiInstrument}
2636 @cindex @code{Staff.instrument}
2637
2638 The MIDI instrument name is set by the @code{Staff.midiInstrument}
2639 property or, if that property is not set, the @code{Staff.instrument}
2640 property.  The instrument name should be chosen from the following list.
2641 If the selected string does not exactly match, then LilyPond uses the
2642 default piano.
2643
2644 [FIXME: to appendix ]
2645
2646
2647 @example 
2648 "acoustic grand"            "contrabass"           "lead 7 (fifths)"
2649 "bright acoustic"           "tremolo strings"      "lead 8 (bass+lead)"
2650 "electric grand"            "pizzicato strings"    "pad 1 (new age)"
2651 "honky-tonk"                "orchestral strings"   "pad 2 (warm)"
2652 "electric piano 1"          "timpani"              "pad 3 (polysynth)"
2653 "electric piano 2"          "string ensemble 1"    "pad 4 (choir)"
2654 "harpsichord"               "string ensemble 2"    "pad 5 (bowed)"
2655 "clav"                      "synthstrings 1"       "pad 6 (metallic)"
2656 "celesta"                   "synthstrings 2"       "pad 7 (halo)"
2657 "glockenspiel"              "choir aahs"           "pad 8 (sweep)"
2658 "music box"                 "voice oohs"           "fx 1 (rain)"
2659 "vibraphone"                "synth voice"          "fx 2 (soundtrack)"
2660 "marimba"                   "orchestra hit"        "fx 3 (crystal)"
2661 "xylophone"                 "trumpet"              "fx 4 (atmosphere)"
2662 "tubular bells"             "trombone"             "fx 5 (brightness)"
2663 "dulcimer"                  "tuba"                 "fx 6 (goblins)"
2664 "drawbar organ"             "muted trumpet"        "fx 7 (echoes)"
2665 "percussive organ"          "french horn"          "fx 8 (sci-fi)"
2666 "rock organ"                "brass section"        "sitar"
2667 "church organ"              "synthbrass 1"         "banjo"
2668 "reed organ"                "synthbrass 2"         "shamisen"
2669 "accordion"                 "soprano sax"          "koto"
2670 "harmonica"                 "alto sax"             "kalimba"
2671 "concertina"                "tenor sax"            "bagpipe"
2672 "acoustic guitar (nylon)"   "baritone sax"         "fiddle"
2673 "acoustic guitar (steel)"   "oboe"                 "shanai"
2674 "electric guitar (jazz)"    "english horn"         "tinkle bell"
2675 "electric guitar (clean)"   "bassoon"              "agogo"
2676 "electric guitar (muted)"   "clarinet"             "steel drums"
2677 "overdriven guitar"         "piccolo"              "woodblock"
2678 "distorted guitar"          "flute"                "taiko drum"
2679 "guitar harmonics"          "recorder"             "melodic tom"
2680 "acoustic bass"             "pan flute"            "synth drum"
2681 "electric bass (finger)"    "blown bottle"         "reverse cymbal"
2682 "electric bass (pick)"      "skakuhachi"           "guitar fret noise"
2683 "fretless bass"             "whistle"              "breath noise"
2684 "slap bass 1"               "ocarina"              "seashore"
2685 "slap bass 2"               "lead 1 (square)"      "bird tweet"
2686 "synth bass 1"              "lead 2 (sawtooth)"    "telephone ring"
2687 "synth bass 2"              "lead 3 (calliope)"    "helicopter"
2688 "violin"                    "lead 4 (chiff)"       "applause"
2689 "viola"                     "lead 5 (charang)"     "gunshot"
2690 "cello"                     "lead 6 (voice)" 
2691 @end example 
2692
2693
2694
2695
2696
2697 @c .  {Tempo}
2698 @node Tempo
2699 @subsection Tempo
2700 @cindex Tempo
2701 @cindex beats per minute
2702 @cindex metronome marking
2703
2704 @cindex @code{\tempo}
2705 @example
2706   \tempo @var{duration} = @var{perminute} @code{;}
2707 @end example
2708
2709 Used to specify the tempo.  For example, @code{\tempo 4 = 76;} requests
2710 output with 76 quarter notes per minute.
2711
2712
2713
2714
2715
2716 @c . {Music entry}
2717 @node Music entry
2718 @section Music entry
2719 @cindex Music entry
2720 @menu
2721 * Relative::                    
2722 * Point and click::             
2723 @end menu
2724
2725
2726
2727 @c .  {Relative}
2728 @node Relative
2729 @subsection Relative
2730 @cindex Relative
2731 @cindex relative octave specification
2732
2733 Octaves are specified by adding @code{'} and @code{,} to pitch names.
2734 When you copy existing music, it is easy to accidentally put a pitch in
2735 the wrong octave and hard to find such an error.  To prevent these
2736 errors, LilyPond features octave entry.
2737
2738 @cindex @code{\relative}
2739 @example
2740   \relative @var{startpitch} @var{musicexpr}
2741 @end example
2742
2743 The octave of notes that appear in @var{musicexpr} are calculated as
2744 follows: If no octave changing marks are used, the basic interval
2745 between this and the last note is always taken to be a fourth or less.
2746   The octave changing marks @code{'} and @code{,} can then
2747 be added to raise or lower the pitch by an extra octave.  Upon entering
2748 relative mode, an absolute starting pitch must be specified that will
2749 act as the predecessor of the first note of @var{musicexpr}.
2750
2751 This distance is determined without regarding accidentals: a
2752 @code{fisis} following a @code{ceses} will be put above the
2753 @code{ceses}.
2754
2755 Entering scales is straightforward in relative mode.
2756
2757 @lilypond[fragment,verbatim,center]
2758   \relative c'' {
2759     g a b c d e f g g, g
2760   }
2761 @end lilypond
2762
2763 And octave changing marks are used for intervals greater than a fourth.
2764
2765 @lilypond[fragment,verbatim,center]
2766   \relative c'' {
2767     c g c f, c' a, e'' }
2768 @end lilypond
2769
2770 If the preceding item is a chord, the first note of the chord is used
2771 to determine the first note of the next chord.  But other notes
2772 within the second chord are determined by looking at the immediately
2773 preceding note.
2774
2775 @lilypond[fragment,verbatim,center]
2776   \relative c' {
2777     c <c e g> 
2778     <c' e g>
2779     <c, e' g>
2780   }
2781 @end lilypond 
2782 @cindex @code{\notes}
2783
2784 The pitch after the @code{\relative} contains a notename.  To parse
2785 the pitch as a notename, you have to be in note mode, so there must
2786 be a surrounding @code{\notes} keyword (which is not
2787 shown here).
2788
2789 The relative conversion will not affect @code{\transpose} or
2790 @code{\relative} sections in its argument.  If you want to use
2791 relative within transposed music, you must place an additional
2792 @code{\relative} inside the @code{\transpose}.
2793
2794
2795 @c .  {Point and click}
2796 @node Point and click
2797 @subsection Point and click
2798
2799 [todo]
2800
2801 @c . {Engravers}
2802 @node Engravers
2803 @section Engravers
2804 @cindex engravers
2805 @menu
2806 * Notation Contexts::           
2807 * Creating contexts::           
2808 * Default contexts::            
2809 * Context properties::          
2810 * Context definitions::         
2811 @end menu
2812
2813 @c .  {Music expressions}
2814
2815
2816
2817 @c .  {Notation Contexts}
2818 @node Notation Contexts
2819 @subsection Notation Contexts
2820
2821 @cindex notation contexts
2822
2823 Notation contexts are objects that only exist during a run of LilyPond.
2824 During the interpretation phase of LilyPond (when lily prints
2825 "interpreting music"), music a @code{\score} block is interpreted in
2826 time order, i.e. in much the same order that humans read, play, and
2827 write music.
2828
2829 During this reading, the notation context is holds the state
2830 for the current point within the music. It contains information like
2831
2832 @itemize @bullet
2833   @item What notes are playing at this point?
2834   @item What symbols will be printed at this point?
2835   @item What is the current key signature, time signature, point within
2836        the measure, etc.?
2837 @end itemize
2838
2839 Contexts are grouped hierarchically: A @code{Voice} context is
2840 contained in a @code{Staff} context (because a staff can contain
2841 multiple voices at any point), a @code{Staff} context is contained in
2842 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
2843 these can all contain multiple staffs).
2844
2845
2846 Contexts associated with sheet music output are called @emph{notation
2847 contexts}, those for sound output are called performance contexts.
2848
2849
2850 @node Creating contexts
2851 @subsection Creating contexts
2852
2853 @cindex @code{\context}
2854 @cindex context selection
2855
2856 Contexts for a music expression can be selected manually, using the
2857 following music expression.
2858
2859 @example
2860   \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
2861 @end example
2862
2863 This instructs lilypond to interpret @var{musicexpr} within the context
2864  of type @var{contexttype} and with name @var{contextname}.  If this
2865 context does not exist, it will be created.  
2866
2867 @quotation
2868
2869 @lilypond[verbatim]
2870 \score {
2871   \notes \relative c'' {
2872     c4 <d4 \context Staff = "another" e4> f
2873   }
2874 }
2875
2876 @end lilypond
2877 @end quotation
2878
2879 In this example, the @code{c} and @code{d} are printed on the
2880 default staff.  For the @code{e}, a context Staff called
2881 @code{another} is specified; since that does not exist, a new
2882 context is created.  Within @code{another}, a (default) Voice context
2883 is created for the @code{e4}.  When all music referring to a
2884 context is finished, the context is ended as well.  So after the
2885 third quarter, @code{another} is removed.
2886
2887
2888
2889 @node Default contexts
2890 @subsection Default contexts
2891
2892 Most music expressions don't need @code{\context}: they inherit the
2893 notation context from their parent. Each note is a music expression, and
2894 as you can see in the following example, only the sequential music
2895 enclosing the three notes has an explicit context. 
2896
2897 @lilypond[verbatim]
2898 \score { \notes \context Voice = goUp { c'4 d' e' } } 
2899 @end lilypond
2900
2901 There are some quirks that you must keep in mind when dealing with
2902 defaults:
2903
2904 Every top-level music is interpreted by the Score context, in other
2905 words, you may think of @code{\score} working like
2906 @example
2907         \score @{
2908                 \context Score @var{music}
2909         @}
2910 @end example
2911
2912 Sequential music follows the contexts of its "children".  Take this example
2913 @lilypond
2914 \score { \context Score \notes { c'4 (  d' )e' } }
2915 @end lilypond
2916
2917 The sequential music is interpreted by the Score context initially
2918 (notice that the @code{\context} specification is redundant), but when a
2919 note is encountered, contexts are setup to accept that note. In this
2920 case, a Thread, Voice and Staff are created. The rest of the sequential
2921 music is also interpreted with the same Thread, Voice and Staff context,
2922 putting the notes on the same staff, in the same voice.
2923
2924 This is a convenient mechanism, but do not expect opening chords to work
2925 without @code{\context}. For every note, a separate staff
2926 @lilypond
2927 \score { \notes <c'4 es'> } 
2928 @end lilypond
2929
2930 Of course, if the chord is preceded by a normal note in sequential
2931 music, the chord will be interpreted by the Thread of the preceding
2932 note:
2933 @lilypond
2934 \score { \notes { c'4 <c'4 es'> }  }
2935 @end lilypond
2936
2937
2938
2939 @node Context properties
2940 @subsection Context properties
2941
2942 Notation contexts can be modified from within the @file{.ly} file. The
2943 following music expression does that job:
2944
2945 @cindex @code{\property}
2946 @example
2947   \property @var{contextname}.@var{propname} =  @var{value}
2948 @end example
2949
2950 Sets the @var{propname} property of the context @var{contextname} to the
2951 specified Scheme expression @var{value}.  All @var{propname} and
2952 @var{contextname} are strings, which are typically unquoted.
2953
2954 Properties that are set in one context are inherited by all of the
2955 contained contexts.  This means that a property valid for the
2956 @code{Voice} context can be set in the @code{Score} context (for
2957 example) and thus take effect in all @code{Voice} contexts.
2958
2959
2960
2961
2962 @c .  {Context definitions}
2963 @node Context definitions
2964 @subsection Context definitions
2965
2966 @cindex context definition
2967 @cindex translator definition
2968
2969 [todo: ]
2970
2971 A notation contexts is defined by the following information
2972
2973 @enumerate 1
2974   @item  A name.
2975
2976   @item  The LilyPond modules that do the actual conversion of music to
2977        notation.  Each module is a so-called
2978        @emph{engraver}
2979 @cindex engraver
2980 .
2981
2982   @item  How these modules should cooperate, i.e. which ``cooperation
2983        module'' should be used.  This cooperation module is a special
2984        type of engraver.
2985
2986   @item  What other contexts the context can contain,
2987
2988   @item  What properties are defined.
2989 @end enumerate
2990
2991 A context definition has this syntax:
2992
2993 @example
2994
2995   \translator @code{@{}
2996                       @var{translatorinit} @var{translatormodifierlist}
2997                     @code{@}}
2998 @end example
2999
3000 @var{translatorinit} can be an identifier or 
3001 @example
3002   \type @var{typename} @code{;}
3003 @end example
3004 where @var{typename} is one of
3005
3006 @table @code
3007 @cindex @code{Engraver_group_engraver}
3008   @item @code{Engraver_group_engraver}  
3009     The standard cooperation engraver.
3010 @cindex @code{Score_engraver}
3011
3012   @item @code{Score_engraver}  
3013     This is cooperation module that should be in the top level context.
3014 @cindex @code{Grace_engraver_group}
3015
3016   @item @code{Grace_engraver_group}  
3017     This is a special cooperation module (resembling
3018     @code{Score_engraver}) that is used to created an embedded
3019     `miniscore'.
3020 @end table 
3021
3022 @var{translatormodifierlist} is a list of items where each item is
3023 one of
3024
3025 @itemize @bullet
3026   @item  @code{\consists} @var{engravername} @code{;}  
3027     Add @var{engravername} to the list of modules in this context. 
3028   The order of engravers added with @code{\consists} is
3029     significant.
3030   
3031   @item  @code{\consistsend} @var{engravername} @code{;}  
3032     Analogous to @code{\consists}, but makes sure that
3033     @var{engravername} is always added to the end of the list of
3034     engravers.
3035
3036     Some engraver types need to be at the end of the list; this
3037     insures they are put there, and stay there, if a user adds or
3038     removes engravers.  This command is usually not needed for
3039     end-users.
3040     
3041   @item  @code{\accepts} @var{contextname} @code{;}  
3042     Add @var{contextname} to the list of  context this context can
3043     contain.  The first listed context is the context to create by
3044     default.
3045
3046   @item @code{\denies}. The opposite of @code{\accepts}. Added for
3047 completeness, but is never used in practice.
3048  
3049   
3050   @item  @code{\remove} @var{engravername} @code{;}  
3051     Remove a previously added (with @code{\consists}) engraver.
3052   
3053   @item  @code{\name} @var{contextname} @code{;}  
3054     This sets name of the context, e.g. @code{Staff}, @code{Voice}.  If
3055     the name is not specified, the translator won't do anything.
3056
3057   @item  @var{propname} @code{=} @var{value} @code{;}  
3058     A property assignment.
3059 @end itemize
3060
3061 In the @code{\paper} block, it is also possible to define translator
3062 identifiers.  Like other block identifiers, the identifier can only
3063 be used as the very first item of a translator.  In order to define
3064 such an identifier outside of @code{\score}, you must do
3065
3066 @quotation
3067
3068 @example 
3069 \paper @{
3070   foo = \translator @{ @dots{} @}
3071 @}
3072 \score @{
3073   \notes @{
3074     @dots{}
3075   @}
3076   \paper @{
3077     \translator @{ \foo @dots{} @}
3078   @}
3079 @} 
3080 @end example 
3081
3082 @end quotation
3083
3084
3085 @cindex paper types, engravers, and pre-defined translators
3086
3087 Some pre-defined identifiers can simplify modification of
3088 translators.  The pre-defined identifiers are:
3089
3090 @table @code
3091 @cindex @code{StaffContext}
3092   @item @code{StaffContext}  
3093     Default Staff context. 
3094 @cindex @code{RhythmicStaffContext}
3095
3096   @item @code{RhythmicStaffContext}  
3097     Default RhythmicStaff context. 
3098 @cindex @code{VoiceContext}
3099
3100   @item @code{VoiceContext}  
3101     Default Voice context.  
3102 @cindex @code{ScoreContext}
3103
3104   @item @code{ScoreContext}  
3105     Default Score context. 
3106
3107 @cindex @code{HaraKiriStaffContext}
3108
3109   @item @code{HaraKiriStaffContext}  
3110     Staff context that does not print if it only contains rests. 
3111     Useful for orchestral scores.@footnote{Harakiri, also called
3112     Seppuku, is the ritual suicide of the Japanese Samourai warriors.}
3113
3114 @end table
3115
3116 Using these pre-defined values, you can remove or add items to the
3117 translator:
3118
3119 @quotation
3120
3121 @example 
3122 \paper @{
3123   \translator @{
3124     \StaffContext
3125     \remove Some_engraver;
3126     \consists Different_engraver;
3127   @}
3128 @} 
3129 @end example 
3130
3131 @end quotation
3132
3133       
3134
3135
3136         Properties can be preset within the @code{\translator} block
3137 corresponding to the appropriate context.  In this case, the syntax
3138 is
3139
3140 @example
3141   @var{propname} @code{=} @var{value}
3142 @end example
3143
3144 This assignment happens before interpretation starts, so a
3145 @code{\property} expression will override any predefined settings.
3146
3147 The property settings are used during the interpretation phase.  They
3148 are read by the LilyPond modules where interpretation contexts are
3149 built of.  These modules are called @emph{translators}.  Translators for
3150 notation are called @emph{engravers}, and translators for sound are
3151 called @emph{performers}.
3152
3153
3154
3155
3156 @c . {Syntactic details}
3157 @node Syntactic details
3158 @section Syntactic details
3159 @cindex Syntactic details
3160 @menu
3161 * Top level::                   
3162 * Identifiers::                 
3163 * Music expressions::           
3164 * Manipulating music expressions::  
3165 * Assignments::                 
3166 * Lexical details::             
3167 * Lexical modes::               
3168 * Ambiguities::                 
3169 @end menu
3170
3171 @c .  {Top level}
3172 @node Top level
3173 @subsection Top level
3174 @cindex Top level
3175
3176 This section describes what you may enter at top level.
3177
3178
3179 @unnumberedsubsec Score definition
3180 @cindex score definition
3181
3182 The output is generated combining a music expression with an output
3183 definition.  A score block has the following syntax:
3184
3185 @example
3186   \score @{ @var{musicexpr} @var{outputdefs} @}
3187 @end example
3188
3189 @var{outputdefs} are zero or more output definitions.  If no output
3190 definition is supplied, the default @code{\paper} block will be added.
3191
3192
3193 @c .   {Score}
3194 @subsubsection Score
3195 @cindex Score
3196
3197 @c .   {Paper}
3198 @subsubsection Paper
3199 @cindex Paper
3200
3201 @c .   {Midi}
3202 @subsubsection Midi
3203 @cindex Midi
3204
3205 @c .   {Header}
3206 @subsubsection Header
3207 @cindex Header
3208 @cindex @code{\header}
3209
3210 The syntax is
3211
3212 @example
3213   \header @{ @var{key1} = @var{val1};
3214 @cindex @code{ly2dvi}
3215              @var{key2} = @var{val2}; @dots{} @}
3216 @end example
3217
3218
3219 A header describes the file's contents.  It can also appear in a
3220 @code{\score} block.  Tools like @code{ly2dvi} can use this
3221 information for generating titles.  Key values that are used by
3222 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
3223 metre, arranger, piece and tagline.
3224
3225 It is customary to put the @code{\header} at the top of the file.
3226
3227 @subsubsection Default output
3228
3229 A @code{\midi} or @code{\paper} block at top-level sets the default
3230
3231 paper block for all scores that lack an explicit paper block.
3232
3233 @c .  {Identifiers}
3234 @node Identifiers
3235 @subsection Identifiers
3236 @cindex  Identifiers
3237
3238 All of the information in a LilyPond input file, is represented as a
3239 Scheme value. In addition to normal Scheme data types (such as pair,
3240 number, boolean, etc.), LilyPond has a number of specialized data types,
3241
3242 @itemize @bullet
3243 @item Input
3244 @item c++-function
3245 @item Music
3246 @item Identifier
3247 @item Translator_def
3248 @item Duration
3249 @item Pitch
3250 @item Score
3251 @item Music_output_def
3252 @item Moment (rational number)
3253 @end itemize
3254
3255 LilyPond also includes some transient object types. Objects of these
3256 types are built during a LilyPond run, and do not `exist' per se within
3257 your input file. These objects are created as a result of your input
3258 file, so you can include commands in the input to manipulate them,
3259 during a lilypond run.
3260
3261 @itemize @bullet
3262 @item Grob: short for Graphical object. See @ref{Grobs}. 
3263 @item Molecule: device-independent page output object,
3264 including dimensions.  Produced by some Grob functions
3265 See @ref{Molecules}
3266 @item Translator: object that produces audio objects or Grobs. This is
3267 not yet user accessible.
3268 @item Font_metric: object representing a font. (See @ref{Font metrics})
3269
3270 @end itemize
3271
3272
3273 @node Music expressions
3274 @subsection Music expressions
3275
3276 @cindex music expressions
3277
3278 Music in LilyPond is entered as a music expression.  Notes, rests, lyric
3279 syllables are music expressions, and you can combine music expressions
3280 to form new ones, for example by enclosing a list of expressions in
3281 @code{\sequential @{ @}} or @code{< >}.  In this example, a compound
3282 expression is formed out of the quarter note @code{c} and a quarter note
3283 @code{d}:
3284
3285 @example 
3286 \sequential @{ c4 d4 @} 
3287 @end example 
3288
3289 @cindex Sequential music
3290 @cindex @code{\sequential}
3291 @cindex sequential music
3292 @cindex @code{<}
3293 @cindex @code{>}
3294 @cindex Simultaneous music
3295 @cindex @code{\simultaneous}
3296
3297 The two basic compound  music expressions are simultaneous  and
3298 sequential music.
3299
3300 @example
3301   \sequential @code{@{} @var{musicexprlist} @code{@}}
3302   \simultaneous @code{@{} @var{musicexprlist} @code{@}}
3303 @end example
3304 For both, there is a shorthand:
3305 @example
3306   @code{@{} @var{musicexprlist} @code{@}}
3307 @end example
3308 for sequential and
3309 @example
3310   @code{<} @var{musicexprlist} @code{>}
3311 @end example
3312 for simultaneous music.
3313 Other compound music expressions include
3314 @example
3315  \repeat @var{expr}
3316  \transpose @var{pitch} @var{expr}
3317  \apply @var{func} @var{expr}
3318  \context @var{type} = @var{id} @var{expr}
3319  \times @var{fraction} @var{expr}
3320 @end example
3321
3322 In principle, the way in which you nest sequential and simultaneous to
3323 produce music is not relevant.  In the following example, three chords
3324 are expressed in two different ways:
3325
3326 @lilypond[fragment,verbatim,center]
3327   \notes \context Voice {
3328     <a c'> <b  d' > <c' e'>
3329     < { a b  c' } { c' d' e' } >
3330   }
3331 @end lilypond
3332
3333 However, in some cases, LilyPond will also try to choose contexts, and
3334 use the structure of the music expression  to do so. This can have
3335 undesired effects: for example, LilyPond will create a separate staff
3336 for each note if you start a @code{\score} with a  chord:
3337 @lilypond[verbatim,center]
3338   \score {
3339     \notes <c''4 e''>
3340     \paper {
3341       linewidth = -1.;
3342     }
3343   }
3344 @end lilypond
3345   The solution is to explicitly instantiate the context you desire.
3346 In this case this is typically a Voice context
3347 @lilypond[verbatim,center]
3348   \score {
3349     \notes\context Voice <c''4 e''>
3350     \paper {
3351       linewidth = -1.;
3352     }
3353   }
3354 @end lilypond
3355 If you use @code{\context Staff} you will get separate stems for each
3356 note head, leading to collisions, so don't use that.
3357
3358
3359
3360 @c . {Manipulating music expressions}
3361 @node Manipulating music expressions
3362 @subsection  Manipulating music expressions
3363
3364 The @code{\apply} mechanism gives you access to the internal
3365 representation of music. You can write Scheme-functions that operate
3366 directly on it. The syntax is 
3367 @example
3368         \apply #@var{func} @var{music}
3369 @end example
3370 This means that @var{func} is applied to @var{music}.  The function
3371 @var{func} should return a music expression.
3372
3373 This example replaces the text string of a script. It also shows a dump
3374 of the music it processes, which is useful if you want to know more
3375 about how music is stored.
3376 @lilypond[verbatim]
3377 #(define (testfunc x)
3378         (if (equal? (ly-get-mus-property x 'text) "foo")
3379                 (ly-set-mus-property x 'text "bar"))
3380         ;; recurse
3381         (ly-set-mus-property x 'elements
3382           (map testfunc (ly-get-mus-property x 'elements)))
3383         (display x)
3384         x        
3385 )
3386 \score { \notes
3387   \apply #testfunc { c4_"foo" }
3388
3389 @end lilypond
3390
3391 For more information on what is possible, see the @ref{Tricks} and the
3392 automatically generated documentation.
3393
3394 As always: directly accessing internal representations is dangerous: the
3395 implementation is subject to changes, so you should not use this if
3396 possible.
3397
3398
3399 @c .   {Assignments}
3400 @node Assignments
3401 @subsection Assignments
3402 @cindex Assignments
3403
3404 Identifiers allow objects to be assigned to names during the parse
3405 stage.  To assign an identifier, you use @var{name}@code{=}@var{value}
3406 and to refer to an identifier, you preceed its name with a backslash:
3407 `@code{\}@var{name}'.  @var{value} is any valid Scheme value or any of
3408 the input-types listed above.  Identifier assignments can appear at top
3409 level in the LilyPond file, but also in @code{\paper} blocks.
3410
3411 Semicolons are forbidden after top level assignments, but mandatory in
3412 other places. The rules about semicolons and assignments are very
3413 confusing, but when LilyPond input evolves more towards Scheme, we hope
3414 that this problem will grow smaller.
3415
3416 An identifier can be created with any string for its name, but you will
3417 only be able to refer to identifiers whose names begin with a letter,
3418 being entirely alphabetical.  It is impossible to refer to an identifier
3419 whose name is the same as the name of a keyword.
3420
3421 The right hand side of an identifier assignment is parsed completely
3422 before the assignment is done, so it is allowed to redefine an
3423 identifier in terms of its old value, e.g.
3424
3425 @example
3426 foo = \foo * 2.0
3427 @end example
3428
3429 When an identifier is referenced, the information it points to is
3430 copied.  For this reason, an identifier reference must always be the
3431 first item in a block.
3432 @example
3433 \paper  @{
3434         foo = 1.0
3435         \paperIdent % wrong and invalid
3436 @}
3437
3438 \paper @{
3439         \paperIdent % correct
3440         foo = 1.0 @}
3441 @end example
3442
3443 @c .  {Lexical details}
3444 @node Lexical details
3445 @subsection Lexical details
3446 @cindex Lexical details
3447 @menu
3448 @end menu
3449
3450 @c .   {Comments}
3451 @subsubsection Comments
3452 @cindex Comments
3453
3454 @cindex @code{%}
3455
3456
3457 A one line comment is introduced by a @code{%} character. 
3458 Block comments are started by @code{%@{} and ended by @code{%@}}. 
3459 They cannot be nested.
3460
3461 @c .  {Direct Scheme}
3462 @subsubsection Direct Scheme
3463 @cindex Scheme
3464 @cindex GUILE
3465 @cindex Scheme, in-line code
3466
3467
3468 LilyPond contains a Scheme interpreter (the GUILE library) for
3469 internal use. In some places Scheme expressions also form valid syntax:
3470 whereever it is allowed,
3471 @example
3472   #@var{scheme}
3473 @end example
3474 evaluates the specified Scheme code. If this is used at toplevel, then
3475 the result is discarded. Example:
3476 @example
3477   \property Staff.TestObject \override #'foobar =  #(+ 1 2)
3478 @end example
3479
3480 @code{\override} expects two Scheme expressions, so there are two Scheme
3481 expressions. The first one is a symbol (@code{foobar}), the second one
3482 an integer (namely, 3).
3483
3484 Scheme is a full-blown programming language, and a full discussion is
3485 outside the scope of this document. Interested readers are referred to
3486 the website @uref{http://www.schemers.org/} for more information on
3487 Scheme.
3488
3489
3490 @c .   {Keywords}
3491 @subsubsection Keywords
3492 @cindex Keywords
3493
3494
3495 Keywords start with a backslash, followed by a number of lower case
3496 alphabetic characters.  These are all the keywords.
3497
3498 @example
3499 apply arpeggio autochange spanrequest commandspanrequest
3500 simultaneous sequential accepts alternative bar breathe
3501 char chordmodifiers chords clef cm consists consistsend
3502 context denies duration dynamicscript elementdescriptions
3503 font grace header in lyrics key mark pitch
3504 time times midi mm name pitchnames notes outputproperty
3505 override set revert partial paper penalty property pt
3506 relative remove repeat addlyrics partcombine score
3507 script stylesheet skip textscript tempo translator
3508 transpose type
3509 @end example
3510
3511 @c .   {Integers}
3512 @subsubsection Integers
3513
3514 @cindex integers
3515 @cindex @code{+}
3516 @cindex @code{-}
3517 @cindex @code{*}
3518 @cindex @code{/}
3519
3520 Formed from an optional minus sign followed by digits.  Arithmetic
3521 operations cannot be done with integers, and integers cannot be mixed
3522 with reals.
3523
3524 @c .   {Reals}
3525 @subsubsection Reals
3526 @cindex real numbers
3527
3528
3529
3530
3531
3532 Formed from an optional minus sign and a sequence of digits followed
3533 by a @emph{required} decimal point and an optional exponent such as
3534 @code{-1.2e3}.  Reals can be built up using the usual operations:
3535 `@code{+}', `@code{-}', `@code{*}', and
3536 `@code{/}', with parentheses for grouping.
3537
3538 @cindex @code{\mm},
3539 @cindex @code{\in}
3540 @cindex @code{\cm}
3541 @cindex @code{\pt}
3542 @cindex dimensions
3543
3544 A real constant can be followed by one of the dimension keywords:
3545 @code{\mm} @code{\pt}, @code{\in}, or @code{\cm}, for millimeters,
3546 points, inches and centimeters, respectively.  This converts the number
3547 to a real that is the internal representation of dimensions.
3548
3549
3550 @c .   {Strings}
3551 @subsubsection Strings
3552 @cindex string
3553 @cindex concatenate
3554
3555 Begins and ends with the @code{"} character.  To include a @code{"}
3556 character in a string write @code{\"}.  Various other backslash
3557 sequences have special interpretations as in the C language.  A string
3558 that contains no spaces can be written without the quotes.  See
3559 @ref{Lexical modes} for details on unquoted strings; their
3560 interpretation varies depending on the situation.  Strings can be
3561 concatenated with the @code{+} operator.
3562
3563 The tokenizer accepts the following commands. They have no grammatical
3564 function, hence they can appear anywhere in the input.
3565
3566
3567 @c .   {Main input}
3568 @subsubsection Main input
3569 @cindex Main input
3570
3571 @cindex @code{\maininput}
3572
3573 The @code{\maininput} command is used in init files to signal that the
3574 user file must be read. This command cannot be used in a user file.
3575
3576 @c .   {File inclusion}
3577 @subsubsection Main input
3578 @cindex Main input
3579
3580 @subsubsection File inclusion
3581 @cindex @code{\include}
3582 @example
3583   \include @var{filename}
3584 @end example
3585
3586 Include @var{filename}.  The argument @var{filename} may be a quoted string (an
3587 unquoted string will not work here!) or a string identifier.  The full
3588 filename including the @file{.ly} extension must be given,
3589
3590 @subsubsection Version information 
3591 @cindex @code{\version}
3592 @example
3593   \version @var{string} ;
3594 @end example
3595
3596 Specify the version of LilyPond that a file was written for.  The
3597 argument is a version string in quotes, for example @code{"1.2.0"}. 
3598 This is used to detect invalid input, and to aid
3599 @code{convert-ly}  a tool that automatically upgrades input files. See
3600 See @ref{convert-ly} for more information on @code{convert-ly}.
3601
3602 @cindex convert-ly
3603
3604
3605 @c .   {Pitch names}
3606 @subsubsection Defining pitch names
3607 @cindex Lexical modes
3608 @cindex definining pitch names
3609 @cindex pitch names, definining
3610 @cindex note names
3611 @cindex chord modifier names
3612
3613 A @code{\paper} block at top level sets the default paper block.  A
3614 @code{\midi} block at top level works similarly.
3615
3616 @c .   {Assignments}
3617 @subsubsection Assignments
3618 @cindex assignments
3619 @cindex @code{#}
3620
3621 Identifier assignments may appear at top level.  @ref{Assignments}
3622
3623
3624
3625 @c .    {Direct scheme}
3626 @subsubsection Direct scheme
3627 @cindex Direct scheme
3628
3629 Scheme statements maybe issued to produce interesting side-effects. 
3630
3631
3632 @c .  {Lexical modes}
3633 @node Lexical modes
3634 @subsection Lexical modes
3635 @cindex Lexical modes
3636 @cindex input mode
3637 @cindex mode, input 
3638 @cindex @code{\notes}
3639 @cindex @code{\chords}
3640 @cindex @code{\lyrics}
3641
3642 To simplify entering notes, lyrics, and chords, LilyPond has three
3643 special input modes on top of the default mode: note, lyrics and chords
3644 mode.  These input modes change the way that normal, unquoted words are
3645 interpreted: for example, the word @code{cis} may be interpreted as a
3646 C-sharp, as a lyric syllable `cis' or as a C-sharp major triad
3647 respectively.
3648
3649 A mode switch is entered as a compound music expressions
3650 @example
3651 @code{\notes} @var{musicexpr}
3652 @code{\chords} @var{musicexpr}
3653 @code{\lyrics}  @var{musicexpr}.
3654 @end example
3655
3656 In each of these cases, these expressions do not add anything to the
3657 meaning of their arguments.  They are just a way to indicate that the
3658 arguments should be parsed in indicated mode.  The modes are treated in
3659 more detail in the sections @ref{Note entry}, @ref{Lyrics} and
3660 @ref{Chords}.
3661
3662 You may nest different input modes.
3663
3664 @c .  {Ambiguities}
3665 @node Ambiguities
3666 @subsection Ambiguities
3667 @cindex ambiguities
3668 @cindex grammar
3669
3670
3671 The grammar contains a number of ambiguities. We hope to resolve them at
3672 some time.
3673
3674 @itemize @bullet
3675   @item  The assignment
3676
3677          @example 
3678 foo = bar 
3679 @end example 
3680
3681        can be interpreted as making a string identifier @code{\foo}
3682        containing @code{"bar"}, or a music identifier @code{\foo}
3683        containing the syllable `bar'.
3684
3685   @item  The assignment
3686
3687          @example 
3688 foo = -6 
3689 @end example 
3690
3691        can be interpreted as making an integer identifier
3692        containing -6, or a Request identifier containing the
3693        fingering `6' (with neutral direction).
3694
3695   @item  If you do a nested repeat like
3696
3697        @quotation
3698
3699 @example 
3700 \repeat @dots{}
3701 \repeat @dots{}
3702 \alternative 
3703 @end example 
3704
3705        @end quotation
3706
3707        then it is ambiguous to which @code{\repeat} the
3708        @code{\alternative} belongs.  This is the classic if-then-else
3709        dilemma.  It may be solved by using braces.
3710
3711   @item  (an as yet unidentified ambiguity :-)
3712 @end itemize
3713
3714
3715
3716
3717 @c . {Unsorted}
3718 @node Unsorted
3719 @section Unsorted
3720
3721 [mucho todo]
3722
3723 Translation?
3724
3725 @cindex properties
3726 @unnumberedsubsec Translation property
3727
3728
3729 [todo: add \set/\override/\revert]
3730
3731
3732
3733 @cindex output properties
3734 @unnumberedsubsec Output properties
3735
3736 These allow you to tweak what is happening in the back-end
3737 directly. If you want to control every detail of the output
3738 formatting, this is the feature to use. The downside to this is that
3739 you need to know exactly how the backend works. Example:
3740
3741
3742 @lilypond[fragment,verbatim]
3743 \relative c'' { c4
3744   \context Staff \outputproperty
3745   #(make-type-checker 'note-head-interface)
3746   #'extra-offset = #'(0.5 . 0.75)
3747   <c8 e g> }
3748 @end lilypond
3749
3750 This selects all note heads occurring at current staff level, and sets
3751 the @code{extra-offset} of those heads to @code{(0.5,0.75)}, shifting
3752 them up and right.
3753
3754 Use of this feature is entirely on your own risk: if you use this, the
3755 result will depend very heavily on the implementation of the backend,
3756 which we change regularly and unscrupulously.
3757
3758
3759 Don't move the finger 2, only text "m.d." ...
3760 @lilypond[verbatim]
3761 #(define (make-text-checker text)
3762    (lambda (grob) (equal? text (ly-get-elt-property grob 'text))))
3763
3764 \score {    
3765   \notes\relative c''' {
3766     \property Voice.Stem \set #'direction = #1
3767     \outputproperty #(make-text-checker "m.d.")
3768       #'extra-offset = #'(-3.5 . -4.5)
3769     a^2^"m.d."    
3770   }
3771   \paper { linewidth = -1.; }
3772 }
3773 @end lilypond
3774
3775
3776 @menu
3777 * Text markup::                 
3778 @end menu
3779
3780 @node Text markup
3781 @subsection Text markup
3782 @cindex text markup
3783 @cindex markup text
3784
3785 LilyPond has an internal mechanism to typeset texts: you can
3786 form text markup expressions by composing scheme expressions
3787 in the following way:
3788
3789 @lilypond[verbatim]
3790 \score { \notes \relative c' {
3791   b-#"text"
3792   c-#'(bold "text")
3793   d-#'(lines "one" (bold "text"))
3794   e-#'(music (named "noteheads-2" "flags-u3"))
3795 }
3796 \paper { linewidth = 10.\cm; } }
3797 @end lilypond
3798
3799 Formally, Scheme markup text is defined as follows:
3800
3801 @example
3802 text: string | (head? text+)
3803 head: markup | (markup+)
3804 markup-item: property | abbrev | @var{fontstyle}
3805 property: (@var{key} . @var{value})
3806 abbrev: @code{rows lines roman music bold italic named super sub text}
3807 @end example
3808
3809 The markup is broken down and converted into a list of grob properties,
3810 which are prepended to the grop's property list.  The
3811 @var{key}-@var{value} pair is a grob property.
3812 @ignore
3813 [Why is this useful?]
3814
3815 ?Snapnie: markup text is eerste item dat voldoet aan mijn gewelfdige,
3816 ideale idee van direct-en-eenmalig-per-item te zetten properties, ipv
3817 gehaspel via \property en hopen dat je property (enkel) in juiste item
3818 terecht gaat komen.  Heb je deze wel bewust meegemaakt:
3819
3820 Sender: jan@appel.lilypond.org
3821 To: Han-Wen <hanwen@cs.uu.nl>   
3822 Subject: (elt) properties
3823 Organization: Jan at Appel
3824 From: janneke@gnu.org
3825 Date: 01 Nov 2000 10:39:10 +0100
3826 Message-ID: <m3og00av5t.fsf@appel.lilypond.org>
3827 User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7
3828 MIME-Version: 1.0
3829 Content-Type: text/plain; charset=us-ascii
3830 Lines: 77
3831 Xref: appel.lilypond.org vers:1991
3832
3833 Hi,
3834
3835 Wat ik vooral mis, is een koele manier om een propertie eenmalig aan
3836 een element te hangen.  Hoop dat je zinvol over wilt meedenken; zie
3837 het monster van les-nereides.  Misschien dat we 't niet moeten doen
3838 voor 1.4 maar wachten tot properties nog wat verder
3839 uitgekristalliseerd zijn?
3840
3841 Nu moet je
3842
3843    \property Voice.Stem \push #'length = #'6
3844    a
3845    \property Voice.Stem \pop #'length
3846    b
3847
3848 waarmee je in feite zeg tegen de stem-engraver: vanaf nu aan moet je
3849 alle stems 6 lang maken (maakt stem); onee, doe maar weer default
3850 lengte.
3851
3852 Maar dat is eigenlijk niet wat je bedoelt, wat je zou willen is net
3853 zo'n directe interface als wat we nu hebben voor markup text, bv. iets
3854 van:
3855
3856    a+#'(Stem::length . 6) b
3857
3858 Bij markup text kun je direct en eenmalig een reeks properties aan een
3859 enkel item toevoegen; iets wat je volgens mij vaak nodig hebt.
3860
3861 Ik zat eerst te denken aan ``request properties'': properties
3862 toevoegen aan request, die dan worden doorgegeven aan alle items die
3863 door dat request worden gemaakt.
3864
3865 Maar misschien zuigt dat wel te vreselijk en moeten we iets van
3866 ``volatile'' properties maken.
3867
3868 Btw,
3869
3870     \property Voice.Slur \push #'dash = #1
3871     \property Voice.Slur \pop #'dash
3872     a()b
3873     \property Voice.Slur \push #'direction = #-1
3874     \property Voice.Slur \pop #'direction
3875     ()c
3876
3877 of de kluts waar ik brr van word, eigenlijk ook alleen doenbaar is
3878 voor wat veelgebruikte properties:
3879
3880     slurDotted = \property Voice.Slur \push #'dash = #1
3881     slurNoDots = \property Voice.Slur \pop #'dash
3882     slurUp = \property Voice.Slur \push #'direction = #1
3883     slurDown = \property Voice.Slur \push #'direction = #-1
3884     slurBoth = \property Voice.Slur \pop #'direction
3885
3886     [..]
3887
3888     \slurDotted\slurDown
3889     a()b
3890     ()c
3891     \slurNoDots\slurBoth
3892
3893 zou toch graag meer iets in trant van, als je begrijpt wat ik bedoel
3894
3895     Slur+#'((dash . 1) (direction . 1))
3896     b () c
3897     Slur-#'(dash direction)
3898
3899 ofwel
3900
3901     a(+#'((dash . 1) (direction . 1))
3902     )b(+#'((dash . 1) (direction . 1))
3903     )c
3904 @end ignore
3905
3906 The following abbreviations are currently
3907 defined:
3908
3909 @table @code
3910 @item rows
3911 horizontal mode: set all text on one line (default)
3912 @item lines
3913  vertical mode: set every text on new line
3914 @item roman
3915  select roman font
3916 @item music
3917  select feta font
3918 @item bold
3919  select bold series
3920 @item italic
3921  select italic shape
3922 @item named
3923  lookup by character name
3924 @item text
3925  plain text lookup (by character value)
3926 @item super
3927  superscript
3928 @item sub
3929  subscript
3930 @end table
3931
3932
3933 @var{fontstyle} may be any of @code{finger volta timesig mmrest mark
3934 script large Large dynamic}
3935
3936 @ignore
3937 [kern, raise ??]
3938 Wat is daarmee, zijn toch gewoon grob properties van text-interface?
3939 @end ignore
3940
3941 @c .{Local emacs vars}
3942 @c Local variables:
3943 @c mode: texinfo
3944 @c minor-mode: font-lock
3945 @c minor-mode: outline
3946 @c outline-layout: (-1 : 0)
3947 @c outline-use-mode-specific-leader: "@c \."
3948 @c outline-primary-bullet: "{"
3949 @c outline-stylish-prefixes: nil
3950 @c outline-override-protect: t
3951 @c End:
3952