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