-If you are reading this, you probably are interested in printing
-music. LilyPond is a program that can print music from a
-specification that you, the user, supply. Using LilyPond may be a bit
-quaint in the beginning, because you have to give that specification
-using a em(language). That might not be what you expect if you are
-familiar with graphical interfaces. But there are some big
-advantages: first, once you master the language, entering music can be
-done quite efficiently. Secondly, it is possible to explain exactly
-what the meaning of a language is, i.e., the semantics are much
-clearer. Thirdly, since the program is not interactive, no tradeoffs
-have to be made between processing speed and beauty of the output.
-
-This chapter is a gentle introduction to Mudela, the language that
-instructs LilyPond to typeset music. We will explain Mudela by
-presenting a series of examples of Mudela input. The corresponding
-output will be shown on the right or below, just as it was produced by
-LilyPond.
-
-We will assume that you more or less understand the basics of music notation.
-If you are not familiar with the English terms for music notation, you
-should consult bind(Appendix)ref(glossary): it contains a glossary
-of musical terms along with translations in some other languages.
-
-If you want to try the examples given here, you should have a
-look at bind(Section)ref(sec:running-lilypond) first.
-
-sect(Music copying, music definition and music entry)
-label(tutorial:copying-vs-def-vs-entry)
-
-If you have copied music before, using LilyPond may seem awkward
-to you in the beginning. The purpose of LilyPond informally is
-explained by the term `music typesetter'.
-
-This may give the impression that the program is like a drawing tool
-and that it lets you control precisely how the music is formatted.
-This is not the case: not only does the program print musical symbols,
-LilyPond also tries to make esthetic decisions---to be precise, we
-programmed her to do what we find nop(pretty.)footnote(We formed our
-taste by looking at, and reading all about fine music engraving. Of
-course, our taste is also bound by all the accepted rules of common
-music notation.) You do not have complete control over what is
-happening. Usually that is not a big loss, since good engraving is a
-very complex trade. In other words, you don't have control, so you do
-not have to worry about what is happening precisely.
-
-Secondly, we expect you to enter the meaning of the music, not the
-sheet music itself. The input to LilyPond is a music definition,
-which is something different than notation: notation is a graphical
-system. Put more concretely: your input to LilyPond should contain
-information like ``a dotted quarter note, pitch nop(d)sups(2).''
-LilyPond will figure out from the musical information that a black
-note head with a stem but without flag, fourth staff line, with dot
-should be printed.
-
-When you are copying music by hand from a printed score, you don't have
-to know what the score means; you just copy the symbols. With LilyPond
-such a thing is not possible. You have to enter the meaning of the
-symbols, and this might not always be as easy. On the other hand, once
-entered, any piece of music can be played and transposed automatically.
-
-Finally, in some spots we will cheat a bit when it comes to musical
-definition. Mudela has some entry modes that help to make typing
-Mudela pleasant. For example, the phrase ``a dotted quarter note,
-pitch nop(d)sups(2)'' translates to the following longhand:
+LilyPond is a program that can print music from a specification that
+you, the user, supply. Using LilyPond may be a bit quaint in the
+beginning, because you have to give that specification using a
+em(language). This document is a gentle introduction to that
+language, which is called Mudela, an abbreviation for Music Definition
+Language.
+
+We will demonstrate the working of Mudela by presenting examples of
+input alongside with the resulting output. We will comment on these
+examples using English terms for notation, so if you are not familiar
+with these terms, you should consult the glossary that is distributed
+with LilyPond: it contains a list of musical terms along with
+explanations and translations in some other languages.
+
+sect(The first tune)
+label(sec:firsttune)
+
+To demonstrate what LilyPond input looks like, we start off with a
+full fledged, yet simple, example. It is somewhat convoluted version
+of one of the menuets in bind(J.)bind(S.)Bach's em(Clavierbuchlein).
+
+mudela(verbatim)(
+% lines preceded by a percent are comments.
+\include "paper16.ly"
+\score {
+ \notes
+ \relative c'' {
+ \key g;
+ \time 3/4;
+
+ \repeat 2 {
+ d4 g,8 a b c d4 g, g |
+ e'4 c8 d e fis g4 g, g |
+ c4 d8( )c b a( )b4 c8 b a g |
+ a4 b8 a g fis g2. |
+ }
+
+ b'4 g8 a b g
+ a4 d,8 e fis d |
+ g4 e8 fis g d cis4 b8 cis a4 |
+ a8-. b-. cis-. d-. e-. fis-.
+ g4 fis e |
+ fis a, r8 cis8
+ d2.-\fermata
+ \bar "|.";
+ }
+ \paper {
+ linewidth = 14.0 \cm; % standard settings are too wide for a book
+ }
+})
+
+Before we will discuss the contents of the above, it would be best if
+you would try to enter and save this text with a text editor, compile
+it with LilyPond and view the output. Details of this procedure may
+vary from system to system. On a Unix system, you should enter the
+input in a file ending in file(.ly), such as file(menuet.ly). To
+create the output, one would issue code(ly2dvi menuet).
+
+file(ly2dvi) is a little program that does the job of calling the
+LilyPond and TeX() and adjusting page margins.
+
+If all goes well, this will create the output file file(menuet.dvi).
+To view this output, issue the command code(xdvi menuet). Now that we
+are familiar with the procedure to view the output, we will analyse
+the input itself, line by line.
+
+verb(% lines preceded by a percent are comments.)COMMENT(
+
+)The percent sign, `code(%)', introduces a line comment. If you want
+make larger comments, you can use block comments. These are delimited
+by `code(%{)' and `code(%})'
+
+verb(\input "paper16.ly")
+
+By default, LilyPond will use definitions for a staff of 20
+nop(point)footnote(A point is the standard measure of length for
+printing. One point is 1/72.27 inch.)
+
+high. If you want smaller output (e.g., 16 point), you have to import
+the settings for that size. You can do this by including a file.
+code(\include "file") is replaced by the contents of code(file).
+LilyPond will inspect the standard search to look for the requested
+file.COMMENT(
+
+)verb(\score {
+) COMMENT(
+
+) A mudela file combines music with directions for outputting that
+music. The music is combined with the output directions by putting
+them into a code(\score) block.
+verb(
+ \notes
+) COMMENT(
+
+)This makes LilyPond ready for accepting notes.
+verb(
+ \relative c''
+)COMMENT(
+
+) As we will see, pitches are combinations of octave, note name and
+chromatic alteration. In this scheme, the octave is indicated by
+using raised quotes (`code(')') and ``lowered'' quotes (commas:
+`code(,)'). The central C is denoted by code(c'). The C one octave
+higher is code(c''). One and two octaves below central C is denoted
+by code(c) and code(c,) respectively.
+
+If you have to indicate the pitches in a long piece that is written in
+either a high or very low octave, you would have to type very many
+quotes. To remedy this, LilyPond has a so-called ``relative'' octave
+entry mode. In this mode, notes without quotes are chosen in such an
+octave that they are the closest to the preceding note. If you add a
+high-quote an extra octave is added. The lowered quote will substract
+an extra octave. Because the first note obviously has no predecessor,
+you have to give the (absolute) pitch of the note to start with.
+COMMENT(
+
+)verb(
+ { % sequential music follows
+)COMMENT(
+
+) The brace indicates that what follows is sequential music, i.e.,
+notes that are to be played and printed after each other. This is in
+contrast with simultaneous music: notes that are to be played like a
+chord. You should be careful not to confuse this brace with the one
+coming after code(\score).
+
+
+verb(
+ \time 3/4; % set the time signature.
+) COMMENT(
+
+) This command changes the time signature of the current piece: this
+prints a 3/4 sign. The 3/4 value is also used to generate bar lines
+in the right spots.
+verb(
+ \key g;
+) COMMENT(
+
+) This command changes the current key to G-major. Although
+this command comes after the code(\time) command, in the
+output, the key comes before the time signature: LilyPond knows about
+music typesetting conventions.
+verb(
+ \repeat 2 {
+) COMMENT(
+
+) This command tells LilyPond that the enclosed piece of music must
+be played twice.
+verb(
+ d4
+) COMMENT(
+
+) This is a code(d) note. The relative music was started with a
+code(c''), the real pitch of this note is code(d''). The 4
+designates the duration of the note (it is a quarter note). COMMENT(
+
+)verb(
+ a b
+)COMMENT(
+
+)These are notes with pitch code(a') and code(b'). Because their
+duration is the same as the code(g), there is no need to enter the
+duration (It is not illegal to enter it anyway. You would then enter
+code(a8 b8)) COMMENT(
+
+)verb(
+ d4 g, g |
+) COMMENT(
+
+) Three more notes: The code(|) is a ``barcheck''. When processing the
+music, LilyPond will check that barchecks are found at the start of
+a bar. This can help you track down notes you forgot to enter.
+verb(
+ e'4 c8 d e fis
+) COMMENT(
+
+) So far, no notes were chromatically altered. Here is the first one
+that is: code(fis). Mudela by default uses Dutch note names, and
+``Fis'' is the Dutch note name for ``F sharp''. However, there is no
+sharp sign in the output. The program keeps track of key signatures,
+and will only print accidentals if they are needed.
+verb(
+ c4 d8( )c b a( )b4 c8 b a g |
+) COMMENT(
+
+) The next line shows something new: In mudela, one enters a slur by
+marking the beginning and ending note of the slur with an opening and
+closing parenthesis respectively. In the line shown above this is
+done for two slurs. Note that parentheses (slur markers) are between
+the notes. As you can see, parentheses do not have to nest.
+verb(
+ a4 b8 a g fis g2. |
+) COMMENT(
+
+) A duration that is to be augmented with a duration dot, is notated
+with a duration number followed by periods, as many as you want
+augmentation dots.
+verb(
+ }
+) COMMENT(
+
+) The end of the repeated music. LilyPond will typset a repeat bar.
+verb(
+ cis'4 b8 cis a4 |
+) COMMENT(
+
+) This line shows that Lily will print an accidental if that is
+needed: the first C sharp will be printed with an accidental, the
+second one without. COMMENT(
+
+)verb( a8-. b-. cis-. d-. e-. fis-. % try some super and subscripts.)COMMENT(
+
+)There is more to music than just pitches and rhythms. An important
+aspect is articulation. You can enter articulation signs either in an
+abbreviated form, by a dash and the the character for the
+articulation to use, e.g. code(-.) for staccato as shown above.
+COMMENT(
+
+)verb(
+ fis a, r8 cis8
+) COMMENT(
+
+)
+Rests are denoted by the special notename code(r). You can also make
+an invisible rest by using the special notename code(s).
+verb(
+ d2.-\fermata
+) COMMENT(
+
+) All articulations have a verbose form, like code(\fermata). The
+``command'' COMMENT(Hi Adrian :-) code(\fermata) is not part of the
+core of the language (most of the other discussed elements are), but
+it is an abbreviation of a more complicated description of a fermata.
+code(\fermata) names that description and is therefore called an
+em(identifier).
+
+verb(
+ }
+) COMMENT(
+
+)
+This ends the sequential music.
+
+verb(\paper {
+ linewidth = 10.0\cm;
+})
+This specifies a conversion from music to notation output. Most of
+the details of this conversions (font sizes, dimensions, etc.) have
+been taken care of, but to fit the output in this document, it has
+to be smaller. We do this by setting the line width to 10 centimeter
+(approximately 4 inches).
+