]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/refman.itely
patch::: 1.3.103.jcn3
[lilypond.git] / Documentation / user / refman.itely
1 @c TODO: 
2 @c - Reinsert subsection commands that were lost in the
3 @c   ancient conversion from YODL!  /MB
4 @c - Restructure! Separate internal commands from user level commands. /MB
5 @c - Add some words about Guile.  /MB
6 @c - Fix indexing (keyindex) so it doesn't add line breaks  /MB
7
8 @node Reference Manual, ,  , Top
9 @menu
10 * Overview::                      Overview
11 * Top level::                     Top level
12 * notenames::                     notenames
13 * Lexical conventions::           Lexical conventions
14 * Other languages::                      notelang
15 * modes::                         modes
16 * Types::                         Types
17 * Music expressions::             Music expressions
18 * Atomic music expressions::      Atomic music expressions
19 * Note specification::                      notedesc
20 * barlines::                      barlines
21 * Manual beams::                  Manual beam
22 * stem tremolo::                       tremolo
23 * Compound music expressions::    Compound music expressions
24 * relative::                      relative
25 * Repeats::                       Repeats       
26 * transpose::                     transpose
27 * Ambiguities::                   Ambiguities
28 * Notation conversion specifics:: Notation conversion specifics
29 * autobeam::                      autobeam
30 * lyricprint::                    lyricprint
31 * Notation Contexts::             Notation Contexts
32 * Properties::                    Changing formatting
33 * Notation output definitions::   Notation output definitions
34 * paper::                         paper
35 * Paper variables::                     papervars
36 * contextdefs::                   contextdefs
37 @c should include backend doco
38 @c * engravers::                     engravers
39 * Sound output::                  Sound output
40 * midilist::                      midilist
41 * Pre-defined Identifiers::       Pre-defined Identifiers
42 @end menu
43
44 @chapter Reference Manual
45
46
47
48 @node Overview, , , Reference Manual
49 @section Overview
50
51 This document@footnote{This document has been revised for
52 LilyPond 1.2.} describes the the GNU LilyPond input format, which is
53 a language for defining music.  We call this language @emph{Music
54 Definition Language} or @emph{Mudela}, for short.@footnote{If anybody
55 comes up with a better name, we'd gladly take this.  Gourlay already
56 uses a ``Musical Description Language,'' ISO standard 10743 defines a
57 ``Standard Music Description Language.''  We're not being original
58 here.}
59
60 @emph{Mudela} is a language that allows you to
61
62 @itemize @bullet
63   @item  create musical expressions by combining pitches, durations 
64   @item  output those musical expressions to various formats
65   @item  give those musical expressions and output definitions names, so
66        you can enter them in manageable chunks.
67 @end itemize
68
69 @emph{Mudela} aims to define a piece of music completely, both from
70 typesetting and from a performance point of view.
71
72
73
74 @node Top level, , , Reference Manual
75 @section Top level
76
77 @cindex top level
78
79 This section describes what you may enter at top level.
80
81
82
83 @cindex score definition
84
85 The output is generated combining a music expression with an output
86 definition.  A score block has the following syntax:
87
88 @example
89   \score @{ @var{musicexpr} @var{outputdefs} @}
90 @end example
91
92 @var{outputdefs} are zero or more output definitions.  If no output
93 definition is supplied, the default @code{\paper} block will be added.
94
95
96
97 @cindex header
98
99 @keyindex{header}
100
101 The syntax is
102
103 @example
104   \header @{ @var{key1} = @var{val1};
105              @var{key2} = @var{val2}; @dots{} @}
106 @end example
107
108 A header describes the file's contents.  It can also appear in a
109 @code{\score} block.  Tools like @code{ly2dvi}@indexcode{ly2dvi} can use this
110 information for generating titles.  Key values that are used by
111 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
112 metre, arranger, piece and tagline.
113
114 It is customary to put the @code{\header} at the top of the file.
115
116
117 @node notenames, , ,  Reference Manual
118
119 Note name tables can be specified using
120
121 @example
122    \notenames@keyindex{notenames}
123   @{ @var{assignmentlist} @}
124 @end example
125
126 @var{assignmentlist} is a list of definitions of the form
127
128 @example
129   @var{name} = @var{pitch}
130 @end example
131
132 Chord modifiers can be set analogously, with
133 @code{\chordmodifiers}@keyindex{chordmodifiers}.
134
135 A @code{\paper} block at top level sets the default paper block.  A
136 @code{\midi} block at top level works similarly.
137
138
139
140 LilyPond contains a Scheme interpreter (the GUILE library) for
141 internal use.  The following commands access the interpreter
142 directly.
143
144 @example
145   #@var{scheme}
146 @end example
147
148 Evaluates the specified Scheme code.  The result is discarded.
149
150 Identifier assignments may appear at top level.  Semicolons are
151 forbidden after top level assignments.
152
153
154
155 @node Lexical conventions, , ,  Reference Manual
156 @section Lexical conventions
157
158 @cindex lexical conventions
159
160
161
162 @cindex comment
163
164 @indexcode{%}
165
166
167 A one line comment is introduced by a `@code{%}' character. 
168 Block comments are started by `@code{%@{}' and ended by `@code{%@}}'. 
169 They cannot be nested.
170
171
172
173 @cindex keyword
174
175 Keywords start with a backslash, followed by a number of lower case
176 alphabetic characters.  These are all the keywords.
177
178 [FIXME]
179
180 @example
181   \accepts
182   \addlyrics
183   \alternative
184   \bar
185   \breathe
186   \chordmodifiers
187   \chords
188   \clef
189   \cm
190   \consists
191   \consistsend
192   \context
193   \duration
194   \font
195   \grace
196   \header
197   \in
198   \key
199   \keysignature
200   \lyrics
201   \mark
202   \midi
203   \mm
204   \musicalpitch
205   \name
206   \notenames
207   \notes
208   \paper
209   \partial
210   \penalty
211   \property
212   \pt
213   \relative
214   \remove
215   \repeat
216   \repetitions
217   \scm
218   \scmfile
219   \score
220   \script
221   \sequential
222   \simultaneous
223   \skip
224   \spanrequest
225   \tempo
226   \textscript
227   \time
228   \times
229   \translator
230   \transpose
231   \type
232 @end example
233
234
235
236
237 @cindex integer
238
239 Formed from an optional minus sign followed by digits.  Arithmetic
240 operations cannot be done with integers, and integers cannot be mixed
241 with reals.
242
243
244
245 @cindex real
246  
247
248 Formed from an optional minus sign and a sequence of digits followed
249 by a @emph{required} decimal point and an optional exponent such as
250 @code{-1.2e3}.  Reals can be built up using the usual operations:
251 `@code{+}@indexcode{+}', `@code{-}@indexcode{-}', `@code{*}@indexcode{*}', and
252 `@code{/}@indexcode{/}', with parentheses for grouping.
253
254 A real constant can be followed by one of the dimension
255 keywords:
256 @cindex dimensions
257  @code{\mm}@keyindex{mm},
258 @code{\pt}@keyindex{pt}, @code{\in}@keyindex{in}, or
259 @code{\cm}@keyindex{cm}, for millimeters, points, inches and
260 centimeters, respectively.  This converts the number to a real that
261 is the internal representation of dimensions.
262
263
264
265 @cindex string
266  
267
268 Begins and ends with the `@code{"}' character.  To include a `@code{"}'
269 character in a string write `@code{\"}'.  Various other backslash
270 sequences have special interpretations as in the C language.  A
271 string that contains no spaces can be written without the quotes. 
272 See section XREF-modes [FIXME] for details on unquoted strings; their
273 interpretation varies depending on the situation.  Strings can be
274 concatenated with the `@code{+}' operator.
275
276
277 The tokenizer accepts the following commands.  They can appear
278 anywhere.
279
280 @example
281   \maininput@keyindex{maininput}
282 @end example
283
284 This command is used in init files to signal that the user file must
285 be read. This command cannot be used in a user file.
286
287 @example
288   \include@keyindex{include} @var{file}
289 @end example
290
291 Include @var{file}.  The argument @var{file} may be a quoted string (an
292 unquoted string will not work here!) or a string identifier.  The full
293 filename including the @file{.ly} extension must be given,
294
295 @example
296   \version@keyindex{version} @var{string} ;
297 @end example
298
299 Specify the version of LilyPond that a file was written for.  The
300 argument is a version string in quotes, for example @code{"1.2.0"}. 
301 This is used to detect invalid input, and to aid
302 @code{convert-mudela}, a tool that automatically upgrades input files.
303
304
305
306 @cindex other languages
307
308 @node Other languages, , ,  Reference Manual
309
310 Note name definitions have been provided in various languages. 
311 Simply include the language specific init file.  For example:
312 `@code{\include "english.ly"}'.  The available language files and the
313 names they define are:
314
315 @example 
316                         Note Names               sharp       flat
317 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
318 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
319 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
320 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
321 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
322 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
323 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b 
324 @end example 
325
326 Pitch names can be redefined using the
327 @code{\notenames}@keyindex{notenames} command, see
328 subsection XREF-notenames [FIXME].
329
330
331
332 @cindex lexical modes
333
334 @cindex modes
335
336 @node modes, , ,  Reference Manual
337
338 To simplify entering notes, lyrics, and chords, @emph{Mudela} has three
339 special input modes on top of the default mode.  In each mode, words
340 are identified on the input.  If @code{"word"} is encountered, it is
341 treated as a string.  If @code{\word} is encountered, it is treated as
342 a keyword or as an identifier.  The behavior of the modes differs in
343 two ways: Different modes treat unquoted words differently, and
344 different modes have different rules for deciding what is a word.
345
346 @table @samp
347   @item Normal mode.
348 @cindex mode!normal
349  
350     At the start of parsing, @emph{Mudela} is in Normal mode.  In Normal
351     mode, a word is an alphabetic character followed by alphanumeric
352     characters.  If @code{word} is encountered on the input it is
353     treated as a string.
354
355   @item Note mode.
356 @cindex mode!note
357
358     Note mode is introduced by the keyword
359     @code{\notes}@keyindex{notes}.  In Note mode, words can only
360     contain alphabetic characters.  If @code{word} is encountered,
361     LilyPond first checks for a notename of @code{word}.  If no
362     notename is found, then @code{word} is treated as a string.
363
364     Since combinations of numbers and dots are used for indicating
365     durations, it is not possible to enter real numbers in this mode.
366
367   @item Chord mode.
368 @cindex mode!chord
369
370     Chord mode is introduced by the keyword
371     @code{\chords}@keyindex{chords}.  It is similar to Note mode, but
372     words are also looked up in a chord modifier table (containing
373     @code{maj}, @code{dim}, etc).
374
375     Since combinations of numbers and dots are used for indicating
376     durations, you can not enter real numbers in this mode.  Dashes
377     and carets are used to indicate chord additions and subtractions,
378     so scripts can not be entered in Chord mode.
379
380   @item Lyrics mode. 
381 @cindex mode!lyric
382
383     Lyrics mode is introduced by the keyword
384     @code{\lyrics}@keyindex{lyrics}.  This mode has rules that make it
385     easy to include punctuation and diacritical marks in words.  A
386     word in Lyrics mode begins with: an alphabetic character,
387     `@code{_}', `@code{?}', `@code{!}', `@code{:}', `@code{'}', the
388     control characters @code{^A} through @code{^F}, @code{^Q} through
389     @code{^W}, @code{^Y}, @code{^^}, any 8-bit character with ASCII code
390     over 127, or a two-character combination of a backslash followed
391     by one of `@code{`}', `@code{'}', `@code{"}', or
392     `@code{^}'.@footnote{The purpose of Lyrics mode is that you can
393     enter lyrics in @TeX{} format or a standard encoding without
394     needing quotes.  The precise definition of this mode indeed is
395     ludicrous.  This will remain so until the authors of LilyPond
396     acquire a deeper understanding of character encoding, or someone
397     else steps up to fix this.}
398
399     Subsequent characters of a word can be any character that is not
400     a digit and not white space.  One important consequence of this
401     is that a word can end with `@code{@}}', which may be confusing if
402     you thought the closing brace was going to terminate Lyrics
403     mode.@footnote{LilyPond will issue a warning, though.}  Any
404     `@code{_}' character which appears in an unquoted word is
405     converted to a space.  This provides a mechanism for introducing
406     spaces into words without using quotes.  Quoted words can also be
407     used in Lyrics mode to specify words that cannot be written with
408     the above rules.  Here are some examples.  Not all of these words
409     are printable by @TeX{}.
410
411 @example 
412 Ah!             % a word
413 2B_||_!2B       % not a word because it starts with a digit
414 ``Hello''       % not a word because it starts with `
415 _ _ _ _         % 4 words, each one a space 
416 @end example 
417
418     Since combinations of numbers and dots are used for indicating
419     durations, you can not enter real numbers in this mode.
420 @end table
421
422 It is possible to create words that break the rules by prefixing them
423 with the dollar sign `@code{$}@indexcode{$}'.  Regardless of the context, a
424 word beginning with `@code{$}' extends until the next white space
425 character.  Such words can contain numbers (even in Note mode), or
426 other forbidden characters.  The dollar sign can be used to create
427 and access identifiers that could not otherwise be used.@footnote{Use
428 of `@code{$}' hampers readability and portability to future LilyPond
429 versions, thus the use of the dollar sign is discouraged.}
430
431
432
433 @node Types, , ,  Reference Manual
434 @section Types
435
436 @cindex types and identifiers
437
438 @emph{Mudela} has a limited set of types:
439
440 @itemize @bullet
441   @item  integers
442   @item  reals
443   @item  strings
444   @item  music expressions
445   @item  durations of notes and rests (specified with
446        @code{\notenames}@keyindex{notenames})
447   @item  note name tables
448   @item  context definitions, part of output definitions.  See
449        section XREF-contextdefs [FIXME] for more information
450   @item  output definitions (like @code{\paper}@keyindex{paper} blocks
451        and @code{\midi}@keyindex{midi} blocks)
452   @item  score definitions (@code{\score}@keyindex{score} blocks)
453 @end itemize
454
455 Type is a syntactical property: @emph{Mudela} has no real type system,
456 so there is no support for generic expressions, functions, or user
457 defined types.  For the same reason, it is not possible to mix reals
458 and integers in arithmetic expressions, and ``type
459 errors''
460 @cindex type error
461  (e.g., using a string identifier to
462 initialize a @code{\paper}@keyindex{paper} block) will yield a ``parse
463 error''.
464
465 Identifiers allow objects to be assigned to names.  To assign an
466 identifier, you use `@var{name}=@var{value}' and to refer to an
467 identifier, you preceed its name with a backslash:
468 `@code{\}@var{name}'.  Identifier assignments must appear at top level
469 in the @emph{Mudela} file.  Semicolons are forbidden after assignments
470 appearing at top level but they are obligatory after assignments
471 appearing in the @code{\paper} block, see Section XREF-paper [FIXME].
472
473 @var{value} is any of the types listed above.
474
475 An identifier can be created with any string for its name, but you
476 will only be able to refer to identifiers whose names begin with a
477 letter, being entirely alphanumeric.  It is impossible to refer to an
478 identifier whose name is the same as the name of a keyword.
479
480 The right hand side of an identifier assignment is parsed completely
481 before the assignment is done, so it is allowed to redefine an
482 identifier in terms of its old value, e.g.
483
484 @example
485   foo = \foo * 2.0
486 @end example
487
488 When an identifier is referenced, the information it points to is
489 copied.  Therefore it only makes sense to put identifiers for
490 translators, output definitions, and @code{\score}@keyindex{score}
491 blocks as the first item in a block.  For this reason, if you
492 reference a @code{\foo} variable in a @code{\foo} block, it must be the
493 first item in the list following @code{\foo}.@footnote{@code{\paper@{\one
494 \two@}} does not make sense, because the information of @code{\two}
495 would overwrite the information of @code{\one}, thereby making the
496 reference to the first identifier useless.}
497
498
499
500 @node Music expressions, , ,  Reference Manual
501 @section Music expressions
502
503 @cindex music expressions
504
505 Music in @emph{Mudela} is entered as a music expression.  Notes, rests,
506 lyric syllables are music expressions (the atomic
507 expressions)
508 @cindex atomic music expressions
509 , and you can combine
510 music expressions to form new ones.  This example forms a compound
511 expressions out of the quarter @code{c} note and a @code{d}
512 note:
513
514 @example 
515 \sequential @{ c4 d4 @} 
516 @end example 
517
518 The meaning of this compound expression is to play the `@code{c}'
519 first, and then the `@code{d}' (as opposed to playing them
520 simultaneously, for instance).
521
522 Atomic music expression are discussed in
523 subsection XREF-atomicmusic [FIXME].  Compound music expressions are
524 discussed in subsection XREF-compoundmusic [FIXME].
525
526
527
528 @node Atomic music expressions, , ,  Reference Manual
529 @section Atomic music expressions
530
531
532
533
534 @cindex pitch
535
536 @cindex duration
537  
538
539 The syntax for pitch specification is
540
541
542 @example
543   \musicalpitch@keyindex{musicalpitch} @{ @var{octave} @var{note} @var{shift} @}
544 @end example
545
546 @var{octave} is specified by an integer, zero for the octave
547 containing middle C.  @var{note} is a number from 0 to 7, with 0
548 corresponding to C and 7 corresponding to B.  The shift is zero for a
549 natural, negative to add flats, or positive to add sharps.
550
551 In Note and Chord mode, pitches may be designated by names.  See
552 section XREF-notelang [FIXME] for pitch names in different languages.
553
554 The syntax for duration specification is
555
556 @example
557  \duration@keyindex{duration}
558    @{ @var{length} @var{dotcount} @}
559 @end example
560
561 @var{length} is the negative logarithm (base 2) of the duration:
562 1 is a half note, 2 is a quarter note, 3 is an eighth
563 note, etc.  The number of dots after the note is given by
564 @var{dotcount}.
565
566 In Note, Chord, and Lyrics mode, durations may be designated by
567 numbers and dots.  See Section XREF-notelang [FIXME] for details.
568
569
570 @node Note specification, , ,  Reference Manual
571
572 @cindex note specification
573
574 @cindex pitches
575
576 @cindex entering notes
577
578 A note specification has the form
579
580 @example
581   @var{pitch}[@var{octavespec}][!][?][@var{duration}]
582 @end example
583
584 The pitch of the note is specified by the note's name.
585
586
587 The default names are the Dutch note names.  The notes are specified
588 by the letters `@code{c}' through `@code{b}', where `@code{c}' is an
589 octave below middle C and the letters span the octave above that C. 
590 In Dutchcindex(notenames!Dutch), a sharp is formed by adding
591 `@code{-is}' to the end of a pitch name.  A flat is formed by adding
592 `@code{-es}'. Double sharps and double flats are obtained by adding
593 `@code{-isis}' or `@code{-eses}'.  `@code{aes}' and `@code{ees}' are
594 contracted to `@code{as}' and `@code{es}' in Dutch, but both forms will
595 be accepted.
596
597 LilyPond has predefined sets of notenames for various languages.  See
598 section XREF-notelang [FIXME] for details.
599
600
601 The optional octave specification takes the form of a series of
602 single quote (`@code{'}@indexcode{'}') characters or a series of comma
603 (`@code{,}@indexcode{,}') characters.  Each @code{'} raises the pitch by one
604 octave; each @code{,} lowers the pitch by an octave.
605
606 @mudela[fragment,verbatim,center]
607   c' d' e' f' g' a' b' c''
608 @end mudela
609
610 @mudela[fragment,verbatim,center]
611   cis' dis' eis' fis' gis' ais' bis'
612 @end mudela
613
614 @mudela[fragment,verbatim,center]
615   ces' des' es' fes' ges' as' bes'
616 @end mudela
617
618 @mudela[fragment,verbatim,center]
619   cisis' eisis' gisis' aisis' beses'
620 @end mudela
621
622 @mudela[fragment,verbatim,center]
623   ceses' eses' geses' ases' beses'
624 @end mudela
625
626 Whenever a C-sharp is desired,  you must specify a C-sharp.  LilyPond
627 will determine what accidentals to typeset depending on the key and
628 context.  A reminder accidental 
629 @cindex reminder accidental
630  can be
631 forced by adding an exclamation mark `@code{!}' after the pitch.  A
632 cautionary accidental, 
633 @cindex cautionary accidental
634  i.e., an
635 accidental within parentheses can be obtained by adding the question
636 mark `@code{?}@indexcode{?}' after the pitch.
637
638 @mudela[fragment,verbatim,center]
639   cis' d' e' cis'  c'? d' e' c'!
640 @end mudela
641
642
643 @cindex duration
644
645 Durations are entered as their reciprocal values.  For notes longer
646 than a whole note, use identifiers.
647
648 @quotation
649
650 @example 
651 c'\longa c'\breve  
652 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 
653 @end example 
654
655 @end quotation
656
657 @quotation
658
659 @mudela[]
660 \score {
661   \notes \relative c'' {
662     a\longa a\breve  
663     a1 a2 a4 a8 a16 a32 a64 a64 
664   }
665   \paper {
666 %{    \translator {
667       \StaffContext
668         \remove "Clef_engraver";
669         \remove "Staff_symbol_engraver";
670     } %}
671   }
672 }
673 @end mudela
674 @end quotation
675
676 @quotation
677
678 @example 
679 r\longa r\breve  
680 r1 r2 r4 r8 r16 r32 r64 r64 
681 @end example 
682
683 @end quotation
684
685 @quotation
686
687 @mudela[]
688 \score {
689   \notes \relative c'' {
690     r\longa r\breve  
691     r1 r2 r4 r8 r16 r32 r64 r64 
692   }
693   \paper {
694     loose_column_distance = 2.5 * \staffspace;
695     linewidth = -1.0;
696     \translator {
697         \StaffContext
698         \remove "Clef_engraver";
699         \remove "Staff_symbol_engraver";
700         \remove "Bar_engraver";
701     }
702   }
703 }
704 @end mudela
705 @end quotation
706
707 If the duration is omitted then it is set equal to the previous
708 duration.  If there is no previous duration, a quarter note is
709 assumed.  The duration can be followed by a dot (`@code{.}@indexcode{.}')
710 to obtain dotted note lengths.
711
712 @mudela[fragment,verbatim,center]
713   a'4. b'4.
714 @end mudela
715
716 You can alter the length of duration by writing
717 `@code{*}@var{fraction}' after it.  This will not affect the
718 appearance of note heads or rests.
719
720
721 Rests are entered like notes, with note name `@code{r}@indexcode{r}',
722 or `@code{R}@indexcode{R}'.  There is also a note name
723 `@code{s}@indexcode{s}', which produces a space of the specified
724 duration.  `@code{R}' is specifically meant for entering parts: the
725 @code{R} rest can expand to fill a score with rests, or it can be
726 printed as a single multimeasure rest.
727
728 You can control the expansion by setting the property
729 @code{Score.skipBars}. If this is set to true, Lily will not expand
730 empty measures, and the multimeasure rests automatically adds the
731 appropriate number.
732
733
734 @cindex lyrics expressions
735
736 Syllables are entered like notes, with pitches replaced by text.  For
737 example, `@code{Twin-4 kle4 twin-4 kle4}' enters four syllables, each
738 with quarter note duration.  Note that the hyphen has no special
739 meaning for lyrics, and does not introduce special symbols.  See
740 section XREF-modes [FIXME] for a description of what is interpreted as
741 lyrics.
742
743 Spaces can be introduced into a lyric either by using quotes
744 (`@code{"}') or by using an underscore without quotes: `@code{He_could4
745 not4}'.  All unquoted underscores are converted to spaces.  Printing
746 lyrics is discussed in section XREF-lyricprint [FIXME].
747
748
749
750 @cindex properties
751
752 @example
753   \property@keyindex{property}
754     @var{contextname}.@var{propname} =  @var{value}
755 @end example
756
757 Sets the @var{propname} property of the context @var{contextname} to
758 the specified @var{value}.  All three arguments are strings. 
759 Depending on the context, it may be necessary to quote the strings or
760 to leave space on both sides of the dot.
761
762
763
764 @cindex translator switches
765
766 @example
767   \translator@keyindex{translator}
768     @var{contexttype} = @var{name}
769 @end example
770
771 A music expression indicating that the context which is a direct
772 child of the a context of type @var{contexttype} should be shifted to
773 a context of type @var{contexttype} and the specified name.
774
775 Usually this is used to switch staffs in Piano music, e.g.
776
777 @example
778   \translator Staff = top @var{Music}
779 @end example
780
781
782 @cindex output properties
783
784
785 These allow you to tweak what is happening in the back-end
786 directly. If you want to control every detail of the output
787 formatting, this is the feature to use. The downside to this is that
788 you need to know exactly how the backend works. Example:
789
790
791 @mudela[fragment,verbatim]
792 \relative c'' { c4
793         \context Staff \outputproperty
794                 #(make-type-checker 'Note_head)
795                 #'extra-offset = #'(5.0 . 7.5)
796 <c8 e g> }
797 @end mudela
798
799 This selects all note heads occurring at current staff level, and sets
800 the extra-offset of those heads to (5,7.5), shifting them up and
801 right.
802
803 Use of this feature is entirely on your own risk: if you use this, the
804 result will depend very heavily on the implentation of the backend,
805 which we change unscrupulously.
806
807
808
809
810 @cindex commands
811
812 Commands are music expressions that have no duration.   
813
814
815 @example
816
817   @code{\key}@keyindex{key} @var{pitch} @var{type} @code{;}
818 @end example
819
820 Change the key signature.  @var{type} should be
821 @code{\major}@keyindex{major} or @code{\minor}@keyindex{minor} to get
822 @var{pitch}-major or @var{pitch}-minor, respectively.  The second
823 argument is optional; the default is major keys.  The @var{\context}
824 argument can also be given as an integer, which tells the number of
825 semitones that should be added to the pitch given in the subsequent
826 @code{\key}@keyindex{key} commands to get the corresponding major key,
827 e.g., @code{\minor}@keyindex{minor} is defined as 3.  The standard
828 mode names @code{\ionian}@keyindex{ionian},
829 @code{\locrian}@keyindex{locrian}, @code{\aeolian}@keyindex{aeolian},
830 @code{\mixolydian}@keyindex{mixolydian}, @code{\lydian}@keyindex{lydian},
831 @code{\phrygian}@keyindex{phrygian}, and @code{\dorian}@keyindex{dorian}
832 are also defined.
833
834 @example
835
836   @code{\keysignature}@keyindex{keysignature} @var{pitchseq} @code{;}
837 @end example
838
839 Specify an arbitrary key signature.  The pitches from @var{pitch} will
840 be printed in the key signature in the order that they appear on the
841 list.
842
843         
844 @example
845   \mark@keyindex{mark} @var{unsigned};
846   \mark @var{string};
847 @end example
848
849 Prints a mark over or under (depending on the
850 @code{markDirection}@indexcode{markDirection} property) the staff.  You must add
851 @code{Mark_engraver}@indexcode{Mark_engraver} to either the Score or Staff context for
852 this to work.
853
854 @node barlines, , ,  Reference Manual
855
856 @example
857   \bar@keyindex{bar} @var{bartype};
858 @end example
859
860 This is a request to print a special bar symbol. It replaces the 
861 regular bar symbol with a special
862 symbol.  The argument @var{bartype} is a string which specifies the
863 kind of bar to print.  Options are @code{":|"}
864 @cindex "|A@@@code{:|}
865 ,
866 @code{"|:"}
867 @cindex "|B@@@code{|:}
868 , @code{":|:"}
869 @cindex "|C@@@code{:|:}
870 ,
871 @code{"||"}
872 @cindex "|D@@@code{||}
873 , @code{"|."}
874 @cindex "|E@@@code{|.}
875 ,
876 @code{".|"}
877 @cindex "|F@@@code{.|}
878 , and @code{".|."}
879 @cindex "|G@@@code{.|.}
880
881 These produce, respectively, a right repeat, a left repeat, a double
882 repeat, a double bar, a start bar, an end bar, and a thick double
883 bar.  If @var{bartype} is set to @code{"empty"} then nothing is
884 printed, but a line break is allowed at that spot.
885
886 You are encouraged to use @code{\repeat} for repetitions.
887 See section XREF-sec-repeats [FIXME].
888
889  
890
891
892 @example
893
894   \time@keyindex{time} @var{numerator}@code{/}@var{denominator} @code{;}
895 @end example
896
897 Change the time signature.  The default time signature is 4/4. 
898 The time signature is used to generate bar lines.
899
900 @example
901
902   \tempo@keyindex{tempo} @var{duration} = @var{perminute} @code{;}
903 @end example
904
905 Used to specify the tempo.  For example, `@code{\tempo 4 = 76;}'
906 requests output with 76 quarter notes per minute.
907
908 @example
909
910   \partial@keyindex{partial} @var{duration} @code{;}
911 @end example
912
913 @cindex anacrusis
914
915 @cindex upstep
916
917 This creates an incomplete measure (anacrusis, upbeat) at the start of 
918 the music, e.g., `@code{\partial 8*2;}' creates a starting measure 
919 lasting two eighth notes.
920
921 @example
922
923   @code{|}@indexcode{|}
924 @cindex bar check
925
926 @end example
927
928 @cindex shorten measures
929
930 @cindex upstep
931
932 `@code{|}' is a bar check.  Whenever a bar check is encountered during
933 interpretation, a warning message is issued if it doesn't fall at a
934 measure boundary.  This can help you finding errors in the input. 
935 The beginning of the measure will be relocated, so this can also
936 be used to shorten measures.
937
938
939 @example
940
941   \penalty@keyindex{penalty} @var{int} @code{;}
942 @end example
943
944 Discourage or encourage line breaks.  See identifiers
945 @code{\break}@keyindex{break} and @code{\nobreak}@keyindex{nobreak} in
946 section [on identifiers] [FIXME].
947
948 @example
949
950   \clef@keyindex{clef} @var{clefname} @code{;}
951 @end example
952
953 Music expression that sets the current clef.  The argument is a
954 string which specifies the name of the clef.  Several clef names are
955 supported.  If `@code{_8}' or `@code{^8}' is added to the end of a clef
956 name, then the clef lowered or raised an octave will be generated. 
957 Here are the supported clef names with middle C shown in each
958 clef:
959
960 @quotation
961
962 @mudela[]
963 \score {
964   \notes {
965     \cadenzaOn
966     %\property Voice.textStyle = typewriter
967     \clef subbass;     c'4-"\kern -5mm subbass" 
968     \clef bass;        c'4^"\kern -2mm bass"
969     \clef baritone;    c'4_"\kern -5mm baritone"
970     \clef varbaritone; c'4^"\kern -6mm varbaritone"
971     \clef tenor;       c'4_"\kern -3mm tenor"
972     \clef "G_8";       c'4^"\kern -2mm G\\_8" 
973   }  
974   \paper {
975     linewidth = -1.0;
976   }
977 }
978 @end mudela
979 @end quotation
980
981 @quotation
982
983 @mudela[]
984 \score {
985   \notes {
986         \cadenzaOn
987     \clef alto;         c'4_"\kern -2mm alto"
988     \clef mezzosoprano; c'4^"\kern -9mm mezzosoprano"
989     \clef soprano;      c'4_"\kern -6mm soprano"
990     \clef treble;       c'4^"\kern -4mm treble"
991     \clef french;       c'4_"\kern -4mm french"
992   }
993   \paper {
994     linewidth = 4.5 \in;
995   }
996 }
997 @end mudela
998 @end quotation
999
1000 The three clef symbols can also be obtained using the names `@code{G}', 
1001 `@code{C}' or `@code{F}', optionally followed by an integer which 
1002 indicates at which note line the clef is located. An as example, the 
1003 @code{mezzosoprano} clef can also be given as `@code{C2}'.
1004
1005 @example
1006
1007   \skip@keyindex{skip} @var{duration} @code{;}
1008 @end example
1009
1010 Skips the amount of time specified by @var{duration}.  If no other
1011 music is played, a gap will be left for the skipped time with no
1012 notes printed.  It works in Note Mode or Lyrics Mode.  In Note mode,
1013 this has the same effect as the space rest `@code{s}'.
1014
1015
1016 @cindex beams
1017
1018 @node Manual beams, , ,  Reference Manual
1019
1020 A beam is specified by surrounding the beamed notes with brackets
1021 `@code{[}@indexcode{[}' and `@code{]}@indexcode{]}'.  
1022
1023 @mudela[fragment,verbatim,center]
1024   [a'8 a'] [a'16 a' a' a']
1025 @end mudela
1026
1027 Some more elaborate constructions:
1028
1029 @mudela[fragment,verbatim,center]
1030   [a'16 <a' c''> c'' <a' c''>]
1031   \times 2/3 { [e'8 f' g'] }
1032 @end mudela
1033
1034 Beaming can be generated automatically; see section XREF-autobeam [FIXME].
1035
1036 [OUTDATED, FIXME]
1037
1038 To place tremolo marks between notes, use @code{\repeat} with tremolo
1039 style.
1040 @cindex tremolo beams
1041   To create tremolo beams on a single note, simply attach
1042 `@code{:}@var{length}' to the note itself (see also section
1043 XREF-tremolo [FIXME]).
1044   
1045
1046 @mudela[fragment,verbatim,center]
1047   \repeat "tremolo" 8 { c16 d16 }
1048   \repeat "tremolo" 4 { c16 d16 }    
1049 @end mudela
1050
1051 @mudela[fragment,verbatim,center]
1052   c'4:32
1053 @end mudela
1054
1055
1056 @cindex --@@@code{-}@code{-}
1057
1058 @indexcode{__}
1059
1060 @cindex extender
1061
1062 @cindex hyphen
1063
1064 The syntax for an extender mark is `@code{__}'.  This syntax can only
1065 be used within lyrics mode.  The syntax for a spanning hyphen (i.e.,
1066 a hyphen that will be printed between two lyric syllables) is
1067 `@code{-}@code{-}'.
1068
1069
1070 @cindex ties
1071
1072 A tie connects two adjacent note heads of the same pitch.  When used
1073 with chords, it connects all of the note heads whose pitches match.
1074 Ties are indicated using the tilde symbol `@code{~}@indexcode{~}'.
1075 If you try to tie together chords which have no common pitches, a
1076 warning message will appear and no ties will be created.
1077
1078 @mudela[fragment,verbatim,center]
1079   e' ~ e' <c' e' g'> ~ <c' e' g'>
1080 @end mudela
1081
1082
1083
1084 [TODO: explain Requests]
1085
1086
1087 @cindex articulations
1088
1089 @cindex scripts
1090
1091 @cindex ornaments
1092
1093 A variety of symbols can appear above and below notes to indicate
1094 different characteristics of the performance.  These symbols can be
1095 added to a note with `@var{note}@code{-\}@var{name}'.  Numerous symbols
1096 are defined in @file{script.ly} and @file{script.scm}.  Symbols can be
1097 forced to appear above or below the note by writing
1098 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1099 respectively.  Here is a chart showing symbols above notes, with the
1100 name of the corresponding symbol appearing underneath.
1101
1102 @mudela[]
1103
1104   \score {
1105     < \notes {
1106         c''-\accent      c''-\marcato      c''-\staccatissimo c''-\fermata 
1107         c''-\stopped     c''-\staccato     c''-\tenuto        c''-\upbow
1108         c''-\downbow     c''^\lheel        c''-\rheel         c''^\ltoe
1109         c''-\rtoe        c''-\turn         c''-\open          c''-\flageolet
1110         c''-\reverseturn c''-\trill        c''-\prall         c''-\mordent
1111         c''-\prallprall  c''-\prallmordent c''-\upprall       c''-\downprall
1112         c''-\thumb       c''-\segno        c''-\coda
1113       }
1114       \context Lyrics \lyrics {  
1115         accent__      marcato__      staccatissimo__ fermata
1116         stopped__     staccato__     tenuto__        upbow
1117         downbow__     lheel__        rheel__         ltoe
1118         rtoe__        turn__         open__          flageolet
1119         reverseturn__ trill__        prall__         mordent
1120         prallprall__  prallmordent__ uprall__        downprall
1121         thumb__       segno__        coda
1122       }
1123     >
1124     \paper {
1125       linewidth = 5.875\in;          
1126       indent    = 0.0;
1127     }
1128   }
1129
1130 @end mudela
1131
1132 In addition, it is possible to place arbitrary strings of text or
1133 @TeX{} above or below notes by using a string instead of an
1134 identifier: `@code{c^"text"}'.  Fingerings 
1135 @cindex fingering
1136  can be
1137 placed by simply using digits.  All of these note ornaments appear in
1138 the printed output but have no effect on the MIDI rendering of the
1139 music.
1140
1141 To save typing, fingering instructions (digits 0 to 9 are
1142 supported) and single characters shorthands exist for a few
1143 common symbols
1144
1145 @mudela[]
1146
1147   \score {
1148     \notes {
1149       \property Voice.textStyle = typewriter
1150       c''4-._"c-."      s4
1151       c''4--_"c-{}-"    s4
1152       c''4-+_"c-+"      s4
1153       c''4-|_"c-|"      s4
1154       c''4->_"c->"      s4
1155       c''4-^_"c-\\^{ }" s4
1156       c''4-1_"c-1"      s4
1157       c''4-2_"c-2"      s4
1158       c''4-3_"c-3"      s4
1159       c''4-4_"c-4"      s4
1160     }
1161     \paper {
1162       linewidth = 5.875 \in;
1163       indent    = 0.0;
1164     }
1165   }
1166
1167 @end mudela
1168
1169 Dynamic marks are specified by using an identifier after a note:
1170 `@code{c4-\ff}' (the dash is optional for dynamics: `@code{c4 \ff})'.  
1171 The available dynamic marks are:
1172 @code{\ppp}@keyindex{ppp},
1173 @code{\pp}@keyindex{pp}, @code{\p}@keyindex{p}, @code{\mp}@keyindex{mp},
1174 @code{\mf}@keyindex{mf}, @code{\f}@keyindex{f}, @code{\ff}@keyindex{ff},
1175 @code{\fff}@keyindex{fff}, @code{\fff}@keyindex{ffff},
1176 @code{\fp}@keyindex{fp}, @code{\sf}@keyindex{sf},
1177 @code{\sff}@keyindex{sff}, @code{\sp}@keyindex{sp},
1178 @code{\spp}@keyindex{spp}, @code{\sfz}@keyindex{sfz}, and
1179 @code{\rfz}@keyindex{rfz}.
1180
1181
1182 @example
1183
1184   \textscript@keyindex{textscript} @var{text} @var{style}
1185 @end example
1186
1187 Defines a text to be printed over or under a note.  @var{style} is a
1188 string that may be one of @code{roman}, @code{italic}, @code{typewriter}, 
1189 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1190
1191 You can attach a general textscript request using this syntax:
1192
1193 @quotation
1194
1195 @example 
1196 c4-\textscript "6" "finger"
1197 c4-\textscript "foo" "normal" 
1198 @end example 
1199
1200 @end quotation
1201
1202 This is equivalent to `@code{c4-6 c4-"foo"}'.  
1203
1204
1205 @cindex scripts
1206
1207 @example
1208
1209   \script@keyindex{script} @var{alias}
1210 @end example
1211
1212 Prints a symbol above or below a note.  The argument is a string
1213 which points into the script-alias table defined in @file{script.scm}.
1214 The scheme definitions specify whether the symbol follows notes into
1215 the staff, dependence of symbol placement on staff direction, and a
1216 priority for placing several symbols over one note.  Usually the
1217 @code{\script}@keyindex{script} keyword is not used directly.  Various
1218 helpful identifier definitions appear in @file{script.ly}.
1219
1220
1221 @cindex slur
1222
1223 Slurs connects chords and try to avoid crossing stems.  A slur is
1224 started with `@code{(}' and stopped with `@code{)}'.  The
1225 starting `@code{(}' appears to the right of the first note in
1226 the slur.  The terminal `@code{)}' appears to the left of the
1227 first note in the slur.  This makes it possible to put a note in
1228 slurs from both sides:
1229
1230 @mudela[fragment,verbatim,center]
1231   f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1232 @end mudela
1233
1234
1235 @cindex crescendo
1236
1237 A crescendo mark is started with @code{\cr}@keyindex{cr} and terminated
1238 with @code{\rc}@keyindex{rc}.  A decrescendo mark is started with
1239 @code{\decr}@keyindex{decr} and terminated with
1240 @code{\rced}@keyindex{rced}.  There are also shorthands for these
1241 marks.  A crescendo can be started with @code{\<}@keyindex{<} and a
1242 decrescendo can be started with @code{\>}@keyindex{>}.  Either one can
1243 be terminated with @code{\!}@keyindex{"!}.  Note that @code{\!}
1244 must go before the last note of the dynamic mark whereas @code{\rc}
1245 and @code{\rced} go after the last note.  Because these marks are
1246 bound to notes, if you want to get several marks during one note, you
1247 must use spacer notes.
1248
1249 @mudela[fragment,verbatim,center]
1250   c'' \< \! c''   d'' \decr e'' \rced 
1251   < f''1 { s4 \< \! s2 \> \! s4 } >
1252 @end mudela
1253
1254
1255 @example
1256
1257   \spanrequest@keyindex{spanrequest} @var{startstop} @var{type}
1258 @end example
1259
1260 Define a spanning request. The @var{startstop} parameter is either -1
1261 (@code{\start}@keyindex{start}) or 1 (@code{\stop}@keyindex{stop}) and
1262 @var{type} is a string that describes what should be started.
1263 Supported types are @code{crescendo}, @code{decrescendo},
1264 @code{beam}, @code{slur}.  This is an internal command.  Users should
1265 use the shorthands which are defined in the initialization file
1266 @file{spanners.ly}.
1267
1268 You can attach a (general) span request to a note using
1269
1270 @mudela[fragment,verbatim,center]
1271   c'4-\spanrequest \start "slur"
1272   c'4-\spanrequest \stop "slur"
1273 @end mudela
1274
1275 The slur syntax with parentheses is a shorthand for this.
1276
1277
1278
1279 @cindex tremolo marks
1280
1281 @node stem tremolo, , ,  Reference Manual
1282
1283 Tremolo marks can be printed on a single note by adding
1284 `@code{:}[@var{length}]' after the note.  The length must be at
1285 least 8.  A @var{length} value of 8 gives one line across
1286 the note stem.  If the length is omitted, then the last value is
1287 used, or the value of the @code{tremoloFlags}@indexcode{tremoloFlags} property if there was
1288 no last value.
1289
1290 @mudela[verbatim,fragment,center]
1291   c'2:8 c':32
1292 @end mudela
1293
1294
1295
1296 @node Compound music expressions, , ,  Reference Manual
1297 @section Compound music expressions
1298
1299 @cindex compound music expressions
1300
1301 Music expressions are compound data structures.  You can nest music
1302 expressions any way you like.  This simple example shows how three
1303 chords can be expressed in two different ways:
1304
1305 @mudela[fragment,verbatim,center]
1306   \notes \context Staff {
1307     \cadenzaOn
1308     <a c'> <b  d' > <c' e'>
1309     < { a b  c' } { c' d' e' } >
1310   }
1311 @end mudela
1312
1313 @cindex context selection
1314 @c @keyindex{context}
1315
1316 @example
1317   \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
1318 @end example
1319
1320 Interpret @var{musicexpr} within a context of type @var{contexttype}. 
1321 If the context does not exist, it will be created.  The new context
1322 can optionally be given a name.  See
1323 section XREF-contextselection [FIXME] and XREF-contextdefs [FIXME] for more
1324 information on interpretation contexts.
1325
1326
1327
1328 @cindex input modes
1329
1330 @cindex mode switch
1331
1332 Mode switching keywords form compound music expressions: @code{\notes}
1333 @keyindex{notes} @var{musicexpr}, @code{\chords} @keyindex{chords}
1334 @var{musicexpr}, and @code{\lyrics} @keyindex{lyrics} @var{musicexpr}. 
1335 These expressions do not add anything to the meaning of their
1336 arguments.  They are just a way to indicate that the arguments should
1337 be parsed in indicated mode.  See section XREF-modes [FIXME] for more
1338 information on modes.
1339
1340 More information on context selection can be found in
1341 section XREF-contextselection [FIXME].
1342
1343
1344
1345 @cindex sequential music
1346
1347
1348
1349 @example
1350
1351   \sequential@keyindex{sequential}
1352     @code{@{} @var{musicexprlist} @code{@}}
1353 @end example
1354
1355 This means that list should be played or written in sequence, i.e.,
1356 the second after the first, the third after the second.  The duration
1357 of sequential music is the the sum of the durations of the elements. 
1358 There is a shorthand, which leaves out the keyword:
1359
1360 @example
1361
1362   @code{@{} @var{musicexprlist} @code{@}}
1363 @end example
1364
1365
1366
1367 @cindex simultaneous music
1368
1369 @indexcode{<}
1370 @indexcode{>}
1371
1372 @example
1373
1374   \simultaneous@keyindex{simultaneous}
1375     @code{@{} @var{musicexprlist} @code{@}}
1376 @end example
1377
1378 It constructs a music expression where all of its arguments start at
1379 the same moment.  The duration is the maximum of the durations of the
1380 elements.  The following shorthand is a common idiom:
1381
1382 @example
1383
1384   @code{<} @var{musicexprlist} @code{>}
1385 @end example
1386
1387 If you try to use a chord as the first thing in your score, you might
1388 get multiple staffs instead of a chord.
1389
1390 @mudela[verbatim,center]
1391   \score {
1392     \notes <c''4 e''>
1393     \paper {
1394       linewidth = -1.;
1395     }
1396   }
1397 @end mudela
1398
1399 This happens because the chord is interpreted by a score context.
1400 Each time a note is encountered a default Voice context (along with a
1401 Staff context) is created.  The solution is to explicitly instantiate
1402 a Voice context:
1403
1404 @mudela[verbatim,center]
1405   \score {
1406     \notes\context Voice <c''4 e''>
1407     \paper {
1408       linewidth = -1.;
1409     }
1410   }
1411 @end mudela
1412
1413
1414
1415 @cindex relative pitch specification
1416
1417 @node relative, , , Reference Manual
1418
1419 It is easy to get confused by octave changing marks and accidentally
1420 putting a pitch in the wrong octave.  A much better way of entering a
1421 note's octave is `the relative octave' mode.
1422
1423 @example
1424
1425   \relative@keyindex{relative} @var{startpitch} @var{musicexpr}
1426 @end example
1427
1428 The octave of notes that appear in @var{musicexpr} are calculated as
1429 follows: If no octave changing marks are used, the basic interval
1430 between this and the last note is always taken to be a fourth or
1431 less.@footnote{The interval is determined without regarding
1432 accidentals.  A @code{fisis} following a @code{ceses} will be put above
1433 the @code{ceses}.}  The octave changing marks `@code{'}' and `@code{,}'
1434 can then be added to raise or lower the pitch by an extra octave. 
1435 Upon entering relative mode, an absolute starting pitch must be
1436 specified that will act as the predecessor of the first note of
1437 @var{musicexpr}.
1438
1439 Entering scales is straightforward in relative mode.
1440
1441 @mudela[fragment,verbatim,center]
1442   \relative c' {
1443     c d e f g a b c c,
1444   }
1445 @end mudela
1446
1447 And octave changing marks are used for intervals greater than a fourth.
1448
1449 @mudela[fragment,verbatim,center]
1450   \relative c'' {
1451     c g c f, c' a, e'' }
1452 @end mudela
1453
1454 If the preceding item is a chord, the first note of the chord is used
1455 to determine the first note of the next chord.  But other notes
1456 within the second chord are determined by looking at the immediately
1457 preceding note.
1458
1459 @mudela[fragment,verbatim,center]
1460   \relative c' {
1461     c <c e g> 
1462     <c' e g>
1463     <c, e' g>
1464   }
1465 @end mudela 
1466
1467 The pitch after the @code{\relative} contains a notename.  To parse
1468 the pitch as a notename, you have to be in note mode, so there must
1469 be a surrounding @code{\notes}@keyindex{notes} keyword (which is not
1470 shown here).
1471
1472 The relative conversion will not affect @code{\transpose} or
1473 @code{\relative} sections in its argument.  If you want to use
1474 relative within transposed music, you must place an additional
1475 @code{\relative} inside the @code{\transpose}.
1476
1477 It is strongly recommended to use relative pitch mode: less work,
1478 less error-prone, and more readable.
1479
1480
1481
1482 Chord names are a way to generate simultaneous music expressions that
1483 correspond with traditional chord names.  It can only be used in
1484 Chord mode (see section XREF-modes [FIXME]).
1485
1486 @example
1487
1488   @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1489 @end example
1490
1491 @var{tonic} should be the tonic note of the chord, and @var{duration}
1492 is the chord duration in the usual notation.  There are two kinds of
1493 modifiers.  One type is @emph{chord additions}, which are obtained by
1494 listing intervals separated by dots.  An interval is written by its
1495 number with an optional `@code{+}' or `@code{-}' to indicate raising or
1496 lowering by half a step.  Chord additions has two effects: It adds
1497 the specified interval and all lower odd numbered intervals to the
1498 chord, and it may lower or raise the specified interval.  Intervals
1499 must be separated by a dot (`@code{.}').
1500
1501 @quotation
1502
1503 @mudela[fragment,verbatim]
1504 \transpose c'' {
1505   \chords {
1506     c1  c:3-       c:7     c:8
1507     c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1508   }
1509 }
1510
1511 @end mudela
1512 @end quotation
1513
1514 The second type of modifier that may appear after the `@code{:}' is a
1515 named modifier.  Named modifiers are listed in the file
1516 @file{chord-modifiers.ly}.  The available modifiers are `@code{m}' and
1517 `@code{min}' which lower the 3rd half a step, `@code{aug}@indexcode{aug}' which
1518 raises the 5th, `@code{dim}@indexcode{dim}' which lowers the 5th,
1519 `@code{maj}@indexcode{maj}' which adds a raised 7th, and `@code{sus}@indexcode{sus}'
1520 which replaces the 5th with a 4th.
1521
1522 @quotation
1523
1524 @mudela[fragment,verbatim]
1525 \transpose c'' {
1526   \chords {
1527     c1:m c:min7 c:maj c:aug c:dim c:sus
1528   }
1529 }
1530
1531 @end mudela
1532 @end quotation
1533  
1534
1535 Chord subtractions are used to eliminate notes from a chord.  The
1536 notes to be subtracted are listed after a `@code{^}' character,
1537 separated by dots.
1538
1539 @mudela[fragment,verbatim,center]
1540   \transpose c'' {
1541     \chords {
1542       c1^3 c:7^5.3 c:8^7
1543     }
1544   }
1545 @end mudela 
1546
1547 Chord inversions can be specified by appending `@code{/}@indexcode{/}' and
1548 the name of a single note to a chord.  This has the effect of
1549 lowering the specified note by an octave so it becomes the lowest
1550 note in the chord.  If the specified note is not in the chord, a
1551 warning will be printed.
1552
1553 @mudela[fragment,verbatim,center]
1554   \transpose c''' {
1555     \chords {
1556       c1 c/e c/g c:7/e
1557     }
1558   }
1559
1560 @end mudela 
1561
1562 Bass notes can be added by `@code{/+}@indexcode{/+}' and
1563 the name of a single note to a chord.  This has the effect of
1564 adding the specified note to the chord, lowered by an octave,
1565 so it becomes the lowest note in the chord.
1566
1567 @mudela[fragment,verbatim,center]
1568   \transpose c''' {
1569     \chords {
1570       c1 c/+c c/+g c:7/+b
1571     }
1572   }
1573
1574 @end mudela 
1575
1576 Throughout these examples, chords have been shifted around the staff
1577 using @code{\transpose}.
1578
1579 You should not combine @code{\relative} with named chords. 
1580
1581
1582
1583 @cindex tuplets
1584
1585 Tuplets are made out of a music expression by multiplying their
1586 duration with a fraction.
1587
1588 @example
1589
1590   \times@keyindex{times} @var{fraction} @var{musicexpr}
1591 @end example
1592
1593 The duration of @var{musicexpr} will be multiplied by the fraction. 
1594 In print, the fraction's denominator will be printed over the notes,
1595 optionally with a bracket.  The most common tuplet is the triplet in
1596 which 3 notes have the length of 2, so the notes are 2/3 of
1597 their written length:
1598
1599 @mudela[fragment,verbatim,center]
1600   g'4 \times 2/3 {c'4 c' c'} d'4 d'4
1601 @end mudela
1602
1603
1604
1605 @cindex grace notes
1606
1607 @example
1608
1609   \grace@keyindex{grace} @var{musicexpr}
1610 @end example
1611
1612 A grace note expression has duration 0; the next real note is
1613 assumed to be the main note.
1614
1615 You cannot have the grace note after the main note, in terms of
1616 duration, and main notes, but you can typeset the grace notes to the
1617 right of the main note using the property
1618 @code{graceAlignPosition}@indexcode{graceAlignPosition}.
1619
1620 When grace music is interpreted, a score-within-a-score is set up:
1621 @var{musicexpr} has its own time bookkeeping, and you could (for
1622 example) have a separate time signature within grace notes.  While in
1623 this score-within-a-score, you can create notes, beams, slurs, etc.
1624 Unbeamed eighth notes and shorter by default have a slash through the
1625 stem.  This behavior can be controlled with the
1626 @code{flagStyle}@indexcode{flagStyle} property.
1627
1628 @quotation
1629
1630 @mudela[fragment,verbatim]
1631 \relative c'' {
1632   \grace c8 c4 \grace { [c16 c16] } c4
1633   \grace { \property Grace.flagStyle = "" c16 } c4
1634 }
1635
1636 @end mudela
1637 @end quotation
1638
1639 At present, nesting @code{\grace}@keyindex{grace} notes, e.g.
1640
1641 @example
1642
1643   @code{\grace @{ \grace c32 c16 @} c4}
1644 @end example
1645
1646 may result in run-time errors of LilyPond.  Since the meaning of such
1647 a construct is unclear, we don't consider this a loss.  Similarly,
1648 juxtaposing two @code{\grace} sections is syntactically valid, but
1649 makes no sense and may cause runtime errors.
1650
1651 Ending a staff or score with grace notes may also generate a run-time
1652 error, since there will be no main note to attach the grace notes to.
1653
1654
1655
1656 @cindex repeats
1657
1658 @node Repeats, , , Reference Manual
1659
1660 In order to specify repeats, use the @code{\repeat}@keyindex{repeat}
1661 keyword.  Since repeats look and sound differently when played or
1662 printed, there are a few different variants of repeats.
1663
1664 @table @samp
1665   @item unfolded  
1666     Repeated music is fully written (played) out.  Useful for MIDI
1667     output.
1668
1669   @item volta  
1670     This is the normal notation: Repeats are not written out, but
1671     alternative endings (voltas) are printed, left to right.
1672
1673   @item folded  
1674     Alternative endings are written stacked, which is useful for
1675     lyrics.
1676 @end table  
1677
1678 The syntax for repeats is
1679
1680 @example
1681
1682   \repeat @var{variant} @var{repeatcount} @var{repeatbody}
1683 @end example
1684
1685 If you have alternative endings, you may add
1686
1687 @example
1688
1689   \alternative@keyindex{alternative}
1690     @code{@{} @var{alternative1}
1691             @var{alternative2}
1692             @var{alternative3} @dots{} @code{@}}
1693 @end example
1694
1695 where each @var{alternative} is a Music expression.
1696
1697 Normal notation repeats are used like this:
1698
1699 @quotation
1700
1701 @mudela[fragment,verbatim]
1702   c'1
1703   \repeat volta 2 { c'4 d' e' f' }
1704   \repeat volta 2 { f' e' d' c' }
1705
1706 @end mudela
1707 @end quotation
1708
1709 With alternative endings:
1710
1711 @quotation
1712
1713 @mudela[fragment,verbatim]
1714   c'1
1715   \repeat volta 2 {c'4 d' e' f'} 
1716   \alternative { {d'2 d'} {f' f} }
1717
1718 @end mudela
1719 @end quotation
1720
1721 Folded repeats look like this:@footnote{Folded repeats offer little
1722 more over simultaneous music.  However, it is to be expected that
1723 more functionality -- especially for the MIDI backend -- will be
1724 implemented.}
1725
1726 @quotation
1727
1728 @mudela[fragment,verbatim]
1729   c'1
1730   \repeat fold 2 {c'4 d' e' f'} 
1731   \alternative { {d'2 d'} {f' f} }
1732
1733 @end mudela
1734 @end quotation
1735
1736 @quotation
1737
1738 @mudela[fragment,verbatim]
1739 \context Staff {
1740   \relative c' {
1741     \partial 4;
1742     \repeat volta 2 { e | c2 d2 | e2 f2 | }
1743     \alternative { { g4 g g } { a | a a a a | b1 } }
1744   }
1745 }
1746
1747 @end mudela
1748 @end quotation
1749
1750 If you don't give enough alternatives for all of the repeats, then
1751 the first alternative is assumed to be repeated often enough to equal
1752 the specified number of repeats.
1753
1754 @quotation
1755
1756 @mudela[fragment,verbatim]
1757 \context Staff {
1758   \relative c' {
1759     \repeat volta 3 { \partial 4; e | c2 d2 | e2 f2 | }
1760     \alternative { { g4 g g }
1761                    {\partial 1; e4 e e } 
1762                    {\partial 1; a a a a | b1 } }
1763   }
1764 }
1765
1766 @end mudela
1767 @end quotation
1768
1769 It is possible to nest @code{\repeat}.  This is not entirely
1770 supported: the notes will come be in the right places, but the repeat
1771 bars will not.
1772
1773
1774
1775 @cindex transposition of pitches
1776
1777 @node transpose, , , Reference Manual
1778
1779 A music expression can be transposed with
1780 @code{\transpose}@keyindex{transpose}.  The syntax is
1781
1782 @example
1783
1784   \transpose @var{pitch} @var{musicexpr}
1785 @end example
1786
1787 This means that middle C in @var{musicexpr} is transposed to
1788 @var{pitch}.
1789
1790 @code{\transpose} distinguishes between enharmonic pitches: both
1791 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
1792 a tone.  The first version will print sharps and the second version
1793 will print flats.
1794
1795 @quotation
1796
1797 @mudela[fragment,verbatim]
1798 \context Staff {
1799   \clef "F";
1800   { \key e \major; c d e f }
1801   \clef "G";
1802   \transpose des'' { \key e \major; c d e f }
1803   \transpose cis'' { \key e \major; c d e f }
1804 }
1805
1806 @end mudela
1807 @end quotation
1808
1809 If you want to use both @code{\transpose} and @code{\relative}, then
1810 you must use @code{\transpose} first.  @code{\relative} will have no
1811 effect music that appears inside a @code{\transpose}.
1812
1813
1814
1815 @cindex automatic lyric durations
1816
1817 If you have lyrics that are set to a melody, you can import the
1818 rhythm of that melody into the lyrics using @code{\addlyrics}.
1819 @keyindex{addlyrics} The syntax for this is
1820
1821 @example
1822
1823   \addlyrics @var{musicexpr1 musicexpr2}
1824 @end example
1825
1826 This means that both @var{musicexpr1} and @var{musicexpr2} are
1827 interpreted, but that every non-command atomic music expression
1828 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1829 of @var{musicexpr1}.
1830
1831 If the property @code{automaticMelismata}@indexcode{automaticMelismata} is set in the
1832 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1833 notes.
1834
1835 @quotation
1836
1837 @mudela[verbatim,fragment]
1838 \addlyrics
1839 \transpose c'' {
1840   \property Voice.automaticMelismata = ##t
1841   c8 () cis d8. e16 f2
1842 }
1843 \context Lyrics \lyrics {
1844  do4 re mi fa }
1845
1846 @end mudela
1847 @end quotation
1848
1849 You should use a single rhythm melody, and single rhythm lyrics (a
1850 constant duration is the obvious choice).  If you do not, you will get
1851 undesired effects when using multiple stanzas:
1852
1853 @quotation
1854
1855 @mudela[verbatim,fragment]
1856 \addlyrics
1857 \transpose c'' {
1858   c8 () cis d8. e16 f2
1859 }
1860 \context Lyrics \lyrics
1861 < { do4 re mi fa }
1862   { do8 re mi fa } >
1863
1864 @end mudela
1865 @end quotation
1866
1867 It is valid (but probably not very useful) to use notes instead of
1868 lyrics for @var{musicexpr2}.
1869
1870
1871
1872
1873 @node Ambiguities, , ,  Reference Manual
1874 @section Ambiguities
1875
1876 @cindex ambiguities
1877
1878 The grammar contains a number of ambiguities.@footnote{The authors
1879 hope to resolve them at a later time.}
1880
1881 @itemize @bullet
1882   @item  The assignment
1883
1884          @example 
1885 foo = bar 
1886 @end example 
1887
1888        can be interpreted as making a string identifier @code{\foo}
1889        containing @code{"bar"}, or a music identifier @code{\foo}
1890        containing the syllable `bar'.
1891
1892   @item  The assignment
1893
1894          @example 
1895 foo = -6 
1896 @end example 
1897
1898        can be interpreted as making an integer identifier
1899        containing -6, or a Request identifier containing the
1900        fingering `6' (with neutral direction).
1901
1902   @item  If you do a nested repeat like
1903
1904        @quotation
1905
1906 @example 
1907 \repeat @dots{}
1908 \repeat @dots{}
1909 \alternative 
1910 @end example 
1911
1912        @end quotation
1913
1914        then it is ambiguous to which @code{\repeat} the
1915        @code{\alternative} belongs.  This is the classic if-then-else
1916        dilemma.  It may be solved by using braces.
1917
1918   @item  (an as yet unidentified ambiguity :-)
1919 @end itemize
1920
1921
1922
1923 @node Notation conversion specifics, , ,  Reference Manual
1924 @section Notation conversion specifics
1925
1926
1927
1928 @cindex automatic beam generation
1929
1930 @node autobeam, , ,  Reference Manual
1931
1932 By default, LilyPond will generate beams automatically.  This feature
1933 can be disabled by setting the @code{Voice.noAutoBeaming}@indexcode{Voice.noAutoBeaming}
1934 property to 1.  It can be overridden for specific cases by
1935 specifying explicit beams as described in
1936 section XREF-manualbeam [FIXME].
1937
1938 A large number of Voice properties are used to decide how to generate
1939 beams.  Their default values appear in @file{auto-beam-settings.ly}.
1940 In general, beams can begin anywhere, but their ending location is
1941 significant.  Beams can end on a beat, or at durations specified by
1942 the @code{Voice.beamAutoEnd}@indexcode{Voice.beamAutoEnd} property.  To end beams every
1943 quarter note, for example, you could set
1944 @code{Voice.beamAutoEnd}@indexcode{Voice.beamAutoEnd} equal to `@code{"1/4"}'.  To end beams
1945 at every three eighth notes you would set it to `@code{"3/8"}'.  The
1946 same syntax can be used to specify beam starting points using
1947 @code{Voice.beamAutoBegin}@indexcode{Voice.beamAutoBegin}.
1948
1949 To allow different settings for different time signatures, these
1950 property names can start with `@code{time}@var{N}@code{_}@var{M}' to
1951 restrict the definition to `@var{N}@code{/}@var{M}' time.  For example,
1952 to specify beams ending only for 6/8 time you would use the
1953 property @code{Voice.time6_8beamAutoEnd}.  To allow different endings
1954 for notes of different durations, the duration can be tacked onto the
1955 end of the property.  To specify beam endings for beams that contain
1956 32nd notes, you would use @code{Voice.beamAutoEnd_32}.
1957
1958
1959
1960 @cindex chord names
1961
1962 @cindex chords
1963
1964 @cindex printing!chord names
1965
1966 For displaying printed chord names, use the @code{ChordNames}@indexcode{ChordNames}
1967 and @code{ChordNameVoice}@indexcode{ChordNameVoice} contexts.  The chords may be entered
1968 either using the notation described above, or directly using
1969 simultaneous music.
1970
1971 @quotation
1972
1973 @mudela[fragment,verbatim]
1974 <
1975   \context ChordNames {
1976     \chords{a b c} \notes{<d f g>  <e g b>}
1977   }
1978   \context Staff \notes {
1979     a b c' d' e'
1980   }
1981 >
1982
1983 @end mudela
1984 @end quotation
1985
1986 LilyPond examines chords specified as lists of notes to determine a
1987 name to give the chord.  By default, LilyPond will not try to
1988 identify chord inversions:
1989
1990 @mudela[fragment,verbatim,center]
1991   <
1992     \context ChordNameVoice \notes {
1993       <e'1 g' c''>
1994     }
1995     \context Thread \notes {
1996       <e'1 g' c''>
1997     }
1998   >
1999 @end mudela
2000
2001 If you want inversions to be recognized, you must set the property
2002 @code{ChordNames.chordInversion}@indexcode{ChordNames.chordInversion}:
2003
2004 @mudela[fragment,verbatim,center]
2005   <
2006     \property Score.chordInversion = ##t
2007     \context ChordNameVoice \notes {
2008       <e'1 g' c''>
2009     }
2010     \context Thread \notes {
2011       <e'1 g' c''>
2012     }
2013   >
2014 @end mudela
2015
2016
2017
2018 @cindex lyrics
2019
2020 @cindex printing!lyrics
2021
2022 @node lyricprint, , ,  Reference Manual
2023
2024 Lyric syllables must be interpreted within a @code{Lyrics} context
2025
2026 @cindex context!Lyrics
2027  for printing them.
2028
2029 Here is a full example: 
2030
2031 @quotation
2032
2033 @mudela[verbatim]
2034 \score {
2035   <
2036     \notes \transpose c'' {
2037       c d e c | c d e c |
2038       e f g2 | e4 f g2 \bar "|.";
2039     }
2040     \context Lyrics \lyrics { 
2041       Va-4 der Ja- cob Va- der Ja- cob
2042       Slaapt gij nog?2 Slaapt4 gij nog?2
2043     }
2044   >
2045 }
2046
2047 @end mudela
2048 @end quotation
2049
2050 You may want a continuous line after the syllables to show melismata. 
2051 To achieve this effect, add a `@code{__}' lyric as a separate word
2052 after the lyric to be extended.  This will create an extender, a line
2053 that extends over the entire duration of the lyric.  This line will
2054 run all the way to the start of the next lyric, so you may want to
2055 shorten it by using a blank lyric (using `@code{_}').
2056
2057 @quotation
2058
2059 @mudela[verbatim]
2060 \score {
2061   <
2062     \notes \relative c'' {
2063       a4 () b () c () d | c () d () b () a | c () d () b () a
2064     }
2065     \context Lyrics \lyrics {
2066       foo1 __ | bar2. __ _4 | baz1 __
2067     }
2068   >
2069 }
2070
2071 @end mudela
2072 @end quotation
2073
2074      
2075 If you want to have hyphens centered between syllables (rather than
2076 attached to the end of the first syllable) you can use the special
2077 `@code{-}@code{-}' lyric as a separate word between syllables.  This
2078 will result in a hyphen which length varies depending on the space
2079 between syllables, and which will be centered between the syllables. 
2080 For example:
2081
2082 @quotation
2083
2084 @mudela[verbatim]
2085 \score {
2086   <
2087     \notes \transpose c'' {
2088       c d e c | c d e c |
2089       e f g2 | e4 f g2 \bar "|.";
2090     }
2091     \context Lyrics \lyrics {
2092       Va4 -- der Ja -- cob | Va -- der Ja -- cob |
2093       Slaapt gij nog?2 | Slaapt4 gij nog?2
2094     }
2095   >
2096 }
2097
2098 @end mudela
2099 @end quotation
2100
2101
2102
2103 @node Notation Contexts, , ,  Reference Manual
2104 @section Notation Contexts
2105
2106 @cindex notation contexts
2107
2108 Notation contexts are objects that only exist during a run of
2109 LilyPond.  During the interpretation phase of LilyPond, the Music
2110 expression contained in a @code{\score} block is interpreted in time
2111 order.  This is the order in which humans read, play, and write
2112 music.
2113
2114 A context is an object that holds the reading state of the
2115 expression; it contains information like
2116
2117 @itemize @bullet
2118   @item  What notes are playing at this point?
2119   @item  What symbols will be printed at this point?
2120   @item  In what style will they printed?
2121   @item  What is the current key signature, time signature, point within
2122        the measure, etc.?
2123 @end itemize
2124
2125 Contexts are grouped hierarchically: A @code{Voice} context is
2126 contained in a @code{Staff} context (because a staff can contain
2127 multiple voices at any point), a @code{Staff} context is contained in
2128 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
2129 these can all contain multiple staffs).
2130
2131 Contexts associated with sheet music output are called @emph{notation
2132 contexts}, those for sound output are called playing contexts.
2133
2134 Contexts are created either manually or automatically.  Initially,
2135 the top level music expression is interpreted by the top level
2136 context (the @code{Score} context).  When a atomic music expression
2137 (i.e. a note, a rest, @code{\bar}, or @code{\time} commands), a nested
2138 set of contexts is created that can process these atomic expressions,
2139 as in this example:
2140
2141 @example
2142
2143   @example 
2144 \score @{ \notes < c4 > @} 
2145 @end example 
2146
2147 @end example
2148
2149 The sequential music, `@code{@{ c4 @}}' is interpreted by @code{Score}
2150 context. When the note `@code{c4}' itself is interpreted, a set of
2151 contexts is needed that will accept notes.  The default for this is a
2152 @code{Voice} context, contained in a @code{Staff} context.  Creation of
2153 these contexts results in the staff being printed.
2154
2155
2156 @cindex context
2157
2158 You can also create contexts manually, and you probably have to do so
2159 if you want to typeset complicated multiple part material.  If a
2160 `@code{\context} @var{name} @var{musicexpr}' expression is encountered
2161 during the interpretation phase, the @var{musicexpr} argument will be
2162 interpreted with a context of type @var{name}.  If you specify a name,
2163 the specific context with that name is searched.
2164
2165 If a context of the specified type and name can not be found, a new
2166 one is created.  For example,
2167
2168 @quotation
2169
2170 @mudela[verbatim]
2171 \score {
2172   \notes \relative c'' {
2173     c4 <d4 \context Staff = "another" e4> f
2174   }
2175 }
2176
2177 @end mudela
2178 @end quotation
2179
2180 In this example, the @code{c} and @code{d} are printed on the
2181 default staff.  For the @code{e}, a context Staff called
2182 `@code{another}' is specified; since that does not exist, a new
2183 context is created.  Within @code{another}, a (default) Voice context
2184 is created for the @code{e4}.  When all music referring to a
2185 context is finished, the context is ended as well.  So after the
2186 third quarter, @code{another} is removed.
2187
2188 Almost all music expressions inherit their interpretation context
2189 from their parent.  In other words, suppose that the syntax for a
2190 music expression is
2191
2192 @example
2193
2194   \keyword @var{musicexpr1} @var{musicexpr2} @dots{}
2195 @end example
2196
2197 When the interpretation of this music expression starts, the context
2198 for @var{musicexpr1}, @var{musicexpr2}, etc. is that of the total
2199 expression.
2200
2201 Lastly, you may wonder, why this:
2202
2203 @quotation
2204
2205 @example 
2206 \score @{
2207   \notes \relative c'' @{
2208     c4 d4 e4
2209   @}
2210 @} 
2211 @end example 
2212
2213 @end quotation
2214
2215 doesn't result in this:
2216
2217 @mudela[]
2218
2219   \score {
2220     \notes \relative c'' {
2221       <c4> <d4> <e4>
2222     }
2223   }
2224
2225 @end mudela
2226
2227 For the @code{c4}, a default @code{Staff} (with a contained
2228 @code{Voice}) context is created.  After the @code{c4} ends, no
2229 music refers to this default staff, so it would be ended, with the
2230 result shown.  To prevent this inconvenient behavior, the context to
2231 which the sequential music refers is adjusted during the
2232 interpretation.  So after the @code{c4} ends, the context of the
2233 sequential music is also the default @code{Voice} context. 
2234 The @code{d4} gets interpreted in the same context
2235 as @code{c4}.
2236
2237
2238
2239 These are the contexts supplied with the package.  They are defined
2240 in the initialization file @file{ly/engraver.ly}.
2241
2242 @table @samp
2243 @end table
2244
2245
2246
2247 Properties that are set in one context are inherited by all of the
2248 contained contexts.  This means that a property valid for the
2249 @code{Voice} context can be set in the @code{Score} context (for
2250 example) and thus take effect in all @code{Voice} contexts.
2251
2252 Properties can be preset within the @code{\translator} block
2253 corresponding to the appropriate context.  In this case, the syntax
2254 is
2255
2256 @example
2257
2258   @var{propname} @code{=} @var{value}
2259 @end example
2260
2261 This assignment happens before interpretation starts, so a
2262 @code{\property} expression will override any predefined settings.
2263
2264 The @code{\property} expression will create any property you specify.
2265 There is no guarantee that a property will be used.  So if you spell
2266 a property name wrong, there will be no error message.
2267
2268 The property settings are used during the interpretation phase.  They
2269 are read by the LilyPond modules where interpretation contexts are
2270 built of.  These modules are called @emph{translators}.  Translators for
2271 notation are called @emph{engravers}, and translators for sound are
2272 called @emph{performers}.
2273
2274 The precise result of a property is determined by the implementation
2275 of the translator that reads them.  Therefore, the result of a
2276 property can vary, since it is implementation and configuration
2277 dependent.
2278
2279 In order to fully find out what properties are used, you must
2280 currently search the source code for calls to @code{get_property}. 
2281 The rest of the section is devoted to an (incomplete) overview of
2282 available properties.
2283
2284 @mbinclude properties.itely
2285
2286 @node Notation output definitions, , ,  Reference Manual
2287 @section Notation output definitions
2288
2289 @cindex output
2290
2291 @cindex notation output
2292
2293 @cindex output definition
2294
2295 @node paper, , ,  Reference Manual
2296
2297 The most important output definition is the @code{\paper} block, for
2298 music notation.  The syntax is
2299
2300 @example
2301
2302   @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2303 @end example
2304
2305 where each of the items is one of
2306
2307 @itemize @bullet
2308   @item  An assignment.  The assignment must be terminated by a
2309        semicolon.  See section XREF-papervars [FIXME] for information on
2310        paper variables.
2311
2312   @item  A context definition.  See section XREF-contextdefs [FIXME] for
2313        more information on context definitions.
2314
2315   @item
2316         FIXME now in SCM
2317
2318         A margin shape declaration.  The syntax is
2319
2320        @example
2321
2322          \shape @var{indent1}@code{,} @var{width1}@code{,}
2323                       @var{indent2}@code{,} @var{width2} @dots{} @code{;}
2324        @end example
2325
2326        @keyindex{shape}
2327
2328        Each pair of @var{indent} and @var{width} values is a dimension
2329        specifying how far to indent and how wide to make the line. 
2330        The indentation and width of successive lines are specified by
2331        the successive pairs of dimensions.  The last pair of
2332        dimensions will define the characeristics of all lines beyond
2333        those explicitly specified.
2334
2335   @item  \stylesheet  declaration.  Its syntax is
2336
2337        @example
2338                 \stylesheet @var{scm}
2339        @end example
2340
2341
2342         See font.scm for details of @var{scm} 
2343 @end itemize
2344
2345
2346
2347 @cindex changing font size and paper size
2348
2349 The Feta font provides musical symbols at six different sizes.  These
2350 fonts are 11 point, 13 point, 16 point, 20 point,
2351 23 point, and 26 point.  The point size of a font is the
2352 height of the five lines in a staff when displayed in the font.
2353
2354 Definitions for these sizes are the files @file{paperSZ.ly}, where
2355 @code{SZ} is one of 11, 13, 16, 20, 23 and 26.  If you include
2356 any of these files, the identifiers @code{paper_eleven},
2357 @code{paper_thirteen}, @code{paper_sixteen}, @code{paper_twenty},
2358 @code{paper_twentythree}, and @code{paper_twentysix} are defined
2359 respectively.  The default @code{\paper} block is also set.
2360
2361 To change the paper size, you must first set the
2362 @code{papersize}@indexcode{papersize} variable at top level.  Set it to the strings
2363 @code{a4}, @code{letter}, or @code{legal}.  After this specification,
2364 you must set the font as described above.  If you want the default
2365 font, then use the 20 point font.  The new paper size will not
2366 take effect if the font is not loaded and selected afterwards.  Paper
2367 size selection works by loading a file named after the paper size you
2368 select.
2369
2370
2371
2372 @cindex paper variables
2373
2374 @node Paper variables, , ,  Reference Manual
2375
2376 There is a large number of paper variables that are used to control
2377 details of the layout.  These variables control the defaults for the
2378 entire score.  Usually, they do not have to be changed; they are by
2379 default set to values that depend on the font size in use.  The
2380 values are used by the graphic objects while formatting the score;
2381 they are therefore implementation dependent.  Most variables are
2382 accompanied by documentation in the initalization file
2383 @file{params.ly} or @file{paperSZ.ly}, where @code{SZ} is the staff
2384 height in points.
2385
2386 Nevertheless, here are some variables you may want to use or change:
2387
2388 @table @samp
2389   @item @code{indent}@indexcode{indent}  
2390     The indentation of the first line of music.
2391
2392   @item @code{staffspace}@indexcode{staffspace}
2393     The distance between two staff lines, calculated from the center
2394     of the lines.  You should use either this or @code{rulethickness}
2395     as a unit for distances you modify.
2396   
2397   @item @code{linewidth}@indexcode{linewidth}  
2398     Sets the width of the lines.  If set to -1.0, a single
2399     unjustified line is produced.
2400
2401   @item @code{textheight}@indexcode{textheight}  
2402     Sets the total height of the music on each page. Only used by
2403     ly2dvi.
2404
2405   @item @code{interscoreline}@indexcode{interscoreline}  
2406     Sets the spacing between the score lines. Defaults to 16 pt.
2407
2408   @item @code{interscorelinefill}@indexcode{interscorelinefill}  
2409     If set to a positive number, the distance between the score 
2410     lines will stretch in order to fill the full page. In that
2411     case @code{interscoreline} specifies the minimum spacing.
2412     Defaults to 0.
2413
2414   @item @code{stafflinethickness}@indexcode{stafflinethickness}  
2415     Determines the thickness of staff and bar lines. 
2416 @end table
2417
2418
2419 @node contextdefs, , ,  Reference Manual
2420
2421 @cindex context definition
2422
2423 A notation contexts is defined by the following information
2424
2425 @enumerate i
2426   @item  A name.
2427
2428   @item  The LilyPond modules that do the actual conversion of music to
2429        notation.  Each module is a so-called
2430        @emph{engraver}
2431 @cindex engraver
2432 .
2433
2434   @item  How these modules should cooperate, i.e. which ``cooperation
2435        module'' should be used.  This cooperation module is a special
2436        type of engraver.
2437
2438   @item  What other contexts the context can contain,
2439
2440   @item  What properties are defined.
2441 @end enumerate
2442
2443 A context definition has this syntax:
2444
2445 @example
2446
2447   \translator @code{@{}
2448                       @var{translatorinit} @var{translatormodifierlist}
2449                     @code{@}}
2450 @end example
2451
2452 @var{translatorinit} can be an identifier or of the form
2453
2454 @example
2455
2456   \type @var{typename} @code{;}
2457 @end example
2458
2459 @var{typename} is one of
2460
2461 @table @samp
2462   @item @code{Engraver_group_engraver}@indexcode{Engraver_group_engraver}  
2463     The standard cooperation engraver.
2464
2465   @item @code{Score_engraver}@indexcode{Score_engraver}  
2466     This is cooperation module that should be in the top level context.
2467
2468   @item @code{Grace_engraver_group}@indexcode{Grace_engraver_group}  
2469     This is a special cooperation module (resembling
2470     @code{Score_engraver}) that is used to created an embedded
2471     `miniscore'.
2472 @end table 
2473
2474 @var{translatormodifierlist} is a list of items where each item is
2475 one of
2476
2477 @itemize @bullet
2478   @item  @code{\consists} @var{engravername} @code{;}  
2479     Add @var{engravername} to the list of modules in this context. 
2480     Section XREF-engravers [FIXME] contains an overview of the engravers
2481     available.  The order of engravers added with @code{\consists} is
2482     significant.
2483   
2484   @item  @code{\consistsend} @var{engravername} @code{;}  
2485     Analogous to @code{\consists}, but makes sure that
2486     @var{engravername} is always added to the end of the list of
2487     engravers.
2488
2489     Some engraver types need to be at the end of the list; this
2490     insures they are put there, and stay there, if a user adds or
2491     removes engravers.  This command is usually not needed for
2492     end-users.
2493     
2494   @item  @code{\accepts} @var{contextname} @code{;}  
2495     Add @var{contextname} to the list of  context this context can
2496     contain.  The first listed context the context to create by
2497     default.
2498   
2499   @item  @code{\remove} @var{engravername} @code{;}  
2500     Remove a previously added (with @code{\consists}) engraver.
2501   
2502   @item  @code{\name} @var{contextname} @code{;}  
2503     This sets name of the context, e.g. @code{Staff}, @code{Voice}.  If
2504     the name is not specified, the translator won't do anything.
2505
2506   @item  @var{propname} @code{=} @var{value} @code{;}  
2507     A property assignment.  It is allowed to use reals for
2508     @var{value}.
2509 @end itemize
2510
2511 In the @code{\paper} block, it is also possible to define translator
2512 identifiers.  Like other block identifiers, the identifier can only
2513 be used as the very first item of a translator.  In order to define
2514 such an identifier outside of @code{\score}, you must do
2515
2516 @quotation
2517
2518 @example 
2519 \paper @{
2520   foo = \translator @{ @dots{} @}
2521 @}
2522 \score @{
2523   \notes @{
2524     @dots{}
2525   @}
2526   \paper @{
2527     \translator @{ \foo @dots{} @}
2528   @}
2529 @} 
2530 @end example 
2531
2532 @end quotation
2533
2534
2535 @cindex paper types, engravers, and pre-defined translators
2536
2537 Some pre-defined identifiers can simplify modification of
2538 translators.  The pre-defined identifiers are:
2539
2540 @table @samp
2541   @item @code{StaffContext}@indexcode{StaffContext}  
2542     Default Staff context. 
2543
2544   @item @code{RhythmicStaffContext}@indexcode{RhythmicStaffContext}  
2545     Default RhythmicStaff context. 
2546
2547   @item @code{VoiceContext}@indexcode{VoiceContext}  
2548     Default Voice context.  
2549
2550   @item @code{ScoreContext}@indexcode{ScoreContext}  
2551     Default Score context. 
2552
2553   @item @code{ScoreWithNumbers}@indexcode{ScoreWithNumbers}  
2554     Score context with numbering at the Score level.
2555
2556   @item @code{BarNumberingStaffContext}@indexcode{BarNumberingStaffContext}  
2557     Staff context with numbering at the Staff level.
2558
2559   @item @code{HaraKiriStaffContext}@indexcode{HaraKiriStaffContext}  
2560     Staff context that does not print if it only contains rests. 
2561     Useful for orchestral scores.@footnote{Harakiri, also called
2562     Seppuku, is the ritual suicide of the Samourai.}
2563
2564   @item @code{OrchestralPartStaffContext}@indexcode{OrchestralPartStaffContext}
2565
2566   @item @code{OrchestralScoreContext}@indexcode{OrchestralScoreContext}
2567 @end table
2568
2569 Using these pre-defined values, you can remove or add items to the
2570 translator:
2571
2572 @quotation
2573
2574 @example 
2575 \paper @{
2576   \translator @{
2577     \StaffContext
2578     \remove Some_engraver;
2579     \consists Different_engraver;
2580   @}
2581 @} 
2582 @end example 
2583
2584 @end quotation
2585
2586       
2587 @node Sound output, , ,  Reference Manual
2588 @section Sound output
2589
2590
2591
2592 The MIDI block is analogous to the paper block, but it is simpler.
2593 The @code{\midi} block can contain:
2594 @cindex MIDI block
2595
2596 @itemize @bullet
2597   @item  a @code{\tempo} definition
2598   @item  context definitions
2599 @end itemize
2600
2601 Assignments in the @code{\midi} block are not allowed.
2602
2603
2604
2605 @cindex context definition
2606
2607 Context definitions follow precisely the same syntax as within the
2608 \paper block.  Translation modules for sound are called performers.
2609 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2610
2611
2612
2613 @cindex MIDI instrument names
2614
2615 @node midilist, , , Reference Manual
2616
2617 The MIDI instrument name is set by the
2618 @code{Staff.midiInstrument}@indexcode{Staff.midiInstrument} property or,
2619 if that property is not set, the
2620 @code{Staff.instrument}@indexcode{Staff.instrument} property.  The
2621 instrument name should be chosen from the following list.  If the
2622 selected string does not exactly match, then LilyPond uses the default
2623 piano.
2624
2625 @c @quotation
2626
2627 @example 
2628 "acoustic grand"            "contrabass"           "lead 7 (fifths)"
2629 "bright acoustic"           "tremolo strings"      "lead 8 (bass+lead)"
2630 "electric grand"            "pizzicato strings"    "pad 1 (new age)"
2631 "honky-tonk"                "orchestral strings"   "pad 2 (warm)"
2632 "electric piano 1"          "timpani"              "pad 3 (polysynth)"
2633 "electric piano 2"          "string ensemble 1"    "pad 4 (choir)"
2634 "harpsichord"               "string ensemble 2"    "pad 5 (bowed)"
2635 "clav"                      "synthstrings 1"       "pad 6 (metallic)"
2636 "celesta"                   "synthstrings 2"       "pad 7 (halo)"
2637 "glockenspiel"              "choir aahs"           "pad 8 (sweep)"
2638 "music box"                 "voice oohs"           "fx 1 (rain)"
2639 "vibraphone"                "synth voice"          "fx 2 (soundtrack)"
2640 "marimba"                   "orchestra hit"        "fx 3 (crystal)"
2641 "xylophone"                 "trumpet"              "fx 4 (atmosphere)"
2642 "tubular bells"             "trombone"             "fx 5 (brightness)"
2643 "dulcimer"                  "tuba"                 "fx 6 (goblins)"
2644 "drawbar organ"             "muted trumpet"        "fx 7 (echoes)"
2645 "percussive organ"          "french horn"          "fx 8 (sci-fi)"
2646 "rock organ"                "brass section"        "sitar"
2647 "church organ"              "synthbrass 1"         "banjo"
2648 "reed organ"                "synthbrass 2"         "shamisen"
2649 "accordion"                 "soprano sax"          "koto"
2650 "harmonica"                 "alto sax"             "kalimba"
2651 "concertina"                "tenor sax"            "bagpipe"
2652 "acoustic guitar (nylon)"   "baritone sax"         "fiddle"
2653 "acoustic guitar (steel)"   "oboe"                 "shanai"
2654 "electric guitar (jazz)"    "english horn"         "tinkle bell"
2655 "electric guitar (clean)"   "bassoon"              "agogo"
2656 "electric guitar (muted)"   "clarinet"             "steel drums"
2657 "overdriven guitar"         "piccolo"              "woodblock"
2658 "distorted guitar"          "flute"                "taiko drum"
2659 "guitar harmonics"          "recorder"             "melodic tom"
2660 "acoustic bass"             "pan flute"            "synth drum"
2661 "electric bass (finger)"    "blown bottle"         "reverse cymbal"
2662 "electric bass (pick)"      "skakuhachi"           "guitar fret noise"
2663 "fretless bass"             "whistle"              "breath noise"
2664 "slap bass 1"               "ocarina"              "seashore"
2665 "slap bass 2"               "lead 1 (square)"      "bird tweet"
2666 "synth bass 1"              "lead 2 (sawtooth)"    "telephone ring"
2667 "synth bass 2"              "lead 3 (calliope)"    "helicopter"
2668 "violin"                    "lead 4 (chiff)"       "applause"
2669 "viola"                     "lead 5 (charang)"     "gunshot"
2670 "cello"                     "lead 6 (voice)" 
2671 @end example 
2672
2673 @c @end quotation
2674
2675
2676 @cindex MIDI types and performers
2677
2678 The types available for  MIDI translators are:
2679
2680 @table @samp
2681   @item @code{Performer_group_performer}@indexcode{Performer_group_performer}
2682   @item @code{Score_performer}@indexcode{Score_performer}
2683   @item @code{Staff_performer}@indexcode{Staff_performer}
2684 @end table
2685
2686 The performers for MIDI translators are:
2687
2688 @table @samp
2689   @item @code{Key_performer}@indexcode{Key_performer}
2690   @item @code{Time_signature_performer}@indexcode{Time_signature_performer}
2691   @item @code{Note_performer}@indexcode{Note_performer}
2692   @item @code{Lyric_performer}@indexcode{Lyric_performer}
2693   @item @code{Swallow_performer}@indexcode{Swallow_performer}
2694 @end table
2695
2696
2697
2698 @node Pre-defined Identifiers, , ,  Reference Manual
2699
2700 @section Pre-defined Identifiers
2701
2702 @cindex pre-defined identifiers
2703
2704
2705 Various identifiers are defined in the initialization files to
2706 provide shorthands for some settings.  Most of them are in
2707 @file{ly/declarations.ly}.
2708
2709 @table @samp
2710   @item @code{\break}@keyindex{break}  
2711     Force a line break in music by using a large argument for the
2712     keyword @code{\penalty}.
2713
2714   @item @code{\center}@keyindex{center}  
2715     Used for setting direction  properties.  Equals 0.
2716
2717   @item @code{\down}@keyindex{down}  
2718     Used for setting direction setting properties.  Is equal
2719     to -1.
2720
2721   @item @code{\free}@keyindex{free}  
2722     Used for setting direction setting properties.  Is equal
2723     to 0.
2724
2725   @item @code{\left}@keyindex{left}  
2726     Used for setting text alignment property.  Is equal to -1.
2727
2728   @item @code{\nobreak}@keyindex{nobreak}  
2729     Prevent a line break in music by using a large negative argument
2730     for the keyword @code{\penalty}.
2731
2732   @item @code{\none}@keyindex{none}  
2733     Used for setting @code{Score.beamslopedamping} and
2734     @code{Score.beamquantisation} properties.  Is equal to 0.
2735
2736   @item @code{\normal}@keyindex{normal}  
2737     Used for setting @code{Score.beamslopedamping} and
2738     @code{Score.beamquantisation} properties.  Is equal to 1.
2739
2740   @item @code{\normalkey}@keyindex{normalkey}  
2741     Select normal key signatures where each octave has the same key
2742     signature.  This sets the @code{Staff.keyoctaviation} property.
2743
2744   @item @code{\right}@keyindex{right}  
2745     Used for setting text alignment property.  Is set to 1.
2746
2747   @item @code{\shiftoff}@keyindex{shiftOff}  
2748     Disable horizontal shifting of note heads that collide.  Sets the
2749     @code{Voice.horizontalNoteShift} property.
2750
2751   @item @code{\shiftOn}@keyindex{shiftOn}  
2752     Enable note heads that collide with other note heads to be
2753     shifted horiztonally.  Sets the @code{Voice.horizontalNoteShift}
2754     property.
2755
2756   @item @code{\slurBoth}@keyindex{slurBoth}  
2757     Allow slurs to be above or below notes.  This sets the
2758     @code{Voice.slurVerticalDirection} property.
2759
2760   @item @code{\slurDown}@keyindex{slurDown}  
2761     Force slurs to be below notes.  This sets the
2762     @code{Voice.slurVerticalDirection} property.
2763
2764   @item @code{\slurUp}@keyindex{slurUp}  
2765     Force slurs to be above notes.  This sets the
2766     @code{Voice.slurVerticalDirection} property.
2767
2768   @item @code{\specialkey}@keyindex{specialkey}  
2769     Allow key signatures do differ in different octaves.  This sets
2770     the @code{Staff.keyoctaviation} property.
2771
2772   @item @code{\stemBoth}@keyindex{stemBoth}  
2773     Allow stems, beams, and slurs to point either upwards or
2774     downwards, decided automatically by LilyPond.  This sets the
2775     @code{Voice.verticalDirection} property.
2776
2777   @item @code{\stemdown}@keyindex{stemdown}  
2778     Force stems, beams, and slurs to point down.  This sets the
2779     @code{Voice.verticalDirection} property.
2780
2781   @item @code{\stemUp}@keyindex{stemUp}  
2782     Force stems, beams and slurs to point up.  This sets the
2783     @code{Voice.verticalDirection} property.
2784
2785   @item @code{\traditional}@keyindex{traditional}  
2786     Used for setting the @code{Score.beamquantisation} property.  Is
2787     equal to 2.
2788
2789   @item @code{\up}@keyindex{up}  
2790     Used for setting various direction properties.  Is equal
2791     to 1.
2792 @end table