1 mailto(gnu-music-discuss@gnu.org)
4 redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))\
7 COMMENT( This document contains Mudela fragments. You need at least
8 Yodl-1.30.18 to convert this to tex or html.
12 pipethrough(date) sucks.
14 paragraphs have too much space.
19 Mainly written by Han-Wen Nienhuys,
21 with help of (among others)
33 htmlbodyopt(bgcolor)(white)
34 htmlcommand(<font color=black>)
38 \textheight 53\baselineskip
39 \advance\textheight by \topskip
40 \marginparwidth 1 in % Width of marginal notes.
41 \oddsidemargin 0.25 in % Note that \oddsidemargin = \evensidemargin
42 \evensidemargin 0.25 in
43 \marginparwidth 0.75 in
44 \textwidth 5.875 in % Width of text line.
48 whenlatex(notableofcontents())
49 whentexinfo(notableofcontents())
51 article(Mudela -- Using LilyPond to typeset music)
52 (Han-Wen Nienhuys and Jan Nieuwenhuizen)
53 (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
56 latexcommand(\def\interexample{})
57 latexcommand(\def\preexample{\par})
58 latexcommand(\def\postexample{\par\medskip})
59 latexcommand(\def\file#1{{code(#1)}})
62 includefile(html-disclaimer.yo-urg)
67 label(tutorial:introduction)
68 latexcommand(\parindent2pc)
70 LilyPond is a program that can print music from a specification that
71 you, the user, supply. Using LilyPond may be a bit quaint in the
72 beginning, because you have to give that specification using a
73 em(language). This document is a gentle introduction to that
74 language, which is called Mudela, an abbreviation for Music Definition
77 We will demonstrate the working of Mudela by presenting examples of
78 input alongside with the resulting output. We will comment on these
79 examples using English terms for notation, so if you are not familiar
80 with these terms, you should consult the glossary that is distributed
81 with LilyPond: it contains a list of musical terms along with
82 explanations and translations in some other languages.
87 To demonstrate what LilyPond input looks like, we start off with a
88 full fledged, yet simple, example. It is a convoluted version
89 of one of the menuets in bind(J.)bind(S.)Bach's em(Clavierbuchlein).
92 % lines preceded by a percent are comments.
101 d4 g,8 a b c d4 g, g |
102 e'4 c8 d e fis g4 g, g |
103 c4 d8( )c b a( )b4 c8 b a g |
109 g4 e8 fis g d cis4 b8 cis a4 |
110 a8-. b-. cis-. d-. e-. fis-.
117 linewidth = 14.0 \cm; % standard settings are too wide for a book
121 Before we will discuss the contents of the above, it would be best if
122 you would try to enter and save this text with a text editor, compile
123 it with LilyPond and view the output. Details of this procedure may
124 vary from system to system. On a Unix system, you should enter the
125 input in a file ending in file(.ly), such as file(menuet.ly). To
126 create the output, one would issue code(ly2dvi menuet).
128 file(ly2dvi) is a little program that does the job of calling the
129 LilyPond and TeX() and adjusting page margins.
131 If all goes well, this will create the output file file(menuet.dvi).
132 To view this output, issue the command code(xdvi menuet). Now that we
133 are familiar with the procedure to view the output, we will analyse
134 the input itself, line by line.
136 verb(% lines preceded by a percent are comments.)COMMENT(
138 )The percent sign, `code(%)', introduces a line comment. If you want to
139 make larger comments, you can use block comments. These are delimited
140 by `code(%{)' and `code(%})'COMMENT(
142 )verb(\input "paper16.ly")COMMENT(
144 )By default, LilyPond will use definitions for a staff of 20
145 nop(point)footnote(A point is the standard measure of length for
146 printing. One point is 1/72.27 inch.)
148 high. If you want smaller output (e.g., 16 point), you have to import
149 the settings for that size. You can do this by including a file.
150 code(\include "file") is replaced by the contents of code(file).
151 LilyPond will inspect the standard search path to look for the requested
157 ) A mudela file combines music with directions for outputting that
158 music. The music is combined with the output directions by putting
159 them into a code(\score) block.
164 )This makes LilyPond ready for accepting notes.
169 ) As we will see, pitches are combinations of octave, note name and
170 chromatic alteration. In this scheme, the octave is indicated by
171 using raised quotes (`code(')') and ``lowered'' quotes (commas:
172 `code(,)'). The central C is denoted by code(c'). The C one octave
173 higher is code(c''). One and two octaves below central C is denoted
174 by code(c) and code(c,) respectively.
176 If you have to indicate the pitches in a long piece that is written in
177 either a high or very low octave, you would have to type very many
178 quotes. To remedy this, LilyPond has a so-called ``relative'' octave
179 entry mode. In this mode, notes without quotes are chosen in such an
180 octave that they are the closest to the preceding note. If you add a
181 high-quote an extra octave is added. The lowered quote will substract
182 an extra octave. Because the first note obviously has no predecessor,
183 you have to give the (absolute) pitch of the note to start with.
187 { % sequential music follows
190 ) The brace indicates that what follows is sequential music, i.e.,
191 notes that are to be played and printed after each other. This is in
192 contrast with simultaneous music: notes that are to be played like a
193 chord. You should be careful not to confuse this brace with the one
194 coming after code(\score).COMMENT(
197 \time 3/4; % set the time signature.
200 ) This command changes the time signature of the current piece: this
201 prints a 3/4 sign. The 3/4 value is also used to generate bar lines
207 ) This command changes the current key to G-major. Although
208 this command comes after the code(\time) command, in the
209 output, the key comes before the time signature: LilyPond knows about
210 music typesetting conventions.
215 ) This command tells LilyPond that the enclosed piece of music must
221 ) This is a code(d) note. The relative music was started with a
222 code(c''), the real pitch of this note is code(d''). The 4
223 designates the duration of the note (it is a quarter note). COMMENT(
229 )These are notes with pitch code(a') and code(b'). Because their
230 duration is the same as the code(g), there is no need to enter the
231 duration (It is not illegal to enter it anyway. You would then enter
232 code(a4 b4)) COMMENT(
238 ) Three more notes: The code(|) is a ``barcheck''. When processing the
239 music, LilyPond will check that barchecks are found at the start of
240 a measure. This can help you track down notes you forgot to enter.
245 ) So far, no notes were chromatically altered. Here is the first one
246 that is: code(fis). Mudela by default uses Dutch note names, and
247 ``Fis'' is the Dutch note name for ``F sharp''. However, there is no
248 sharp sign in the output. The program keeps track of key signatures,
249 and will only print accidentals if they are needed.
251 c4 d8( )c b a( )b4 c8 b a g |
254 ) The next line shows how to make a slur:
255 the beginning and ending note of the slur is marked with an opening and
256 closing parenthesis respectively. In the line shown above this is
257 done for two slurs. Note that parentheses (slur markers) are between
258 the notes. COMMENT(As you can see, parentheses do not have to nest.)
263 ) A duration that is to be augmented with a duration dot, is notated
264 with a duration number followed by periods, as many as you want
270 ) The end of the repeated music. LilyPond will typset a repeat bar.
275 ) This line shows that Lily will print an accidental if that is
276 needed: the first C sharp will be printed with an accidental, the
277 second one without. COMMENT(
279 )verb( a8-. b-. cis-. d-. e-. fis-. )COMMENT(
281 )There is more to music than pitches and rhythms. An important aspect
282 is articulation. You can enter articulation signs either in a verbose
283 in abbreviated for. Here we demonstrate the abbreviated form: it is
284 formed by a dash and the the character for the articulation to use,
285 e.g. code(-.) for staccato as shown above. COMMENT(
292 Rests are denoted by the special notename code(r). You can also make
293 an invisible rest by using the special notename code(s).
298 ) All articulations have a verbose form, like code(\fermata). The
299 ``command'' COMMENT(Hi Adrian :-) code(\fermata) is not part of the
300 core of the language (most of the other discussed elements are), but
301 it is an abbreviation of a more complicated description of a fermata.
302 code(\fermata) names that description and is therefore called an
310 This ends the sequential music.
315 This specifies a conversion from music to notation output. Most of
316 the details of this conversions (font sizes, dimensions, etc.) have
317 been taken care of, but to fit the output in this document, it has
318 to be smaller. We do this by setting the line width to 10 centimeters
319 (approximately 4 inches).
326 )The last brace ends the code(\score) block.
328 There are a couple of things to note here. The input format tries to
329 capture the meaning of em(music), and not notation. Therefore the
330 format contains musical concepts like pitches and durations, instead
331 of symbols and positions. Second, the format tries to be
332 em(context-free): a note will sound the same regardless of the current
333 time signature, the key nop(etc.)
335 The purpose of LilyPond informally is explained by the term `music
336 typesetter'. As you may have figured out by now, this is not a really
337 adequate name: not only does the program print musical symbols, it
338 also tries to make esthetic decisions, and it also em(generates) both
339 the symbols and the decisions from a high-level musical description.
340 In other words, the function of LilyPond would be best described by
341 `music compiler' or `music to notation compiler'.
343 As you can see, the most interesting part of the input is music
344 itself, in this case the sequence of notes. We will therefore focus
345 on entering music for now. Consequently, when we mean
351 ) we will leave out the the repetitive details for now and only print
356 sect(When you know the notes to nop(print)ellipsis())
358 The basic building block of music is the note. We lightly touched
359 notes in the previous example. Here comes the full explanation A note
360 is made of a pitch and a duration. The pitch of the central C is
361 written as code(c'). This is in line with musicological notation;
362 there this pitch is transcribed as nop(c)sups(1) or c'. A
363 quarter-note duration is written as code(4). So, to print a quarter
364 note whose pitch is central C, you enter the following code(c'4).
368 The duration of a note is specified as a number: a whole note is
369 denoted by 1, a half note by 2, a quarter by 4, and so on. If you
370 want to augment a duration with a dot, simply affix a period to the
371 number. You can also print notes longer than a whole. You do this by
372 using identifiers (code(\breve) and code(\longa)):
373 Here are some random notes to show how it works.
377 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16
384 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16
388 \translator { \type "Score_engraver";
390 \consists "Note_heads_engraver";
391 \consists "Stem_engraver";
392 \consists "Rhythmic_column_engraver";
397 subsect(Basic pitches)
399 The pitch code(c') consists of two parts: one part for the note name,
400 and one for the octave. The letter specifies which note name to use:
401 note names simply are the letters code(a) to code(g). The number of
402 apostrophes specifies the octave to use: the central C is denoted by
403 code(c').footnote(By convention, the A above central C at concert
404 pitch is the tone that is used to tune instruments. Its frequency is
405 about 440 Hz.) The C which is an eighth higher (the C in the
406 ``two-line octave'') is denoted by code(c''): every octave adds a
407 quote. A note name without quotes designates the pitch below code(c')
408 (the C in the ``small octave''). If you want to go down even further,
409 commas (sunken apostrophes) should be added, e.g., the C in the
410 ``contra octave'' is expressed as code(c,,).
412 This example demonstrates pitches
413 mudela(fragment,verbatim,center)(
414 c,,4 c, c c' c'' c''' d'4 e'4 f'4 g'4
420 We have so far ignored chromatically altered pitches. The names `a'
421 to `g' for entering pitches are convenient: they are short,
422 pronounceable and they resemble the words for pitches in normal
425 Enter flats and sharps. In English there is no standard terse word
426 for C sharp or C flat. For this reason, mudela uses a different,
427 non-English convention for entering altered pitches: a note is made
428 sharp by adding the suffix `--is' to its name, and flat by adding the
429 suffix `--es'. For a double sharp another `--is' suffix is added, for
430 flats another `--es' nop(suffix.) footnote(Variations on this
431 convention are used in a number of germanic languages, notably Dutch,
432 German, Swedish, and Norwegian.) The names for the alterations of C
433 are given in bind(Table)ref(notename-tab).
435 latexcommand(\begin{table}[h])
438 row(cell(English)cell(LilyPond))
440 row(cell(c double flat)cell(ceses))
441 row(cell(c flat)cell(ces))
442 row(cell(c natural)cell(c))
443 row(cell(c sharp)cell(cis))
444 row(cell(c double sharp)cell(cisis))
447 latexcommand(\caption{Default note names})
449 latexcommand(\end{table})
451 Throughout this document we will continue to use these names.footnote(
452 Mudela defaults to Dutch notenames. To make (Dutch) pronunciation
453 easier, the a-flat and e-flat are contracted to code(as) and
454 code(es). Similarly, the a double flat and e double flat are
455 contracted to code(ases) and code(eses). For consistency, the dutch
456 names also include code(aes), code(aeses), code(ees) and
459 If you are not comfortable with these names, you can make your own.
460 Note names for different languages are included with the example
461 initialisation files, amongst others English (C sharp is abbreviated
462 to code(cs)), Italian, Swedish and Norwegian. If you want to use
463 these names, issue code(\include "LANGUAGE.ly") where you could
464 substitute code(italiano), code(deutsch) etc. for LANGUAGE. You
465 should include these files at toplevel, i.e., before opening a
471 The previous examples all notes that were to be played sequentially, one
472 note following the other. You can also use LilyPond to typeset
473 chords. You do this by expressing in mudela simultaneous music,
474 i.e., notes that are to be played concurrently.
476 subsect(Where the chords have no names)
477 In Mudela you can form simultaneous music by enclosing notes in
478 pointed parentheses, bind(i.e.)bind(langle())bind(and)rangle(). ASCII
479 doesn't really have these delimiters, so Mudela uses the larger-than
480 (code(>)) and smaller-than (code(<)) signs instead. For example, a
481 D-major chord is expressed as
482 mudela(fragment,verbatim,center)(
486 Chords can be entered in the music in the same places that notes
487 can. As an example we give a snippet of ``Twinkle Twinkle Little
488 Star'' in chords. The chords may seem slightly unconventional, but
489 they only serve to show how chords work. We've aligned the chords in
490 the input on their starting beat to help you reading it. This
491 layout does not influence the typesetting result in any way.
493 mudela(verbatim, fragment)(
497 <c e a> <b d a'> <b2 d g>
498 <a4 d f> <bes d f> <bes c e> <g c e>
499 <e a d> <a, g' cis'> <d2 f d'>
503 There is one thing to note, in sequences of chords, the (relative)
504 pitch of a is taken with reference to the first note of the previous
507 You can nest simultaneous and sequential music in any way you want,
510 )mudela(verbatim,fragment,center)(
512 { c'8 <c' e'> c' <c' e'> } >
516 As you can see, LilyPond has difficulty typesetting this
517 elegantly. To adequately solve this, you have to persuade LilyPond to
518 make separate stems for both sequential music lists. This is a topic
519 that is covered in bind(Section)ref(sec:polyphonic).
521 [Chords and relative mode]
523 subsect(Chords with names)
525 In the previous section we have been talking more about `stacked notes'
526 rather than `chords'.
527 If you need to enter a lot of chords that have proper names, you can use
528 the code(\chords) mode as an alternative:
530 )mudela(verbatim,fragment,center)(
531 \chords\transpose c''{ c1 d e }
534 \chords\relative c''{ c1 d e }
537 subsect(Names with chords)
539 A more common problem is the typesetting of chord names. LilyPond has
540 a special kind of staff for this, the code(ChordNames) staff.
541 The code(ChordNames) staff accepts music like a normal staff,
542 but typesets only the name of each chord:
545 )mudela(verbatim,center)(
547 \context ChordNames {
549 { c1 d-min e-maj5+.9 }
557 ) Because the ChordNames staff accepts normal music, it can be transposed,
558 and you may enter it any way you like, either as chords or as notes.
560 sect(Adding nuances: articulation and dynamics)
562 Music can have articulation, dynamics (louder and softer), etc. These
563 aspecs have notation, so LilyPond can print those. We'll start out by
564 explaining how to obtain the smallest grains of nuance: the
565 articulation of a single note. Articulation is entered by writing a
566 dash and the name of the desired articulation mark. You have to add a
567 backslash in front of the name to distinguish it from the name of a
570 )mudela(fragment,verbatim)(
572 c''4-\tenuto )COMMENT(
574 ) Typing a lot of staccato notes in this syntax will get tedious very
575 quickly. Therefore, Mudela has handy abbreviations for
576 articulation marks such as staccato and tenuto. They are shown in the
577 following example: COMMENT(
581 \property Score.textstyle = typewriter
582 \context Staff \notes {
590 \context Lyrics\lyrics {
591 "."4 "-" "+" "|" ">" "\^{ }" }
593 \paper { linewidth = -1.\cm; }
596 )Text and digits for fingering can be entered in the same manner: add a
597 dash and the text or digit to be printed:
600 )mudela(fragment,verbatim)(c''4-1 g''4-5 c''-"Sul tasto" )
601 COMMENT(Currently, the meaning of the
602 syntax `note-dash-digit/articulation/text' is ``add a superscript to this
603 note.'' This is not in line with our goal to em (define) music with
604 Mudela. We hope that this will be fixed in a future version of the
605 language. In the meantime you can abuse this: the super- and
606 subscripts can be forced into up or down position respectively by entering an
607 a caret (code(^)) or an underscore, code (_) instead of the dash:
608 mudela (fragment,verbatim,center) (
609 c'4-^ c'4^^ c'''4-^ c'''4_^
612 Dynamic markings are another way to add a nuance to a note. They are
613 entered by adding the name for the dynamic sign after the note. You
614 should not enter a dash between the name and the note.footnote(This
615 is inconsistent. We hope that this will be fixed in a later
616 version of the language.)COMMENT(
618 )mudela(verbatim,fragment)(
619 c4 \ff c4 \fp c4 c4 \ppp c4 c4 \sfz
625 sect(Bridging the notes: beams, slurs and ties)
627 Music typesetting does not use fixed symbols only. A lot of symbols
628 are variable: they run from one note to another. In LilyPond
629 terminology, such a symbol is called a em(spanner). To print a
630 spanner, you have to attach a marker to the note that begins it and to
631 the one that ends it. These are the spanners that are entered like
636 The slur has the opening parenthesis as
637 start marker is. The stopping marker is the closing parenthesis.
639 mudela(fragment,center,verbatim)( c'4( )c'4 )
641 The slur is flexible: you can nest nop(slurs,)footnote(This is
642 inconsistent when compared to the syntax for articulation hints. This
643 will be fixed some time, we hope.) and you can connect a note with a
644 slur on both the left and the right side:
646 mudela(fragment,verbatim,center)(
647 c'4(( )c''4 )c'4( )g'4
652 The starting marker for the beam is the opening bracket, the ending
653 marker is the closing bracket. The brackets have to be em(around) the
654 beamed notes. footnote(Strictly speaking, a beam is not a musical
655 concept: beaming doesn't change the meaning of music, it only
656 clarifies the rhythmic structure. One might argue that beams should
657 not be present in a music representation language. Unfortunately,
658 LilyPond is not smart enough to insert beams into music on its own.
660 LilyPond does have code that guesses what the pattern should look
661 like, so that you don't have to specify the beaming for complicated
662 patterns. Alas, the algorithm used is not foolproof
663 yet: code([c8. c32 c32]) will produce incorrect results.)
665 mudela(fragment,verbatim)(
666 [c'8 c'] [c'16 c' c' c'] [c'16. c'32 c' c'16.]
669 The brackets themselves have no duration, so they are grammatically
670 equivalent to the barcheck.
672 dit(Tie) LilyPond's tie is entered as a tilde, `code(~)', in analogy
673 with TeX()'s tie (which ties together words with a space), The tie is
674 similar to the slur: it looks like a slur, but a slur connects whole
675 chords, whereas the tie connects note heads.
677 The following example demonstrates the use of ties:
678 mudela(fragment,verbatim,center)(
680 <c'2. g' es''> ~ <c'4 g' es''>
683 Since the tie is thought to be inbetween the notes, it has no
684 duration, and is grammatically equivalent to the barcheck.
687 Crescendi and decrescendi can be printed in hairpin style. The
688 starting marker for the crescendo is code(\<), and for the decrescendo
689 code(\>). Both have code(\!) as the ending marker.
690 mudela(fragment, verbatim)(
691 \relative c'' { c4 \< \! c4 \> \! c2
693 { s4 \< \! s4 \> \! s2 } > }
695 This example shows a trick: by attaching the markings to space rests
696 that run parallel to the whole note, you can have dynamic markings
701 It is your job to make sure that each spanner that you start, also
702 ends. If it doesn't, then Bad Things are likely to happen. If you end
703 spanners that are not started, LilyPond will warn you about illegal
709 Music notation constructs with no duration, like clefs and key
710 signatures, can be entered by inserting various
711 commands between the music. The general form of these commands is
714 )center(code(\keyword argument argument ... ;))COMMENT(
716 )These are the commands that are currently supported in alfabetic order:
718 dit(code(\bar) var(bartype))
719 This command makes LilyPond print special bar
720 lines and repeat symbols. You can also use it to allow line breaks
721 when entering cadenzas. The argument var(bartype) is a string that
722 describes what kind of bar line to print.
725 )mudela(fragment,verbatim)(
726 \bar "|:"; c'4 \bar ":|:"; c'4 \bar ":|"; c'4 \bar "||";
727 c'4 \bar "empty"; c'4 \bar "|.";
730 )The command `code(\bar "empty")' does not create any visible bar
731 line, but it tells LilyPond to allow a linebreak at that position.
732 The `code(\bar)' command prints the specified symbol where you enter
733 it. If you give a `code(\bar)' command at the end of a measure then
734 the specified symbol replaces the automatic bar line.
736 The code(\bar) command does not affect metric structure.
738 dit(code(\cadenza) var(togglevalue)) This command toggles the
739 automatic printing of barlines. `code(\cadenza 1)' turns off the
740 automatically generated bar lines. They are switched on again with
741 `code(\cadenza 0)'. Then a bar line is printed, and LilyPond will act
742 as if you are again at the start of a measure.
745 This is useful when typesetting music without a meter (such as an ad
748 dit(code(\clef) var(clefname)) This command sets the current clef for notation,
749 i.e., a clef symbol is printed and the notes following this command
750 are shifted vertically. The argument is a string, the name of the
751 new clef. The default clef is the treble clef.
752 mudela(fragment,verbatim)(
758 dit(code(\key) var(pitch) var(type)) This command changes the current
759 key signature. The key signature is printed at the start of every
760 line. The var(type) argument is an integer. Useful values are
761 available as the predefined identifiers code(\major) and
762 code(\minor). Omitting the second argument gives major keys. The
763 key of C-minor can thus be specified as `code(\key es)' or
764 `code(\key c \minor)'.
766 dit(code(\keysignature) var(pitchlist))
768 This command changes the current key signature. Unlike the
769 `code(\key)' command, this command can produce arbitrary key
770 signatures, which can be useful for unconventional keys or modes. The
771 key signature is given in the form of a list of notes. The notes will
772 be printed in the key signature in the order that they appear on the
773 list. For example, the key of C-minor can be specified as
774 `code(\keysignature bes es as)'. The command `code(\keysignature fis
775 es bis)' provides a more exotic example.
778 dit(code(\time) var(numerator)code(/)var(denominator))
779 This command changes the current time signature.
780 The default value for this time signature is common time (4/4).
782 dit(code(\partial) var(duration))
783 This command allows you to make
784 upsteps at the start of a piece.
785 The var(duration) argument has the same form as the duration of a
788 The `code(\partial)' command cannot be used to generate partial
789 measures in the middle of the music.
791 mudela(fragment,verbatim)(
794 [d'8 dis'] e' c''4 e'8 c''4
798 The commands described above do not give music that you could hear,
799 but within the language, they are "Music": they are grammatically
800 equivalent to notes, so they can appear in the same places as notes.
802 sect(Notation context)
804 In bind(Section)ref(tutorial:more-staffs) it was explained that there
805 are more ways to notate a simple chord: as a single voice on a single
806 staff or in multiple staffs (and we'll soon see, that you can typeset
807 it as multiple voices on a staff). Obviously the concept of staff is
808 not really something musical. But what is it then?
810 The most simplistic explanation is: a staff is a graphic peculiarity
811 of the notation system. In other words, a staff is a picture of five
812 lines on which one can print note heads. We will call this view on
813 the concept of staff `staff symbol' from now on.
816 there is more to a staff than the symbol. A staff
817 contains---besides a staff symbol--- more components:
821 it()A staff can have a key signature (printed at the left)
822 it()A staff can have a time signature (printed at the left)
823 it()A staff has bar lines
824 it()A staff has a clef (printed at the left)
828 To explain what a staff really is, we'll try to print music without
829 these components. Without those, it is still
830 possible to print music:
832 \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 }
837 \remove "Time_signature_engraver";
838 \remove "Bar_engraver";
839 \remove "Staff_symbol_engraver";
840 \remove "Clef_engraver";
841 \remove "Key_engraver";
846 ) As you can see, you can still make out the general form of the
847 melody and the rhythm that is to be played, but the notation is
848 difficult to read. Moreover, the musical information is not complete.
849 The stress pattern in the notes can't be deduced from this output.
850 For this, we need a time signature:
854 \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 }
859 \remove "Bar_engraver";
860 \remove "Staff_symbol_engraver";
861 \remove "Clef_engraver";
862 \remove "Key_engraver";
866 )Technically speaking you can find out where the strong and weak beats are, but
867 it is difficult to find them quickly. Bar lines help you in finding
868 the location of the notes within the measure:
871 \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 }
876 \remove "Staff_symbol_engraver";
877 \remove "Clef_engraver";
878 \remove "Key_engraver";}
883 We can remedy part of the difficulties with reading pitches by adding a staff
887 \notes\relative c' { \time 2/4; g'4 c,4
888 a'4 f4 e c d2 } \paper {
893 \remove "Clef_engraver";
894 \remove "Key_engraver";
900 This makes the output decidedly easier to read, but you still don't
901 know what the pitches of the notes above are. So this is still not
902 enough. But suppose you see the following notation:
904 \notes \relative c' {\clef alto; \time 2/4; g'4 c,4 a'4 f4 e c d2 }
910 ) Now you know the pitch of the notes: you look at the start of the line
911 and see a clef, and with this clef, you can determine the notated pitches.
912 You have found the em(context) in which the notation is to be
915 So the context determines the relationship between a piece of music
916 and its notation: you, the reader, use context to deduce music from
917 notation. Because LilyPond writes notation, context works the
918 other way around for LilyPond: with context a piece of music can be
919 converted to notation.
921 We see that a staff forms context, and that context is needed to
922 convert between notation and music. In LilyPond we turn around this
923 reasoning: LilyPond has a notion of notation context, and the staff is
924 an example of a notation context. In fact, the arguments of the
925 code(\context) command (Staff, GrandStaff) were all names of different
926 contexts. A notation context is a conversion between music and
929 We make one final observation before listing the standard notation
930 contexts: a score can contain many staffs and a staff can contain many
931 voices. This suggests that notation contexts are objects that can
932 contain other notation contexts.
935 is a list in alfabetic order of the contexts that are supported by
936 LilyPond. Each notation context is characterised by its name, the
937 notation elements it creates, and the contexts that it can contain.
941 dit(GrandStaff) A code(GrandStaff) context contains code(Staff)
942 contexts, and it adds a brace to the output at the
943 nop(left.)footnote(The GrandStaff is limited, LilyPond can not do
944 cross staff beaming and slurring.)
946 A code(GrandStaff) context can contain code(Staff)s. Typically, it
947 will contain two code(Staff)s, one treble staff, and one bass
948 staff. The bar lines of the contained staffs are connected
951 dit(Lyrics) As its name suggests, The code(Lyrics) context deals with
952 typesetting lyrics. This topic will be covered in
953 bind(Section)ref(tutorial:lyrics).
955 dit(Score) The code(Score) context is the toplevel context: no context
956 can contain a code(Score) context. The code(Score) context handles
957 the administration of time signatures. It also makes sure that
958 items such as clefs, time signatures, and key-signatures are aligned
959 in columns across staffs.
961 The code(Score) can contain code(Staff), code(StaffGroup),
962 code(Lyrics), code(GrandStaff) and code(RhythmicStaff) contexts.
964 dit(RhythmicStaff) The code(RhythmicStaff) context is like the staff,
965 but much simpler: the notes are printed on one line, and pitches are
966 ignored. code(RhythmicStaff) can contain code(Voice)
970 dit(Staff) The code(Staff) context handles clefs, bar lines, keys,
971 accidentals. A code(Staff) context can contain code(Voice)
974 dit(StaffGroup) A code(StaffGroup) context contains
975 code(Staff) or code(Lyrics) contexts, and prints a bracket at the
976 left. The bar lines in the participating staffs are connected.
979 dit(Voice) The code(Voice) context is a context that corresponds to a
980 voice on a staff. This context handles the conversion of noteheads,
981 dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests
983 COMMENT(do ChoireStaff)
987 If you are familiar with structured documents, you might see the
988 analogy of a context with a stylesheet: a stylesheet is neither
989 presentation nor information, but rather a recipe em(how) a specific
990 piece of information should be presented. The big difference with
991 stylesheets is that in music notation the elements provided by context
992 are essential to understanding what is notated.
994 The notions of ``current clef'' and ``current position within the
995 measure'' are all properties of notation contexts. Commands like
996 code(\clef) and code(\cadenza) change these properties, and this
997 explains why they are fundamentally different from musical expressions
998 like notes and rests.
1000 A notation context is not a primitive element of LilyPond: in
1001 bind(Section)ref(tutorial:engravers) it will be explained how you can
1002 form your own notation contexts.
1004 sect(Nested music: multiple staffs)
1005 label(tutorial:more-staffs)
1007 Now we explain how to typeset music that runs in multiple staffs.
1008 Consider the following---unrealistic---example:
1011 \context GrandStaff <e'4 {\clef bass; g4^""} >
1014 In this example the music consists of two notes. The above would
1015 sound the same if it were written as a single chord on a single staff,
1022 ) The Mudela construct for multiple staffs reflects the similarity
1023 between the two examples: to get multiple staffs in Mudela you enter a
1024 chord, with an additional instruction to tell LilyPond that the chord
1025 does not represent notes stacked together, but staffs stacked
1028 If a piece of music is to be interpreted as a staff, then this can be
1029 expressed with the code(\context) construct. The following input says
1030 ``the quarter note with pitch e should be put on a staff.''
1036 ) The same can be done for the other note, i.e.,
1042 ) If you want to stack these staffs, you must create a chord of both:
1045 < \context Staff e'4
1050 This looks reasonable, but the effect of this input is not what you
1053 < \context Staff e'4
1058 ) Since there are no names specified for the desired staffs, LilyPond
1059 thinks your wishes are fullfilled by putting the code(g) on the same
1060 staff as the code(e). The correct solution is to label both staffs
1061 with different names, for example code(trebleStaff) and
1062 code(bassStaff). This makes LilyPond distinguish between them, and
1065 mudela(verbatim,fragment)(
1066 < \context Staff = trebleStaff e'4
1067 \context Staff = bassStaff g4
1071 ) The names that you choose do not matter as long as they are
1072 different. This is almost right, except for the brace at the left and
1073 the clef of the second staff. If you want a brace, then you have to
1074 tell LilyPond that the chord you formed is to be interpreted as a
1075 so-called grand staff. This is also done with the code(\context)
1076 command. The bass clef is made with a clef command: COMMENT(
1078 ) mudela(verbatim,fragment)(
1079 \context GrandStaff <
1080 \context Staff = treblestaff e'4
1081 \context Staff = bassstaff { \clef "bass"; g4 }
1086 sect(Polyphonic music (or: Notation context properties))
1087 label(sec:polyphonic)
1089 In the section on notation contexts we explained that a notation
1090 context can have properties that influence the conversion from music
1091 to notation. A simple example of such a property is the clef: the
1092 type of a clef helps determines the vertical position of note heads in
1093 a staff. Some of these properties can be modified by commands such as
1094 code(\clef) and code(\time). But notation contexts can have other
1095 properties, that are settable in
1096 a generic fashion. We will demonstrate this feature by printing
1097 multiple voices on a staff.
1099 Printing more than one voice on a staff is like printing multiple
1100 staffs stacked together. This suggests that the template to follow is
1105 \context Voice = one ...
1106 \context Voice = two ...
1110 ) On the ellipsis there should be music going from left to right, in
1111 other words, notes enclosed in braces. Let us try the following counterpoint:COMMENT(
1113 )mudela(fragment,verbatim)(
1115 \context "Voice" = "one" { r4 as'4 () as'4 g'4 }
1116 \context "Voice" = "two" { g'2 f'4 e'4 }
1119 As you can see the result is not perfect. The notes on the last
1120 two beats look like plain chords and not like separate voices. What
1121 really happened was that the stems of the upper and lower voices were
1122 printed on top of each other.
1124 To remedy this, engravers traditionally make the stems of the lower
1125 voice point down, and the stems of the upper up, as shown in
1126 bind(Figure)ref(tutorial:multi-voice-fig).
1128 Surely the direction of a single stem is a property of the stem as a
1129 graphical object. But the fact that all of the stems in a voice point
1130 in the same direction is not directly graphical. Since this is a
1131 property shared by all the stems in the voice, this property is a
1132 property of the context code(Voice). The context code(Voice) has an
1133 attribute whose value is the direction to use for stems. You can
1134 change it to `up' by issuing the following phrase:
1136 \property "Voice"."verticalDirection" = "1"
1139 This command should be read as ``change the property called
1140 code(verticalDirection) within the current code(Voice) context to the value
1141 code(-1).'' For the property code(verticalDirection) the value code(1) means
1142 `up', and code(-1) means `down'. So, the
1143 proper way to code the polyphonic example is given in
1144 bind(Figure)ref(tutorial:multi-voice-fig).
1146 latexcommand(\begin{figure}[h])
1147 mudela(fragment,verbatim,center)(
1149 \context "Voice" = "one" {
1150 \property Voice.verticalDirection = "1"
1151 r4 as'4 () as'4 g'4 }
1152 \context "Voice" = "two" {
1153 \property Voice.verticalDirection = "-1"
1157 latexcommand(\caption{Multiple voices})
1158 label(tutorial:multi-voice-fig)
1159 latexcommand(\end{figure})
1161 As you can see, this property also controls the directions of slurs.
1163 Other properties can also be set, and they can be within different
1164 contexts. In general, you can set a property by specifying
1165 code(\property) var(contexttype)code(.)var(propertyname) code(=)
1166 var(value). Both var(contexttype), var(propertyname) and var(value)
1169 The effect of a property is pretty much hardwired into the
1170 implementation (and thus subject to change), so we will not deal with
1171 all the possible properties in detail. Among other characteristics
1172 that can be set are the layout of slurs and beams. The initialisation
1173 file file(property.ly) and the reference manual contain explanations
1177 label(tutorial:lyrics)
1179 Since a lyrics can have durations like notes, we consider them to
1180 be music too. Entering lyrics in mudela has two aspects. First, you
1181 have to enter the text, i.e., the syllables along with their
1182 durations. After this, you have to specify how to convert these to
1185 Lyrics consist of syllables, which are strings together with
1186 durations. For entering lyrics we have to instruct LilyPond that what
1187 we enter are not note names but strings. This instruction is the
1188 keyword code(\lyrics). After entering this keyword you can enter a
1189 musical construct---sequential music, simultaneous music, code(\context)
1190 entries, etc.--- but with syllables instead of pitches. For example:
1193 )verb(\lyrics { 'got8 me on my knees4, Le-8 lie! })COMMENT(
1195 ) Next comes the conversion to notation. LilyPond can't (yet) figure
1196 out that lyrics need different treatment than notes. As a result, the
1197 default conversion will try to put the text you entered as note heads
1198 onto a staff, and this will fail. This default must be overridden
1199 with a code(\context) keyword. Printing syllables of text in a line is
1200 done by a context called code(Lyrics). You can select this context
1201 with the code(\context) keyword. Here is a simple example with output:
1204 )mudela(fragment,verbatim)(
1205 \context Lyrics \lyrics { 'got8 me on my knees,4 Le-8 lie! })COMMENT(
1207 )The result is technically correct, but it needs a melody to make it
1208 perfor0mable: COMMENT(
1210 )mudela(fragment,verbatim)(
1213 \property Voice.beamAuto = "0" % no beams in melody
1214 c''8. c''16 bes'8. a'16 g'4 f'8 g'4.
1216 \context Lyrics \lyrics { 'got8. me16 on8. my16 knees,4 Le-8 lie!4. }
1220 ) The strings that makes up each syllable in the lyrics block are
1221 passed along to TeX() verbatim, so if you are proficient with TeX()
1222 you can do various nifty things. Keep in mind that a syllable
1223 either starts with a letter (a character in the range `code(a)' to
1224 `code(z)' or `code(A)' to `code(Z)'), or it is a string enclosed
1225 double quotes. It ends with either a number for the duration, or a space.
1226 These tricks are demonstrated in the following example:
1230 \context Lyrics \lyrics { 'got8 m\textbf{e}8 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.}
1231 \context Lyrics \lyrics { 'got8 m{\bf e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.}
1234 )mudela(fragment,verbatim)(<
1236 \property Voice.beamAuto = "0" % no beams in melody
1237 c''8. c''16 bes'8. a'16 g'4 f'8 g'4.
1239 \context Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.}
1244 ) COMMENT(Groen is de kleur van geluk. Dat geldt zeker voor Bj"ork)
1246 sect(Toplevel Mudela)
1248 Back in bind(Section)ref(sec:firsttune) we said we would ignore
1249 toplevel constructions (e.g., code(\score)) until a later moment.
1250 Now we will look at these constructions.
1253 Mudela allows you to name constructs of the language. This is done by
1254 using an em(identifier). Generally you can define an
1255 identifier by entering code(identifierName = ... ) where there can be
1256 a variety of things on the ellipsis.
1258 Here is a (partial) list of what you can abbreviate with identifiers
1261 it()The code(\score) block
1262 it()The code(\paper) block
1263 it()The code(\midi) block (to be explained in
1264 bind(Section)ref(tutorial:sound))
1265 it()Music (sequential music, simultaneous music etc.)
1268 it()Translators (to be explained in bind(Section)ref(tutorial:engravers))
1275 to the abbreviated entity, you must precede code(identifierName)
1276 with a backslash, i.e., code(\identifierName). For example:
1278 czerny = \notes { [c16 g e g] }
1280 \notes \context GrandStaff <
1282 { \clef bass; \czerny \czerny \czerny \czerny}
1290 You can also see identifiers in action within the code(\paper) block:
1291 the value code(-1.0) is assigned to code(linewidth). Within the
1292 code(\paper) block, identifiers are not used as abbreviation only:
1293 assigning to some identifiers can influence the output: in this case,
1294 the music line is printed at natural width.
1296 Recall the properties of a context, that could be set with
1297 code(\property). It is a very general mechanism to tune the output of
1298 the music, that is neatly separated from the real music.
1299 Unfortunately, it is not convenient to type or read, and the precise
1300 effect of a setting property isn't always apparent from its
1301 definition. To remedy this, we can use an identifier to capture the
1302 meaning of a code(\property).
1305 stemup = \property Voice.verticalDirection = "1"
1306 stemdown = \property Voice.verticalDirection = "-1"
1307 shift = \property Voice.hshift = "1"
1309 \context "Staff" \notes <
1310 \context "Voice" = "one" { \stemup r4 as'4 () as'4 g'4 }
1311 \context "Voice" = "two" { \stemup \shift g'2 f'4 e'4 }
1312 \context "Voice" = "three" { \stemdown [d'8 dis'] [d' cis'] [c' b] c'4 } >
1313 \paper{ linewidth = -1.0\pt; }
1316 Several abbreviations like code(\stemup) are defined in the standard
1317 initialisation file file(property.ly). Setting or changing context
1318 properties can have a similar effect as the commands that were
1319 discussed in bind(Section)ref(sec:commands). Don't be fooled by the
1320 similarity in appearance between a declared property-setting entry and
1321 a real command like code(\clef) or code(\bar). Real commands are
1322 hardcoded into the language and they have to be terminated by
1326 label(tutorial:sound)
1328 You get output by combining music with definition a conversion to
1329 output. LilyPond currently supports one other conversion besides
1330 notation: the conversion from abstract music to sound. You can have
1331 LilyPond play the music that you entered. The format that is used for
1332 this output is MIDI. The result is not very pretty, but it is useful
1333 for prooflistening your files: typing errors stand out when you
1334 listen, especially if they involve accidentals.
1336 The only information that you need to enter is the
1337 tempo (Unfortunately, at this time, this the only thing that can be
1338 tuned.). The syntax for the tempo is code(\tempo )var(duration) =
1339 var(beatsperminute);, for example: COMMENT(
1344 \midi { \tempo 4 = 76; }
1349 sect(Contexts revisited: engravers)
1350 label(tutorial:engravers)
1352 As was promised, we will now take a dive into the more wizardrous parts
1353 of LilyPond: redefining (notation) contexts. We previously explained
1357 it()is a conversion from music to notation,
1358 it()can contain other contexts
1359 it()handles specific notation constructs
1362 This characterization almost automatically explains what the definition of a
1363 context should look like:
1365 it() It should define a name
1366 it()It should be part of the ``notation output definition,'' i.e., the
1369 It should contain a specification of what other contexts may be contained
1370 in the context we're defining.
1372 It should contain a list of the notation constructs to be
1376 LilyPond can create notation for a large number of symbols. This code
1377 is split up into basic building blocks. Each building block is called
1378 an em(engraver), and an engraver generally handles only one notation
1379 construct: the code(Clef_engraver) takes care of the clefs, the
1380 code(Time_signature_engraver) takes care of printing time signatures,
1383 A notation context is formed by a group of engravers. A special class
1384 in LilyPond---the code(Engraver_group_engraver)---allows engravers to
1385 cooperate in a group, thus forming a notation context. A variant of
1386 this grouping object is the code(Line_group_engraver_group), which
1387 puts the output of all the engravers (clefs, bars, etc) into a
1388 compound object, so that these symbols can be treated as a whole.
1390 The following definition shows a simplified Staff context: COMMENT(
1395 \context "Line_group_engraver_group";
1398 \consists "Bar_engraver";
1399 \consists "Clef_engraver";
1400 \consists "Key_engraver";
1401 \consists "Local_key_engraver";
1402 \consists "Time_signature_engraver";
1403 \consists "Staff_symbol_engraver";
1405 defaultClef = treble;
1410 ) This context, named Staff, puts its graphic objects into a compound
1411 object (a so-called ``Line group''). At Staff level, bars, clefs,
1412 keys, accidentals, time signatures and the staff symbol are handled.
1413 A staff can contain a Voice context. You can also preset properties
1414 of contexts: for instance, the clef that is printed upon starting a
1415 Staff, is the treble clef.
1419 As a practical example, we will show how to typeset polymetric music,
1420 i.e., music where the meter can differ for each staff. The solution
1421 is not very complicated: normally all timing information (time
1422 signature, rhythmic grouping) is synchronised across each staff. This
1423 is done by having only one administration for timing information: in
1424 the default configuration there is only one code(Timing_engraver), in
1425 the code(Score) context.
1427 All staffs use the information in the code(Timing_engraver) for
1428 generating bar lines and time signatures. So, we can have different
1429 timing for every staff, by moving the code(Timing_engraver) into the
1432 You can also declare contexts, and reference them. This is useful in
1433 combination with code(\remove "..."): code(\remove) does the opposite
1440 \context Staff = one { \time 2/4; c'4 c'4 c'4 c'4 c'4 c'4 }
1441 \context Staff = two { \time 3/4; c'4 c'4 c'4 c'4 c'4 c'4 }
1447 \remove "Timing_engraver";
1451 \consists "Timing_engraver";
1457 The context definitions provided as a default are in the standard
1458 initialisation file file(engraver.ly).
1461 sect(Urtexts and context selection)
1462 label(tutorial:urtext)
1464 In bind(Section)ref(tutorial:more-staffs), we have shown you how to
1465 make multiple staffs, and explained that you have to label every staff
1466 (or more precisely: different contexts), to make sure that new ones
1467 are created when you need them. In this section, the real power of
1468 this mechanism will be unveiled.
1470 By naming other contexts that you create, you can reference other
1471 contexts than the current context from within the music. For example,
1472 from within the music that you enter for staff code(One), one could
1473 enter a small piece of music, and send it to staff code(Two), e.g.,
1476 ) mudela(fragment,verbatim)(
1478 \context Staff = one { c''4 \context Staff = two { c4 c4 } c''4 }
1479 \context Staff = two { \clef bass; g,4 g,4 g,4 g,4 }
1485 The mechanism of context selection can be used to fabricate an
1486 nop(Urtext)footnote(em(Urtext) is the German word for `original text'.
1487 The Urtext edition of a piece of music, is an edition that reflects
1488 the original writing of the composer. Such editions are useful for
1489 musicologists, and performers that want to perform authentic
1490 interpretations. However, for mere mortals, the Urtext can be
1491 hard to read. It might not contain fingering and beaming, and
1492 typically it is full of footnotes. Moreover, common interpretations
1493 may have emerged---after the composer died. For this reason, the
1494 music that can be had as Urtext usually is also available in enhanced
1495 and edited editions. ) and an edited edition from em(one source). We
1496 will use the first few bars of bind(J.)bind(S.)Bach's first Cello
1497 suite to demonstrate this. The example makes heavy use of space
1498 rests; here they are used as a placeholder to attach articulation
1502 bach = \notes \relative c { g16 d' b' a b d, b' d, }
1503 bachBeams = \notes { [s4] [s4] }
1504 staffStuff = \notes { \clef bass; \time 4/4; s1 \bar "|."; }
1506 slursOne = \notes { s16( s s s s16 s s )s }
1507 slursTwo = \notes { s16-. s s() s s16() s s ()s }
1513 \context Voice = celloVoice { \bach \bach}
1514 \context Voice = celloVoice < { \slursOne \slursOne }
1515 { \bachBeams \bachBeams } >
1519 \context Voice = celloVoice { \bach \bach }
1520 \context Voice = celloVoice < { \slursTwo \slursTwo }
1521 { \bachBeams \bachBeams } >
1525 \paper { linewidth = -1.;}
1529 The slurs that you define should be put on the music that is defined
1530 by the code(\bach) identifier. By labeling a code(Voice) context, and
1531 directing both the articulation and the notes to that same code(Voice)
1532 context, the articulation is put over the right notes.
1536 label(tutorial:more-grammar)
1539 One of the things that you can do with music is em(transposing) it.
1540 If you want to transpose a piece of music, then you should prefix it
1541 with the keyword code(\transpose) along with the pitch (relative to
1542 the central C, i.e., code(c')) for the transposition.footnote(the
1543 code(\context Staff) is to make sure that no separate staffs are created
1544 for the code(\scale) and code(\transpose cis' \scale) part.)
1548 scale = \notes \relative c' { [c8 d e f] }
1551 \context Staff { \scale \transpose cis' \scale }
1553 \paper { linewidth = -1.0; }
1557 sect(Staff switching)
1559 We have seen that contexts can be nested. This means that they form a
1560 tree. It is possible to edit this tree: for example, a code(Voice)
1561 context can be taken out of a code(Staff) context, and put into
1562 another. This has the effect of the voice switching staffs (something
1563 that often happens in keyboard music). The syntax for this operation
1564 with these particular contexts is code(\translator Staff = newStaffName).
1566 The effect is analogous to the first example in section
1567 ref(tutorial:urtext), but with the code(\translator) construction it
1568 is possible to split the real music and the commands that determine in
1569 which staff the music is printed. For example:
1574 aVoice = \context Voice = voiceA \notes { c''4 c4 c4 c''4 }
1575 bVoice = \context Voice = voiceB \notes { g,4 g,4 g,4 g,4 }
1577 % staff switching stuff
1578 switch = \context Voice = voiceA \notes { s4 \translator Staff = staffB s4
1579 s4 \translator Staff = staffA s4 }
1583 \context Staff = staffA < \aVoice \switch >
1584 \context Staff = staffB < \bVoice \clef bass; >
1586 \paper { linewidth = -1.; }
1590 If you want to switch staffs you are in the middle of a slur or a
1591 beam, the staffs should have a fixed distance. You do this by using the PianoStaff context.
1592 mudela(verbatim,center)(
1594 \context PianoStaff <
1595 \context Staff=one \notes{ s2 }
1596 \context Staff=two \notes\relative c{
1600 \translator Staff=one \stemup
1612 The notes in a triplet take 2/3 of their notated duration. The syntax
1613 for triplet in LilyPond reflects this. To make a triplet, you enter
1616 )mudela(verbatim,fragment,center)(
1617 \context Voice \times 2/3 { c''4 c''4 c''4 }
1620 )Since tuplet brackets are printed by the Voice context, a Voice
1621 context must exist before code(\times) is interpreted. To ensure this,
1622 a context is instantiated explicitly with code(\context Voice). You
1623 don't need this, if a Voice context is already instantiated, like in
1624 the following example:
1627 )mudela(fragment,verbatim,center)(
1628 c''4 \times 2/3 { c''4 c''4 c''4 } c''4
1633 Of course, you can also use different ratios, and use beamed notes or
1637 \context Voice \times 4/5 { [c''8 c''16 c''16] r8 [g'8 g'8] }
1640 If you make a tuplet of beamed notes, where the beam is as wide as
1641 the bracket, the bracket is omitted.
1645 A repeated piece of music can consist of two parts: one part to be
1646 repeated, and optionally, a list of alternative endings:
1649 )mudela(verbatim,fragment,center)(
1653 \repeat "semi" 2 { b c }
1659 ) The number code(repeat-count) defines how many times the piece should be
1660 played. You may leave out the code(\alternative) part. There must not
1661 be more alternative endings than the code(repeat-count).
1663 A less intuitive form may be needed for lyrics, when there are
1664 a couple alternatives, but nothing is repeated. The code(\repeat) command
1665 must be present, but it may specify an empty music list:
1668 )mudela(verbatim,fragment,center)(
1669 \context Lyrics \lyrics {
1670 \repeat "folded" 2 { }