]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/tex/refman.yo
release: 1.0.12
[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 COMMENT( This document contains Mudela fragments.  You need at least
7 Yodl-1.30.18 to convert this to tex or html.
8
9 TODO
10
11 in stead <-> instead
12 )
13
14 htmlbodyopt(bgcolor)(white)
15 htmlcommand(<font color=black>)
16
17 latexlayoutcmds(
18 \setlength{\topmargin}{-0.25in}
19 \setlength{\textheight}{9in}
20 \setlength{\textwidth}{5.875in} 
21 \setlength{\oddsidemargin}{0.25in}   
22 \setlength{\evensidemargin}{0.25in}
23 \usepackage[T1]{fontenc}
24 \input mudela-book
25 )
26
27 whenlatex(notableofcontents())
28 whentexinfo(notableofcontents())
29
30 article(Mudela, reference manual)
31       (Han-Wen Nienhuys and Jan Nieuwenhuizen)
32       (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
33
34 COMMENT(
35
36 * The [ ] look weird
37
38 * paragraphs have too much space.
39
40 )
41
42
43 latexcommand(\def\interexample{})
44 latexcommand(\def\preexample{\par})
45 latexcommand(\def\postexample{\par\medskip})
46 latexcommand(\def\file#1{{code(#1)}})
47 COMMENT(
48 latexcommand(\def\texttt#1{\tt #1})
49 latexcommand(\def\textbf#1{\bf #1})
50 )
51
52 COMMENT(urg, texinfo include breaks)
53 whenhtml(
54 includefile(html-disclaimer.yo-urg)
55 )
56
57 bf(This document is not up to date).  All rendered examples of course
58 are current, but the rest probably isn't.  Adjusting the tutorial was
59 considered more important than writing the reference manual.  We
60 apologize for the inconvenience.
61
62
63 This document describes the the GNU LilyPond input format, which is an
64 effective language for defining music.  We call this language (rather
65 arrogantly) The Musical Definition Language or Mudela, for
66 short.footnote(If anybody comes up with a better name, we'd gladly
67   take this. Gourlay already uses Musical Description Language,
68   G-Sharp Score Definition Language.  ISO standard 10743 defines a
69   Standard Music Description Language.  We're not being original here.)
70
71 The first aim of Mudela is to define a piece of music, being complete
72 from both from a musical typesetting, as from a musical performing
73 point of view.
74
75 The Musical Definition Language (Mudela), has a logical structure,
76 making use of identifiers, that allows for flexible input, and
77 definition reuse. See the documentation file file(MANIFESTO), included
78 with the LilyPond sources for reasons and design considerations.
79
80 The below is included for explanatory purposes only (i.e., for a
81 complete and up-to-date definition, see file(lily/parser.yy) and
82 file(lily/lexer.ll)).
83
84 As a related note, you should take a look at the examples and the init
85 files, as this document does not cover every aspect of Mudela yet, and
86 may be out of date.footnote(Ok, I am being pessimistic here.  This
87 just is a disclaimer.  Docs usually are written after the program
88 itself.)  This document intends to give an idea of how it works. It is
89 not a guide on how to use it.
90
91
92 sect(Running LilyPond)
93
94 When invoked with a filename that has no extension, LilyPond will add
95 a file(.ly) extension.  When invoked with a filename  ending  in
96 file(.fly),  LilyPond processes  the file as a music fragment  using
97 file(init.fly).  When file(foo.fly) is read, LilyPond does something
98 like this:
99 \verb(\score {
100   \notes\relative c {
101     \input "foo.fly"
102   }
103   \paper{}
104   \midi{}
105 })
106
107
108 sect(Syntax)
109
110 A Mudela files consists of statements, generally
111 separated by spaces, tabs or newlines.  A one line comment is
112 introduced by a code(%) character.  Block comments are started by
113 code(%{) and ended by code(%}).  They cannot be nested.
114
115 Mudela supports several data types.  Four types of simple constants
116 are supported: integers, reals, strings, and notes.  An integer is a
117 sequence of digits such as code(12).  A real is fromed from an
118 optional minus sign and a sequence of digits followed by a decimal
119 point and an optional exponent such as code(-1.2e3).  A string is
120 started and ended with the code(") character.  To include a code(")
121 character in a string, you must write code(\").  Various other
122 backslash sequences have special interpretations as in the C language.
123 A string that contains no spaces can be written without the quotes.  A
124 note consists of a note name followed by an optional duration.  See
125 section ref(notedesc) for details on this type.  A dimension consists
126 of a real followed by one of the dimension keywords: code(\mm),
127 code(\pt), code(\in), or code(\cm).  Dimensions are converted
128 immediately to a real which gives the dimension in points, so they can
129 be mixed with reals.
130
131 Compound types are built up from the simple types.  The compound types
132 are: arglist, assignlist and musiclist.  An arglist is a
133 white space separated list of integers, reals and or strings surrounded
134 by braces code({) and code(}).  An assignlist is a list of 
135 identifier assignments, which have the form var(key)code(=)var(value).
136 The simplest musiclist is a single note.  More complicated music lists
137 are formed by surrounding a list of musiclists with braces code({) and
138 code(}) or with angle brackets code(<) and code(>).  Items appearing
139 in braces will be treated as serial. Items in angle brackets will be
140 simultaneous. 
141
142 A statement in Mudela has one of three forms:
143 verb(\keyword argument
144 \keyword argument1 argument2 ... ;
145 string=value)
146         
147 To assign an identifier you use:
148 verb(string = ...)
149 To use an identifier, you must preceed it with a backslash: code(\).
150 verb(oboe = \notes { ... }
151 \score{ \notes { \oboe }})
152 The left-hand part of the assignment is really a string, so 
153 verb("Foo bar 4 2 " = \notes { ... })
154 is also a valid assignment (but you would have trouble referencing it)
155 If you reuse identifiers, then the previous contents will be thrown
156 away after the right hand is evaluated, e.g.
157 verb(bla = \notes { \bla })
158 is legal.
159
160 COMMENT(It's not clear to me what things are allowed on the RHS of 
161 an identifier assignment.)
162
163 The following words are keywords.  You can define an identifer whose
164 name is a keyword, but you will not be able to reference it.
165
166 verb(absdynamic  font           mm             pt              time       
167 accepts     grouping       musicalpitch   relative        translator 
168 bar         header         notenames      score           transpose  
169 cadenza     in             notes          script          type       
170 clear       include        octave         shape           version    
171 clef        key            output         skip        
172 cm          keysignature   paper          spandynamic 
173 consists    lyric          partial        symboltables
174 contains    mark           penalty        table       
175 duration    midi           property       tempo )
176
177 COMMENT( I don't know the proper way to make this kind of table in
178 yodl. )
179
180 COMMENT(
181 subsect(Hierarchical structures)
182
183 The general structure consists of declarations:
184 verb(IDENTIFIER = \TYPE{
185         <type specific data>
186 })
187 and instantiations:
188
189 verb(\TYPE{ <type specific data> })
190
191 (Currently, code(\score) is the only type that can be instantiated
192 at top level.)
193
194 Most instantiations that use an IDENTIFIER are specified as follows:
195
196 verb(\TYPE{ \IDENTIFIER [...] })
197
198 Some exceptions on this rule have been made to prevent inputting
199 Mudela becoming tedious
200 )
201
202
203
204 sect(Modes)
205
206 To simplify different aspects of music definition (entering the notes
207 and manipulating them) Mudela has a number of different input "modes".
208 In each mode, words are identified on the input.  If code("word") is
209 encountered, it is treated as a string.  If code("\word") is
210 encountered it is treated as a keyword or as an identifier.  The
211 behavior of the modes differs in two ways: different modes treat
212 unquoted words different, and different modes have different rules for
213 deciding what is a word.  
214
215 description(
216
217 dit(Normal mode)
218 At the start of parsing, Mudela is in normal mode.
219 In normal mode, a word is an alphabetic character followed by
220 alphanumeric characters.  If code(word) is encountered on the input it
221 is treated as a string. 
222
223 dit(Note mode) Note mode is introduced by the keyword
224 code(\notes).  In Note mode, words can only contain alphabetic
225 characters.  If code(word) is encountered, LilyPond first checks for a
226 notename of code(word).  If no notename is found, then code(word) is
227 treated as a string.  If you mistype a notename, the parser will most
228 likely complain that you should be in code(\lyric) mode to do lyrics. 
229
230 dit(Lyric mode) Lyrics mode is introduced by the keyword
231   code(\lyric).  Because of the various control characters that can
232   appear in lyrics, e.g., foreign language accents, the inputting a
233   string containing these has been made very easy.  Every sequence of
234 non-digit and non-white characters starting with an alphabetic
235 character or the code(_) is considered a word.  When code("word") is
236 encountered it is treated as a lyric (without the quotes).  Likewise,
237 when code(word) is encountered, it is treated as a lyric.  The code(_)
238 character is converted to a space; it provides a mechanism for
239 creating words that contain spaces.  
240 verb(a&@&@&TSI|{[    % a word
241 1THtrhortho     % not a "word"
242 Leise DOEXPAND(Fl\)DOEXPAND("u\)ss{}teren meine Sapfe       % 4 words
243 _ _ _ _         % 4 words: 4 spaces
244 ))
245
246 COMMENT(Well, " seems to present some problems.  Also `` seems to be
247 problematic.  So the above statement isn't quite right.  Unless these
248 characters are considered to be "white")
249
250 COMMENT(
251 These modes are of a lexical nature. Normal and Note mode largely
252 resemble each other, save the possibility of entering Reals, 
253 meaning of code(_) and the resolution of words
254
255 What's this about reals?  When can you enter them or not enter them?)
256
257
258 sect(Note Description)
259 label(notedesc)
260
261 subsect(Basic Note Specification)
262
263 A note specification has the form 
264 var(pitch)[var(octavespec)][code(!)][var(duration)].
265 The pitch of the note is specified by the note's name.  
266
267 LilyPond has predefined note names for various languages.  The default
268 names are the Dutch note names.  The notes are specified by the
269 letters code(c) through code(b), where code(c) is an octave below
270 middle C and the letters span the ocatave above that C.  
271 In Dutch, a sharp is formed by adding
272 code(is).  A flat is formed by adding code(es).
273 Double sharps and double flats are obtained by adding code(isis) or
274 code(eses).  
275 Lily has predefined sets of notenames
276 for various nop(languages)footnote(These 
277 are Dutch, English, German, Italian and Swedish.
278 Simply include the language specific init file file(language.ly).).
279 Rests are specified with the note name code(r).  There is also a note
280 name code(s) which produces a nonprinting note of the specified
281 duration.  
282
283 The optional octave specification takes the form of a series of single
284 quote 
285 code(') characters or a series of comma code(,) characters.  Each
286 code(') raises the pitch by one octave; each code(,) lowers the pitch
287 by an octave.  
288
289 mudela(fragment,verbatim,center)(
290 c' d' e' f' g' a' b' c''
291 )
292
293 mudela(fragment,verbatim,center)(
294 cis' dis' eis' fis' gis' ais' bis'
295 )
296
297 mudela(fragment,verbatim,center)(
298 ces' des' es' fes' ges' as' bes'
299 )
300
301 mudela(fragment,verbatim,center)(
302 cisis' eisis' gisis' aisis' beses'
303 )
304
305 mudela(fragment,verbatim,center)(
306 ceses' eses' geses' ases' beses'
307 )
308
309 Whenever a C-sharp is desired,  you must specify a C-sharp.  LilyPond
310 will determine what accidentals to  typeset  depending on the  key and
311 context.   
312 A reminder accidental can be forced by
313 using the optional exclamation mark `code(!)'
314 on a pitch.
315 mudela(fragment,verbatim,center)(
316 cis' d' e' cis'  c'! d' e' c' 
317 )
318
319
320 Durations are entered as their reciprocal values
321 mudela(fragment,verbatim,center)(
322 a'1 a'2 a'4 a a'8 a a'16 a'32 a'64
323 )
324 mudela(fragment,verbatim,center)(
325 r1 r2 r4 r8 r16 r32
326 )
327
328 If the duration is omitted then it is set equal to the previous
329 duration.  If there is no previous duration, then a quarter note is
330 assumed.  
331 The duration can be followed by a dot code(.) to obtain dotted note
332 lengths.  
333 mudela(fragment,verbatim,center)(
334 a'4. b'4.
335 )
336
337 In addition, the duration can be followed by a multiplier which is
338 introduced with the asterisk code(*) and can be an integer or a
339 fraction.  The multiplier changes the duration that LilyPond uses
340 internally for the note, but it does not change the symbol that is
341 printed.  
342 mudela(fragment,verbatim,center)(
343 c'4*2 c'4*2 d'8*2/3 d'8*2/3
344 )
345
346 Extra long notes can be obtained using the code(\breve) and
347 code(longa) durations:
348 mudela(fragment,verbatim,center)(
349 c'\breve gis'\longa
350 )
351
352
353 subsect(Beams and Tuplets)
354
355 A beam is specified by surrounding the beamed notes with brackets
356 code([) and code(]).  
357 mudela(fragment,verbatim,center)(
358 [a'8 a'] [a'16 a' a' a']
359 )
360
361 In order to create triplets, you must use a length multiplier after
362 the brackets.  An open bracket code([) followed by a fraction
363 instructs LilyPond to print a number over the beam, and it also
364 starts multiplying all note lengths by the fraction.  The closing
365 bracket code(]) should be followed by the fraction code(1/1) in order
366 to restore normal note lengths.  To create a triplet without a beam,
367 place a backslace code(\) before the opening and closing brackets. 
368
369 For example, in an ordinary triplet, the notes have duration 2/3 as
370 long as normal. 
371 mudela(fragment,verbatim,center)(
372 [2/3 a'8 a' a' ]1/1 \[2/3 b'4 b' b'\]1/1
373 )
374
375 There is a shorthand that can be used when you 
376 want notes lengths multiplied by 2/n.  
377 The 2 can be omitted after the open bracket
378 and the first 1 can be omitted after the closing bracket.  
379 mudela(fragment,verbatim,center)(
380 [/3 b'8 b' b' ]/1  \[/3 a'4 a'8\]/1
381 )
382
383 COMMENT(The rest of this section needs to be rewritten.  I don't
384 understand what's going on at all here.  The meaning of the lone ] is
385 unclear.  And the : syntax is also unclear.  --Adrian)   
386
387 Here is a combination
388 mudela(fragment,verbatim,center)(
389 [/3 a'8 a'16 a'] a'8 \]
390 )
391
392 Abbreviations
393 mudela(fragment,verbatim,center)(
394 c'1:16 [:16 e'1 g']
395 )
396
397 mudela(fragment,verbatim,center)(
398 c'4:32 [:16 c'8 d'8]
399 )
400
401
402
403 subsect(Slurs and Ties)
404
405 A tie connects two adjacent note heads
406
407 mudela(fragment,verbatim,center)(
408 e' ~ e'
409 )
410
411 Whereas a slur rather connects `chords', 
412 and tries to avoid crossing stems
413
414 mudela(fragment,verbatim,center)(
415 e'( )e'
416 )
417
418 And of course, such a (legato) slur can span several notes
419 mudela(fragment,verbatim,center)(
420 c'( d' e' )f'
421 )
422
423 subsect(Note Ornaments)
424
425 A variety of symbols can appear above and below notes to indicate
426 different characteristics of the performance.  These symbols can be
427 added to a note with `var(note)code(-\)var(name)'.  Numerous different
428 symbols are defined in file(script.ly).  Each symbol is defined using
429 the code(\script) keyword which specifies where symbols appear.
430 Symbols can be forced to appear above the note by writing
431 `var(note)code(^\)var(name)', and they can be forced to appear below
432 by writing `var(note)code(_\)var(name)'.  Here is a chart showing
433 symbols above notes, with the name of the corresponding symbol
434 appearing underneath.  
435
436 mudela()(
437 \score{
438  < \notes{ c''-\accent c''-\marcato c''-\staccatissimo f'-\fermata 
439           c''-\stopped c''-\staccato c''-\tenuto c''-\upbow c''-\downbow
440           c''-\lheel c''-\rheel  c''-\ltoe  c''-\rtoe  c''-\turn
441           c''-\open  c''-\flageolet  c''-\reverseturn 
442           c''-\trill
443           c''-\prall c''-\mordent c''-\prallprall  c''-\prallmordent
444           c''-\upprall c''-\downprall }
445   \type Lyrics \lyric{  
446         accent      marcato      staccatissimo fermata stopped
447            staccato tenuto upbow downbow lheel rheel ltoe rtoe  turn
448            open  flageolet reverseturn 
449              trill  prall
450            mordent prallprall prallmordent uprall  downprall }>
451   \paper{linewidth  = 5.875\in
452          indent = 0.0
453         }
454 }
455 )
456
457 In addition, it is possible to place arbitrary strings of text or
458 TeX() above or below notes by using a string instead of an identifier:
459 `code(c^"text")'.  Fingerings can be placed by simply using digits.
460
461 To save typing,  a few common symbols  can  be  abbreviated  with
462 single characters:
463 mudela()(
464 \score{ \notes {
465         \property Voice.textstyle = typewriter
466         c''4-._"c-." s4
467         c''4--_"c--"  s4
468         c''4-+_"c-+" s4
469         c''4-|_"c-|" s4
470         c''4->_"c->"  s4
471         c''4-^_"c-\\^{ }"  s4 }
472         \paper { linewidth = 12.\cm; }})
473
474 Dynamic marks are specified by using an identifier after
475 a note without a dash: code(c4 \ff).  The available  dynamic marks
476 are:  code(\ppp),  code(\pp), code(\p), code(\mp), code(\mf),
477 code(\f), code(\ff),  code(\fff), code(\fp), code(sf), and code(\sfz).
478
479 A crescendo mark is started with code(\cr) and terminated with
480 code(\rc).  A decrescendo mark is started with code(\decr) and
481 terminated with code(\rced).
482
483
484
485 sect(Lyrics)
486
487 Lyrics are entered like notes, with pitches replaced
488 by text.  For example code(Twin-4 kle4 twin-4 kle4) enters four
489 syllables, each with quarter note duration.  
490
491 In order to instruct LilyPond to write lyrics underneath the
492 staff, you must enter the lyrics context with code(\type Lyrics).  
493 Lyrics should be entered in lyrics mode which is entered with code(\lyric).
494
495 Two syllables or words that compose a single
496 duration entry are bound together using an underscore: 
497 code(He_could4 not4).  Here is a full example:
498 mudela(verbatim)(\score{ 
499   <  \notes \transpose c'' {c d e c | c d e c | e f g'2 | 
500                               e'4 f g'2 \bar "|."; }
501      \type Lyrics \lyric { 
502               DOEXPAND(Fr\)`e-4 re Ja- que DOEXPAND(Fr\)`e- re Ja- que
503               Dor- mez vous?2 Dor-4 mez vous?2  }
504   >
505 })
506
507 COMMENT(
508 URG
509                         Fr\`e-4 re Ja- que
510                         Fr\`e- re Ja- que
511 )
512
513
514
515 sect(Chords and Voices)
516
517 Here's a simple chord
518 mudela(fragment,verbatim,center)(
519 <c e g>
520 )
521
522 here are a few
523 mudela(fragment,verbatim,center)(
524 <
525         { c'()d'()c' }
526         { e'()f'()e' }
527         { g'()a'()g' }
528 >
529 )
530
531 and similarly voices
532 mudela(fragment,verbatim)(
533 <
534         { \voiceone c'4 g' c' g' }
535         { \voicetwo c2 g2 }
536 >
537 )
538
539
540 sect(Time)  
541
542 LilyPond aligns all musical objects according to the amount of time
543 they occupy.  All of these objects have a duration.  When music is
544 written in series using braces the duration is the sum of the 
545 durations of the elements.  When music is stacked using angle
546 brackets, the duration is the maximum of the durations of the
547 elements.  
548
549 Because LilyPond knows the durations of all musical elements, the time
550 signature enables LilyPond to draw bar lines automatically.  The time
551 signature is specified with the code(\time) keyword: code(\time 3/4).
552 If no time signature is given, LilyPond assumes 4/4.  The automatic
553 generation of bar lines can toggled with the code(\cadenza) keyword,
554 and an incomplete measure at the start of the music can be created
555 using the code(\partial) keyword: code(\partial 8*2;) creates a
556 starting measure lasting two eighth notes.
557
558 In order to help with error checking, you can insert bar markers in
559 your music by typing code(|).  Whenever LilyPond encounters a code(|)
560 that doesn't fall at a measure boundary, she prints a warning message.
561
562 Rhythmic grouping is  a concept closely associated with this. 
563 A default grouping is selected for the chosen time signature.  
564 The default consists of combinations of 2 and 3 beats with as many
565 groups of 3 as possible, and the groups of 3 coming first.  For
566 example, 4/4 is divided into 2+2 and 8/8 is divided into 3+3+2.  This
567 default grouping can be changed using the \grouping keyword which
568 takes a list of durations to specify the grouping. 
569
570
571
572 sect(Composition: forming bigger structures)
573 label(sec:grammar)
574
575 The computer savy user may be interested in a more formal
576 specification.  We can capture what have learned about forming
577 sentences in Mudela in a context-free grammar.
578
579 latexcommand(\smallskip)
580
581 table(2)(lll)(
582         row(cell(em(Music))cell(: em(Note)))
583         row(cell()cell(code(|) em(Rest)))
584         row(cell()cell(code(|) code({) em(MusicList) code(})))
585         row(cell()cell(code(|) code(<) em(MusicList) code(>)))
586         row(cell()cell(code(|) em(Command)))
587         row(cell()cell(code(|) code(\type) em(string) code(=) em(string)  em(Music)))
588         row(cell()cell(;))
589         row(cell(em(MusicList))cell(: em(empty)))
590         row(cell()cell(code(|)  em(MusicList)  em(Music)))
591         row(cell()cell(;))
592 )
593
594 latexcommand(\smallskip)
595
596 In mathematics you can form expressions by combining expressions,
597 which are ultimately some kind of atom or terminal symbol.  The same
598 goes for Mudela: there are some basic building blocks, and by
599 combining those you create complex music.
600
601 You can combine music in three ways:
602 itemize(
603 it()If you enclose a sequence of music-elements in braces ( code({)
604     and code(}) ), then you form another kind of music called
605 sequential music
606     with those pieces.
607   The duration of sequential composition is the sum of the durations of its elements
608   verb(
609       { c c g g a a g2 }      % twinkle twinkle
610       { { c c g g} { a a g2 } }
611   )
612 it()You can stack music by enclosing a sequence of music elements
613     with code(<) and code(>). This is called simultaneous music.  
614     The duration of a simultaneous composition is the maximum of the durations 
615     of its elements Example:
616     verb(
617         <a4 {cis8 cis8} e'4>      % a-major chord
618     )
619 it()You can form music by transposing music:
620     verb(
621     \transpose  
622         d       % from c to the d that's almost one octave down
623                 { e4 f4 }       % the horizontal music
624 )
625 it()verb(\type)
626 it()verb(\property)
627 it()verb(\translator)
628 it()verb(\relative)
629 )
630
631 Of course you can also combine these three mechanisms.
632 verb(
633 { c <c e> <c e g> <c e g \transpose d' dis > }  % 4 increasing chords
634 )
635
636
637
638
639 sect(Keywords)
640
641 Keywords sometimes appear alone, but usually they require arguments. 
642 A keyword may have a single argument, or a sequence of arguments separated
643 by spaces and terminated by a semicolon:
644 `code(\keyword argument argument ... ;)'
645
646
647 description(
648
649 dit(code(\absdynamic) code({) var(code) code(})) Internal command for
650 printing dynamic marks such as $f$ under music.  The parameter
651 var(code) is unsigned and specifies the dynamic mark to print.
652 Normally you should use the more user friendly abbreviations defined
653 in the init file file(dynamic.ly).
654
655 dit(code(\accepts) var(string)code(;)) This command can appear only within a
656 code(\translator) block.  It specifies what contexts are allowed
657
658 dit(code(\bar) var(bartype)code(;)) Prints a special bar symbol, or at
659 measure boundaries, replaces the regular bar symbol with a special
660 symbol.  The argument var(bartype) is a string which specifies the
661 kind of bar to print.  Options are code(":|"), code("|:"),
662 code(":|:"), code("||"), code("|."), code(".|"), or code(".|.").
663 These produce respectively a right repeat, a left repeat, a double
664 repeat, a double bar, a start bar, an end bar, or a thick double bar.
665 If var(bartype) is set to code("empty") then nothing is printed, but a
666 line break is allowed at that spot.  Note that the printing of special bars
667 has no effect on the MIDI output.
668
669 dit(code(\cadenza) var(togglevalue)code(;)) Toggles the automatic generation
670 of bar lines.  If var(togglevalue) is 0 then bar line generation is
671 turne off.   If var(togglevalue) is  1  then a bar is  immediately
672 printed and bar generation is turned  on.
673
674 dit(code(\clear)) Allowed only within code(\notename).  Clears all the
675 previously defined note names.  
676
677 dit(code(\clef) var(clefname)code(;)) Allowed only in music.  
678 Sets the current clef.  The argument is
679 a string which specifies the name of the clef.  Several clef names are
680 supported.  If code(_8) or code(^8) is added to the end of a clef
681 name then the clef lowered or raised an octave will be generated.  
682 Here are the supported clef names with middle C shown in each clef:
683 mudela()(
684 \score{
685   \notes{  
686    %\property Voice.textstyle = typewriter
687    \clef subbass; c'4-"\kern-10mm subbass" 
688            \clef bass;    c'4^"\kern -8mm bass"
689            \clef baritone; c'4_"\kern -10mm baritone"
690            \clef varbaritone; c'4^"\kern -10mm varbaritone"
691            \clef tenor;     c'4_"\kern -10mm tenor"
692            \clef "G_8";   c'4^"\kern -6mm G\_8"  }  
693 \paper{ linewidth= 4.5 \in;
694 Staff = \translator {
695         \type "Line_group_engraver_group";
696
697         defaultclef = violin;
698
699 %       \consists "Bar_engraver";
700         \consists "Clef_engraver";
701         \consists "Key_engraver";
702         \consists "Local_key_engraver";
703         \consists "Time_signature_engraver";
704         \consists "Staff_sym_engraver";
705         \consists "Collision_engraver";
706         \consists "Rest_collision_engraver";
707         \consists "Separating_line_group_engraver";
708           
709         \accepts "Voice";
710         }
711
712 }
713
714 }
715 )
716 mudela()(
717 \score{
718   \notes{\clef alto;    c'4_"\kern -10mm alto"
719            \clef mezzosoprano; c'4^"\kern -10mm mezzosoprano"
720            \clef soprano;  c'4_"\kern -10mm soprano"
721            \clef treble;  c'4^"\kern -6mm treble"
722            \clef french;  c'4_"\kern -10mm french" }  
723 \paper{ linewidth= 4.5 \in;
724 Staff = \translator {
725         \type "Line_group_engraver_group";
726
727         defaultclef = violin;
728
729 %       \consists "Bar_engraver";
730         \consists "Clef_engraver";
731         \consists "Key_engraver";
732         \consists "Local_key_engraver";
733         \consists "Time_signature_engraver";
734         \consists "Staff_sym_engraver";
735         \consists "Collision_engraver";
736         \consists "Rest_collision_engraver";
737         \consists "Separating_line_group_engraver";
738           
739         \accepts "Voice";
740         }
741 }
742 }
743 )
744 The treble  clef  can also  be obtained using  the  names code(G) or
745 code(violin).  The bass clef is also available by code(\clef  F). 
746
747 dit(code(\cm)) Specify a dimension in centimeters. 
748
749 dit(code(\consists) var(string)code(;)) This command can appear only within a
750 code(\translator) block.  It specifies that an engraver named
751 var(string) should be added to the translator.
752
753 dit(code(\contains)) Produces a parse error.  (There is no rule in the
754 grammar that refers to this token.)
755
756 dit(code(\duration) code({) var(length) var(dotcount) code(})) Specify note
757 duration.  The parameter var(length) is the negative logarithm (base
758 2) of duration: 1 is a half note, 2 is a quarter note, 3 is an eighth
759 note, etc.  The number of dots  after  the  note is given by
760 var(dotcount). 
761
762 dit(code(\font) var(string)) Internal command.  Used within
763 code(\symboltables) to specify the font.
764
765 dit(code(\grouping) var(durationseq); )  Sets  the  metric structure of
766 the measure.  Each argument specifies the duration of one metric unit.
767 For example, code(\duration 16*5;) specifies a grouping of five beats
768 together in 5/16 time.  The default grouping is to have as many groups
769 of 3 as possible followed by groups of two.  
770
771 dit(code(\in)) Specify a dimension in inches.  
772
773 dit(code(\include) var(file)) Include the specified file.  The
774 argument var(file) is a string.  The full filename including the
775 file(.ly) extension must be given. 
776
777 dit(code(\lyric) var(lyriclist)) Parse var(lyriclist) in lyrics mode.
778
779 dit(code(\key) var(pitch)) Change key signature to that of
780 var(pitch)-major.
781
782 dit(code(\keysignature) var(pitchseq);)
783 Specify an arbitrary key signature.  The pitches from var(pitch) will
784 be printed in the key signature in the order that they appear on the list.
785
786 dit(code(\mark) var(unsigned) or code(\mark) var(string)) Allowed in
787 music only.  What does this do?
788
789 dit(code(\musicalpitch) code({) var(octave) var(note) var(shift) code(})) 
790 Specify note pitch.  The octave is specified by an integer,
791 zero for the octave containing middle C.  The note is a number from 0
792 to 7, with 0 corresponding to C and 7 corresponding to B.  The shift
793 is zero for a natural, negative to add flats, or positive to add
794 sharps.
795
796 dit(code(\notes) var(music)) Enter note mode and process the
797 specified music. 
798
799 dit(code(\time) var(numerator)code(/)var(denominator)) Change the time
800 signature.  The default time signature  is 4/4.  
801
802 dit(code(\midi) var(statementlist)) Appears in a score block to
803 indicate that musical output should be produced.  See code(\tempo).
804
805 dit(code(\mm)) Specify a dimension in millimeters. 
806
807 dit(code(\header) code({) var(key1) = var(val1); var(key2) = var(val2); ... code(}))
808 Specifies information about the music.  A header should appear at the
809 top of the file describing the file's contents.  If a file has
810 multiple code(\score) blocks, then a header should appear in
811 each score block describing its contents.  Tools like code(ly2dvi) can
812 use this information for generating titles.   Some possible key values
813 are: title, opus, description, composer, enteredby, and copyright.
814
815 dit(code(\notenames) var(assignmentlist)) Define new note names.  
816 The argument is a list of definitions of  the form
817 var(name) = var(pitch),  where var(pitch) is specified with the
818 code(\musicalpitch) command.  Another possibility is code(\clear)
819 which can appear instead of an assignment.  
820
821 dit(code(\octave)) Generate a parse error.  Never referred to in the
822 grammar.
823
824 dit(code(\output) var(string)code(;)) Allowed only in
825 code(\paper) block.  The parameter var(string) specifies an alternate
826 name for the TeX() output.  A file(.tex) extension will be added to
827 var(string) to produce the output file name.
828
829 dit(code(\partial) var(duration)) Specify that the first measure of
830 the music lasts only for the specified duration.
831
832 dit(code(\paper) var(statmentlist)) 
833 Appears in a score block to indicate that the music should be printed.
834
835 dit(code(\penalty) code(=) var(int)) Allowed only in musiclists.
836 Discourages line breaks.
837
838 dit(code(\property) var(contextname)code(.)var(propname) code(=) var(value))
839 Sets the var(propname) property of the context var(contextname) to the
840 specified var(value).  All three arguments are strings.
841
842 dit(code(\pt)) Specify a dimension in points. 
843
844 dit(code(\relative) var(pitch) var(music)) Processes the specified
845 var(music) in relative pitch
846 mode.  In this mode, the octave of a pitch note is chosen so that the
847 note is closest to the preceeding note.  
848 The argument var(pitch) is
849 the starting pitch for this comparision.  In the case of chords, the
850 first note of a chord is used as the base for the pitches in the next
851 chord.  
852
853 Because transposing changes both note names and octaves relativizing
854 transposed music doesn't make any sense.  If you want to transpose
855 relative music, do code(\transpose var(pitch) \relative var(pitch)
856 var(music)), i.e., first enter the music in relative mode, and then
857 transpose it by prepending the code(\transpose) keyword.
858 code(\relative var(pitch) \transpose var(pitch)) has no effect.
859
860 For the same reason the first code(\relative) in code(\relative
861 var(pitch1) \relative var(pitch2) var(music)) has no effect.
862
863
864 dit(code(\score) var(statementlist)) Define music.
865
866 dit(code(\script) code({) var(name) var(instaff) var(withstem)
867 var(location) var(invertible) var(priority) code(})) This command is
868 used the initialization file(script.ly) to define the various symbols
869 that can appear above and below notes.  The first argument is the name
870 of the symbol.  The second argument var(instaff) is 1 if the symbol
871 follows the notehead into the staff and 0 if the symbol stays above or
872 below the staff lines.  The third parameter var(withstem) is 0 if the
873 symbol's placement does not depend on the stem direction; it is 1 if
874 the symbol should be at the stem end of the note and it is -1 if the
875 symbol should be at the note head end of the note.  The argument
876 var(location) is set to 1 for symbols that always appear above the
877 staff; it is -1 for symbols that appear below the staff.  If
878 var(invertible) is set to 1 then the symbol can be inverted; otherwise
879 it cannot.  The last argument var(priority) sets a priority for the
880 order of placement of several symbols on a single note.
881
882 dit(code(\shape) code(=) var(indent1) var(width1) var(indent2)
883 var(width2) ... code(;)) Allowed only within code(\paper).  Each pair
884 of var(indent) and var(width) values is a dimension specifying how far
885 to indent and how wide to make the line.  The indentation and width of
886 successive lines are specified by the successive pairs of dimensions.
887 The last pair of dimensions will define the characeristics of all
888 lines beyond those explicitly specified.
889
890 COMMENT(First pair of dimensions seems to be skipped.  At least it is
891 in the example file denneboom.ly.)
892
893 dit(code(\skip) var(duration)) Skips the amount of time specified by
894 var(duration).  A gap will be left for the skipped time with no notes
895 printed.  It works in Note Mode or Lyrics Mode (but generates a
896 mysterious error in lyrics).
897
898 dit(code(\spandynamic) code({) var(kind) var(toggle) code(})) Internal
899 command for crescendo and decrescendo symbols.  The first parameter
900 var(kind) is set to 1 for a crescendo and -1 for a decrescendo.  The
901 second parameter is set to 1 to start the mark and 2 to stop it.
902 Users should use the abbreviations which are defined in the
903 initialization file file(dynamic.ly).
904
905 dit(code(\symboltables)) Internal command.  Used to create symbol
906 tables.  See initialization files file(paper*.ly), file(feta*.ly), and
907 file(table*.ly).  
908
909 dit(code(\table)) Internal command.  Used within code(\symboltables)
910 to specify the tables.  See initialization  files. 
911
912 dit(code(\tempo) var(duration) = var(perminute)) Used within
913 code(\midi) to specify the tempo.  For example, 
914 `code(\midi { \tempo 4 = 76})' requests output with 76 quarter notes
915 per minute. 
916
917 dit(code(\translator) var(statements) or code(\translator)
918 var(context) = var(name)) The first variant appears only within
919 code(\paper) and specifies a translator for
920 converting music to notation.  The translator is specified with a
921 single code(\type) statement and a series of code(\accepts), and
922 code(\consists) statements.  The second variant appears in a
923 musiclist.  It specifies that the current the contexts
924 contained within the specified context should be shifted to the
925 context with the specified name.  
926
927 COMMENT( \translator seems like a strange name for the second
928 operation, and is the overloading desireable? )
929
930 dit(code(\type) var(contexttype) [code(=) var(contextname)]
931 var(musiclist) or code(\type) var(translatortype)code(;)) The first
932 variant is used only within musiclists to 
933 create a instance of a context.  The new context
934 can optionally be given a name.  The second variant appears within a
935 code(\translator) block and specifies the type of translator being
936 created.
937
938 dit(code(\transpose) var(pitch) var(music)) Transposes the specified
939 music.  Middle C is tranposed to var(pitch). 
940
941 dit(code(\version) var(string)) Specify the version of Mudela that a
942 file was written for.  The argument is the version number, for example
943 code("1.0.1").  Note that the Mudela version is different from the
944 LilyPond version.
945
946 )
947
948
949 sect(Notation Contexts)
950
951 Notation contexts provide information that appears in printed music
952 but not in the music itself.  A new musical context is created using
953 the code(\type) keyword: `code(\type) var(contexttype) [code(=)
954 var(contextname)] var(musiclist)'.  The following context types are
955 allowed.
956
957 description(
958
959 dit(code(Lyrics)) Typesets lyrics.
960
961 dit(code(Voice)) Corresponds to a voice on a staff.
962   This context handles the conversion of noteheads,
963   dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests.
964
965 dit(code(Staff)) Handles clefs, bar lines, keys,
966   accidentals.  It can contain code(Voice) or code(Lyrics) contexts.
967
968 dit(code(RhythmicStaff)) A context like code(Staff) but for printing
969 rhythms.  Pitches are ignored; the notes are printed on one line.  
970 It can contain code(Voice) or code(Lyrics) contexts. 
971
972 dit(code(GrandStaff)) Contains code(Staff) or code(RhythmicStaff)
973 contexts.  It adds a brace on the left side grouping the staffs
974 together. The bar lines of the contained staffs are connected vertically.
975 It can contain code(Staff), code(RhythmicStaff) or code(Lyrics) contexts.
976
977 dit(code(StaffGroup)) Contains code(Staff) or code(RhythmicStaff)
978 contexsts.  Adds a bracket on the left side, grouping the staffs
979 together.  The bar lines of the contained staffs are connected vertically.
980 It can contain code(Staff), code(RhythmicStaff) or code(Lyrics) contexts.  
981
982 dit(code(ChoireStaff)) Identical to code(StaffGroup) except that the
983 contained staffs are not connected vertically.  
984
985 COMMENT(Odd spelling of "choir".)
986
987 dit(code(Score)) This is the top level notation context.  It is entered with
988 the code(\score) command rather than the code(\type) command.  No
989 other context can contain a code(Score) context.  This context handles
990 the administration of time signatures.  It also makes sure that items
991 such as clefs, time signatures, and key-signatures are aligned across
992 staffs.  It can contain code(Lyrics), code(Staff),
993 code(RhythmicStaff), code(GrandStaff), code(StaffGroup), and
994 code(ChoireStaff) contexts.
995
996 )
997
998 The various contexts have properties associated with them.  These
999 properties can be changed using the code(\property) command:
1000 `code(\property) var(context)code(.)var(propname) code(=) var(value)'.
1001 Properties can also be set within the code(\translator) block
1002 corresponding to the appropriate context.  In this case, they are
1003 assigned by `var(propname) code(=) var(value)'.
1004
1005
1006 description(
1007   dit(Lyrics properties)
1008
1009      description(
1010         dit(code(textstyle)) Set the font for lyrics.  The available
1011 font choices are code(normaltext), code(roman), code(italic), code(bold)
1012 code(normaltext), code(large), code(Large), code(huge), and
1013 code(finger).  The code(finger) font can only display numbers.  
1014 Note also that you must be careful when using code(\property) in
1015 Lyrics mode.  Because of the way strings are parsed, either put quotes
1016 around the arguments to code(\property) or be sure to leave a space on
1017 both sides of the dot.  
1018     dit(code(textalignment))
1019 Controls alignment of lyrics.
1020 Set to -1 to align the left end of the lyric with
1021 the note; set to 1 to align the right end of the lyric with the note.
1022 Set to 0 to align the center of the lyric with the note.  
1023        )
1024    dit(Voice properties)
1025
1026      description(  
1027      dit(code(ydirection)) Determines the direction of
1028 stems, subscripts, beams, slurs, and ties.  Set to -1 to force them
1029 down, 1 to force them up, or 0 to let LilyPond decide.  This can be
1030 used to distinguish between voices on the same staff.  The
1031 code(\stemdown), code(\stemup), and code(\stemboth) identifiers set
1032 this property.  
1033    dit(code(slurydirection)) Set to 0 for free choice of slur
1034 direction, set to 1 to force slurs up, set to 0 to force slurs down.
1035 The shorthands code(\slurup), code(\slurdown), and code(\slurboth) are
1036 available.  
1037
1038    dit(code(slurdash)) Set to 0 for normal slurs, 1 for dotted slurs,
1039 and a larger value for dashed slurs.  Identifiers code(\slurnormal)
1040   and code(\slurdotted) are  predefined  to  set the first two settings.
1041
1042    dit(code(hshift)) Set to 1 to enable LilyPond to shift notes
1043 horizontally if they collide with other notes.  This is useful when
1044 typesetting many voices on one staff.  The identifier code(\shift) is
1045 defined to enable this.  
1046
1047    dit(code(textalignment)) Controls alignment of superscripted and
1048 subscripted text.  Set to -1 to align the left end of the text with
1049 the note; set to 1 to align the right end of the text with the note.
1050 Set to 0 to align the center of the text with the note.  
1051   dit(code(textstyle)) Set the text style for superscripts and
1052 subscripts.  See above for list of text styles.
1053
1054   dit(code(fontsize)) Can be used to select smaller font sizes for music.  The
1055   normal font size is 0, and the two smaller sizes are -1 and -2.
1056
1057   dit(code(pletvisibility)) Determines whether tuplets of notes are
1058   labelled.   Setting to 0 shows nothing; setting to 1  shows a
1059   number; setting to 2  shows a  number and  a bracket if there is  no
1060   beam; setting  to  3 shows  a number, and if there is no beam it
1061   adds a  bracket; setting  to 4 shows both a  number  and  a bracket
1062   unconditionally.   
1063 )
1064
1065 dit(Staff properties)
1066
1067  description(
1068  
1069    dit(code(defaultclef)) Determines the default clef.  See code(\clef)
1070    keyword.
1071
1072    dit(code(nolines)) If set to 1, then the staff has only one line instead
1073  of the usual five lines.
1074     
1075    dit(code(barAlways)) If set to 1 a bar line is drawn after each note.
1076
1077    dit(code(defaultBarType)) Sets the default  type of bar  line.  See
1078    code(\bar) keyword.   
1079
1080    dit(code(keyoctaviation)) If set to 1, then keys are the same in all
1081    octaves.  If set to 0 then the key signature for different octaves
1082    can be different and is specified independently:
1083    code(\keysignature bes fis').  The default value
1084    is 1.  Can be set to zero with code(\specialkey) or reset to 1 with
1085    code(\normalkey).  
1086
1087    dit(code(instrument) and code(instr)) If code(Staff_margin_engraver) is
1088    added to the Staff translator, then the code(instrument) property is used to
1089    label the first line of the staff and the code(instr) property is used to
1090    label subsequent lines.
1091 COMMENT(Check that this works)
1092
1093    dit(code(midi_instrument)) Sets  the  instrument for MIDI  output. 
1094
1095    dit(code(transposing)) Tranpose the MIDI  output. 
1096 COMMENT(What syntax?   "0 c" "2 c" ???)
1097
1098      dit(code(ydirection))   What does this do in staff ???
1099 )
1100    
1101   dit(GrandStaff  properties)
1102
1103     description( 
1104       dit(code(maxVerticalAlign))
1105       dit(code(minVerticalAlign))
1106       )
1107
1108    dit(Score properties)
1109
1110    description(
1111     dit(code(part))  Set  to a part  number  for  music with  several  parts.   
1112       Each part has its own code(\score) block  with a different part setting.  
1113    dit(code(SkipBars)) ???
1114
1115    dit(code(beamquantisation)) Set to 0 for no  quantization.  Set  to 1 to
1116    quantize  position  and  slope.  Set to 2 to  avoid  wedges.   These three
1117    settings  are available via code(\beamposfree),  code(\beamposnormal),  and
1118    code(\beampostraditional).    
1119
1120    dit(code(beamslopedamping)) Set to 0 for undamped beams.  Set to 1 for
1121    damped beams.  Set to 100000 for beams with zero slope.  The identifiers
1122    code(\beamslopeproportional), code(\beamslopedamped), and
1123    code(\beamslopezero) each set the corresponding value.
1124   )
1125        
1126 )
1127
1128
1129 COMMENT(
1130
1131 Mystery properties:
1132
1133 bar-column-engraver.cc:  "barColumnPriority"
1134 bar-number-engraver.cc:  "barNumberBreakPriority"
1135 bar-number-engraver.cc:  "barScriptPadding"
1136 dynamic-engraver.cc:     "dynamicdir"
1137 mark-engraver.cc:        "markScriptPadding"
1138 mark-engraver.cc:        "markBreakPriority"
1139 span-bar-engraver.cc:    "singleStaffBracket"
1140 staff-margin-engraver.cc:"marginBreakPriority"
1141 stem-engraver.cc:        "abbrev"
1142 )
1143
1144 sec(Pre-defined Identifiers)
1145
1146 Various identifiers are defined in the initialization files to
1147 provide shorthands for some settings.  
1148
1149 description(
1150 dit(code(\cr)) Start a crescendo.
1151 dit(code(\decr)) Start a decrescendo.
1152 dit(code(\f)) Print forte symbol on the preceeding note.
1153 dit(code(\ff)) Print fortissimo symbol on the preceeding note. 
1154 dit(code(\fff)) Print fortississimo symbol on preceeding note. 
1155 dit(code(\fp)) Print fortepiano symbol on preceeding note. 
1156 dit(code(\mf)) Print mezzoforte symbol on preceeding note. 
1157 dit(code(\mp)) Print mezzopiano symbol on preceeding note. 
1158 dit(code(\normalkey)) Select normal key signatures where each octave
1159 has the same key signature.  This sets the Staff.keyoctaviation property.
1160 dit(code(\p)) Print a piano symbol on preceeding note. 
1161 dit(code(\pp)) Print pianissimo symbol on preceeding note. 
1162 dit(code(\ppp)) Print pianississimo symbol on preceeding note. 
1163 dit(code(\rc)) Terminate a crescendo. 
1164 dit(code(\rced)) Terminate a decrescendo
1165 dit(code(\sf)) Print a ?? symbol on preceeding note. 
1166 dit(code(\sfz)) Print a ?? symbol on preceeding note. 
1167 dit(code(\shift)) Enable note heads that collide with other note heads
1168 to be shifted horiztonally.  This sets the Voice.hshift property.
1169 dit(code(\slurboth)) Allow slurs to be above or below notes.  This
1170 sets the Voice.slurydirection property. 
1171 dit(code(\slurdown)) Force slurs to be below notes. This sets the
1172 Voice.slurydirection property. 
1173 dit(code(\slurup)) Force slurs to be above notes.  This sets the
1174 Voice.slurydirection property.  
1175 dit(code(\specialkey)) Allow keys signatures do differ in different
1176 octaves.  This sets the Staff.keyoctaviation property.  
1177 dit(code(\stemboth)) Allow stems, beams, and slurs to point either
1178 direction.  This sets the Voice.ydirection property. 
1179 dit(code(\stemdown)) Force stems, beams, and slurs to point down.
1180 This sets the Voice.ydirection property. 
1181 dit(code(\stemup)) Force stems, beams and slurs to point up.  This
1182 sets the Voice.ydirectoin property. 
1183 )
1184
1185
1186 sect(The code(\paper) Block)
1187
1188 The code(\paper) block may begin with an optional identifier reference.  No
1189 identifier references are allowed anywhere else in the block.  
1190 The keywords code(\shape), code(\output) and code(\translator) may
1191 appear in this block.  In addition, variable assignments may appear.  
1192 The variables control layout details and are set to reasonable
1193 defaults that depend on the font size in use. 
1194
1195 subsect(Paper variables)
1196
1197 description(
1198   dit(var(integer)) If an integer appears on the left side of an
1199 assignment then a code(\symboltables) keyword must appear on the right
1200 side.  This defines a font.  
1201
1202 dit(code(arithmetic_basicspace))
1203 dit(code(arithmetic_multiplier))
1204 dit(code(basicspace))
1205 dit(code(beam_thickness)) Specify the thickness of beams
1206 dit(code(geometric))
1207 dit(code(indent)) Sets the indentation of the first line of music.  
1208 dit(code(interbeam))
1209 dit(code(interbeam4))
1210 dit(code(interline))
1211 dit(code(internote))
1212 dit(code(linewidth))  Sets the width of the lines.  If it is set to
1213 -1, then a single unjustified line is produced.  
1214 dit(code(notewidth))
1215 dit(code(rulethickness)) Determines thickness of staff lines and bars. 
1216 dit(code(staffheight))
1217 dit(code(unitspace))
1218 )