* More movements ::
* A piano excerpt:: Piano music
* An orchestral score::
+* Part extraction::
* end of tutorial:: The end
@end menu
ly2dvi test.ly
@end example
After some disk-activity, you should end up with a @file{.dvi} file.
-Ly2dvi is further described in the Chapter @ref{ly2dvi}.
+Ly2dvi is further described in the @ref{ly2dvi}.
Secondly, you can generate PostScript directly. This is useful if you
can not or do not want to run @TeX{} on your system.
@end example
You have to set some environment variables to view or print this
-output. More information can be found in the Section @ref{Invoking
+output. More information can be found in the @ref{Invoking
LilyPond}.
Finally, there is a script called lilypond-book, that allows you to
freely mix LilyPond input with Texinfo or LaTeX input. For example, this
-manual was written using lilypond-book.
+manual was written using lilypond-book. lilypond-book is discussed in
+@ref{lilypond-book}.
@unnumberedsubsec Windows
denoted by @code{c} and @code{c,} respectively.
@cindex relative
-For pitches in a long piece you might have to type many quotes. To
-remedy this, LilyPond has a ``relative'' octave entry mode. In this
-mode, octaves of notes without quotes are chosen such that a note is
-as close as possible (graphically, on the staff) to the the preceding
-note. If you add a high-quote an extra octave is added. The lowered
-quote (a comma) will subtract an extra octave. Because the first note
-has no predecessor, you have to give the (absolute) pitch of the note
-to start with.
+For pitches in a long piece you might have to type many quotes. It is
+easy to make typing errors with this, so LilyPond has a special entry
+mode to remedy this. In this ``relative'' octave mode, octaves of notes
+without quotes are chosen such that a note is as close as possible
+(graphically, on the staff) to the the preceding note. If you add a
+high-quote an extra octave is added. The lowered quote (a comma) will
+subtract an extra octave. Because the first note has no predecessor,
+you have to give the (absolute) pitch of the note to start with.
@example
\sequential @{
@node Lyrics and chords
@section Lyrics and chords
-In this section we show how to typeset a song.@footnote{The author would
-welcome information about the origin of this song.}. This file is
+In this section we show how to typeset a song. This file is
included as @file{flowing.ly}.
@example
@end example
-The result would look this@footnote{The titling and font size shown
+The result would look this.@footnote{The titling and font size shown
may differ, since the titling in this document is not generated by
-@file{ly2dvi}.}.
+@file{ly2dvi}.}
@center @strong{The river is flowing}
@center Traditional
@center @strong{Two miniatures}
@flushright
- Opus 1.
+Opus 1.
@end flushright
@flushleft
@var{Up}
}
@end lilypond
@flushright
- Opus 2.
+Opus 2.
@end flushright
@flushleft
@var{Down}
@node An orchestral score
@section An orchestral score
-[ LOTS TODO
-* Orchestral: demonstrate Hara-Kiri, part combining, part extraction,
-scores, transposition, instrument names,
-]
+If you've come this far, you should have seen enough LilyPond source to
+feel comfortable with an orchestral score. We will not go through the
+input line by line, but only indicate and explain the new elements.
-Hopefully, you have seen enough LilyPond input examples by now to be
-able read the input for a full orchestral score. We will not go through
-the input line by line, but only indicate and explain the new elements.
+This orchestral score example consists of three input files. In the
+first file, @file{os-music.ly}, we define the music for all instruments.
+This file is to be used by the other two files, as you will see below.
+If you run lilypond on this file, no output will be produced.
-@lilypond[verbatim]
-\version "1.3.130";
-\include "paper13.ly";
+@example
+% os-music.ly
+\header @{
+ title = "Zo, goed lieverd?";
+ subtitle = "How's, this babe?";
+ composer = "JCN";
+ opus = "1";
+ piece = "Laid back";
+@}
+global = @{
+ \time 2/4;
+ \skip 2*4; \bar "|.";
+@}
+Key = \notes \key as \major;
+flautoI = \notes\relative c'' @{
+ f8 g f g f g f g
+ bes as bes as bes as bes as
+@}
+flautoII = \notes\relative c'' @{
+ as8 bes as bes R1 d4 ~ d
+@}
+tromboI = \notes\relative c'' @{
+ c4. c8 c8 c4. es4 R1*1/2 es4
+@}
+tromboII = \notes\relative c'' @{
+ as4. as8 as8 as4. R1*1/2 as4 es'
+@}
+timpani = \notes\relative c, @{
+ \times 2/3 @{ f4 f f @}
+ \times 4/5 @{ as8 as as as as @}
+@}
+corno = \notes\relative c' @{
+ bes4 d f, bes d f, bes d
+@}
+@end example
-% #(set! point-and-click #t)
+Things to note here are the definition of @code{\global} where we define
+meter, and set the end bar. And the separate definition of @code{\Key}
+that we will use all staffs except staffs for transposing instruments.
-% Coriolan 218-222
-flautoI = \notes\relative c'' {
- \property Score.currentBarNumber = #218
- des2.()c4|e(f e)f|\break
- r2 des4\sf()c|r2 des4\sf()c|
-}
-flautoII = \notes\relative c'' {
- g2.()as4|bes(as bes)as|
- R1*2
-}
-oboeI = \notes\relative c'' {
- e2.()f4|e(f e)f|
- r2 as|r as\sf|
-}
-oboeII = \notes\relative c'' {
- g2.()as4|bes(as bes)as|
- r2 as'|r as\sf|
-}
-clarinettoI = \notes\relative c' {
- es2.()d4|c(bis c)bes|
-% r2 es4\sf()d|r2 es4\sf()d|
-}
-clarinettoII = \notes\relative c' {
- es2.()d4|c(bes c)bes|
-% r2 es'4\sf()d|r2 es4\sf()d|
-}
-fagottoI = \notes\relative c' {
- bes2.()as4|g(f g)f|
- r r8 des' des4\sf()es|r r8 des des4\sf()es|
-}
-fagottoII = \notes\relative c' {
- bes2.()as4 | g(f g)f|
- f4 r r2 | f4 r r2|
-}
-cornoI = \notes\relative c''' {
- g2. f4|g f g f|
-% r4 r8 f f2|r4 r8 f f2|
-}
-cornoII = \notes\relative c''' {
- g,2. d'4|g, d' g, d'|
- r4 r8 d d4\sf()es|r4 r8 d d4\sf()es|
-}
-tromboI = \notes\relative c'' {
- c2. c4|c c c c|
- R1*2|
-}
-tromboII = \notes\relative c' {
- c2. c4|c c c c|
- R1*2|
-}
-timpani = \notes\relative c {
- c2:16 c4 c|c c c c |
- R1*2|
-}
-violinoI = \notes\relative c' {
- des'2:16\ff des4: c:|e,: f: e: f:|
- r8 as des,4\sf~des()c |r8 as' des,4\sf~des()c|
-}
-violinoII = \notes\relative c' {
- des2:16\ff des4: c: | bes: as: bes: as:|
-% r8 as des,4\sf ~ des()c| r8 as' des,4\sf ~ des()c|
-}
-violaI = \notes\relative c' {
- e2:16\ff e4: f:|b,: c: b: c:|
- r4 r8 as as2\sf|r4 r8 as as2\sf|
-}
-violaII = \notes\relative c' {
- bes2:16\ff bes4: as:|g: f: g: f: |
- r4 r8 f f4\sf()ges|r4 r8 f f4\sf()ges|
-}
-violoncello = \notes\relative c {
- bes2.\ff()as4|g( f g )f |
- r4 r8 f' f4\sf()ges |r4 r8 f f4\sf()ges |
-}
-contrabasso = \notes\relative c {
- bes2.\ff()as4|g( f g )f|
- f4 r r2 |f'4 r r2|
-}
+The second file, @file{os-score.ly} reads the definitions of the first
+(@file{os-music.ly}), and defines the @code{\score} block for the full
+conductor's score.
-#(define text-flat '((font-relative-size . -2) (music "accidentals--1")))
-
-staffCombinePianoStaffProperties = {
- \property PianoStaff.devNullThread = #'()
- \property PianoStaff.soloADue = ##t
- \property PianoStaff.soloText = #""
- \property PianoStaff.soloIIText = #""
- % This is non-conventional, but currently it is
- % the only way to tell the difference.
- \property PianoStaff.aDueText = #"\\`a2"
- \property PianoStaff.splitInterval = #'(1 . 0)
- \property PianoStaff.changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1))
- \property PianoStaff.noDirection = ##t
-}
+@example
+% os-score.ly
+\include "os-music.ly";
+\include "paper13.ly";
-%%
-%% Hmm, can't we move this to a `template.ly'
-%%
-\score {
- <
- \context StaffGroup = wood <
+#(set! point-and-click #t)
+#(define text-flat '((font-relative-size . -2)
+ (music "accidentals--1")))
+
+\score @{
+ <
+ \global
+ \context StaffGroup = woodwind <
\context Staff = flauti <
\property Staff.midiInstrument = #"flute"
\property Staff.instrument = "2 Flauti"
\property Staff.instr = "Fl."
- \context Voice=one \partcombine Voice
- \context Thread=one \flautoI
- \context Thread=two \flautoII
- >
- \context Staff = oboes <
- \property Staff.midiInstrument = #"oboe"
- \property Staff.instrument = "2 Oboi"
- \property Staff.instr = "Ob."
- \context Voice=one \partcombine Voice
- \context Thread=one \oboeI
- \context Thread=two \oboeII
- >
- \context Staff = clarinets <
- \property Staff.midiInstrument = #"clarinet"
- \property Staff.instrument = #`(lines
- "2 Clarinetti" (rows "(B" ,text-flat ")"))
- \property Staff.instr = #`(lines
- "Cl." (rows "(B" ,text-flat ")"))
- \property Staff.transposing = #-2
- \notes \key f \major;
- \context Voice=one \partcombine Voice
- \context Thread=one \clarinettoI
- \context Thread=two \clarinettoII
- >
- \context Staff = bassoons <
- \property Staff.midiInstrument = #"bassoon"
- \property Staff.instrument = "2 Fagotti"
- \property Staff.instr = "Fg."
- \clef bass;
- \context Voice=one \partcombine Voice
- \context Thread=one \fagottoI
- \context Thread=two \fagottoII
- >
- >
- \context StaffGroup = brass <
- \context Staff = frenchHorns <
- \property Staff.midiInstrument = #"french horn"
- \property Staff.instrument = #`(lines
- "2 Corni" (rows "(E" ,text-flat ")"))
- \property Staff.instr = #`(lines
- "Cor." (rows "(E" ,text-flat ")"))
- \property Staff.transposing = #3
- \notes \key c \major;
- \context Voice=one \partcombine Voice
- \context Thread=one \cornoI
- \context Thread=two \cornoII
- >
- \context Staff = trumpets <
- \property Staff.midiInstrument = #"trumpet"
- \property Staff.instrument = #`(lines
- "2 Trombe" (rows "(C)"))
- \property Staff.instr = #`(lines
- "Tbe." (rows "(C)"))
- \context Voice=one \partcombine Voice
- \context Thread=one \tromboI
- \context Thread=two \tromboII
+ \Key
+ \context Voice=one @{ \voiceOne \flautoI @}
+ \context Voice=two @{ \voiceTwo \flautoII @}
>
>
\context StaffGroup = timpani <
\context Staff = timpani <
\property Staff.midiInstrument = #"timpani"
- \property Staff.instrument = #'(lines
- "2 Timpani" "(C-G)")
+ \property Staff.instrument = #'(lines "Timpani" "(C-G)")
\property Staff.instr = #"Timp."
\clef bass;
+ \Key
\timpani
>
>
- \context StaffGroup = strings <
- \context GrandStaff = violins <
- \context Staff = viI <
- \property Staff.midiInstrument = #"violin"
- \property Staff.instrument = "Violino I"
- \property Staff.instr = "Vi. I"
- \violinoI
- >
- \context Staff = viII <
- \property Staff.midiInstrument = #"violin"
- \property Staff.instrument = "Violino II"
- \property Staff.instr = "Vi. II"
- \violinoII
- >
- >
- \context Staff = vla <
- \property Staff.midiInstrument = #"viola"
- \property Staff.instrument = "Viola"
- \property Staff.instr = "Vla."
- \clef alto;
+ \context StaffGroup = brass <
+ \context Staff = trombe <
+ \property Staff.midiInstrument = #"trumpet"
+ \property Staff.instrument = #`(lines "2 Trombe" "(C)")
+ \property Staff.instr = #`(lines "Tbe." "(C)")
+ \Key
\context Voice=one \partcombine Voice
- \context Thread=one \violaI
- \context Thread=two \violaII
+ \context Thread=one \tromboI
+ \context Thread=two \tromboII
>
- \context PianoStaff=bass <
- \staffCombinePianoStaffProperties
- \context Staff=one <
- \property Staff.midiInstrument = #"cello"
- \property Staff.instrument = #'(lines
- "Violoncello" " e" "Contrabasso")
- \property Staff.instr = "Vc."
- \clef bass;
- >
- \context Staff=two <
- \property Staff.midiInstrument = #"contrabass"
- \property Staff.instrument = "Contrabasso"
- \property Staff.instr = "C.B."
- \clef bass;
- \skip 1*4; % sustain clef
- >
- \context Staff=one \partcombine Staff
- \context Voice=one \violoncello
- \context Voice=two \contrabasso
+ \context Staff = corni <
+ \property Staff.midiInstrument = #"french horn"
+ \property Staff.instrument = #`(lines "Corno"
+ (rows "(E" ,text-flat ")"))
+ \property Staff.instr = #`(lines "Cor."
+ (rows "(E" ,text-flat ")"))
+ \property Staff.transposing = #3
+ \notes \key bes \major;
+ \context Voice=one \corno
>
>
>
- \paper {
- \paperThirteen
- linewidth = 80 * \staffspace;
- textheight = 200 * \staffspace;
- \translator{
+ \paper @{
+ indent = 15 * \staffspace;
+ linewidth = 60 * \staffspace;
+ textheight = 90 * \staffspace;
+ \translator@{
\ThreadContext
\consists "Rest_engraver";
-
- % Set value for engraver at thread level,
- % to override the default that is set in ScoreContext
- % for added engraver at Voice level
- devNullThread = #'()
- }
- \translator{
+ @}
+ \translator@{
\VoiceContext
\remove "Rest_engraver";
-
- % The staff combine (bassi part) needs a
- % thread_devnull_engraver here.
- % Instead of maintaining two separate hierarchies,
- % we switch add it, but switch it off immediately.
- % --> move to Score level to be able to override
- % The staff combine part switches it on.
-
- %% devNullThread = #'never
- \consists "Thread_devnull_engraver";
- }
- \translator{
+ @}
+ \translator@{
\HaraKiriStaffContext
- \consists "Mark_engraver";
- }
- \translator {
+ @}
+ \translator @{
\OrchestralScoreContext
- % skipBars = ##t
-
- soloText = #"I."
- soloIIText = #"II."
- % By default, turn off the Thread_devnull_engraver
- % at Voice level
- devNullThread = #'never
-
- % Hmm
- currentBarNumber = #218
BarNumber \override #'padding = #3
- RestCollision \override #'maximum-rest-count = #1
- TimeSignature \override #'style = #'C
- }
- }
-}
-@end lilypond
+ @}
+ @}
+ \midi @{
+ \tempo 4 = 75;
+ @}
+@}
+@end example
+
+@center @strong{Zo, goed lieverd?}
+@sp 1
+@center How's, this babe?
+@flushright
+Opus 1.
+@end flushright
+@flushleft
+@sc{Laid back}
+@end flushleft
-Ok, so explain:
+@lilypondfile{os-score.ly}
+First, we need to include the music definitions we made in
+@file{os-music.ly}.
@example
-% #(set! point-and-click #t)
+\include "os-music.ly";
@end example
+In a large orchestral score like this you're bound to make some small
+mistakes, so we enable point and click (See @ref{Point and click})
+editing.
@example
-#(define text-flat '((font-relative-size . -2) (music "accidentals--1")))
+#(set! point-and-click #t)
@end example
+We need a flat sign in text to name the tuning of the french horn, so we
+predefine it with bit of scheme markup text (See @ref{Text markup}).
@example
-staffCombinePianoStaffProperties = @{
+#(define text-flat '((font-relative-size . -2)
+ (music "accidentals--1")))
@end example
+Of course, all staffs are simultaneous and use the same global settings.
@example
-% Coriolan 218-222
+ <
+ \global
@end example
+Then, we start a new staff group for the woodwind section (just the
+flutes in this case). Immediately after that, we start the staff for
+the two flutes, that also play simultaneously.
@example
-flautoI = \notes\relative c'' @{
+ \context StaffGroup = woodwind <
+ \context Staff = flauti <
@end example
+We specify the intrument for MIDI output (see @ref{MIDI instrument
+names}).
@example
- \property Score.currentBarNumber = #218
+ \property Staff.midiInstrument = #"flute"
@end example
+And define the intrument names to be printed in the margin,
+@code{instrument} for the first line of the score, @code{instr} for the
+rest of the score.
@example
-flautoII = \notes\relative c'' @{
+ \property Staff.instrument = "2 Flauti"
+ \property Staff.instr = "Fl."
@end example
-[skip]
-
-
-The hairyness of Staff combining
-
+The flutes play in the default key.
@example
- \property PianoStaff.devNullThread = #'()
+ \Key
@end example
+Last come the actual flute parts. Remember that we're still in
+simultaneous mode. We name both voices differently, so that LilyPond
+will actually create two Voice contexts. The flute parts are simple, so
+we specify manually which voice is which: @code{\voiceOne} forces the
+direction of stems, beams, slurs and ties up, @code{\voiceTwo} sets
+directions down.
@example
- \property PianoStaff.soloADue = ##t
+ \context Voice=one @{ \voiceOne \flautoI @}
+ \context Voice=two @{ \voiceTwo \flautoII @}
@end example
+We close the flutes staff and woodwind staff group.
@example
- \property PianoStaff.soloText = #""
- \property PianoStaff.soloIIText = #""
+ >
+ >
@end example
+The timpani staff only shows a new piece of scheme markup, it sets two
+lines of text.
@example
- % This is non-conventional, but currently it is
- % the only way to tell the difference.
- \property PianoStaff.aDueText = #"\\`a2"
+ \property Staff.instrument = #'(lines "Timpani" "(C-G)")
@end example
+For the trumpets we use the automatic part combiner (see @ref{Automatic
+part combining}) to combine the two simultaneous trumpet parts onto the
+trumpet staff. Each trumpet gets its own Thread context, which must be
+named @code{one} and @code{two}). The part combiner makes these two
+threads share a Voice when they're similar, and splits the threads up
+when they're different.
@example
- \property PianoStaff.splitInterval = #'(1 . 0)
- \property PianoStaff.changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1))
+ \context Voice=one \partcombine Voice
+ \context Thread=one \tromboI
+ \context Thread=two \tromboII
@end example
+The french horn has the most complex scheme markup name, made up of two
+lines of text. The second line has two elements (rows), the @code{E}
+and the flat sign @code{text-flat} that we defined before.
@example
- \property PianoStaff.noDirection = ##t
+ \property Staff.instrument = #`(lines "Corno"
+ (rows "(E" ,text-flat ")"))
@end example
-
+The french horn is to be tuned in E-flat, so we tell the MIDI backend to
+transpose this staff by three steps.
@example
-\score @{
- <
+ \property Staff.transposing = #3
@end example
+Therefore, it has a different key.
@example
- \context StaffGroup = wood <
+ \notes \key bes \major;
@end example
+We specify a big indent for the first line and a small linewith for this
+tuturial.
@example
- \context Staff = flauti <
+ indent = 15 * \staffspace;
+ linewidth = 60 * \staffspace;
@end example
+Because we have a Thread representing one instument, we move the
+need the @code{Rest_engraver} from Voice to Thread level.
@example
- \property Staff.midiInstrument = #"flute"
+ \translator@{
+ \ThreadContext
+ \consists "Rest_engraver";
+ @}
+ \translator@{
+ \VoiceContext
+ \remove "Rest_engraver";
+ @}
@end example
+In orchestral scores, it often happens that one instrument has only
+rests during one line of the score. The @code{HaraKiriStaffContext} can
+be used as a regular @code{StaffContext} drop-in and will take care of
+the automatic removing of empty staffs.
@example
- \property Staff.instrument = "2 Flauti"
- \property Staff.instr = "Fl."
+ \translator@{
+ \HaraKiriStaffContext
+ @}
@end example
+We want bar numbering at score level and want to move the bar number a
+few staff spaces up.
@example
- \context Voice=one \partcombine Voice
- \context Thread=one \flautoI
- \context Thread=two \flautoII
- >
+ \translator @{
+ \OrchestralScoreContext
+ BarNumber \override #'padding = #3
+ @}
@end example
-[skip]
+@node Part extraction
+@section Part extraction
-@example
- \property Staff.instrument = #`(lines
- "2 Clarinetti" (rows "(B" ,text-flat ")"))
-@end example
+The third file, @file{os-flute-2.ly} also reads the definitions of the
+first (@file{os-music.ly}), and defines the @code{\score} block for the
+second flute part.
@example
- \property Staff.instr = #`(lines
- "Cl." (rows "(B" ,text-flat ")"))
+\include "os-music.ly";
+\include "paper16.ly";
+
+\score @{
+ \context Staff <
+ \property Staff.midiInstrument = #"flute"
+ \global
+ \Key
+ \flautoII
+ >
+ \header @{
+ instrument = "Flauto II";
+ @}
+ \paper @{
+ linewidth = 80 * \staffspace;
+ textheight = 200 * \staffspace;
+ \translator @{
+ \OrchestralScoreContext
+ skipBars = ##t
+ @}
+ @}
+ \midi @{
+ \tempo 4 = 75;
+ @}
+@}
@end example
+@center @strong{Zo, goed lieverd?}
+@sp 1
+@center How's, this babe?
+@center @emph{Flauto II}
+@flushright
+Opus 1.
+@end flushright
+@flushleft
+@sc{Laid back}
+@end flushleft
+@lilypondfile{os-flute-2.ly}
+
+
+Because we separated the music definitions from the @code{\score}
+instantiations, we can easily define a second score from the music of
+the second flute. This then is the part for the second flute player.
+Of course, we make separate parts for all individual instruments.
+
+In this individual part the second flute has a whole staff for itself,
+so we don't want to force stem or tie directions.
@example
- \property Staff.transposing = #-2
+ \flautoII
@end example
+The @code{\header} definitions were also read from @file{os-music.ly},
+but we need to set the instrument for this particular score.
@example
- \notes \key f \major;
+ \header @{
+ instrument = "Flauto II";
+ @}
@end example
+In the conductor's full score, all bars with rests are printed, but for
+the individual parts, we want to contract pieces of consecutive empty
+bars.
@example
+ skipBars = ##t
@end example
-[the syntax of staff combining]
-[the paper block]
-
@node end of tutorial
@section The end