3 Mudela - LilyPond input format 0.1
7 This document describes the the LilyPond input format, which is an
8 effective language for definining music. We call this language
9 (rather arrogantly) The Musical Definition Language (S<Mudela 2>).
11 The first aim of Mudela is to define a piece of music,
12 being complete from both from a musical typesetting,
13 as from a musical performing point of view.
15 The design of Mudela has been (perfect past tense, hopefully)
17 the most important criteria being:
23 define the (musical) message of the composer as unambiguously as possible,
27 be intuitive, and easily readable
28 (compared to, say, Musi*TeX input, or MIDI :-),
32 be writable in ASCII with a simple texteditor, yfte(TM).
36 Other considerations were (and will be):
42 be able to edit the layout
43 without danger of changing the original music (Urtext),
47 allow for adding different interpretations, again,
48 without danger of changing the original,
52 easy to create a conductor's score,
53 as well as the scores for all individual instruments,
57 provide simple musical manipulations, such as
58 S<(i) extracting> a slice of music from a previously defined piece,
59 S<(ii) extracting> only the rhythm from a piece of music,
60 S<(iii) transposing>, etc.,
64 easy to comprehend to both programmers and others.
68 Musical pieces could be
74 Mahlerian orchestral scores,
78 piano pieces (Schubertian, Rachmaninovian),
82 pop songs (lyrics and chords),
90 Bach multivoice organ pieces,
94 short excerpts to be used in musicological publications.
101 The Musical Definition Language (Mudela) S<version 2>,
102 has a logical structure,
103 making use of typing and naming (using identifiers),
104 that allows for flexible input, and definition reuse.
106 The below included for explanatory
107 purposes only (i.e., for a complete and up-to-date definition, see
108 F<lily/parser.y> and F<lily/lexer.l>):
112 The de-facto extension of Mudela is F<.ly>. Files may be included by
113 entering C<include> at the start of a line:
119 Line comments are introduced by a C<%>
123 Keywords are preceded by a backslash "\". They contain alphabetic
126 Identifiers in their normal form consist start with a alpha character,
127 followed by alpha-numerics. Identifiers can contain any characters
128 (except whitespace, C<$> and C<%>), if you use this construct:
130 $Id_with###@weird92chars =
132 =head2 Nesting characters
134 Mudela uses the brace (C<{> and C<}>) for hierarchical structures. To
135 aid the eye in reading, for chords the C<<> and the C<>> are used as
140 =head2 Hierarchical structures
142 The general structure consists of declarations:
150 \TYPE{ <type specific data> }
152 (Currently, C<\score> is the only type that can be instantiated
153 at top level. Currently declarations can only be done at top level)
155 Most instantiations that use an IDENTIFIER are specified as follows:
157 \TYPE { IDENTIFIER [...] }
159 Some exceptions on this rule have been made to prevent inputting
160 Mudela becoming tedious
165 The actual musical part of Mudela that defines a melody, is known as
168 Simple mudela is the most common type of music. It consists of a list
169 of notes or lyrics, chords, and commands.
173 To simplify different aspects of music definition (entering the notes
174 and manipulating them) Mudela has a number of different input "modes":
180 At the start of parsing, Mudela assumes normal mode.
181 In Normal mode, a word is looked up in the following order:
183 word identifier, string
184 \word keyword, string
186 In normalmode, a word is assumed to start with an alphabetic
187 character, followed by alpha-numeric characters.
191 Note mode (and thus Simple mudela) is introduced by the keyword C<\music>.
192 In Note mode, a word is looked up in the following order:
194 word identifier, string
195 \word keyword, string
197 In Note mode a word is considered to have alphabetic characters only.
201 Lyrics mode (and thus Simple mudela) is introduced by the keyword C<\lyrics>.
203 In Lyrics mode, a word is looked up in the following order:
206 \word keyword, string
208 In Lyric mode every sequence of non-digit and non-white characters
209 starting with an alphabetic character is considered a word.
211 a&@&@&TSI|{[ % a word
212 1THtrhortho % not a "word"
213 Leise Fl\"u\ss{}teren meine Sapfe % 4 words
218 These modes are of a lexical nature. Normal and Note mode largely
219 resemble each other, save the possibility of entering Reals, and
224 Simple mudela basically is a sequence of the notes you want to
229 is a A-1 pitched quaver. The ' as well as the ' signify an octave change.
230 A-1 is 440 Hz concert-pitch. C<c'> is also known as the central
242 This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3>
243 signifies that this note is part of a triplet (3 in stead of 2). The
244 duration is one and a half quaver (C<4.>) times 2/3.
246 The default language for notenames is defined to be dutch,
249 cisis disis eisis fisis gisis aisis bisis
251 cis dis eis fis gis ais bis
255 ces des es fes ges as bes
257 ceses deses eses feses geses ases beses
259 The standard notenames also have uppercase versions, which octavate
262 a % 220 concert-pitch
272 These notenames along with duration are enough material to construct
278 Music is able to express more. generally speaking, the other
279 'features' are either connected between notes (slurs, beams: spanning
280 requests) or attached to notes (eg. accents). The former are
281 implemented as START and STOP stop features and then attached to the note.
291 Please note that these two characters do I<not> necessarrily nest, eg:
296 Symbols which can be put at either side of a staff are entered as follows:
298 a-^ % marcato, direction: default
299 a^- % portato, direction: above note
300 a_. % staccato, direction: below note
301 a^\script { "symbolindex" . . . } % see script.ini for details.
303 Dynamics can be put after the notename:
305 a4 \dynamic { 0 } % 0 = fff, 7 = ppp
307 Mudela defines the following dynamic identifiers:
309 ppp pp p mp mf df ff fff % df iso f, f is a notename.
311 The general form of a note is:
313 post-requests de-octavate notename octavate duration pre-requests
315 Notenames are just identifiers, and can be declared for any
316 language appropriate (see F<dutch.ini>).
320 If omit the duration of a, a default value is substituted. For this
321 default value, there are two modes:
327 Use the last duration explicitly entered
331 Use the explicitly set "default duration"
335 Thus the following inputs are equivalent
337 c4 c4 c16 c16 c16 s16 c4 c16
340 c4 c c16 c c c c4 c16
343 c c c16 c16 c16 c16 c c16
348 If you are typing music which does not lie in the "small" and "large"
349 octave, you can prevent having to type C<'> all the time by using the
350 C<\octave> command: These two notes have the same pitch.
354 By default the setting of C<\octave> is 0.
358 Lyrics in Mudela resemble Simple mudela a lot, with notes substituted
361 All syllables are entered separately, separated by whitespace
363 Twin-4 kle4 twin-4 kle4 ...
365 Two syllables or words that compose a single
366 duration entry are bound together using an underscore
370 =head2 Music direction
372 Mudela reads left to right, but LilyPond can stack voices and
373 Voice_elements which are produced in two directions: horizontal
374 (voice like) and vertical (chord like)
376 You can start horizontal music by enclosing a sequence of notes with { and }
378 { c c g g a a g2 } % twinkle twinkle
380 You can start vertical music (a "chord") by enclosing a sequence of
381 notes with < and >. Example:
383 <a cis e'> % a-major chord
385 You can also put vertical music inside horizontal music:
387 { c < c e > <c e g> <c e g c'> } % 4 increasing chords
393 {r2 r2 c c g g a a g2} > % a canon
395 The duration of a chord equals the union of the durations of each of
396 its elements. The C<\multivoice> is a construct which is explained
401 Rhythms in Mudela are entered identical to Simple mudela.
402 The melodic part of the information is ignored.
406 In concrete, a piece of Mudela has the following structure:
408 % declare pieces of music:
409 melody = \music{ <simple mudela> }
410 accompany = \music{ <simple mudela> }
412 % instantiate (=create tex, midi output) the score:
416 \commands{ <score global commands> }
417 \midi{ <midi definitions> }
418 \paper{ <paper and layout definitions }
423 Examples are included with the LilyPond distribution. For the sake of
424 maintenance no long examples are included in this document.
437 LilyPond first reads F<symbol.ini>, which contains declarations crucial
438 to proper operation of LilyPond (symbol tables, note names).
443 This language has a number of roots. First and foremost, LilyPond's
444 predecessor mpp was the inspiration of simple Mudela. Secondly, the
445 hierarchical structure looks a lot like Rayce's (Rayce is a raytracer
446 that I've written as a hobby project. ), which in turn owes a lot to
449 Now, we know, musictypesetting and raytracing do not necessarily
450 require the same input format, and we know that a lot more ways exist
451 to convert music to ASCII, but we did give this language some
452 thoughts. As always suggestions are appreciated.