1 mailto(gnu-music-discuss@gnu.org)
4 redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))\
8 DEFINEMACRO(Large)(1)(\
9 whenlatex(latexcommand(\Large{)ARG1+latexcommand(}))\
10 whentexinfo(texinfocommand(@strong{)ARG1+texinfocommand(}))\
11 whenhtml(htmlcommand(<font size=+2>)ARG1+htmlcommand(</font>))\
14 COMMENT( This document contains Mudela fragments. You need at least
15 Yodl-1.30.18 to convert this to tex or html.
19 * pipethrough(date) sucks.
20 * paragraphs have too much space.
21 * fix the amount of spaces (urg:tabs) at the start of verb() blocks
22 or even better: do verb and description side-by side
23 (TeX: use minipage construct):
28 The explaining texts are right in between examples.
29 Constructs like 'This shows' and 'The next line' are esp.
34 Mainly written by Han-Wen Nienhuys,
36 with help of (among others)
41 htmlbodyopt(bgcolor)(white)
42 htmlcommand(<font color=black>)
46 \textheight 53\baselineskip
47 \advance\textheight by \topskip
48 \marginparwidth 1 in % Width of marginal notes.
49 \oddsidemargin 0.25 in % Note that \oddsidemargin = \evensidemargin
50 \evensidemargin 0.25 in
51 \marginparwidth 0.75 in
52 \textwidth 5.875 in % Width of text line.
56 whenlatex(notableofcontents())
57 whentexinfo(notableofcontents())
59 article(Typesetting music with LilyPond)
60 (Han-Wen Nienhuys and Jan Nieuwenhuizen)
61 (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
64 latexcommand(\def\interexample{})
65 latexcommand(\def\preexample{\par})
66 latexcommand(\def\postexample{\par\medskip})
67 latexcommand(\def\file#1{{code(#1)}})
70 includefile(html-disclaimer.yo-urg)
75 label(tutorial:introduction)
76 latexcommand(\parindent2pc)
78 LilyPond prints music from a specification that you, the user, supply.
79 You have to give that specification using a em(language). This
80 document is a gentle introduction to that language, which is called
81 Mudela, an acronym of Music Definition Language.
83 This tutorial will demonstrate how to use Mudela by presenting
84 examples of input along with resulting output. We will use English
85 terms for notation. In case you are not familiar with those, you may
86 consult the glossary that is distributed with LilyPond.
88 The examples discussed are included in the distribution, in the
89 subdirectory file(input/tutorial/). It is recommended that you
90 experiment with writing Mudela input yourself, to get a feel for
96 To demonstrate what LilyPond input looks like, we start off with a
97 full fledged, yet simple example. It is a convoluted version
98 of the famous menuet in bind(J.)bind(S.)Bach's em(Klavierbuechlein).
100 COMMENT(urg: the fermata sign is placed below the note by default)
101 mudela(verbatim)(% lines preceded by a percent are comments.
102 \include "paper16.ly"
110 d4 g,8 a b c d4 g, g |
111 e'4 c8 d e fis g4 g, g |
112 c4 d8()c b a( )b4 c8 b a g |
113 a4 [b8 a] [g fis] g2. |
118 g4 e8 fis g d cis4 b8 cis a4 |
119 a8-. b-. cis-. d-. e-. fis-.
126 % standard settings are too wide for a book
127 linewidth = 14.0 \cm;
131 Enter it (or copy it, the filename is file(menuet.ly)), compile it
132 with LilyPond and view the output. Details of this procedure may vary
133 from system to system. To create the output, one would issue the
134 command `code(ly2dvi menuet)'. file(ly2dvi) is a program that does
135 the job of running LilyPond and TeX(), handling of titles and
136 adjusting of page margins.
138 If all goes well, the file file(menuet.dvi) will be created.
139 To view this output, issue the command `code(xdvi menuet)'.
141 Now that we are familiar with the procedure of producing output, we
142 will analyse the input, line by line.COMMENT(
145 % lines preceded by a percent are comments.
148 )The percent sign, `code(%)', introduces a line comment. If you want to
149 make larger comments, you can use block comments. These are delimited
150 by `code(%{)' and `code(%})'COMMENT(
156 )By default, LilyPond will use definitions for a 20
157 nop(point)footnote(A point is the standard measure of length for
158 printing. One point is 1/72.27 inch.) high staff. We want smaller
159 output (16 point staff height), so we must import the settings for
160 that size, which is done.COMMENT(
166 ) A mudela file combines music with directions for outputting that
167 music. The music is combined with the output directions by putting
168 them into a code(\score) block.
173 )This makes LilyPond ready for accepting notes.
178 ) As we will see, pitches are combinations of octave, note name and
179 chromatic alteration. In this scheme, the octave is indicated by
180 using raised quotes (`code(')') and ``lowered'' quotes (commas:
181 `code(,)'). The central C is denoted by code(c'). The C one octave
182 higher is code(c''). One and two octaves below the central C is
183 denoted by code(c) and code(c,) respectively.
185 For pitches in a long piece you might have to type many quotes. To
186 remedy this, LilyPond has a ``relative'' octave entry mode. In this
187 mode, octaves of notes without quotes are chosen such that a note is
188 as close as possible (graphically, on the staff) to the the preceding
189 note. If you add a high-quote an extra octave is added. The lowered
190 quote (a comma) will substract an extra octave. Because the first note
191 has no predecessor, you have to give the (absolute) pitch of the note
192 to start with.COMMENT(
198 ) What follows is sequential music, i.e.,
199 notes that are to be played and printed after each other.COMMENT(
205 ) This command changes the time signature of the current piece: a 3/4
206 sign is printed. This command is also used to generate bar lines in
207 the right spots.COMMENT(
213 ) This command changes the current key to G-major. Although this
214 command comes after the code(\time) command, in the output, the key
215 signature comes before the time signature: LilyPond knows about music
216 typesetting conventions. COMMENT(
222 ) This command tells LilyPond that the following piece of music must
223 be played twice; code("volta") volta brackets should be used for
224 alternatives---if there were any.
231 )The subject of the repeat is again sequential music. Since
232 code(\sequential) is such a common construct, a shorthand is provided:
233 just leave off code(\sequential), and the result is the same. COMMENT(
239 ) This is a note with pitch code(d) (determined up to octaves). The
240 relative music was started with a code(c''), so the real pitch of this
241 note is code(d''). The code(4) designates the duration of the note
242 (it is a quarter note). COMMENT(
248 )These are notes with pitch code(a') and code(b'). Because their
249 duration is the same as the code(g), there is no need to enter the
250 duration (You may enter it anyway, eg. code(a4 b4)) COMMENT(
256 ) Three more notes. The `code(|)' character is a `barcheck'. When
257 processing the music, LilyPond will verify that barchecks are found at
258 the start of a measure. This can help you track down errors.
265 ) So far, no notes were chromatically altered. Here is the first one
266 that is: code(fis). Mudela by default uses Dutch note names, and
267 ``Fis'' is the Dutch note name for ``F sharp''. However, there is no
268 sharp sign in the output. The program keeps track of key signatures,
269 and will only print accidentals if they are needed.
276 )LilyPond guesses were beams can be added to eighth and shorter notes.
277 In this case, a beam over 4 eighths is added.
281 c4 d8( )c b a( )b4 c8 b a g |
284 ) The next line shows how to make a slur:
285 the beginning and ending note of the slur is marked with an opening and
286 closing parenthesis respectively. In the line shown above this is
287 done for two slurs. Slur markers (parentheses) are between
293 )Automatic beaming can be overridden by inserting beam marks
294 (brackets). Brackets are put around notes you want beamed.COMMENT(
300 )A duration with augmentation dot is notated
301 with the duration number followed by a period.COMMENT(
306 ) This ends the sequential music to be repeated. LilyPond will typeset
307 a repeat bar. COMMENT(
313 )This line shows that Lily will print an accidental if that is
314 needed: the first C sharp will be printed with an accidental, the
315 second one without. COMMENT(
318 a8-. b-. cis-. d-. e-. fis-.
321 )You can enter articulation signs either in a verbose form using a
322 shorthand. Here we demonstrate the shorthand: it is formed by a dash
323 and the the character for the articulation to use, e.g. `code(-.)' for
324 staccato as shown above. COMMENT(
331 Rests are denoted by the special notename `code(r)'. You can also enter
332 an invisible rest by using the special notename `code(s)'.
337 )All articulations have a verbose form, like code(\fermata). The
338 command `code(\fermata)' is not part of the core of the language (most
339 of the other discussed elements are), but it is a shorthand for a more
340 complicated description of a fermata. code(\fermata) names that
341 description and is therefore called an em(identifier). COMMENT(
357 )This specifies a conversion from music to notation output. Most of
358 the details of this conversions (font sizes, dimensions, etc.) have
359 been taken care of, but to fit the output in this document, it has
360 to be smaller. We do this by setting the line width to 14 centimeters
361 (approximately 6 inches).
368 )The last brace ends the code(\score) block.
370 There are two things to note here. The format contains musical
371 concepts like pitches and durations, instead of symbols and positions:
372 the input format tries to capture the meaning of em(music), and not
373 notation. Therefore Second, the format tries to be em(context-free):
374 a note will sound the same regardless of the current time signature,
377 The purpose of LilyPond is explained informally by the term `music
378 typesetter'. This is not a fully correct name: not only does the
379 program print musical symbols, it also makes esthetic decisions. All
380 symbols and their placement is em(generated) from a high-level musical
381 description. In other words, LilyPond would be best
382 described by `music compiler' or `music to notation compiler'.
385 sect(Lyrics and chords)
387 In this section we show how to typeset a song of unknown
388 origin.footnote(The author would welcome information about the origin
392 title = "The river is flowing";
393 composer = "Traditional (?)";
395 \include "paper16.ly"
396 melody = \notes \relative c' {
399 c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
400 c4 c8 d [es () d] c4 | d4 es8 d c4.
405 The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
406 ri -- ver is flo -- wing down to the sea.
409 accompaniment =\chords {
411 c2-3- f-3-.7 d-min es4 c8-min r8
412 c2-min f-min7 g-7^3.5 c-min }
417 \context ChordNames \accompaniment
420 \context Staff = mel {
421 \property Staff.noAutoBeaming = "1"
422 \property Staff.automaticMelismata = "1"
425 \context Lyrics \text
428 \paper { linewidth = 10.0\cm; }
432 The result would look nop(this)footnote(The titling and font size shown
433 may differ, since the titling in this document is not generated by
436 center(bf(Large(The river is flowing))
441 mudela(center)(\header {
442 title = "The river is flowing";
443 composer = "Traditional (?)";
445 \include "paper16.ly"
446 melody = \notes \relative c' {
449 c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
450 c4 c8 d [es () d] c4 | d4 es8 d c4.
455 The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
456 ri -- ver is flo -- wing down to the sea.
459 accompaniment =\chords {
461 c2-3- f-3-.7 d-min es4 c8-min r8
462 c2-min f-min7 g-7^3.5 c-min }
467 \context ChordNames \accompaniment
470 \context Staff = mel {
471 \property Staff.noAutoBeaming = "1"
472 \property Staff.automaticMelismata = "1"
475 \context Lyrics \text
478 \paper { linewidth = 10.0\cm; }
481 Again, we will dissect the file line by line.COMMENT(
487 )Information about the music you are about to typeset goes into a
488 code(\header) block. The information in this block is not used by
489 LilyPond, but it is included in the output. file(ly2dvi) uses this
490 information to print titles above the music.
492 title = "The river is flowing";
493 composer = "Traditional (?)";)COMMENT(
495 )the code(\header) block contains assignments. An assignment starts
496 with a string. (which is unquoted, in this case). Then comes the
497 equal sign `code(=)'. After the equal sign comes the expression you
498 want to store. In this case, you want to put in strings. The
499 information has to be quoted here, because it contains spaces. The
500 assignment is finished with a semicolon.COMMENT(
503 \include "paper16.ly"
506 )Smaller size for inclusion in a book.COMMENT(
509 melody = \notes \relative c' {
512 )The structure of the file will be the same as the previous one, a
513 code(\score) block with music in it. To keep things readable, we will
514 give the different parts of music names, and use names to construct
515 music within the score block.
521 The piece starts an anacrusis of one eighth. COMMENT(
524 c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
525 c4 c8 d [es () d] c4 | d4 es8 d c4.
529 )We use explicit beaming. Since this is a song, we will turn automatic
530 beams off, and use explicit beaming where needed.COMMENT(
536 )This ends the definition of code(melody). Note that there are no
537 semicolons after assignments at top level.COMMENT(
543 )Another identifier assignment. This one is for the lyrics.
544 Lyrics are formed by syllables that have duration, and not by
545 notes. To make LilyPond parse words as syllables, switch it into
546 lyrics mode with code(\lyrics). Again, the brace after code(\lyrics)
547 is a shorthand for code(\sequential {). COMMENT(
550 The4 ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
551 ri- ver is flo- __ wing down to the sea.
555 )The syllables themselves are separated by spaces. You can get syllable
556 extenders by entering `code(__)', and centered hyphens with
557 `code(-)code(-)'. We enter the syllables as if they are all quarter notes
558 in length (hence the code(4)), and use a feature to align the
559 syllables to the music (which obviously isn't all quarter notes.)
563 accompaniment =\chords {
566 )We'll put chords over the music. There is a special mode (analogous
567 to code(\lyrics) and code(\notes) mode) where you can give the names
568 of the chords you want, instead of the notes comprising the chord.
575 )There is no accompaniment during the anacrusis.COMMENT(
579 )A chord is started by the tonic of the chord. The
580 first one lasts a half note. An unadorned note creates a major
581 triad, while a minor triad is wanted. code(3-) modifies the third to
582 be small. code(7) modifies (adds) a seventh, which is small by default
583 to create the code(f a c es) chord. Multiple modifiers must be
584 separated by a dot.COMMENT(
590 )Some modifiers have predefined names, eg. code(min) is the same as
591 code(3-), so code(d-min) is a minor code(d) chord.COMMENT(
594 c2-min f-min7 g-7^3.5 c-min }
597 )A named modifier code(min) and a normal modifier code(7) do not have
598 to be separated by a dot. Tones from a chord are removed with chord
599 substractions. Substractions are started with a caret, and they are
600 also separated by dots. In this example, code(g-7^3.5) produces a
601 minor seventh. The brace ends the sequential music. COMMENT(
608 )We assemble the music in the code(\score) block. Melody, lyrics and
609 accompaniment have to sound at the same time, so they should be
610 code(\simultaneous).COMMENT(
616 )Chord mode generates notes grouped in code(\simultaneous) music. If
617 you remove the comment sign, you can see the chords in normal
618 notation: they will be printed as note heads on a separate
622 \context ChordNames \accompaniment
625 )Normally, the notes that you enter are transformed into note heads.
626 The note heads alone make no sense, they need surrounding information:
627 a key signature, a clef, staff lines, etc. They need em(context). In
628 LilyPond, these symbols are created by objects called `interpretation
629 context'. Interpretation contexts only exist during a run of
630 LilyPond. Interpretation contexts that are for printing music (as
631 opposed to playing music) are called `notation context'.
633 By default, LilyPond will create a Staff contexts for you. If you
634 would remove the code(%) sign in the previous line, you can see that
638 We don't want default contexts here, because we want names, not note
639 heads. An interpretation context can also created upon explicit
640 request. The keyword for such a request is code(\context). It takes
641 two arguments. The first is the name of a interpretation context.
642 The name is a string, it can be quoted with double quotes). The
643 second argument is the music that should be interpreted in this
644 context. For the previous line, we could have written code(\context
645 Staff \accompaniment), and get the same effect.COMMENT(
651 )The lyrics need to be aligned with the melody. This is done by
652 combining both with code(\addlyrics). code(\addlyrics) takes two
653 pieces of music (usually a melody and lyrics, in that order) and
654 aligns the syllables of the second piece under the notes of the
655 first piece. If you would reverse the order, the notes would be
656 aligned on the lyrics, which is not very useful. (Besides, it looks
660 \context Staff = mel {
663 )This is the argument of code(\addlyrics). We instantiate a
664 code(Staff) context explicitly: should you chose to remove comment
665 before the ``note heads'' version of the accompaniment, the
666 accompaniment will be on a nameless staff. The melody has to be on a
667 different staff as the accompaniment. This is accomplished by giving
668 the melody staff a different name.COMMENT(
671 \property Staff.noAutoBeaming = "1"
674 )An interpretation context has variables that tune its behaviour. One
675 of the variables is code(noAutoBeaming). If set and non-zero (i.e.,
676 true) LilyPond will not try to put automatic beaming on the current
680 \property Staff.automaticMelismata = "1"
683 )Similarly, we don't want to print a syllable when there is
684 a slur. This sets up the Staff context to signal slurs while
685 code(\addlyrics) is processed. COMMENT(
692 )Finally, we put the melody on the current staff. Note that the
693 code(\property) directives and code(\melody) are grouped in sequential
694 music, so the property settings are done before the melody is
698 \context Lyrics \text
701 )The second argument of code(\addlyrics) is the text. The text also
702 should not land on a Staff, but on a interpretation context for
703 syllables, extenders, hyphens etc. This context is called
710 )This ends code(\simultaneous).COMMENT(
716 )This makes the music go to a MIDI file. MIDI is great for
717 checking music you enter. You listen to the MIDI file: if you hear
718 something unexpected, it's probably a typing error. code(\midi) is an
719 `output definition', a declaration that specifies how to output music
720 analogous to code(\paper { }).COMMENT(
723 \paper { linewidth = 10.0\cm; }
726 )We also want notation output. The linewidth is short so the piece
727 will be set in two lines. COMMENT(
733 )End the score block.
737 Our third subject is a piece piano music. The fragment in the input
738 file is a piano reduction of the G major Sinfonia by Giovanni Battista
739 Sammartini. It was composed around 1740. COMMENT(Sesam atlas vd
740 Muziek. Deel II, blz 414)
743 \include "paper16.ly";
745 viola = \notes \relative c' \context Voice = viola {
747 \property Voice.verticalDirection = \down g'8. b,16
752 oboes = \notes \relative c'' \context Voice = oboe {
753 \stemup s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>
754 \grace <e8( g> <d4 f> <c2 e> \times 2/3 { <d8 \< f> <e g> <f a> }
756 { \times 2/3 { a8 g c } \! c2 }
757 \context Voice = oboeTwo {
760 \property Grace.verticalDirection = \down
765 \grace <c,8( e> <)b8. d8.-\trill> <c16 e> |
766 [<d ( f> < )f8. a>] <)b,8 d> r [<d16( f> <f8. )a>] <b,8 d> r |
767 [<c16( e> < )e8. g>] <c8 e,>
770 hoomPah = \notes \transpose c' {
771 c8 \translator Staff = top \stemdown
772 c'8 \translator Staff = bottom \stemup }
774 hoomPahHoomPah = { [\hoomPah \hoomPah] }
776 bassvoices = \notes \relative c' {
778 \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
779 \stemdown [c8 c'8] r4
781 < {\stemup r2 <e4 c'> <c8 g'> }
782 \context Voice = reallyLow {\stemdown g2 ~ | g4 c8 } >
786 \context PianoStaff \notes <
787 \context Staff = top < \time 2/2;
788 \context Voice = viola \viola
791 \context Staff = bottom < \time 2/2; \clef bass;
798 linewidth = 14.5 \cm; }
801 If it looks like incomprehensible gibberish to you... Then you are
802 right. The author has doctored this example to have as many quirks in
803 one system as possible.COMMENT(
805 )verb(viola = \notes \relative c' \context Voice = viola {)COMMENT(
807 )In this example, you can see multiple parts on a staff. Each part is
808 associated with one notation context. This notation context handles
809 stems and dynamics (among others). The name of this context is
810 code(Voice). For each part we have to make sure that there is
811 precisely one Voice nop(context)footnote(If code(\context) would not
812 have been specified explicitly, three code(Voice) contexts would be
813 created: one for each note in the first chord.).COMMENT(
815 )verb(<c4-\f g' c>)COMMENT(
817 )code(<) and code(>) are short hands for code(\simultaneous {) and
818 code(}). So the expression enclosed in code(<) and code(>) is a
819 chord. code(\f) places a forte symbol under the chord.COMMENT(
821 )verb(\property Voice.verticalDirection = \down)COMMENT(
823 )code(verticalDirection) is a property of the voice context. It
824 controls the directions of stems, articulations marks and other
826 If code(verticalDirection) is set to code(\down)
827 (identifier for the integer -1) the stems go down
828 code(\up) (identifier for the integer 1) makes the stems go up.COMMENT(
830 )verb( g'8. b,16)COMMENT(
832 )Relative octaves work a little differently with chords. The starting
833 point for the note following a chord is the first note of the chord. So
834 the code(g) gets an octave up quote: it is a fifth above the starting
835 note of the previous chord (the central C).
837 verb(s1 s2. r4)COMMENT(
839 )code(s) is a `spacer' rest. It does not print anything, but it does
840 have duration of a rest. COMMENT(
842 )verb(oboes = \notes \relative c'' \context Voice = oboe {)COMMENT(
844 )Now comes a part for two oboes. They play homophonically, so we
845 print the notes as one voice that makes chords. Again, we insure that
846 these notes are indeed processed by precisely one context with
847 code(\context).COMMENT(
849 )verb(\stemup s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>)COMMENT(
851 )code(\stemup) is an identifier reference. It is shorthand for
852 code(\property Voice.verticalDirection = \up). If possible, you
853 should use predefined identifiers like these for setting properties.
854 Your input will be less dependent upon the implementation of LilyPond.
857 )verb(\grace <e8( g> < )d4 f> <c2 e>)COMMENT(
859 )code(\grace) introduces grace notes. It takes one argument, in this
860 case a chord. The slur started on the code(e) of the chord
861 will be attached to the next nop(note.)footnote(LilyPond will squirm
862 about unended Slurs. In this case, you can ignore the warning).
865 )verb(\times 2/3)COMMENT(
867 )Tuplets are made with the code(\times) keyword. It takes two
868 arguments: a fraction and a piece of music. The duration of the
869 second argument is multiplied by the first argument. Triplets make
870 notes occupy 2/3 of their notated duration, so in this case the
871 fraction is 2/3. COMMENT(
873 )verb({ <d8 \< f> <e g> <f a> })COMMENT(
875 )The piece of music to be `tripletted' is sequential music containing
876 three notes. On the first chord (the code(d)), a crescendo is started
877 with code(\<).COMMENT(
881 )At this point, the homophonic music splits into two rhythmically
882 different parts. We can't use a sequence of chords to enter this, so
883 we make a `chord' of sequences to do it. We start with the upper
884 voice, which continues with upward stems: COMMENT(
886 )verb( { \times 2/3 { a8 g c } \! c2 })COMMENT(
888 )The crescendo is ended at the half note by the escaped exclamation
889 mark `code(\!)'. COMMENT(
891 )verb(\context Voice = oboeTwo {
894 )We can't share stems with the other voice, so we have to create a new
895 code(Voice) context. We give it the name code(oboeTwo) to distinguish
896 it from the other context. Stems go down in this voice. COMMENT(
898 )verb(\grace { )COMMENT(
900 )When a grace section is processed, a code(Grace) context is
901 created. This context acts like a miniature score of its own. It has
902 its own time bookkeeping, and you can make notes, beams, slurs
903 etc. Here fiddle with a property and make a beam. The argument of
904 code(\grace) is sequential music.COMMENT(
906 )verb(\property Grace.verticalDirection = \down
909 )Normally, grace notes are always stem up, but in this case, the upper
910 voice interferes. We set the stems down here.
912 As far as relative mode is concerned, the previous note is the
913 code(c'''2) of the upper voice, so we have to go an octave down for
921 )This ends the two-part section. COMMENT(
924 \grace <c,8( e> <)b8. d8.-\trill> <c16 e> | )COMMENT(
926 )code(\stemboth) ends the forced stem directions. From here, stems are
927 positioned as if it were single part music.
929 The bass has a little hoom-pah melody to demonstrate parts switching
930 between staffs. Since it is repetitive, we use identifiers:COMMENT(
932 )verb(hoomPah = \notes \transpose c' {)COMMENT(
934 )Transposing can be done with code(\transpose). It takes two
935 arguments; the first specifies what central C should be transposed to.
936 The second is the to-be-transposed music. As you can see, in this
937 case, the transposition is a no-op. Central C is transposed to
940 The purpose of this no-op is circumventing relative mode. Relative
941 mode can not be used in conjunction with transposition, so relative
942 mode will leave the contents of code(\hoomPah) alone. We can use it
943 without having to worry about getting the motive in a wrong
944 nop(octave)footnote(code(hoomPah = \relative ...) would be more
945 intuitive to use, but that would not let me plug code(\transpose)
946 :-CHAR(41).).COMMENT(
948 )verb(c8 \translator Staff = top \stemdown )COMMENT(
950 )We assume that the first note will be put in the lower staff. After
951 that note we switch to the upper staff with code(\translator). To be
952 precise, this code(\translator) entry switches the current voice to a
953 code(Staff) named code(top). So we have to name the upper staff
954 `code(top)'. Stem directions are set to avoid interfering with the
955 oboe voices. COMMENT(
957 )verb(c'8 \translator Staff = bottom \stemup })COMMENT(
959 )Then a note is put on the upper staff, and we switch again. We have
960 to name the lower staff `code(bottom)'. COMMENT(
962 )verb(hoomPahHoomPah = { [\hoomPah \hoomPah] })COMMENT(
964 )Put two of these fragments in sequence, and beam them.COMMENT(
966 )verb(bassvoices = \notes \relative c' {
968 \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
969 \hoomPahHoomPah)COMMENT(
971 )Entering the bass part is easy: the hoomPahHoomPah variable is
972 referenced four times.COMMENT(
974 )verb(\context Voice = reallyLow {\stemdown g2 ~ | g4 c8 } >)COMMENT(
976 )After skipping some lines, we see code(~). This mark makes ties.COMMENT(
978 )verb(\context PianoStaff)COMMENT(
980 )For piano music, a special context is needed to get cross staff
981 beaming right. It is called code(PianoStaff).COMMENT(
983 )verb(\context Staff = bottom < \time 2/2; \clef bass;)COMMENT(
985 )The bottom staff must have a different clef.COMMENT(
987 )verb(indent = 0.0;)COMMENT(
989 )To make some more room on the line, the first (in this case the only)
990 line is not indented.
992 This example shows a lot of features, but the organisation isn't
993 perfect. For example, it would be less confusing to use a chord
994 containing sequential music than a sequence of chords for the oboe
997 [TODO: demonstrate Hara-Kiri with scores and part extraction.]
1001 That's all folks. From here, you can either try fiddling with input
1002 files, or you can read the reference manual.