]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/tex/refman.yo
release: 1.0.13
[lilypond.git] / Documentation / tex / refman.yo
1 COMMENT(-*-text-*-)
2
3 redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))\
4     whenhtml(sc(ARG1)))
5
6
7 redef(mycode)(1)(tt(ARG1))
8
9
10 COMMENT( This document contains Mudela fragments.  You need at least
11 Yodl-1.30.18 to convert this to tex or html.
12
13 TODO
14
15 in stead <-> instead
16 )
17
18 htmlbodyopt(bgcolor)(white)
19 htmlcommand(<font color=black>)
20
21 latexlayoutcmds(
22 \setlength{\topmargin}{-0.25in}
23 \setlength{\textheight}{9in}
24 \setlength{\textwidth}{5.875in} 
25 \setlength{\oddsidemargin}{0.25in}   
26 \setlength{\evensidemargin}{0.25in}
27 \input mudela-book
28 )
29
30 COMMENT(whenlatex(notableofcontents()))
31 whentexinfo(notableofcontents())
32
33 article(Mudela Reference Manual)
34       (Andrew Moriano, Han-Wen Nienhuys and Jan Nieuwenhuizen)
35       (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
36
37 COMMENT(
38
39 * The [ ] look weird
40
41 * paragraphs have too much space.
42
43 )
44
45
46 latexcommand(\def\interexample{})
47 latexcommand(\def\preexample{\par})
48 latexcommand(\def\postexample{\par\medskip})
49 latexcommand(\def\file#1{{code(#1)}})
50 COMMENT(
51 latexcommand(\def\texttt#1{\tt #1})
52 latexcommand(\def\textbf#1{\bf #1})
53 )
54
55 COMMENT(urg, texinfo include breaks)
56 whenhtml(
57 includefile(html-disclaimer.yo-urg)
58 )
59
60 bf(This document is not up to date).  All rendered examples of course
61 are current, but the rest probably isn't.  Adjusting the tutorial was
62 considered more important than writing the reference manual.  We
63 apologize for the inconvenience.  For a complete and up-to-date
64 definition, see file(lily/parser.yy), file(lily/lexer.ll), and the
65 init files.
66
67 This document describes the the GNU LilyPond input format, which is an
68 effective language for defining music.  We call this language (rather
69 arrogantly) The Musical Definition Language or Mudela, for
70 short.footnote(If anybody comes up with a better name, we'd gladly
71   take this. Gourlay already uses Musical Description Language,
72   G-Sharp Score Definition Language.  ISO standard 10743 defines a
73   Standard Music Description Language.  We're not being original here.)
74
75 The first aim of Mudela is to define a piece of music, being complete
76 from both from a musical typesetting, as from a musical performing
77 point of view.
78
79 The Musical Definition Language (Mudela), has a logical structure,
80 making use of identifiers, that allows for flexible input, and
81 definition reuse. See the documentation file file(MANIFESTO), included
82 with the LilyPond sources for reasons and design considerations.
83
84
85 sect(Running LilyPond)
86
87 When invoked with a filename that has no extension, LilyPond will try adding
88 a file(.fly) extension first, and a file(.ly) extension second.  
89 If the filename ends with 
90 file(.fly),  LilyPond processes  the file as music using
91 file(init.fly).  In this case, LilyPond does something
92 like:
93 verb(\score {
94   \notes\relative c {
95     \input "yourfile.fly"
96   }
97   \paper{}
98   \midi{}
99 })
100 If you invoke LilyPond with a file file(foo.)var(ext) that doesn't
101 have the file(.ly) extension then LilyPond will look for a file called
102 file(init.)var(ext) and process this file.  The file
103 file(init.)var(ext) must contain the code(\maininput) keyword or LilyPond
104 will not read the user specified file.
105
106
107 sect(Syntax)
108
109 subsect(Basic Mudela)
110
111 A Mudela file consists of keywords with arguments and identifier
112 assignments separated by spaces, tabs or newlines.  (Semicolons are
113 used by some keywords but are not generally required.)  A one line
114 comment is introduced by a code(%) character.  Block comments are
115 started by code(%{) and ended by code(%}).  They cannot be nested.
116
117 Mudela supports several types:
118
119 description(
120
121 dit(integer) 
122 Formed from an optional minus sign followed by digits.  Arithmetic
123 operations cannot be done with integers, and integers cannot be mixed
124 with reals.
125
126 dit(real) 
127 Formed from an optional minus sign and a sequence of digits followed
128 by a emph(required) decimal point and an optional exponent such as
129 code(-1.2e3).  Reals can be built up using the usual operations:
130 code(+), code(-), code(*), and code(/), with parentheses for grouping.
131
132 dit(string) 
133 Begins and ends with the code(") character.  To include a code(")
134 character in a string write code(\").  Various other backslash
135 sequences have special interpretations as in the C language.  A string
136 that contains no spaces can be written without the quotes.  See
137 Section ref(modes) for details on unquoted strings; their
138 interpretation varies depending on the situation.  On the right side
139 of identifier assignments and within the code(\header) keyword,
140 strings can be concatenated using the code(+) character.
141
142 dit(dimension) Consists of a real followed by one of the dimension
143 keywords: code(\mm), code(\pt), code(\in), or code(\cm).  Dimensions
144 are converted immediately to a real which gives the dimension in
145 points, so they can be mixed with reals, but the result is no longer
146 of type dimension.  The keywords that require a dimension
147 (code(\shape) and code(\symboltables)) will not accept this.
148
149 dit(pitch) 
150 A pitch is a string which is the name of a pitch.  Example: code(a).
151 The pitch names can be redefined with the code(\notenames) keyword.
152 See Section(notelang) for pitch names in different languages.  Pitches
153 can only be specified inside note mode which is specified with
154 code(\notes).  Therefore, keywords which require pitch arguments must
155 appear inside code(\notes).  
156
157 dit(music) 
158 Music is a compound type: arbitrarily complicated expressions with a
159 hierarchical structure can be formed from simple building blocks.  The
160 simplest expression of type music is a single note.  A note is formed
161 from a pitch and an optional duration and must be specified within
162 code(\notes).  See Section ref(notedesc) for details.  More
163 complicated expressions of type music are formed by surrounding a
164 sequence of expressions of type music with braces code({) and code(})
165 or with angle brackets code(<) and code(>).  Items appearing in braces
166 will be treated as serial. Items in angle brackets will be
167 simultaneous.  So for example code({ c e g }) represents an arpeggio
168 and code(< c e g >) represents a chord.  These items can be nested any
169 way you like.  This simple example shows how three chords can be
170 expressed in two different ways:
171 mudela(fragment,verbatim,center)(
172 \notes<{a b  c'}{c' d' e'}{e' f' g'}>
173 \notes{<a c' e'><b  d' f'><c' e' g'>}
174 )
175
176 )
177
178
179 COMMENT(
180 Compound types are built up from the simple types.  The compound types
181 are: arglist, assignlist and musiclist.  An arglist is a
182 white space separated list of integers, reals and or strings surrounded
183 by braces code({) and code(}).  An assignlist is a list of 
184 identifier assignments, which have the form var(key)code(=)var(value).
185 A statement in Mudela has one of three forms:
186 verb(\keyword argument
187 \keyword argument1 argument2 ... ;
188 string=value)
189 )
190
191 subsect(Identifiers)
192
193 Identifiers allow names to be assigned to constants, music, or other
194 Mudela structures.  To assign an identifier you use
195 var(name)=var(value) and to refer to an identifier, you preceed its
196 name with a backslash: code(\)var(name).  It is legal to redefine an
197 identifier in terms of its old value: code(foo = \foo * 2.0).
198 Identifier assignments must appear at the top level in the Mudela
199 file.
200
201 An identifier can be created with any string for its name, but you
202 will only be able to refer to identifiers whose names begin with a
203 letter and are entirely alphanumeric.  It is also impossible to refer
204 to an identifier whose name is the same as the name of a keyword.  The
205 following words are keywords:
206 verb(absdynamic   header         musicalpitch   score         transpose
207 accepts      in             notenames      script        type     
208 bar          include        notes          shape         version  
209 cadenza      key            output         skip        
210 clef         keysignature   paper          spandynamic 
211 cm           lyric          partial        symboltables
212 consists     maininput      penalty        table       
213 duration     mark           property       tempo       
214 font         midi           pt             time        
215 grouping     mm             relative       translator)
216
217 The right hand side of an identifier assignment is parsed completely
218 when the assignment is made.  It therefore must have any context
219 specified in the definition.  For example, you must write
220 code(foo=\notes{a8 b c}) rather than code(foo={a8 b c}).  Even though
221 the context is specified in the definition, you must refer to the
222 identifier inside the correct context:
223 verb(foo = \paper{ linewidth = 6.0\in }
224 \score{
225   \notes{ ... }
226   \paper{ \foo }
227 })
228 If code(\foo) is used here without the surrounding code(\paper) then
229 an error will result.
230
231 Identifiers can be set equal to integers, reals, strings, music,
232 durations (specified with code(\duration)), note ornaments (specified
233 with code(\script), dynamics commands, or code(:)), translator
234 definitions, the code(\paper) block, the code(\midi) block or the
235 code(\score) block.  When identifiers are used for translators, the
236 code(\paper), code(\midi), and code(\score) blocks, they may only be
237 referred to as the first item in a block.  So code(\paper{\one \two})
238 is illegal because the identifier code(\two) is not the first thing in
239 the block.
240
241
242
243 COMMENT(
244 subsect(Hierarchical structures)
245
246 The general structure consists of declarations:
247 verb(IDENTIFIER = \TYPE{
248         <type specific data>
249 })
250 and instantiations:
251
252 verb(\TYPE{ <type specific data> })
253
254 (Currently, code(\score) is the only type that can be instantiated
255 at top level.)
256
257 Most instantiations that use an IDENTIFIER are specified as follows:
258
259 verb(\TYPE{ \IDENTIFIER [...] })
260
261 Some exceptions on this rule have been made to prevent inputting
262 Mudela becoming tedious
263 )
264
265
266 subsect(Modes)
267 label(modes)
268
269 To simplify different aspects of music definition (entering the notes
270 and manipulating them) Mudela has three different input modes which
271 affect how unquoted strings are interpreted.
272 In each mode, words are identified on the input.  If code("word") is
273 encountered, it is treated as a string.  If code(\word) is
274 encountered it is treated as a keyword or as an identifier.  The
275 behavior of the modes differs in two ways: different modes treat
276 unquoted words different, and different modes have different rules for
277 deciding what is a word.  
278
279 description(
280
281 dit(Normal mode)
282 At the start of parsing, Mudela is in normal mode.
283 In normal mode, a word is an alphabetic character followed by
284 alphanumeric characters.  If code(word) is encountered on the input it
285 is treated as a string. 
286
287 dit(Note mode) Note mode is introduced by the keyword
288 code(\notes).  In Note mode, words can only contain alphabetic
289 characters.  If code(word) is encountered, LilyPond first checks for a
290 notename of code(word).  If no notename is found, then code(word) is
291 treated as a string.  If you mistype a notename, the parser will most
292 likely complain that you should be in code(\lyric) mode to do lyrics. 
293
294 dit(Lyric mode) Lyrics mode is introduced by the keyword
295 code(\lyric).  This mode is has rules that make it easy to include
296 punctuation and diacritical marks in words.  A word in Lyrics mode
297 begins with: an alphabetic character, code(_),
298 code(?), code(!), code(:), code('), 
299 the control characters code(^A) through code(^F), code(^Q) through
300 code(^W), code(^Y), code(^^), any 8-bit character with ASCII code over
301 127, or a two character combination of a backslash followed by one
302 of code(`), code('), code(") or code(^).  
303 Subsequent characters of a word can be any character that is not a
304 digit and not white space.  One important consequence of this is that
305 a word can end with code(}), which may be confusing if you thought the
306 code(}) was going to terminate lyrics mode.  Any code(_) characters
307 which appear in an unquoted word are converted to spaces, providing a
308 mechanism for introducing spaces into words without using quotes.  
309 Quoted words can also be used in lyrics mode to specify words that
310 cannot be specified with the above rules.  Here are some examples.
311 Not all of these words are printable by TeX().  
312 verb(a&@&@&TSI|{[    % a word
313 \'afoo}         % a word
314 1THtrhortho     % not a word because it starts with a digit
315 ``Hello''       % not a word because it starts with `
316 Leise DOEXPAND(Fl\)DOEXPAND("u\)ss{}teren meine Sapfe       % 4 words
317 _ _ _ _         % 4 words, each one a space
318 ))
319
320
321 COMMENT(
322 These modes are of a lexical nature. Normal and Note mode largely
323 resemble each other, save the possibility of entering Reals, 
324 meaning of code(_) and the resolution of words
325
326 What's this about reals?  When can you enter them or not enter them?)
327
328
329 sect(Note Description)
330 label(notedesc)
331
332 subsect(Basic Note Specification)
333
334 A note specification has the form 
335 var(pitch)[var(octavespec)][code(!)][var(duration)].
336 The pitch of the note is specified by the note's name.  
337
338 LilyPond has predefined note names for various languages.  The default
339 names are the Dutch note names.  The notes are specified by the
340 letters code(c) through code(b), where code(c) is an octave below
341 middle C and the letters span the ocatave above that C.  
342 In Dutch, a sharp is formed by adding
343 code(-is) to the end of a pitch name.  A flat is formed by adding code(-es).
344 Double sharps and double flats are obtained by adding code(-isis) or
345 code(-eses).  
346 Lily has predefined sets of notenames
347 for various nop(languages).  See Section ref(notelang) for details.
348 Rests are specified with the note name code(r) or code(R).  
349 There is also a note name code(s) which produces a nonprinting note of the
350 specified duration.
351
352 The optional octave specification takes the form of a series of single
353 quote 
354 code(') characters or a series of comma code(,) characters.  Each
355 code(') raises the pitch by one octave; each code(,) lowers the pitch
356 by an octave.  
357
358 mudela(fragment,verbatim,center)(
359 c' d' e' f' g' a' b' c''
360 )
361
362 mudela(fragment,verbatim,center)(
363 cis' dis' eis' fis' gis' ais' bis'
364 )
365
366 mudela(fragment,verbatim,center)(
367 ces' des' es' fes' ges' as' bes'
368 )
369
370 mudela(fragment,verbatim,center)(
371 cisis' eisis' gisis' aisis' beses'
372 )
373
374 mudela(fragment,verbatim,center)(
375 ceses' eses' geses' ases' beses'
376 )
377
378 Whenever a C-sharp is desired,  you must specify a C-sharp.  LilyPond
379 will determine what accidentals to  typeset  depending on the  key and
380 context.   
381 A reminder accidental can be forced by
382 using the  optional exclamation mark `code(!)'
383 on a pitch.
384 mudela(fragment,verbatim,center)(
385 cis' d' e' cis'  c'! d' e' c' 
386 )
387
388
389 Durations are entered as their reciprocal values
390 mudela(fragment,verbatim,center)(
391 a'1 a'2 a'4 a a'8 a a'16 a'32 a'64
392 )
393 mudela(fragment,verbatim,center)(
394 r1 r2 r4 r8 r16 r32
395 )
396
397 If the duration is omitted then it is set equal to the previous
398 duration.  If there is no previous duration, then a quarter note is
399 assumed.  
400 The duration can be followed by a dot code(.) to obtain dotted note
401 lengths.  
402 mudela(fragment,verbatim,center)(
403 a'4. b'4.
404 )
405
406 In addition, the duration can be followed by a multiplier which is
407 introduced with the asterisk code(*) and can be an integer or a
408 fraction.  The multiplier changes the duration that LilyPond uses
409 internally for the note, but for notes it 
410 does not change the symbol that is printed.  
411 mudela(fragment,verbatim,center)(
412 c'4*2 c'4*2 d'8*2/3 d'8*2/3
413 )
414 For long rests with durations equal to an integer number of whole notes,
415 LilyPond produces output that indicates the duration of the rest.  If you use
416 code(r) then one rest symbol will be printed and several measures left blank.
417 If you use code(R) then all of the measure will be filled with whole rests.
418 If you set the code(Score.SkipBars) property, then only one measure will be
419 printed; with code(R), a number indicating the length of the rest will be
420 displayed.  
421 mudela(fragment,verbatim,center)(
422 r1*3 R1*3
423 \property Score.SkipBars=1
424 r1*3 R1*3)
425
426 Extra long notes can be obtained using the code(\breve) and
427 code(longa) durations:
428 mudela(fragment,verbatim,center)(
429 c'\breve gis'\longa
430 )
431
432
433 subsect(Note Spanners: Beams, Tuplets, Slurs and Ties)
434
435 A beam is specified by surrounding the beamed notes with brackets
436 code([) and code(]).  
437 mudela(fragment,verbatim,center)(
438 [a'8 a'] [a'16 a' a' a']
439 )
440
441 In order to create triplets, you must use a length multiplier after
442 the brackets.  An open bracket code([) followed by a fraction
443 instructs LilyPond to print a number over the beam, and it also
444 starts multiplying all note lengths by the fraction.  The closing
445 bracket code(]) should be followed by the fraction code(1/1) in order
446 to restore normal note lengths.  To create a triplet without a beam,
447 place a backslace code(\) before the opening and closing brackets. 
448
449 For example, in an ordinary triplet, the notes have duration 2/3 as
450 long as normal. 
451 mudela(fragment,verbatim,center)(
452 [2/3 a'8 a' a' ]1/1 \[2/3 b'4 b' b'\]1/1
453 )
454
455 There is a shorthand that can be used when you 
456 want notes lengths multiplied by 2/n.  
457 The 2 can be omitted after the open bracket
458 and the first 1 can be omitted after the closing bracket.  
459 mudela(fragment,verbatim,center)(
460 [/3 b'8 b' b' ]/1  \[/3 a'4 a'8\]/1
461 )
462
463 COMMENT(This next bit needs to be fixed...or the language needs to be
464 fixed.)
465
466 Here is a combination
467 mudela(fragment,verbatim,center)(
468 [/3 a'8 a'16 a'] a'8 \]
469 )
470
471 Another type of spanner is the slur.  Slurs connects chords and try to
472 avoid crossing stems.  A slur is started with code(CHAR(40)) and stopped with
473 code(CHAR(41)).  The starting code(CHAR(40)) appears to the right of the first note
474 in the slur.  The terminal code(CHAR(41)) apppears to the left of the first
475 note in the slur.  This makes it possible to put a note in slurs from
476 both sides:
477 mudela(fragment,verbatim,center)(
478 f'()g'()a' [a'8 b']( a'4 g' )f'
479 )
480
481 A tie connects two adjacent note heads.  When used with chords, it
482 connects all of the note heads.  Ties are indicated using the tilde symbol
483 code(~) by analogy with TeX()'s tie which connects words.  For ties
484 between chords, the input convention is somewhat peculiar.  You cannot
485 write code(<c g>~<c g>), but rather must put the tilde after
486 a note within the first chord.  
487
488 mudela(fragment,verbatim,center)(
489 e' ~ e' <c'~ e' g'><c' e' g'>
490 )
491
492
493 subsect(Note Ornaments)
494
495 A variety of symbols can appear above and below notes to indicate
496 different characteristics of the performance.  
497 These symbols can be
498 added to a note with `var(note)code(-\)var(name)'.  Numerous different
499 symbols are defined in file(script.ly).  Each symbol is defined using
500 the code(\script) keyword which specifies where symbols appear.
501 Symbols can be forced to appear above the note by writing
502 `var(note)code(^\)var(name)', and they can be forced to appear below
503 by writing `var(note)code(_\)var(name)'.  Here is a chart showing
504 symbols above notes, with the name of the corresponding symbol
505 appearing underneath.  
506
507 mudela()(
508 \score{
509  < \notes{ c''-\accent c''-\marcato c''-\staccatissimo f'-\fermata 
510           c''-\stopped c''-\staccato c''-\tenuto c''-\upbow c''-\downbow
511           c''-\lheel c''-\rheel  c''-\ltoe  c''-\rtoe  c''-\turn
512           c''-\open  c''-\flageolet  c''-\reverseturn 
513           c''-\trill
514           c''-\prall c''-\mordent c''-\prallprall  c''-\prallmordent
515           c''-\upprall c''-\downprall }
516   \type Lyrics \lyric{  
517         accent      marcato      staccatissimo fermata stopped
518            staccato tenuto upbow downbow lheel rheel ltoe rtoe  turn
519            open  flageolet reverseturn 
520              trill  prall
521            mordent prallprall prallmordent uprall  downprall }>
522   \paper{linewidth  = 5.875\in
523          indent = 0.0
524         }
525 }
526 )
527
528 COMMENT( The following are defined in script.ly but do not work:
529
530 portato lbheel rbheel lbtoe rbtoe lfheel rfheel lftoe rftoe )
531
532 In addition, it is possible to place arbitrary strings of text or
533 TeX() above or below notes by using a string instead of an identifier:
534 `code(c^"text")'.  Fingerings can be placed by simply using digits.
535 All of these note ornaments appear in the printed output but have no
536 effect on the MIDI rendering of the music.
537
538 To save typing,  a few common symbols  can  be  abbreviated  with
539 single characters:
540 mudela()(
541 \score{ \notes {
542         \property Voice.textstyle = typewriter
543         c''4-._"c-." s4
544         c''4--_"c-{}-"  s4
545         c''4-+_"c-+" s4
546         c''4-|_"c-|" s4
547         c''4->_"c->"  s4
548         c''4-^_"c-\\^{ }"  s4 }
549         \paper { linewidth = 12.\cm; }})
550
551 Dynamic marks are specified by using an identifier after a note
552 without a dash: code(c4 \ff).  Note that this syntax is inconsistent
553 with the syntax for other types of ornaments.  The available dynamic
554 marks are: code(\ppp), code(\pp), code(\p), code(\mp), code(\mf),
555 code(\f), code(\ff), code(\fff), code(\fp), code(sf), and code(\sfz).
556
557 A crescendo mark is started with code(\cr) and terminated with
558 code(\rc).  A decrescendo mark is started with code(\decr) and
559 terminated with code(\rced).
560
561 Tremolo marks can be printed by a note by adding code(:)[var(length)]
562 after the note.  The length must be at least 8.  A var(length) value
563 of 8 gives one line across the note stem.  
564 If the length is omitted,
565 then the last value is used, or the value of the code(Abbrev)
566 property if there was no last value.  To place tremolo marks in
567 between two notes, begin with code([:)var(length) and end with code(]).
568 The tremolo marks will appear instead of beams.  Putting more than two
569 notes in such a construction will produce odd effects. 
570 mudela(fragment,verbatim,center)(
571 c'2:8 c':32 [:16 e'1 g'] [:8 e'4 f']
572 )
573
574 COMMENT(
575 Is the last paragraph correct?  Is it called "tremolo"?  Why is
576 "abbreviation" used?  (What is the unabreviated form?)
577
578
579 mudela(fragment,verbatim,center)(
580 c'4:32 [:16 c'8 d'8]
581 )
582
583 )
584
585
586 sect(Other Ways to Enter Pitches)
587
588 subsect(Pitch Names in Other Languages)
589 label(notelang)
590
591 The pitch names can be easily redefined using the code(\notenames) command.
592 Note name definitions have been provided in various languages.  
593 Simply include the language specific init file.  For example:
594 code(\include "english.ly").  The available language files and the names
595 they define are:
596
597 verb(                        Note Names               sharp       flat
598 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
599 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
600 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
601 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
602 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
603 italiano.ly    do  re  mi  fa  sol la  sid si  -d          -b)
604
605 subsect(Relative Pitch Specification)
606 label(relative)
607
608 One very common error when entering music is to place notes in the wrong
609 octave.  One way to avoid being confused by large numbers of octave changing
610 marks is to use
611 the code(\relative) keyword. 
612 Music which appears within code(\relative) is
613 interpreted differently.  The octave of a note is determined by making it as
614 close to the previous note as possible.  The octave changing marks code(') and
615 code(,) can then be added to raise or lower this note by octaves.  You have to
616 specify a starting pitch because the first note of a list has no predecessor.  
617
618 mudela(fragment,verbatim,center)(
619 \relative c'' { c d b c, d b c' d 
620                 b c,, d b }
621 )
622
623 When the preceeding item is a chord, the first note of the chord is used to
624 determine the first note of the next chord.  But other notes within the second
625 chord are determined by looking at the immediately preceeding note.  
626
627 mudela(fragment,verbatim,center)(
628 \relative c' { <c e g> 
629     <c' e g> <c, e' g> }
630
631
632 The code(\relative) keyword can only appear in music, so there must be a
633 surrounding code(\notes) keyword which does not appear in the fragments shown
634 above.  Also note that if the music passed to a code(\relative) keyword 
635 contains a code(\transpose) keyword, the tranposed music will not be
636 processed in relative mode.  An additional code(\relative) must be placed
637 inside the code(\transpose).  
638
639
640 subsect(Tranposition of Pitches)
641 label(transpose)
642
643 Another way to modify the meaning of the note names is to use the
644 code(\transpose) keyword.  This keyword allows you to transpose music.
645 To use transposition, specify the pitch that middle C should be tranposed to.
646 It is important to distinguish between enharmonic pitches as they can produce
647 different transpositions.  To transpose up half a step, for example, either 
648 code(\transpose cis') or code(\transpose des') will work.  But the first
649 version will print sharps and the second version will print flats.  
650 In this example, a scale in the key of E is transposed to F, or to E-sharp 
651 with odd results.
652 mudela(fragment,verbatim,center)(
653 \relative c' { \key e; 
654   e fis gis a b cis dis e }
655 )
656 mudela(fragment,verbatim,center)(
657 \transpose des' \relative c' { \key e; 
658    e fis gis a b cis dis e }
659 )
660 mudela(fragment,verbatim,center)(
661 \transpose cis' \relative c' { \key e; 
662     e fis gis a b cis dis e }
663 )
664 If you want to use both code(\transpose) and code(\relative), then you must use
665 code(\transpose) first.  Any code(\relative) keywords that are outside the 
666 code(\transpose) have no effect on notes that appear inside the
667 code(\transpose).  
668
669 sect(Lyrics)
670
671 Lyrics are entered like notes, with pitches replaced
672 by text.  For example code(Twin-4 kle4 twin-4 kle4) enters four
673 syllables, each with quarter note duration.  Note that the hyphen has
674 no special meaning for lyrics, and does not introduce special symbols.
675 See Section ref(modes) for a description of what is interpreted as a lyric.
676
677 In order to instruct LilyPond to write lyrics underneath the
678 staff, you must enter the lyrics context with code(\type Lyrics).  
679 Lyrics should be entered in lyrics mode which is entered with code(\lyric).
680
681 Spaces can be introduced into a lyric either by using quotes (code("))
682 or by using an underscore without quotes: code(He_could4 not4).  All
683 unquoted underscores are converted to spaces.  Here is a full example: 
684 mudela(verbatim)(\score{
685   <  \notes \transpose c'' {c d e c | c d e c | e f g'2 | 
686                               e'4 f g'2 \bar "|."; }
687      \type Lyrics \lyric { 
688               DOEXPAND(Fr\)`e-4 re Ja- que DOEXPAND(Fr\)`e- re Ja- que
689               Dor- mez vous?2 Dor-4 mez vous?2  }
690   >
691 })
692
693 COMMENT(
694 URG
695                         Fr\`e-4 re Ja- que
696                         Fr\`e- re Ja- que
697 Why does this warrant an URG?
698 )
699
700
701 COMMENT(
702
703 sect(Chords and Voices)
704
705 Here's a simple chord
706 mudela(fragment,verbatim,center)(
707 <c e g>
708 )
709
710 here are a few
711 mudela(fragment,verbatim,center)(
712 <
713         { c'()d'()c' }
714         { e'()f'()e' }
715         { g'()a'()g' }
716 >
717 )
718
719 and similarly voices
720 mudela(fragment,verbatim)(
721 <
722         { \voiceone c'4 g' c' g' }
723         { \voicetwo c2 g2 }
724 >
725 )
726
727 )
728
729 sect(Time)  
730
731 LilyPond aligns all musical objects according to the amount of time
732 they occupy.  All of these objects have a duration.  When music is
733 written sequentially using braces the duration is the sum of the 
734 durations of the elements.  When music is stacked into simultaneous music 
735 using angle
736 brackets, the duration is the maximum of the durations of the
737 elements.  
738
739 Because LilyPond knows the durations of all musical elements, the time
740 signature enables LilyPond to draw bar lines automatically.  The time
741 signature is specified with the code(\time) keyword: code(\time 3/4).
742 If no time signature is given, LilyPond assumes 4/4.  The automatic
743 generation of bar lines can toggled with the code(\cadenza) keyword,
744 and an incomplete measure at the start of the music can be created
745 using the code(\partial) keyword: code(\partial 8*2;) creates a
746 starting measure lasting two eighth notes.
747
748 In order to help with error checking, you can insert bar markers in
749 your music by typing code(|).  Whenever LilyPond encounters a code(|)
750 that doesn't fall at a measure boundary, she prints a warning message.
751
752 Rhythmic grouping is  a concept closely associated with this. 
753 A default grouping is selected for the chosen time signature.  
754 The default consists of combinations of 2 and 3 beats with as many
755 groups of 3 as possible, and the groups of 3 coming first.  For
756 example, 4/4 is divided into 2+2 and 8/8 is divided into 3+3+2.  This
757 default grouping can be changed using the \grouping keyword which
758 takes a list of durations to specify the grouping. 
759
760
761 COMMENT(
762 sect(Composition: forming bigger structures)
763 label(sec:grammar)
764
765 The computer savy user may be interested in a more formal
766 specification.  We can capture what have learned about forming
767 sentences in Mudela in a context-free grammar.
768
769 latexcommand(\smallskip)
770
771 table(2)(lll)(
772         row(cell(em(Music))cell(: em(Note)))
773         row(cell()cell(code(|) em(Rest)))
774         row(cell()cell(code(|) code({) em(MusicList) code(})))
775         row(cell()cell(code(|) code(<) em(MusicList) code(>)))
776         row(cell()cell(code(|) em(Command)))
777         row(cell()cell(code(|) code(\type) em(string) code(=) em(string)  em(Music)))
778         row(cell()cell(;))
779         row(cell(em(MusicList))cell(: em(empty)))
780         row(cell()cell(code(|)  em(MusicList)  em(Music)))
781         row(cell()cell(;))
782 )
783
784 latexcommand(\smallskip)
785
786 In mathematics you can form expressions by combining expressions,
787 which are ultimately some kind of atom or terminal symbol.  The same
788 goes for Mudela: there are some basic building blocks, and by
789 combining those you create complex music.
790
791 You can combine music in three ways:
792 itemize(
793 it()If you enclose a sequence of music-elements in braces ( code({)
794     and code(}) ), then you form another kind of music called
795 sequential music
796     with those pieces.
797   The duration of sequential composition is the sum of the durations of its elements
798   verb(
799       { c c g g a a g2 }      % twinkle twinkle
800       { { c c g g} { a a g2 } }
801   )
802 it()You can stack music by enclosing a sequence of music elements
803     with code(<) and code(>). This is called simultaneous music.  
804     The duration of a simultaneous composition is the maximum of the durations 
805     of its elements Example:
806     verb(
807         <a4 {cis8 cis8} e'4>      % a-major chord
808     )
809 it()You can form music by transposing music:
810     verb(
811     \transpose  
812         d       % from c to the d that's almost one octave down
813                 { e4 f4 }       % the horizontal music
814 )
815 it()verb(\type)
816 it()verb(\property)
817 it()verb(\translator)
818 it()verb(\relative)
819 )
820
821 Of course you can also combine these three mechanisms.
822 verb(
823 { c <c e> <c e g> <c e g \transpose d' dis > }  % 4 increasing chords
824 )
825
826 )
827
828
829 sect(Keywords)
830
831 Keywords sometimes appear alone, but usually they require arguments.
832 A keyword may have a single argument, a sequence of arguments in
833 braces, or a sequence of arguments separated by spaces and terminated
834 by a semicolon.  The precise syntax of each keyword is shown below.
835 Keywords must appear in the right context.  If you use a keyword in
836 the wrong place, even if the usage is syntactically correct, you will
837 get the message ``parse error'' from LilyPond.
838
839
840 description(
841
842 dit(code(\absdynamic) code({) var(code) code(})) Internal keyword for
843 printing dynamic marks such as $f$ under music.  The parameter
844 var(code) is unsigned and specifies the dynamic mark to print.
845 Normally you should use the more user friendly abbreviations defined
846 in the init file file(dynamic.ly).
847
848 dit(code(\accepts) var(string)code(;)) This keyword can appear only within a
849 code(\translator) block.  It specifies what contexts are allowed with the
850 context that is being defined.  See Section ref(translators).  
851
852 dit(code(\bar) var(bartype)code(;)) Prints a special bar symbol, or at
853 measure boundaries, replaces the regular bar symbol with a special
854 symbol.  The argument var(bartype) is a string which specifies the
855 kind of bar to print.  Options are code(":|"), code("|:"),
856 code(":|:"), code("||"), code("|."), code(".|"), or code(".|.").
857 These produce respectively a right repeat, a left repeat, a double
858 repeat, a double bar, a start bar, an end bar, or a thick double bar.
859 If var(bartype) is set to code("empty") then nothing is printed, but a
860 line break is allowed at that spot.  Note that the printing of special bars
861 has no effect on the MIDI output.
862
863 dit(mycode(\cadenza) var(togglevalue)code(;)) Toggles the automatic generation
864 of bar lines.  If var(togglevalue) is 0 then bar line generation is
865 turne off.   If var(togglevalue) is  1  then a bar is  immediately
866 printed and bar generation is turned  on.
867
868 dit(code(\clef) var(clefname)code(;)) Allowed only in music.  
869 Sets the current clef.  The argument is
870 a string which specifies the name of the clef.  Several clef names are
871 supported.  If code(_8) or code(^8) is added to the end of a clef
872 name then the clef lowered or raised an octave will be generated.  
873 Here are the supported clef names with middle C shown in each clef:
874 mudela(center)(
875 \score{
876   \notes{ \cadenza 1;
877    %\property Voice.textstyle = typewriter
878    \clef subbass; c'4-"\kern-10mm subbass" 
879            \clef bass;    c'4^"\kern -8mm bass"
880            \clef baritone; c'4_"\kern -10mm baritone"
881            \clef varbaritone; c'4^"\kern -10mm varbaritone"
882            \clef tenor;     c'4_"\kern -10mm tenor"
883            \clef "G_8";   c'4^"\kern -6mm G\_8"  }  
884    \paper{ linewidth= 4.5 \in }
885 }
886 )
887 mudela(center)(
888 \score{
889   \notes{\cadenza 1; \clef alto;    c'4_"\kern -10mm alto"
890            \clef mezzosoprano; c'4^"\kern -10mm mezzosoprano"
891            \clef soprano;  c'4_"\kern -10mm soprano"
892            \clef treble;  c'4^"\kern -6mm treble"
893            \clef french;  c'4_"\kern -10mm french" }  
894   \paper{ linewidth= 4.5 \in }
895 }
896 )
897 The treble  clef  can also  be obtained using  the  names code(G) or
898 code(violin).  The bass clef is also available by code(\clef  F). 
899
900 dit(code(\cm)) Specify a dimension in centimeters. 
901
902 dit(code(\consists) var(string)code(;)) This keyword can appear only within a
903 code(\translator) block.  It specifies that an engraver named
904 var(string) should be added to the translator.  See Section ref(translators).
905
906 dit(code(\duration) code({) var(length) var(dotcount) code(})) Specify note
907 duration.  The parameter var(length) is the negative logarithm (base
908 2) of duration: 1 is a half note, 2 is a quarter note, 3 is an eighth
909 note, etc.  The number of dots  after  the  note is given by
910 var(dotcount). 
911
912 dit(code(\font) var(string)) Internal keyword.  Used within
913 code(\symboltables) to specify the font.
914
915 dit(code(\grouping) var(durationseq); )  Sets  the  metric structure of
916 the measure.  Each argument specifies the duration of one metric unit.
917 For example, code(\duration 16*5;) specifies a grouping of five beats
918 together in 5/16 time.  The default grouping is to have as many groups
919 of 3 as possible followed by groups of two.  
920
921 dit(code(\header) code({) var(key1) = var(val1); var(key2) = var(val2); ... code(}))
922 Specifies information about the music.  A header should appear at the
923 top of the file describing the file's contents.  If a file has
924 multiple code(\score) blocks, then a header should appear in
925 each score block describing its contents.  Tools like code(ly2dvi) can
926 use this information for generating titles.   Some possible key values
927 are: title, opus, description, composer, enteredby, and copyright.
928
929 dit(code(\in)) Specify a dimension in inches.  
930
931 dit(code(\include) var(file)) Include the specified file.  The
932 argument var(file) is a string.  The full filename including the
933 file(.ly) extension must be given. 
934
935 dit(code(\key) var(pitch)) Change key signature to that of
936 var(pitch)-major.
937
938 dit(code(\keysignature) var(pitchseq);)
939 Specify an arbitrary key signature.  The pitches from var(pitch) will
940 be printed in the key signature in the order that they appear on the list.
941
942 dit(code(\lyric) var(lyriclist)) Parse var(lyriclist) in lyrics mode.
943
944 dit(code(\maininput)) Internal command.  This command is used for creating init
945 files like file(init.fly) that read the user file into the middle of another
946 file.  Using it in a user file will lead to an infinite loop.
947         
948 dit(code(\mark) var(unsigned) or code(\mark) var(string)) Allowed in
949 music only.  Prints a mark over or under (?) the staff.  You must add
950 code(Mark_engraver) to the Score context and it only seems to work if the
951 mark appears at the beginning of a line.  
952
953 dit(code(\midi) var(statementlist)) Appears in a score block to
954 indicate that musical output should be produced.  See code(\tempo).
955
956 dit(code(\mm)) Specify a dimension in millimeters. 
957
958 dit(code(\musicalpitch) code({) var(octave) var(note) var(shift) code(})) 
959 Specify note pitch.  The octave is specified by an integer,
960 zero for the octave containing middle C.  The note is a number from 0
961 to 7, with 0 corresponding to C and 7 corresponding to B.  The shift
962 is zero for a natural, negative to add flats, or positive to add
963 sharps.
964
965 dit(code(\notenames) var(assignmentlist)) Define new note names.  
966 The argument is a list of definitions of  the form
967 var(name) = var(pitch),  where var(pitch) is specified with the
968 code(\musicalpitch) keyword.  
969
970 dit(code(\notes) var(music)) Enter note mode and process the
971 specified music. 
972
973 dit(code(\)code(output) var(string)code(;)) Allowed only in
974 code(\paper) block.  The parameter var(string) specifies an alternate
975 name for the TeX() output.  A file(.tex) extension will be added to
976 var(string) to produce the output file name.
977
978 dit(code(\paper) var(statmentlist)) 
979 Appears in a score block to indicate that the music should be printed.
980 The var(statmentlist) contains statements that change features of the
981 output.  See Section ref(paper).  
982
983 dit(code(\partial) var(duration)) Specify that the first measure of
984 the music lasts only for the specified duration.
985
986 dit(code(\penalty) code(=) var(int)) Allowed only in music.
987 Discourage or encourage line breaks.  See identifiers code(\break) and
988 code(\nobreak) in Section ref(ident). 
989
990 dit(code(\property) var(contextname)code(.)var(propname) code(=) var(value))
991 Sets the var(propname) property of the context var(contextname) to the
992 specified var(value).  All three arguments are strings.
993
994 dit(code(\pt)) Specify a dimension in points. 
995
996 dit(code(\relative) var(pitch) var(music)) Processes the specified
997 var(music) in relative pitch
998 mode.  In this mode, the octave of a pitch is chosen so that the
999 pitch is closest to the preceeding pitch.  
1000 The argument var(pitch) is
1001 the starting pitch for this comparision.  In the case of chords, the
1002 first note of a chord is used as the base for the first pitches in the next
1003 chord.  See Section ref(relative).
1004
1005 dit(code(\score) var(statementlist)) Create a Score context.  This
1006 is the top level notation context.  
1007 COMMENT(this still needs work)
1008
1009 dit(code(\script) code({) var(name) var(instaff) var(withstem)
1010 var(location) var(invertible) var(priority) code(})) This keyword is
1011 used the initialization file(script.ly) to define the various symbols
1012 that can appear above and below notes.  The first argument is the name
1013 of the symbol.  The second argument var(instaff) is 1 if the symbol
1014 follows the notehead into the staff and 0 if the symbol stays above or
1015 below the staff lines.  The third parameter var(withstem) is 0 if the
1016 symbol's placement does not depend on the stem direction; it is 1 if
1017 the symbol should be at the stem end of the note and it is -1 if the
1018 symbol should be at the note head end of the note.  The argument
1019 var(location) is set to 1 for symbols that always appear above the
1020 staff; it is -1 for symbols that appear below the staff.  If
1021 var(invertible) is set to 1 then the symbol can be inverted; otherwise
1022 it cannot.  The last argument var(priority) sets a priority for the
1023 order of placement of several symbols on a single note.
1024
1025 dit(code(\shape) code(=) var(indent1) var(width1) var(indent2)
1026 var(width2) ... code(;)) Allowed only within code(\paper).  Each pair
1027 of var(indent) and var(width) values is a dimension specifying how far
1028 to indent and how wide to make the line.  The indentation and width of
1029 successive lines are specified by the successive pairs of dimensions.
1030 The last pair of dimensions will define the characeristics of all
1031 lines beyond those explicitly specified.
1032
1033 COMMENT(First pair of dimensions seems to be skipped.  At least it is
1034 in the example file denneboom.ly.)
1035
1036 dit(code(\skip) var(duration)) Skips the amount of time specified by
1037 var(duration).  A gap will be left for the skipped time with no notes
1038 printed.  It works in Note Mode or Lyrics Mode (but generates a
1039 mysterious error in lyrics).
1040
1041 dit(code(\spandynamic) code({) var(kind) var(toggle) code(})) Internal
1042 keyword for crescendo and decrescendo symbols.  The first parameter
1043 var(kind) is set to 1 for a crescendo and -1 for a decrescendo.  The
1044 second parameter is set to 1 to start the mark and 2 to stop it.
1045 Users should use the abbreviations which are defined in the
1046 initialization file file(dynamic.ly).
1047
1048 dit(code(\symboltables)) Internal keyword.  Used to create symbol
1049 tables.  See initialization files file(paper*.ly), file(feta*.ly), and
1050 file(table*.ly).  
1051
1052 dit(code(\table)) Internal keyword.  Used within code(\symboltables)
1053 to specify the tables.  See initialization files. 
1054
1055 dit(code(\tempo) var(duration) = var(perminute)) Used within
1056 code(\midi) to specify the tempo.  For example, 
1057 `code(\midi { \tempo 4 = 76})' requests output with 76 quarter notes
1058 per minute. 
1059
1060
1061 dit(code(\time) var(numerator)code(/)var(denominator)) Change the time
1062 signature.  The default time signature  is 4/4.  
1063
1064
1065 dit(code(\translator) var(statements) or code(\translator)
1066 var(context) = var(name)) The first variant appears only within
1067 code(\paper) and specifies a translator for
1068 converting music to notation.  The translator is specified with a
1069 single code(\type) statement and a series of code(\accepts), and
1070 code(\consists) statements.  See Section ref(translators). 
1071 The second variant appears in 
1072 music.  It specifies that the current the contexts
1073 contained within the specified context should be shifted to the
1074 context with the specified name.  
1075
1076 COMMENT( \translator seems like a strange name for the second
1077 operation, and is the overloading desireable? )
1078
1079 dit(code(\transpose) var(pitch) var(music)) Transposes the specified
1080 music.  Middle C is tranposed to var(pitch).  This is allowed in music only,
1081 and if it appears inside code(\relative), then any notes specified for
1082 transposition should be specified inside another code(\relative).  See Section
1083 ref(transpose).  
1084
1085 dit(code(\type) var(contexttype) [code(=) var(contextname)]
1086 var(music) or code(\type) var(translatortype)code(;)) The first
1087 variant is used only within music to create an instance of a
1088 context.  The new context can optionally be given a name.  The
1089 specified var(music) is processed in the new context. The second
1090 variant appears within a code(\translator) block and specifies the
1091 type of translator being created.
1092
1093 dit(code(\version) var(string)) Specify the version of Mudela that a
1094 file was written for.  The argument is the version number, for example
1095 code("1.0.1").  Note that the Mudela version is different from the
1096 LilyPond version.
1097
1098 )  
1099
1100
1101 sect(Notation Contexts)
1102
1103 Notation contexts provide information that appears in printed music
1104 but not in the music itself.  A new musical context is created using
1105 the code(\type) keyword: `code(\type) var(contexttype) [code(=)
1106 var(contextname)] var(music)'.  The following context types are
1107 allowed.
1108
1109 description(
1110
1111 dit(code(LyricVoice)) Corresponds to a voice with lyrics.  Handles the printing
1112 of a single line of lyrics.  
1113
1114 dit(code(Voice)) Corresponds to a voice on a staff.
1115   This context handles the conversion of noteheads,
1116   dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests.
1117
1118 dit(code(Lyrics)) Typesets lyrics.  It can contain code(LyricVoice) contexts.
1119
1120 dit(code(Staff)) Handles clefs, bar lines, keys,
1121   accidentals.  It can contain code(Voice) contexts.
1122
1123 dit(code(RhythmicStaff)) A context like code(Staff) but for printing
1124 rhythms.  Pitches are ignored; the notes are printed on one line.  
1125 It can contain code(Voice) contexts. 
1126
1127 dit(code(GrandStaff)) Contains code(Staff) or code(RhythmicStaff)
1128 contexts.  It adds a brace on the left side grouping the staffs
1129 together. The bar lines of the contained staffs are connected vertically.
1130 It can contain code(Staff) contexts.
1131
1132 dit(code(StaffGroup)) Contains code(Staff) or code(RhythmicStaff)
1133 contexsts.  Adds a bracket on the left side, grouping the staffs
1134 together.  The bar lines of the contained staffs are connected vertically.
1135 It can contain code(Staff), code(RhythmicStaff), code(GrandStaff) or code(Lyrics) contexts.  
1136
1137 dit(code(ChoirStaff)) Identical to code(StaffGroup) except that the
1138 contained staffs are not connected vertically.  
1139
1140 dit(code(Score)) This is the top level notation context.  It is specified with
1141 the code(\score) keyword rather than the code(\type) command.  No
1142 other context can contain a code(Score) context.  This context handles
1143 the administration of time signatures.  It also makes sure that items
1144 such as clefs, time signatures, and key-signatures are aligned across
1145 staffs.  It can contain code(Lyrics), code(Staff),
1146 code(RhythmicStaff), code(GrandStaff), code(StaffGroup), and
1147 code(ChoirStaff) contexts.
1148
1149 )
1150
1151 The various contexts have properties associated with them.  These
1152 properties can be changed using the code(\property) command:
1153 `code(\property) var(context)code(.)var(propname) code(=) var(value)'.
1154 Properties can also be set within the code(\translator) block
1155 corresponding to the appropriate context.  In this case, they are
1156 assigned by `var(propname) code(=) var(value)'.  The settings made with
1157 code(\property) are processed after settings made in the code(\translator)
1158 block, so the code(\property) settings will override code(\translator)
1159 settings.  
1160
1161 The code(\property) keyword will create any property you specify.
1162 There is no guarantee that a property will actually be used.  If you
1163 spell a property name wrong, there will be no error message.  In order to find
1164 out what properties are used, you must search the source code 
1165 for code(get_property).  
1166 Properties that are set in one context are inherited by all of the
1167 contained contexts.  This means that a property valid for the Voice
1168 context can be set in the Score context (for example) and thus take
1169 effect in all Voice contexts.  
1170
1171 subsubsubsect(Lyrics properties)
1172
1173 description(
1174
1175 dit(code(textstyle)) Set the font for lyrics.  The available font
1176 choices are code(normaltext), code(roman), code(italic), code(bold)
1177 code(normaltext), code(large), code(Large), code(huge), and
1178 code(finger).  The code(finger) font can only display numbers.  Note
1179 also that you must be careful when using code(\property) in Lyrics
1180 mode.  Because of the way strings are parsed, either put quotes around
1181 the arguments to code(\property) or be sure to leave a space on both
1182 sides of the dot.
1183
1184 dit(code(textalignment)) Controls alignment of lyrics.  Set to \left
1185 to align the left end of the lyric with the note; set to \right to
1186 align the right end of the lyric with the note.  Set to \center to
1187 align the center of the lyric with the note.  
1188
1189 )
1190
1191 subsubsubsect(Voice properties)
1192
1193 description(  
1194
1195 dit(code(midi_instrument)) Sets  the  instrument for MIDI  output. 
1196
1197 dit(code(transposing)) Tranpose the MIDI output.  Set this property to
1198 the number of half-steps to transpose by.
1199
1200 dit(code(ydirection)) Determines the direction of stems, subscripts,
1201 beams, slurs, and ties.  Set to code(\down) to force them down,
1202 code(\up) to force them up, or code(\free) to let LilyPond decide.
1203 This can be used to distinguish between voices on the same staff.  The
1204 code(\stemdown), code(\stemup), and code(\stemboth) identifiers set
1205 this property.  See also the identifiers code(\voiceone),
1206 code(\voicetwo), code(\voicethree) and code(\voicefour).
1207
1208 dit(code(slurydirection)) Set to code(\free) for free choice of slur
1209 direction, set to code(\up) to force slurs up, set to code(\down) to
1210 force slurs down.  The shorthands code(\slurup), code(\slurdown), and
1211 code(\slurboth) are available.
1212
1213 dit(code(slurdash)) Set to 0 for normal slurs, 1 for dotted slurs, and
1214 a larger value for dashed slurs.  Identifiers code(\slurnormal) and
1215 code(\slurdotted) are predefined to set the first two settings.
1216
1217 dit(code(hshift)) Set to 1 to enable LilyPond to shift notes
1218 horizontally if they collide with other notes.  This is useful when
1219 typesetting many voices on one staff.  The identifier code(\shift) is
1220 defined to enable this.
1221
1222 dit(code(dynamicdir)) Determines location of dynamic marks.  Set to
1223 code(\up) to print marks above the staff; set to code(\down) to print
1224 marks below the staff.
1225
1226 dit(code(textalignment)) Controls alignment of superscripted and
1227 subscripted text.  Set to \left to align the left end of the text with
1228 the note; set to \right to align the right end of the text with the
1229 note.  Set to \center to align the center of the text with the note.
1230
1231 dit(code(textstyle)) Set the text style for superscripts and
1232 subscripts.  See above for list of text styles.
1233
1234 dit(code(fontsize)) Can be used to select smaller font sizes for
1235 music.  The normal font size is 0, and the two smaller sizes are -1
1236 and -2.
1237
1238 dit(code(pletvisibility)) Determines whether tuplets of notes are
1239 labelled.  Setting to 0 shows nothing; setting to 1 shows a number;
1240 setting to 2 shows a number and a bracket if there is no beam; setting
1241 to 3 shows a number, and if there is no beam it adds a bracket;
1242 setting to 4 shows both a number and a bracket unconditionally.  
1243
1244 )
1245
1246 subsubsubsect(Staff properties)
1247
1248 description(
1249  
1250 dit(code(defaultclef)) Determines the default clef.  See code(\clef)
1251 keyword.
1252
1253 dit(code(nolines)) Sets the number of lines that the staff has.
1254  
1255 dit(code(barAlways)) If set to 1 a bar line is drawn after each note.
1256
1257 dit(code(defaultBarType)) Sets the default type of bar line.  See
1258 code(\bar) keyword.
1259
1260
1261
1262
1263 dit(code(keyoctaviation)) If set to 1, then keys are the same in all
1264 octaves.  If set to 0 then the key signature for different octaves can
1265 be different and is specified independently: code(\keysignature bes
1266 fis').  The default value is 1.  Can be set to zero with
1267 code(\specialkey) or reset to 1 with code(\normalkey).
1268
1269 dit(code(instrument) and code(instr)) If code(Staff_margin_engraver)
1270 is added to the Staff translator, then the code(instrument) property
1271 is used to label the first line of the staff and the code(instr)
1272 property is used to label subsequent lines.
1273 COMMENT(This prints the instrument name on top of the staff lines.)
1274
1275 dit(code(abbrev)) Set length for tremolo to be used if no length is
1276 explicitly specified.
1277
1278 dit(code(createKeyOnClefChange)) Set to a nonempty string if you want key
1279 signatures to be printed when the clef changes.  Set to the empty string (the
1280 default) if you do not want key signatures printed.
1281
1282
1283 dit(code(timeSignatureStyle)) Changes the default two-digit layout
1284    for time signatures. The following values are recognized:
1285    description(
1286       dit(code(C)): 4/4 and 2/2 are typeset as C and struck C,
1287       respectively. All other time signatures are written with two digits.
1288       dit(code(old)): 2/2, 3/2, 3/4, 4/4, 6/4 and 9/4 are typeset with
1289       old-style mensuration marks. All other time signatures are 
1290       written with two digits.
1291       dit(code(1)): All time signatures are typeset with a single
1292       digit, e.g. 3/2 is written as 3.
1293       dit(code(C2/2,C4/4, old2/2, old3/2, old3/4, old4/4, old6/4 or
1294       old9/4)): Tells Lilypond to use a specific symbol as time
1295       signature.
1296    )
1297
1298 The different time signature characters are shown below with
1299 their names:
1300 mudela(fragment,center)(
1301 \relative c'' {
1302 \property Voice.textstyle = typewriter
1303 \property Staff.timeSignatureStyle = "C"
1304 \time 2/2; a2^"C" a2 \time 2/2;
1305 \property Staff.timeSignatureStyle = "old3_2"
1306 a2_"old3\_2" a2 \time 2/2;
1307 \property Staff.timeSignatureStyle = "oldC"
1308 a2^"oldC" a2 \time 2/2;
1309 \property Staff.timeSignatureStyle = "old6_4"
1310 a2_"old6\_4" a2 \time 2/2;
1311 \property Staff.timeSignatureStyle = "old9_4"
1312 a2^"old9\_4" a2
1313 }
1314 )
1315
1316 COMMENT( timeSignatureSymbol?  timeSignatureChar? )
1317
1318
1319 )
1320    
1321
1322
1323 subsubsubsect(GrandStaff properties)
1324
1325 description( 
1326
1327 dit(code(maxVerticalAlign)) Set the maximum vertical distance between
1328 staffs.
1329
1330 dit(code(minVerticalAlign)) Set the minimum vertical distance between
1331 staffs.  
1332
1333 )
1334
1335 subsubsubsect(Score properties)
1336
1337 description(
1338
1339 dit(code(SkipBars)) Set to 1 to skip the empty bars that are produced
1340 by multimeasure notes and rests.  These bars will not appear on the
1341 printed output.  Set to zero (the default) to expand multimeasure
1342 notes and rests into their full length, printing the appropriate
1343 number of empty bars so that synrchonization with other voices is
1344 preserved.  COMMENT(meaning of "skip" here seems to be different from
1345 the meaning used for the keyword \skip.)
1346
1347 dit(code(beamquantisation)) Set to code(\none) for no quantization.
1348 Set to code(\normal) to quantize position and slope.  Set to
1349 code(\traditional) to avoid wedges.  These three settings are
1350 available via code(\beamposfree), code(\beamposnormal), and
1351 code(\beampostraditional).
1352
1353 dit(code(beamslopedamping)) Set to code(\none) for undamped beams.
1354 Set to code(\normal) for damped beams.  Set to code(\infinity) for
1355 beams with zero slope.  The identifiers code(\beamslopeproportional),
1356 code(\beamslopedamped), and code(\beamslopezero) each set the
1357 corresponding value.
1358
1359 )
1360        
1361
1362 COMMENT(
1363
1364 Mystery properties:
1365
1366 bar-number-engraver.cc:  "barScriptPadding"  vertical space for numbers
1367 mark-engraver.cc:        "markScriptPadding" vertical space for marks
1368 span-bar-engraver.cc:    "singleStaffBracket" do single staffs get a bracket?
1369 bar-column-engraver.cc:  "barColumnPriority"        
1370 bar-number-engraver.cc:  "barNumberBreakPriority"   Control horizontal ordering
1371 mark-engraver.cc:        "markBreakPriority"      of bars, clefs, keysig
1372 staff-margin-engraver.cc:"marginBreakPriority"    etc.  Slated for revision
1373 )
1374
1375 sect(Pre-defined Identifiers)
1376 label(ident)
1377
1378 Various identifiers are defined in the initialization files to
1379 provide shorthands for some settings.  
1380
1381 description(
1382 dit(code(\break)) Force a line break in music by using a large
1383 argument for the keyword code(\penalty). 
1384 dit(code(\center)) Used for setting textalignment property.  Is set to 0.
1385 dit(code(\cr)) Start a crescendo.
1386 dit(code(\decr)) Start a decrescendo.
1387 dit(code(\down)) Used for setting direction setting properties.  Is
1388 equal to -1.  
1389 dit(code(\f)) Print forte symbol on the preceeding note.
1390 dit(code(\ff)) Print fortissimo symbol on the preceeding note. 
1391 dit(code(\fff)) Print fortississimo symbol on preceeding note. 
1392 dit(code(\fp)) Print fortepiano symbol on preceeding note. 
1393 dit(code(\free)) Used for setting direction setting properties.  Is
1394 equal to 0.  
1395 dit(code(\Gourlay)) Used for setting the paper variable
1396 code(castingalgorithm).  Is equal to 1.0.  
1397 dit(code(\infinity)) Used for setting the Score.beamslopedamping
1398 property.  Is actually equal to 10000.  
1399 dit(code(\left)) Used for setting textalignment property.  Is equal to -1.
1400 dit(code(\mf)) Print mezzoforte symbol on preceeding note. 
1401 dit(code(\mp)) Print mezzopiano symbol on preceeding note. 
1402 dit(code(\nobreak)) Prevent a line break in music by using a large
1403 negative argument for the keyword code(\penalty). 
1404 dit(code(\none)) Used for setting Score.beamslopedamping and
1405 Score.beamquantisation properties.  Is equal to 0.
1406 dit(code(\normal)) Used for setting Score.beamslopedamping and
1407 Score.beamquantisation properties.  Is equal to 1.
1408 dit(code(\normalkey)) Select normal key signatures where each octave
1409 has the same key signature.  This sets the Staff.keyoctaviation property.
1410 dit(code(\p)) Print a piano symbol on preceeding note. 
1411 dit(code(\pp)) Print pianissimo symbol on preceeding note. 
1412 dit(code(\ppp)) Print pianississimo symbol on preceeding note. 
1413 dit(code(\rc)) Terminate a crescendo. 
1414 dit(code(\rced)) Terminate a decrescendo
1415 dit(code(\right)) Used for setting textalignment property.  Is set to 1.
1416 dit(code(\sf)) Print a ?? symbol on preceeding note. 
1417 dit(code(\sfz)) Print a ?? symbol on preceeding note. 
1418 dit(code(\shiftoff)) Disable horizontal shifting of note heads that collide.  
1419 Sets the Voice.hshift property.
1420 dit(code(\shifton)) Enable note heads that collide with other note heads
1421 to be shifted horiztonally.  Sets the Voice.hshift property.
1422 dit(code(\slurboth)) Allow slurs to be above or below notes.  This
1423 sets the Voice.slurydirection property. 
1424 dit(code(\slurdown)) Force slurs to be below notes. This sets the
1425 Voice.slurydirection property. 
1426 dit(code(\slurup)) Force slurs to be above notes.  This sets the
1427 Voice.slurydirection property.  
1428 dit(code(\specialkey)) Allow keys signatures do differ in different
1429 octaves.  This sets the Staff.keyoctaviation property.  
1430 dit(code(\stemboth)) Allow stems, beams, and slurs to point either
1431 direction.  This sets the Voice.ydirection property. 
1432 dit(code(\stemdown)) Force stems, beams, and slurs to point down.
1433 This sets the Voice.ydirection property. 
1434 dit(code(\stemup)) Force stems, beams and slurs to point up.  This
1435 sets the Voice.ydirection property. 
1436 dit(code(\traditional)) Used for setting the 
1437 Score.beamquantisation property.  Is equal to 2.  
1438 dit(code(\up)) Used for setting various direction properties.  Is
1439 equal to 1. 
1440 dit(code(\voiceone)) Enter Voice context called code(one) and force stems down.
1441 (See code(\stemdown).)
1442 dit(code(\voicetwo)) Enter Voice context called code(two) and force stems
1443 up. (See code(\stemup).)
1444 dit(code(\voicethree)) Enter Voice context called code(three) and force stems
1445 up.  
1446 dit(code(\voicefour)) Enter Voice context called code(four), force stems down
1447 and turn on horizontal shifting.  (See code(\stemdown) and code(\shifton).)
1448 dit(code(\Wordwrap)) Used for setting the paper variable
1449 code(castingalgorithm).  Equal to 0.0.  
1450 )
1451
1452
1453 sect(The code(\paper) Block)
1454 label(paper)
1455
1456 The code(\paper) block may begin with an optional identifier reference.  No
1457 identifier references are allowed anywhere else in the block.  
1458 The keywords code(\shape), code(\)code(output) and code(\translator) may
1459 appear in this block.  In addition, variable assignments may appear.  
1460 The variables control layout details and are set to reasonable
1461 defaults that depend on the font size in use.  The only way to find out what
1462 variables are supported is to search the source code for code(get_var). 
1463
1464 subsect(Paper variables)
1465
1466 There are a large number of paper variables that are used to set internal
1467 details of the layout.  Usually you will not want to change these variables.
1468 Two variables that you may want to change are code(linewidth) and code(indent).
1469
1470 description(
1471   dit(var(integer)) If an integer appears on the left side of an
1472 assignment then a code(\symboltables) keyword must appear on the right
1473 side.  This defines a music font at a particular size.  See Voice
1474 property code(\fontsize).
1475
1476 dit(code(arithmetic_basicspace) and code(arithmetic_multiplier))
1477 The space taken by a note is determined by the formula 
1478 verb(arithmetic_multiplier * ( c + time ))
1479 where code(time) is the amount of time a note occupies.  The value of
1480 code(c) is affected by code(arithmetic_basicspace).  Increasing
1481 code(arithmetic_basicspace) will increase code(c).
1482 dit(code(barsize)) Specify height of bars.  This value may need to be
1483 adjusted if you change the number of lines in the staff.
1484 dit(code(beam_dir_algorithm)) Specify algorithm for determining
1485 whether beams go up or down.  It is real valued.  If set to 2.0 then
1486 majority selection is used.  If set to 3.0, then mean selection is
1487 used based on the mean center distance.  If set to 4.0 then median
1488 selection is used, based on the median center distance.  
1489 dit(code(beam_ideal_stem1))
1490 dit(code(beam_ideal_stem2))
1491 dit(code(beam_minimum_stem1))
1492 dit(code(beam_minimum_stem2))
1493 dit(code(beam_multiple_break))
1494 dit(code(beam_slope_damp_correct_factor))
1495 dit(code(beam_thickness)) Specify the thickness of beams.
1496 dit(code(castingalgorithm)) 
1497 dit(code(forced_stem_shorten)) Stems that have been forced to go the
1498 unnatural direction are shortened by this amount.  Equal to
1499 code(\interline) by default.  
1500 dit(code(gourlay_energybound))
1501 dit(code(gourlay_maxmeasures)) Maximum number of measures per line
1502 when using Gourlay method.
1503 Decreasing this greatly reduces computation time.  Default value: 10.  
1504 dit(code(indent)) Sets the indentation of the first line of music.  
1505 dit(code(interbeam))
1506 dit(code(interbeam4))
1507 dit(code(interline))  The distance between two staff
1508 lines, calculated from the center of the lines.  
1509 dit(code(linewidth))  Sets the width of the lines.  If it is set to
1510 -1.0, then a single unjustified line is produced.  
1511 dit(code(notewidth)) Width of an average note head.  
1512 dit(code(rulethickness)) Determines thickness of staff lines and bars. 
1513 dit(code(slur_clip_angle))
1514 dit(code(slur_clip_height))
1515 dit(code(slur_clip_ratio))
1516 dit(code(slur_height_limit))
1517 dit(code(slur_ratio))
1518 dit(code(slur_rc_factor))
1519 dit(code(slur_slope_damping))
1520 dit(code(slur_thickness))
1521 dit(code(slur_x_gap))
1522 dit(code(slur_x_minimum))
1523 dit(code(staffheight)) The height of the staff from the center of the
1524 bottom line to the center of the top line.  Equal to to code(4 * \interline).
1525 dit(code(stem_length)) Specify length of stems for notes in the staff
1526 that don't have beams.  
1527 dit(code(stemthickness)) Specifies the thickness of the stem lines.  
1528 dit(code(tie_slope_damping))
1529 dit(code(tie_x_minimum))
1530 )
1531
1532 subsect(Translators)
1533 label(translators)
1534
1535 The behavior of notation contexts is defined by the translators for
1536 those contexts.  The translator for a context specifies what notations
1537 are handled by the context, it specifies what other contexts the
1538 context can contain, and it sets property values for the context.  The
1539 default contexts are all defined in file(engraver.ly).  An easy way to
1540 change the behavior of a context is to copy the definition from that
1541 file and modify it.  
1542
1543 The first thing that appears inside a code(\translator)
1544 definition is the type of the context being created.  There are 
1545 four types:
1546 description(
1547   dit(code(Engraver_group_engraver))
1548   dit(code(Hara_kiri_line_group_engraver))
1549   dit(code(Line_group_engraver_group))
1550   dit(code(Score_engraver))  
1551 )
1552 COMMENT( The names of these types seem somewhat confusing. )
1553
1554 After the type of the context is specified, property assignments and
1555 code(\consists) and code(\accepts) keywords can appear in any order.  
1556 Each code(\accepts) keyword specifies what contexts can be contained
1557 inside this one.  
1558
1559 The code(\consists) keywords specify which notations are
1560 handled by the context.  Each code(\consists) keyword specifies the
1561 name of an engraver which handles a certain notation.  
1562 Here is a list
1563 of the engravers. 
1564
1565 description(
1566 dit(code(Abbreviation_beam_engraver))
1567 dit(code(Bar_column_engraver)) 
1568 dit(code(Bar_engraver)) Engraves bar lines.  Normally in code(Staff) and
1569 code(RhythmicStaff).  
1570 dit(code(Bar_number_engraver)) Engrave bar numbers.  These numbers
1571 appear at the start of each line.  Not normally in any translator.  Can
1572 be added to code(Score) for Score-wide numbering or to code(Staff) for
1573 numbering on each staff.  
1574
1575 dit(code(Beam_engraver)) Handles beam requests by engraving beams.  Normally
1576 appears in the code(Voice) translator.  If omitted, then notes will be printed
1577 with flags instead of beams.
1578
1579 dit(code(Beam_req_swallow_translator)) Swallows beam requests.  In
1580 code(LyricVoice).  
1581 dit(code(Clef_engraver)) Engraves the clef symbol.  Normally in code(Staff).
1582 dit(code(Collision_engraver))
1583 dit(code(Dot_column_engraver)) Engraves dots on dotted notes shifted to the
1584 right of the note.  Normally in code(Voice).  If omitted, then dots appear on
1585 top of the notes.  
1586 dit(code(Dynamic_engraver)) Engraves dynamics symbols.  Normally in code(Voice).
1587 dit(code(Font_size_engraver))
1588 dit(code(Key_engraver)) Engraves the key signature.  Normally in code(Staff).
1589 dit(code(Local_key_engraver))
1590 dit(code(Lyric_engraver)) Engraves lyrics.  Normally in code(LyricVoice).
1591 dit(code(Multi_measure_rest_engraver)) Engraves multi-measure rests that are
1592 produced with code(R).  Normally in code(Voice).
1593 dit(code(Note_heads_engraver)) Engraves note heads.  Normally in code(Voice).
1594 Removing this gives a fatal error.  
1595 COMMENT(Perhaps should be Note_head_engraver)
1596 dit(code(Piano_bar_engraver))
1597 dit(code(Pitch_squash_engraver)) Treat all pitches as middle C.  Used in
1598 code(RhythmicStaff).  Note that the notes move, but the locations of
1599 accidentals stay the same. 
1600 dit(code(Plet_engraver)) Engraves brackets and the number over tuplets.  In
1601 code(Voice).  
1602 dit(code(Plet_swallow_engraver)) Swallows tuplet requests without any output.
1603 In code(LyricVoice).  
1604 COMMENT( Should this be named Plet_req_swallow_translator? )
1605 dit(code(Priority_horizontal_align_engraver))
1606 dit(code(Rest_collision_engraver)) Handles collisions of rests. In code(Staff).
1607 dit(code(Rest_engraver)) Engraves rests.  Normally in code(Voice).
1608 dit(code(Rhythmic_column_engraver))
1609 dit(code(Score_priority_engraver))
1610 dit(code(Script_engraver)) Handles note ornaments generated by code(\script).
1611 Normally in code(Voice).  
1612 dit(code(Separating_line_group_engraver))
1613 dit(code(Skip_req_swallow_translator))
1614 dit(code(Slur_engraver)) Engraves slurs.  Normally in code(Voice).
1615 dit(code(Span_bar_engraver)) Engraves lines across multiple staffs.  Normally
1616 in code(Staffgroup) and code(GrandStaff).  Removing this from code(StaffGroup)
1617 gives the definition of code(ChoirStaff).  
1618 dit(code(Span_score_bar_engraver))
1619 dit(code(Staff_group_bar_engraver))
1620 dit(code(Staff_margin_engraver)) Prints the name of the instrument
1621 (specified by code(Staff.instrument) and code(Staff.instr)) at the
1622 left of the staff.  
1623 dit(code(Staff_sym_engraver))
1624 dit(code(Stem_engraver)) Engraves stems.  Normally in code(Voice).
1625 dit(code(Ties_engraver)) Engraves ties.  Normally in code(Voice).
1626 COMMENT(perhaps should be named Tie_engraver?)
1627 dit(code(Time_signature_engraver)) Engraves the time signature.  Normally in
1628 code(Staff) and code(RhythmicStaff).
1629 dit(code(Timing_engraver)) Responsible for synchronizing timing information
1630 from staffs.  Normally in code(Score).  In order to create polyrhythmic music,
1631 this engraver should be removed from code(Score) and placed in code(Staff).
1632 dit(code(Vertical_align_engraver)) 
1633 )
1634