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