]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/tutorial.itely
patch::: 1.3.137.jcn4
[lilypond.git] / Documentation / user / tutorial.itely
index 286cf7d2649bff7af29bb5d78be1a540338cc1c0..aa10de9e43b40588b7d16f43be06cf22a257381f 100644 (file)
@@ -933,7 +933,7 @@ not generated by ly2dvi, so details will differ.}
 
 @center @strong{Two miniatures}
 @flushright
-  Opus 1.
+Opus 1.
 @end flushright
 @flushleft
 @var{Up}
@@ -946,7 +946,7 @@ not generated by ly2dvi, so details will differ.}
   }
 @end lilypond
 @flushright
-  Opus 2.
+Opus 2.
 @end flushright
 @flushleft
 @var{Down}
@@ -1446,16 +1446,22 @@ 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.
 
-% os-music.ly
-@quotation
+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.
+
+
 @example
+% os-music.ly
 \header @{
   title = "Zo, goed lieverd?";
   subtitle = "How's, this babe?";
   composer = "JCN";
+  opus = "1";
   piece = "Laid back";
 @}
-global = \notes @{
+global = @{
   \time 2/4;
   \skip 2*4; \bar "|.";
 @}
@@ -1481,12 +1487,17 @@ corno = \notes\relative c' @{
    bes4 d f, bes d f, bes d
 @}
 @end example
-@end quotation
 
-% geen titels, wat jammer :-(
+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. 
+
+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.
+
+@example
 % os-score.ly
-@quotation
-@lilypond[verbatim]
 \include "os-music.ly";
 \include "paper13.ly";
 
@@ -1494,8 +1505,8 @@ corno = \notes\relative c' @{
 #(define text-flat '((font-relative-size . -2)
          (music "accidentals--1")))
 
-\score {
-  \notes <
+\score @{
+  <
     \global
     \context StaffGroup = woodwind <
       \context Staff = flauti <
@@ -1503,8 +1514,8 @@ corno = \notes\relative c' @{
        \property Staff.instrument = "2 Flauti"
        \property Staff.instr = "Fl."
         \Key
-       \context Voice=one { \voiceOne \flautoI }
-       \context Voice=two { \voiceTwo \flautoII }
+       \context Voice=one @{ \voiceOne \flautoI @}
+       \context Voice=two @{ \voiceTwo \flautoII @}
       >
     >
     \context StaffGroup = timpani <
@@ -1520,9 +1531,8 @@ corno = \notes\relative c' @{
     \context StaffGroup = brass <
       \context Staff = trombe <
        \property Staff.midiInstrument = #"trumpet"
-       \property Staff.instrument = #`(lines "2 Trombe"
-          (rows "(C)"))
-       \property Staff.instr = #`(lines "Tbe." (rows "(C)"))
+       \property Staff.instrument = #`(lines "2 Trombe" "(C)")
+       \property Staff.instr = #`(lines "Tbe." "(C)")
         \Key
        \context Voice=one \partcombine Voice
          \context Thread=one \tromboI
@@ -1540,65 +1550,263 @@ corno = \notes\relative c' @{
       >
     >
   >
-  \paper {
+  \paper @{
     indent = 15 * \staffspace;
     linewidth = 60 * \staffspace;
     textheight = 90 * \staffspace;
-    \translator{
+    \translator@{
       \ThreadContext
       \consists "Rest_engraver";
-    }
-    \translator{
+    @}
+    \translator@{
       \VoiceContext
       \remove "Rest_engraver";    
-    }
-    \translator{
+    @}
+    \translator@{
       \HaraKiriStaffContext
-    }
-    \translator {
+    @}
+    \translator @{
       \OrchestralScoreContext
       BarNumber \override #'padding = #3
-    }
-  }
-  \midi {
+    @}
+  @}
+  \midi @{
     \tempo 4 = 75;
-  }
-}
-@end lilypond
-@end quotation
+  @}
+@}
+@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
+
+@lilypondfile{os-score.ly}
+
+First, we need to include the music definitions we made in
+@file{os-music.ly}.
+@example
+\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
+#(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
+#(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
+  <
+    \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
+    \context StaffGroup = woodwind <
+      \context Staff = flauti <
+@end example
+
+We specify the intrument for MIDI output (see @ref{MIDI instrument
+names}).
+@example
+       \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
+       \property Staff.instrument = "2 Flauti"
+       \property Staff.instr = "Fl."
+@end example
+
+The flutes play in the default key.
+@example
+        \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
+       \context Voice=one @{ \voiceOne \flautoI @}
+       \context Voice=two @{ \voiceTwo \flautoII @}
+@end example
+
+We close the flutes staff and woodwind staff group.
+@example
+      >
+    >
+@end example
+
+The timpani staff only shows a new piece of scheme markup, it sets two
+lines of text.
+@example
+       \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
+       \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 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
+       \property Staff.transposing = #3
+@end example
+
+Therefore, it has a different key.
+@example
+       \notes \key bes \major;
+@end example
+
+We specify a big indent for the first line and a small linewith for this
+tuturial.
+@example
+    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
+    \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
+    \translator@{
+      \HaraKiriStaffContext
+    @}
+@end example
+
+We want bar numbering at score level and want to move the bar number a
+few staff spaces up.
+@example
+    \translator @{
+      \OrchestralScoreContext
+      BarNumber \override #'padding = #3
+    @}
+@end example
 
 @node Part extraction
 @section Part extraction
 
-@quotation
-@lilypond[verbatim]
+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
 \include "os-music.ly";
 \include "paper16.ly";
 
-\score {
+\score @{
   \context Staff <
     \property Staff.midiInstrument = #"flute"
     \global
     \Key
     \flautoII
   >
-  \header {
-    instrument = "flute I";
-  }
-  \paper {
+  \header @{
+    instrument = "Flauto II";
+  @}
+  \paper @{
     linewidth = 80 * \staffspace;
     textheight = 200 * \staffspace;
-    \translator {
+    \translator @{
       \OrchestralScoreContext
       skipBars = ##t
-    }
-  }
-  \midi {
+    @}
+  @}
+  \midi @{
     \tempo 4 = 75;
-  }
-}
-@end lilypond
-@end quotation
+  @}
+@}
+@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
+    \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
+  \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
 
 @node  end of tutorial
 @section The end