3 Mudela - GNU LilyPond input format 0.1
7 This document describes the the GNU LilyPond input format, which is an
8 effective language for defining music. We call this language
9 (rather arrogantly) The Musical Definition Language (S<Mudela 0.1>).
11 [If anybody comes up with a better name, we'd gladly take this Gourlay
12 already uses Musical Description Language, GSharp Score Definition
13 Language. We're not being original here]
15 The first aim of Mudela is to define a piece of music,
16 being complete from both from a musical typesetting,
17 as from a musical performing point of view.
22 The Musical Definition Language (Mudela) S<version 2>, has a logical
23 structure, making use of typing and naming (using identifiers), that
24 allows for flexible input, and definition reuse. See MANIFESTO for
25 reasons and design considerations.
27 The below included for explanatory purposes only (i.e., for a complete
28 and up-to-date definition, see F<lily/parser.y> and F<lily/lexer.l>):
30 As a related note, you should take a look at the examples and the init
31 files, as this document does not cover every aspect of mudela yet, and
36 The de-facto extension of Mudela is F<.ly>. Files may be included by
37 entering C<include> at the start of a line:
43 Line comments are introduced by a C<%>. Block comments are delimited
44 by C<%{> and C<%}>. They do not nest.
48 Occasionally, small changes in syntax across different versions of
49 Mudela might give syntax errors. To warn you about possible
50 incompatibilities, you can specify the Mudela version for which the
51 inputfile was written,
55 A perl-script which tries to convert to newer versions
56 (F<convert-mudela>) is included in the LilyPond distribution.
60 Keywords are preceded by a backslash: '\'. They contain alphabetic
63 Identifiers in their normal form consist start with a alpha character,
64 followed by alpha-numerics. Identifiers can contain any characters
65 (except whitespace, C<$> and C<%>), if you use this construct:
67 $i'm_a_weird###identifier
69 (which is the identifier with the name
70 C<i'm_a_weird###identifier> ). C<$> Takes any sequence of
71 characters which are not whitespace, C<$> and C<%>.
73 \$i'm_a_weird###escaped_word
75 =head2 Nesting characters
77 Mudela uses the brace (C<{> and C<}>) for hierarchical structures. To
78 aid the eye in reading, for chords the < and the > are used as
83 Please note that -.5 is no Real.
93 =head2 Hierarchical structures
95 The general structure consists of declarations:
103 \TYPE{ <type specific data> }
105 (Currently, C<\score> is the only type that can be instantiated
106 at top level. Currently declarations can only be done at top level)
108 Most instantiations that use an IDENTIFIER are specified as follows:
110 \TYPE{ IDENTIFIER [...] }
112 Some exceptions on this rule have been made to prevent inputting
113 Mudela becoming tedious
118 The actual musical part of Mudela that defines a melody, is known as
121 Simple mudela is the most common type of music. It consists of a list
122 of notes or lyrics, chords, and commands.
126 To simplify different aspects of music definition (entering the notes
127 and manipulating them) Mudela has a number of different input "modes":
133 At the start of parsing, Mudela assumes normal mode.
134 In Normal mode, a word is looked up in the following order:
136 word identifier, string
137 \word keyword, identifier, string
139 In normalmode, a word is assumed to start with an alphabetic
140 character, followed by alpha-numeric characters.
144 Note mode (and thus Simple mudela) is introduced by the keyword C<\melodic>.
145 In Note mode, a word is looked up in the following order:
147 word notename, string
148 \word keyword, identifier, string
150 In Note mode a word is considered to have alphabetic characters only.
154 Lyrics mode (and thus Simple mudela) is introduced by the keyword C<\lyrics>.
156 In Lyrics mode, a word is looked up in the following order:
159 \word keyword, identifier, string
161 In Lyric mode every sequence of non-digit and non-white characters
162 starting with an alphabetic character or the '_'is considered a word.
164 a&@&@&TSI|{[ % a word
165 1THtrhortho % not a "word"
166 Leise Fl\"u\ss{}teren meine Sapfe % 4 words
167 _ _ _ _ % 4 words: 4 spaces
171 These modes are of a lexical nature. Normal and Note mode largely
172 resemble each other, save the possibility of entering Reals,
173 meaning of C<_> and the resolution of words
177 Simple mudela basically is a sequence of the notes you want to
182 is a A-1 pitched quaver. The ' signifies an octave change. A-1 is 440
183 Hz concert-pitch. C<c'> is also known as the central c. More examples:
194 This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3>
195 signifies that this note is part of a triplet (3 in stead of 2). The
196 duration is one and a half quaver (C<4.>) times 2/3.
199 Notenames are just a special kind of identifiers, and can be declared
200 for any language appropriate (see F<dutch.ini>). The default language
201 for notenames is defined to be dutch. In dutch, the notenames are
202 a,b,c,d,e,f and g. Sharps are formed by adding the extension "is",
206 cisis disis eisis fisis gisis aisis bisis
208 cis dis eis fis gis ais bis
212 ces des es fes ges as bes
214 ceses deses eses feses geses ases beses
216 The standard notenames also have uppercase versions, which octavate
219 a % 220 concert-pitch
225 Rests are named r or s
228 s % a "space" rest, nothing is printed.
230 These notenames along with duration are enough material to construct
236 Music is able to express more. generally speaking, the other
237 'features' are either connected between notes (slurs, beams: spanning
238 requests) or attached to notes (eg. accents). The former are
239 implemented as START and STOP stop features and then attached to the note.
249 Please note that these two characters do I<not> necessarrily nest,
250 they should attached to the note C<[ {c4 c4} ]> will generate a parse
251 error for this reason.
253 [c8 e8(] [)g8 <c'8] e'8>
255 [2/3 c8 c8 c8]1/1 % a triplet
258 =head2 Slurs and Ties
260 Ties connect the noteheads of adjecent notes. They are entered as follows:
264 Slurs connect whole chords, and try to avoid crossing stems. They are
271 Symbols which can be put at either side (above or below) of a staff
272 are entered as follows:
274 a-^ % marcato, direction: default
275 a^- % portato, direction: above note
276 a_. % staccato, direction: below note
277 a^\script { "symbolindex" . . . } % see script.ini for details.
278 a^\fermata % predefined identifier
280 Dynamics can be put after the notename:
282 a4 \dynamic { 0 } % 0 = fff, 7 = ppp
284 Mudela defines the following dynamic identifiers:
286 ppp pp p mp mf df ff fff % df iso f, f is a notename.
288 and the following abbreviations:
291 \> % start decrescendo
292 \! % end crescendo/decrescendo
296 To accompany a note with a text (eg, "marcato"), you should say:
302 the c- construct chooses the default up/down direction.
309 If omit the duration of a, a default value is substituted. For this
310 default value, there are two modes:
316 Use the last duration explicitly entered
320 Use the explicitly set "default duration"
324 Thus the following inputs are equivalent
326 c4 c4 c16 c16 c16 s16 c4 c16
329 c4 c c16 c c c c4 c16
332 c c c16 c16 c16 c16 c c16
337 If you are typing music which does not lie in the "small" and "large"
338 octave, you can prevent having to type C<'> all the time by using the
339 C<\octave> command: These two lines have the same pitch.
344 By default the setting of C<\octave> is 0.
348 Lyrics in Mudela resemble Simple mudela a lot, with notes substituted
351 All syllables are entered separately, separated by whitespace
353 Twin-4 kle4 twin-4 kle4 ...
355 Two syllables or words that compose a single
356 duration entry are bound together using an underscore
360 =head2 Music direction
362 Mudela reads left to right, but you can still stack voices and
363 Voice_elements which are produced in two directions: horizontal
364 (voice like) and vertical (chord like)
366 A sequence of notes (horizontal) is called simple horizontal, eg
371 You can also glue two pieces of simple horizontal music together with the
372 concatenation operator:
374 horOne = \melodic { c c g g }
375 horTwo = \melodic { a a g2 }
376 twinkle = \melodic { \horOne ++ \horTwo }
378 If you enclose simple horizontal music in braces ( { } ), then you get
381 { c c g g a a g2 } % twinkle twinkle
383 You can start vertical music (a "chord") by enclosing a sequence of
384 notes with < and >. Example:
386 <a cis e'> % a-major chord
388 You can also put vertical music inside horizontal music:
390 { c <c e> <c e g> <c e g c'> } % 4 increasing chords
396 {r2 r2 c c g g a a g2} > % a canon
398 The duration of a chord equals the union of the durations of each of
399 its elements. The C<\multivoice> is a construct which is explained
405 You can transpose horizontal music in the following way:
412 d % from c to the d that's one octave down
413 { e4 f4 } % the horizontal music
417 The result is, as you can see, again simple horizontal music.
422 If more than one "voice" is in a staff, then you have the option of
423 putting the different voices into so called voicegroups: members of
424 the same voicegroup share certain characteristics, among others:
431 For the actual list, see the init file F<register.ini>
433 Putting different musical lines in to the same voicegroup effectively
434 makes LilyPond try to form chords of all those lines. Putting
435 different musical lines in to different voicegroups effectively makes
436 LilyPond try to set those lines as independently as possible.
438 You can set the voicegroup of a voice with the command C<\group>, e.g.,
448 oboeII = \melodic { \group "oboes";
456 melodicregs \melodic{ oboeI }
460 In this example, the two oboe voices share one staff and are initially
461 in the voicegroup called "oboes". They will share beams, dynamics etc.
462 After two quavers, oboeI "pushes" its group: a new voicegroup is
463 created, called "oboes+solo". The C<\group "-"> command makes the
464 voice enter "oboes" again.
466 Please do note that [] are voicegroup wide; the previous input is
467 valid: the beam, started in oboeI, voicegroup "oboes" is also ended in
468 voicegroup "oboes", albeit not in oboeI but oboeII
470 This concept may seem contorted, but it allows you to set the separate
471 oboe parts without changing the C<oboeI> and C<oboeII> (assuming that
472 you edit the [] in the example.)
476 < { .... } {......} >
478 makes a chord (all horizontal parts are in the same voicegroup). The construct
480 < \multivoice { ....} { .... } >
482 creates horizontal parts which behave independently. You will have to
483 set voicegroup features by hand (\stem and \hshift. See examples)
490 Rhythms in Mudela are entered identical to Simple mudela.
491 The melodic part of the information is ignored.
495 A duration always starts with the duration type (1,2,4 etc), and then
496 any optional multipliers/dots
498 =head2 Meters/groupings
500 A meter has this form:
504 Rhythmic grouping is a concept closely associated with this. For
505 example, in a 5/8 meter, the counts are grouped 2+3. In mudela this is
510 You can start the piece with a partial measure, the command takes the
511 same syntax as grouping:
515 Make the piece start with a partial measure [transl?] lasting 1 3/4
518 These commands are also "voice elements", and constitute simple mudela
519 (consisting of stuff with duration 0).
523 In concrete, a piece of Mudela has the following structure:
525 % declare pieces of music:
526 melody = \music{ <simple mudela> }
527 accompany = \music{ <simple mudela> }
529 % instantiate (=create tex, midi output) the score:
531 \staff{ melodicregs melody }
532 \staff{ melodicregs accompany }
533 \midi{ <midi definitions> }
534 \paper{ <paper and layout definitions> }
539 Examples are included with the GNU LilyPond distribution. For the sake of
540 maintenance no long examples are included in this document.
544 The staff is a simple container (containing Voices). The so-called
545 "registers" determine the characteristics of the Staff. At this time,
546 LilyPond supports the following personalities:
552 This makes the staff into a single five line melodic staff.
556 This makes the staff into a staff which will only set Lyric_requests.
564 This language has a number of roots. First and foremost, GNU LilyPond's
565 predecessor mpp was the inspiration of simple Mudela. Secondly, the
566 hierarchical structure looks a lot like Rayce's (Rayce is a raytracer
567 that I've written as a hobby project. ), which in turn owes a lot to
570 Now, we know, musictypesetting and raytracing do not necessarily
571 require the same input format, and we know that a lot more ways exist
572 to convert music to ASCII, but we did give this language some
573 thoughts. As always suggestions are appreciated.