Move instrument names to separate include file
[orchestrallily.git] / Documentation / orchestrallily.tely
blob218f97f8f21754c00026b1f27ef349c9dfde769d
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename orchestrallily.info
4 @settitle The OrchestralLily package for Lilypond
5 @afourpaper
6 @c %**end of header
8 @documentencoding UTF-8
9 @documentlanguage en
11 @macro lilyverb{TEXT}
12 @quotation
13 @verbatim
14 \TEXT\
15 @end verbatim
16 @end quotation
17 @end macro
19 @macro bs
21 @end macro
23 @c *******************************************************
24 @c **               COPYRIGHT INFORMATION               **
25 @c *******************************************************
27 @copying
28 This is the documentation of the OrchestralLily package for Lilypond, the GNU music
29 typesetting application.
31 Copyright @copyright{} 2008 @uref{http://reinhold.kainhofer.com,Reinhold Kainhofer}, @email{reinhold@@kainhofer.com}
32 @end copying
35 @c *******************************************************
36 @c **                     TITLEPAGE                     **
37 @c *******************************************************
39 @titlepage
40 @title OrchestralLily
41 @subtitle A Lilypond package for orchestral scores.
42 @author @uref{http://reinhold.kainhofer.com,Reinhold Kainhofer}, @email{reinhold@@kainhofer.com}
44 @c The following two commands start the copyright page.
45 @page
46 @vskip 0pt plus 1filll
47 @insertcopying
48 @setcontentsaftertitlepage
49 @end titlepage
51 @c Output the table of contents at the beginning.
52 @contents
56 @c *******************************************************
57 @c **                      TOP NODE                     **
58 @c *******************************************************
60 @comment  @ifnottex
61 @node Top
62 @top The OrchestralLily Package
64 @itemize
65 @item @b{Description}: A @uref{http://www.lilypond.org/, Lilypond} package to easily generate orchestral scores and other complex scores.
66 @item @b{Author}: @uref{http://reinhold.kainhofer.com/,Reinhold Kainhofer}, @email{reinhold@@kainhofer.com}
67 @item @b{Date}: June 2008
68 @item @b{Download}: @uref{http://wiki.kainhofer.com/_media/lilypond/orchestrallily.ly,orchestrallily.ly, (Version 0.03@comma{} 2008-06-24)}, licensed under the GPL v3.0
69 @item @b{Development version}:
70 @itemize 
71 @item Web-Frontend: @uref{http://repo.or.cz/w/orchestrallily.git}
72 @item read-only git URL: git://repo.or.cz/orchestrallily.git (use git clone URL)
73 @end itemize
74 @item @b{Documentation}: @uref{index.html,HTML (one page per section)}, @uref{orchestrallily-bigpage.html,HTML (Single page)}, @uref{orchestrallily.pdf,PDF}
75 @end itemize
77 @comment @end ifnottex
79 @menu
80 @comment  * About OrchestralLily and Download::
81 * Motivation::
82 * Simple example::
83 * Extended example::
84 * Structure of a score::
85 * What OrchestralLily does::
86 * Suffixes in use::
87 * Simple examples::
88 * Settings defined by OrchestralLily::
89 * Available functions::
90 * Extending OrchestralLily::
91 * Frequently asked questions::
92 * Version History::
93 * Known limitations and missing features::
94 * Credits::
95 * OrchestralLily index::
96 @end menu
99 @c *******************************************************
100 @c **                      CONTENT                      **
101 @c *******************************************************
103 @comment  @node About OrchestralLily and Download
104 @comment  @chapter About OrchestralLily and Download
105 @comment 
106 @comment  @itemize
107 @comment  @comment  @comment  @item @b{Description}: A @uref{http://www.lilypond.org/, Lilypond} package to easily generate orchestral scores and other complex scores.
108 @comment  @item @b{Author}: @uref{http://reinhold.kainhofer.com/,Reinhold Kainhofer}, @email{reinhold@@kainhofer.com}
109 @comment  @item @b{Date}: February 2008
110 @comment  @item @b{Download}: @uref{http://wiki.kainhofer.com/_media/lilypond/orchestrallily.ly,orchestrallily.ly, (Version 0.02@comma{} 2008-03-06)}, licensed under the GPL v3.0
111 @comment  @end itemize
114 @node Motivation
115 @chapter Motivation
117 Orchestral scores might have a quite complicated structure, which is cumbersome to construct manually, in particular since each movement will have the same structure. The OrchestralLily package for @uref{http://www.lilypond.org/,Lilypond} aids you by adding some more magic to lilypond's already existing magic: You only define the structure of the whole piece once, you define the music that each instrument plays in each movement, and lilypond will do the rest. In particular, OrchestralLily will
118 @itemize
119 @item generate appropriate staves and staff groups
120 @item collate them in the proper (defined) order
121 @item add correct instrument names (if defined by the user)
122 @item add movement titles (if defined)
123 @item add a header "Movement name tacet" in an instrumental score for each movement where the instrument rests
124 @item add correct clefs, keys, time sigatures, transpositions and other settings to each staff (if defined by the user)
125 @item etc.
126 @end itemize
127 This way, generating full scores, scores for individual instruments and for instrument groups are really simple and no additional manual work!
130 As you can imagine, if you have lots of parts and lots of instruments, the number of similar staves/scores simply multiply (e.g. for 12 parts with 23 instruments, you'll have 12*23=276 individual staves, not counting any staff groups!). If you also want to include cue notes into the instrumental scores, you'll define a separate staff or score for the full score, where you call killCues. Thus the number will automatically double! 
132 As they all look really similar, why not automate their creation instead of manually writing them? That is exactly where OrchestralLily comes in.
135 @node Simple example
136 @chapter A simple example
138 Assume you have a piece called "Dada" with soprano solo (including lyrics) and violoncello. You might want to create a score for soprano only, one for cello one, one including both, a cello score including soprano (but in smaller size), etc.
140 We will call the soprano staff @code{SSolo} and the cello staff @code{Vc}. First, we need to define the music and lyrics for each, as well as the score structure. These will go into one file, say @code{dada-defs.ly}:
141 @quotation
142 @verbatiminclude dada-defs.ly
143 @end quotation
145 For each scores (full score, instrumental score, etc.), we write one additional file to generate the score.
148 Notice that all variables have a similar structure: First comes "Dada", then the instrument name ("SSolo" or "Vc"), and finally an indicator ("Settings", "Clef", "Music", "Lyrics", ...). For some of the variables, the instrument or the piece name is left out (This is only important for works with multiple pieces / movements, where you want one variable used in multiple pieces). Also notice that in the full score we have also added a "Percussion" instrument, but haven't defined any music for it (because e.g. it will only play in the second movement, which we haven't written yet). OrchestralLily will then simply ignore this instrument in the "Dada" part of the work.
150 Finally, the call @code{\orchestralScoreStructure} defines a FullScore and an InvertedScore with SSolo and Vc as children. This call tells OrchestralLily how the structure of your score looks like.
152 The above definitions are all that is needed by OrchestralLily to generate all various kinds of scores!
154 @lilypond[quote,verbatim,staffsize=14,line-width=8.0\cm]
155 \version "2.11.40"
156 \include "dada-defs.ly"
158 % the soprano score:
159 \createScore #"Dada" #'("SSolo")
161 % the Vc score:
162 \createScore #"Dada" #'("Vc")
164 % the percussion score, no notes defined -> Tacet
165 \createScore #"Dada" #'("Percussion")
167 % the full score:
168 \createScore #"Dada" #'("FullScore")
169 @end lilypond
171 The actual score creation is done with a call to @code{\createScore}, with the part name ("Dada" in our case) as the first argument and a list of instrument / staff group identifiers as second argument.
175 Now, suppose we want to generate a score for Vc, including the soprano staff in smaller size. This is also really simple in OrchestralLily:
177 @lilypond[quote,verbatim]
178 \version "2.11.40"
179 \include "dada-defs.ly"
181 \header { instrument = \VcInstrumentName }
183 % For the SSolo staff, use a smaller staff size!
184 DadaSSoloSettings = {
185     \DadaSettings 
186     \set fontSize = #-4
187     \override Staff.StaffSymbol #'staff-space = #(magstep -4)
190 \createScore #"Dada" #'("InvertedScore")
191 @end lilypond
194 In full scores, the violoncello and contrabass staff is typically shown with a bracket (StaffGroup) of their own, and the solo staves are shown without any bracket. To achieve this, all you have to do is to define the correct score structure (including a VcB staff group, consisting only of the Vc staff):
196 @lilypond[quote,verbatim]
197 \version "2.11.40"
198 \include "dada-defs.ly"
200 \orchestralScoreStructure #'(
201   ("VcB" StaffGroup ("Vc"))
202   ("FullScore" ParallelMusic ("Percussion" "SSolo" "VcB"))
205 \createScore #"Dada" #'("FullScore")
206 @end lilypond
209 Although it was not explicitly shown in this simple example, OrchestralLily of course supports also nested staff groups.
211 @node Extended example
212 @chapter Extended example: Multiple pieces
214 The whole power of OrchestralLily, however, becomes unleashed only for pieces with multiple movements/sub-parts. Let us now add a second song "Didi", with only Timpani and Soprano Solo, as well as a third song "Dodo" with all instruments playing. For this, we have to add the corresponding music to the definitions file @b{dadafull-defs.ly}, which becomes:
216 @quotation
217 @verbatiminclude dadafull-defs.ly
218 @end quotation
220 After these definitions, we can easily generate individual instrumental scores, as well as a full score:
221 @lilypond[quote,verbatim]
222 \version "2.11.40"
223 \include "dadafull-defs.ly"
225 \header { instrument = \TimInstrumentName }
227 \createScore #"Dada" #'("Tim")
228 \createScore #"Didi" #'("Tim")
229 \createScore #"Dodo" #'("Tim")
230 @end lilypond
232 @lilypond[quote,verbatim]
233 \version "2.11.40"
234 \include "dadafull-defs.ly"
236 \header { instrument = \SSoloInstrumentName }
238 \createScore #"Dada" #'("SSolo")
239 \createScore #"Didi" #'("SSolo")
240 \createScore #"Dodo" #'("SSolo")
241 @end lilypond
243 @lilypond[quote,verbatim]
244 \version "2.11.40"
245 \include "dadafull-defs.ly"
247 \header { instrument = \VcInstrumentName }
249 \createScore #"Dada" #'("Vc")
250 \createScore #"Didi" #'("Vc")
251 \createScore #"Dodo" #'("Vc")
252 @end lilypond
254 @lilypond[quote,verbatim]
255 \version "2.11.40"
256 \include "dadafull-defs.ly"
258 \createScore #"Dada" #'("FullScore")
259 \createScore #"Didi" #'("FullScore")
260 \createScore #"Dodo" #'("FullScore")
261 @end lilypond
265 @node Structure of a score
266 @chapter Structure of a score, naming staff groups
268 @float
269 @image{score_structure,,,A typical score hierarchy}
270 @end float
271 A full score typically consists of several levels of staves and staff groupings, which can also be understood as a hierarchy of staves. We will assign each level in this hierarchy an identifier (written in red in the example). For example, the score on the left has the tree:
272 @itemize
273   @item "FullScore" (parallel staves/groups)
274   @itemize
275     @item "Woodwinds" (staff group)
276     @itemize
277       @item "Fl" (staff with two voices)
278       @item "Ob" (staff with two voices)
279     @end itemize
280     @item "Strings" (staff group)
281     @itemize
282       @item "Violins" (grand staff)
283       @itemize
284         @item "VI" (simple staff)
285         @item "VII" (simple staff)
286       @end itemize
287       @item "Va" (simple staff)
288     @end itemize
289     @item "Vocal" (parallel staves/groups)
290     @itemize
291       @item "Solo" (parallel staves)
292       @itemize
293         @item "SSolo" (simple staff)
294         @item "TSolo" (simple staff)
295       @end itemize
296       @item "Choir" (choir staff)
297       @itemize
298         @item "S" (simple staff)
299         @item "A" (simple staff)
300         @item "T" (simple staff)
301         @item "B" (simple staff)
302       @end itemize
303     @end itemize
304     @item "VcB" (staff group)
305     @itemize
306       @item "Vc" (simple staff)
307     @end itemize
308   @end itemize
309 @end itemize
310 So, the "FullScore" consists of parallel music of the following staves/groups: "Woodwinds", "Strings", "Vocal" and "VcB".
311 Similarly, "Choir" is a ChoirStaff and consists of the individual staves "S", "A", "T" and "B". To be able to generate such a score automatically, lilypond needs to know the structure of the tree. For this, it suffices to know the type and all children of each group, e.g. which staves/groups are direct children of "FullScore", which of "Vocal", etc. No information about the individual staves is needed yet.
313 @menu
314 * Hierarchies in OrchestralLily::
315 * Different staff types::
316 * Different voice types::
317 * Why giving each level a name::
318 @end menu
320 @node Hierarchies in OrchestralLily
321 @section How to define this hierarchy in OrchestralLily
323 This structure can be easily defined in OrchestralLily by calling @code{\orchestral-score-structure} with a simple list describing the hierarchy:
324 @example
325 \orchestral-score-structure #'(
326   ("FullScore" "SimultaneousMusic" ("Woodwinds" "Strings" "Vocal" "VcB"))
327   ("Woodwinds" "StaffGroup" ("Fl" "Ob"))
328   ("Fl" "PartCombinedStaff" ("FlI" "FlII"))
329   ("Ob" "PartCombinedStaff" ("ObI" "ObII"))
330   ("Strings" "StaffGroup" ("Violins" "Va"))
331   ("Violins" "GrandStaff" ("VI" "VII"))
332   ("Vocal" "SimultaneousMusic" ("Solo" "Choir"))
333   ("Solo" "SimultaneousMusic" ("SSolo" "TSolo"))
334   ("Choir" "ChoirStaff" ("S" "A" "T" "B"))
335   ("VcB" "StaffGroup" ("Vc"))
336   ; Staff types
337   ("Percussion" "RhythmicStaff" ())
339 @end example
340 Please note the apostrophe before the list! There are no apostrophes needed in front of the staff group types (because the whole is list is already quoted!).
342 Each entry of the list describes one grouping of staves or voices and has three possible forms:
343 @example
344      ; Staff group of given type
345   ("StaffID" "StaffGroupType" ("List" "of" "child" "identifiers"))
346      ; Staves connected without a bracket
347   ("StaffID" "SimultaneousMusic"|"ParallelMusic" ("List" "children" ))
348      ; One staff with multiple voices
349   ("StaffID" "ParallelVoicesStaff" ("List" "of" "voices"))
350      ; Staff with two part-combined voices
351   ("StaffID" "PartCombinedStaff" ("Two" "voices"))@c
352      ; Non-default staff type
353   ("StaffID" "StaffType" ())
354   ("StaffID" "StaffType" ("ChildVoiceName"))
355 @end example
356 The first entry creates a staff group of type @code{StaffGroupType} (e.g. @code{StaffGroup}, @code{GrandStaff}, @code{PianoStaff}, @code{ChoirStaff}), the second one (i.e. giving either "SimultaneousMusic" or "ParallelMusic" as staff type) creates parallel staves connected by a simple line, but no bracket. In lilypond syntax, this is equivalent to  @code{<< Staff1 Staff2 >>}.
357 The third and fourth forms are not really staff groups, but staves containing multiple voices. The third one with #f as staff type generates a staff with multiple voices (@code{\voiceOne}, @code{\voiceTwo}, etc.), possibly with lyrics, while the fourth one with #t (for combined=##t) as staff type staff with two part-combined voices (e.g. Flute 1 and Flute 2 combined in one staff for Flute). Internally, @code{\partcombine} is used for this (with all its limitations!).
359 If an identifier from the list of child identifiers is not defined in that hierarchy list, it is assumed to be a simple staff.
361 @node Different staff types
362 @section Different staff types
364 Lilypond supports more types than just ordinary staves: DrumStaff, FiguredBass, etc.
365 In OrchestralLily, the type of a staff (e.g. DrumStaff, RhythmicStaff, etc.) can
366 also be defined directly in the score structure by an entry like
367 @example
368      ; Non-default staff type
369   ("StaffID" "StaffType" ())
370   ("StaffID" "StaffType" ("ChildVoiceName"))
371 @end example
373 If "ChildVoiceName" is given, it is used as voice name (in particular, the music
374 is extracted from [Piece]ChildVoiceNameMusic), otherwise, the ID of the staff
375 is also taken for the Voice (the music is extracted from [Piece]StaffIDMusic).
377 @node Different voice types
378 @section Different voice types
380 Some staves and some music definitions need different contexts than Voice, which 
381 is used by default. For example, music defined with @code{\\drummode} needs to
382 be inside a @code{DrumVoice}, @code{\figuremode} inside @code{FiguredBass}, etc.
384 To set the type of context used for a voice in Orchestrallily, simply call 
385 @code{\orchestralVoiceTypes} with an association list defining the voice type 
386 for each voice ID. For example:
387 @example
388 \orchestralVoiceTypes #'(
389   ("Ix" "DrumVoice")
390   ("Iix" "FiguredBass")
392 @end example
396 @node Why giving each level a name
397 @section The advantage of giving each level a name
399 One of the advantages of assigning each group a name is that you can now tell OrchestralLily to generate e.g. a vocal score (containing only the "Vocal" staff group). Whether you want to generate an individual instrumental score, a full score, or a score for a group of instruments, is then no difference to OrchestralLily: You simply tell OrchestralLily to generate the score for a given identifier, and you will end up with the correct PDF. If you tell OrchestralLily to build the "FullScore" score, you'll get a score with the group named "FullScore" (which happens to be the full score), if you tell it to build "Fl", you'll get a score with just one staff, namely the one for the flutes. Similarly, to generate a pure choral score, simply tell OrchestralLily to build the score for the "Choir" group.
402 @node What OrchestralLily does
403 @chapter What OrchestralLily does
405 @menu
406 * How a score is generated::
407 * How a staff is generated::
408 * How a staff group is generated::
409 @end menu 
411 Say you have the following structure
412 @example
414   ("V" "GrandStaff" ("VI" "VII"))
415   ("Strings" "StaffGroup" ("V" "Va"))
416   ("FullScore" "ParallelMusic" ("Strings" "SSolo"))
418 @end example
419 in you score structure definition. This means you have two violins, one viola and a soprano solo.
422 @node How a score is generated
423 @section How a score is generated
425 If you call
426 @example
427 \createScore #"PieceA" #"FullScore"
428 @end example
429 in your lilypond file, OrchestralLily will generate a score for you that is similar to the following hand-written score:
430 @example
431 \score @{
432   <<
433     \PieceAStringsStaff
434     \PieceASSoloStaff
435   >>
436   \header @{ piece = \PieceA[FullScore]PieceName @}
438 @end example
439 If there exists e.g. a variable @code{\PieceAStringsStaff}, it is used, otherwise the staff (group) will be generated by OrchestralLily as described below.
441 If none of the sub-staves (and their sub-staves, etc.) contains any music, OrchestralLily will instead create a title to indicate no music is to be played:
442 @example
443 \markup \piece-title \PieceA[FullScore]PieceNameTacet
444 @end example
445 Here, piece-title is the function used by OrchestralLily to format piece headings. It simply returns the proper markup definition for the given string.
448 @node How a staff group is generated
449 @section How a staff group is generated
451 If there is no definition for @code{\PieceAStringsStaff}, it is generated (as a StaffGroup as defined in the score structure) by OrchestralLily and is equivalent to the following manual definition:
452 @example
453 \context StaffGroup = "\PieceAStringsSt" \with @{
454          instrumentName = \PieceAStringsInstrumentName
455          shortInstrumentName = \PieceAStringsShortInstrumentName 
456 @} <<
457   \PieceAVStaff
458   \PieceAVaStaff  
460 @end example
463 Again, if any of the @code{PieceAVStaff} or @code{PieceAVaStaff} variable is defined, it is inserted, otherwise the corresponding staff or staff group is created automatically (unless there is no music definition for it, in which case it is simply ignored). If any of the instrument name variables is not defined, the corresponding assignment is left out (without any error or warning message!).
465 If the definition of the Strings group in the score structure were a @code{ParallelMusic} or @code{SimultaneousMusic}, the generated code would be equivalent to
466 @example
468   \PieceAVStaff
469   \PieceAVaStaff  
471 @end example
472 without the possibility to have an instrument name attached.
475 @node How a staff is generated
476 @section How a staff is generated
478 If the staff for e.g. "SSolo" is not manually defined, OrchestralLily generates it in a form equivalent to
479 @example
480 \context Staff = "PieceASSoloSt" \with @{
481          instrumentName = \PieceASSoloInstrumentName
482          shortInstrumentName = \PieceASSoloShortInstrumentName 
483 @} <<
484   \context Voice = "PieceASSoloVoice" << 
485     \dynamicUp
486     \PieceA[SSolo]Settings
487     \[PieceA]SSoloClef
488     \PieceA[SSolo]Key
489     \PieceASSoloMusic
490   >>
491   \context Lyrics = "PieceASSoloLyrics" \lyricsto "PieceASSoloVoice" \PieceASSoloLyrics
493 @end example
495 If no lyrics are defined (i.e. the variable @code{\PieceASSoloLyrics} is not defined), the @code{\dynamicUp} as well as the lyrics context is left out. Similarly, if any of the variables shown above is not defined, it is simply left out without any warning or error. If no music is defined (e.g. the variable @code{\PieceASSoloMusic} is not defined), no staff will be generated and it will simply be left out in the parent group.
498 @node Suffixes in use
499 @chapter Suffixes in use
501 @multitable @columnfractions .25 .20 .20 .10 .25
502 @headitem @tab in Score  @tab in Staff group        @tab  in Staff
503 @headitem  Suffix @tab         @tab            @tab  StaffType  @tab  Parallel
504 @item @code{...PieceName}      @tab Title for the piece @tab  -  @tab  -  @tab  -
505 @item @code{...PieceNameTacet} @tab Piece title if no music is found @tab  -  @tab  -  @tab  -
506 @item @code{...Staff}          @tab Used as staff/group @tab  -  @tab  -  @tab  -
507 @headitem The following variables are only used if ...Staff is not defined (i.e. the staff is created by OrchestralLily):
508 @item @code{...Music}          @tab  -  @tab  -  @tab  -  @tab used as music for the staff
509 @item @code{...Lyrics}         @tab  -  @tab  -  @tab  -  @tab Lyrics assigned to music
510 @item @code{...Settings}       @tab  -  @tab  -  @tab  -  @tab music expression at beginning of staff
511 @item @code{...Clef}           @tab  -  @tab  -  @tab  -  @tab music expression at beginning of staff
512 @item @code{...Key}            @tab  -  @tab  -  @tab  -  @tab music expression at beginning of staff
513 @item @code{...TimeSignature}  @tab  -  @tab  -  @tab  -  @tab music expression at beginning of staff
514 @item @code{...TransposeTo}    @tab  -  @tab  -  @tab  -  @tab pitch, definition position of middle c' for the piece
515 @item @code{...InstrumentName} @tab  -  @tab assigned as instr. name @tab  -  @tab assigned as instr. name  
516 @item @code{...ShortInstrumentName} @tab  -  @tab assigned as instr. name @tab  -  @tab assigned as instr. name
517 @item @code{...MidiInstrument} @tab  -  @tab assigned as MIDI instr. @tab  -  @tab assigned as MIDI instr.
518 @end multitable
520 The order in which these variables are looked up is also relevant. If you are printing the score for piece "PieceA" and the currently processed instrument/group is "Instr", OrchestralLily will test the following variable names (in this order):
521 @example
522   \PieceAInstrSuffix
523   \InstrSuffix
524   \PieceASuffix
525 @end example
526 This particular order ensures that you can have a definition for each score-instrument combination, which overrides everything else (e.g. the definition of the music should probably use this variable). However, for piece titles, keys and so on, you can have one definition, which applies to all instruments in that piece (the third form). On the other hand, some instruments (e.g. transposing instruments) need some special settings, which should override the piece-wide settings (like the key). For this, the second form is provided.
528 In the following we will typically give the variable name in full form @code{\PieceAInstrSuffix} with the understanding that of course @code{\InstrSuffix} and @code{\PieceASuffix} will be used if the full form variable does not exist. If any part is written in square brackets [..], this indicates that this part is typically left out and instrument- or piece-wide variables are usually used in this place.
530 One word or care, though: Be careful with variables of the form @code{\InstrStaff}. If you define it, OrchestralLily will use that staff for the given instrument for each part of the whole work and never generate a staff for you!!! Similarly, if you define @code{\PieceAStaff}, all instruments in PieceA will get this staff, unless you manually define a staff for an instrument!
532 FIXME Add ...Transposition 
534 @node Simple examples
535 @chapter Simple examples
537 An example says more than thousand explanations, so in this chapter, I will 
538 present some advanced features of OrchestralLily using simple test cases. It 
539 should be easy to tell how to adapt the example in your own score...
541 @menu
542 * Figured Bass::
543 * Transposing music::
544 * Using custom staff definitions::
545 * Title pages::
546 * Table of contents::
547 * Equally-spaced markup columns::
548 * Using cue notes::
549 * Markup using header fields::
550 * Default instrument names::
551 * Non-standard staves::
552 * Using your custom context definitions::
553 @end menu
556 @node Figured Bass
557 @section Figured Bass
559 Figured bass can be either inserted like a staff (i.e. a direct child of a score 
560 or a staff group) or attached to a given staff (i.e. like a voice). These two 
561 cases are handled differently:
563 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/figuredbass.ly}
567 @node Transposing music
568 @section Transposing music
570 OrchestralLily supports transposing staves by defining the pitches in [Piece][Instrument]TransposeFrom and [Piece][Instrument]TransposeTo. The meaning of the these pitches is exactly the same as in ''\transpose frompitch topitch music''. In one of them is not defined, middle c' is used.
572 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/transpose.ly}
576 @node Using custom staff definitions
577 @section Using custom staff definitions
579 By default, OrchestralLily generates the whole staff definition from the music 
580 definition and the other settings. However, sometimes this is not desirable, 
581 because you want some special settings for one particular staff. In this case, 
582 you can simply define the staff yourself as ''[Piece][Instr]Staff'' and 
583 OrchestralLily will make use of this staff definition:
585 @lilypondfile[quote,verbatim]{../testsuite/staff-variable.ly}
588 @node Title pages
589 @section Title pages
591 OrchestralLily provides a definition ''\\titlePageMarkup''for a nice title page, you only have to assign it as  ''bookTitleMarkup'' in the header block. It uses fields from the header block and formats a title page suitable for a professionally published score:
593 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/titlepage.ly}
598 @node Table of contents
599 @section Table of contents
601 OrchestralLily automatically appends all piece headers to the internal table 
602 of TOC entries, you only have to display them using ''\markuplines \table-of-contents''. Also, you can insert your own
603 headers using ''\createHeadline''.
605 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/auto-toc.ly}
609 @node Equally-spaced markup columns
610 @section Equally-spaced markup columns
612 The ''\fill-line'' markup command generates markup in columns, but unfortunately,
613 the columns of different markups are not aligned with each other. If you want
614 to insert translations to your score, you'll have to use the ''\columns'' 
615 command instead, defined in OrchestralLily:
617 @lilypondfile[quote,verbatim,line-width=15\cm]{../testsuite/markup-columns.ly}
622 @node Using cue notes
623 @section Using cue notes
625 TODO
627 @node Markup using header fields
628 @section Markup using header fields
630 By default, markup in Lilypond does not have access to header fields (unless the
631 markup is assigned to a header variable and called from one of the formatting
632 functions defined in the header). OrchestralLily provides a function 
633 ''\markupWithHeaders'', which formats a given markup and allows access to header 
634 fields from this markup.
636 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/markup-header-fields.ly}
640 @node Default instrument names
641 @section Default instrument names
643 OrchestralLily defines a lot of instrument names and clefs for the most 
644 common instrument abbreviations. In order not to clutter the default output,
645 these are defined in the include file settings_names.ly:
647 @lilypondfile[quote,verbatim,line-width=12\cm]{../testsuite/default-instrument-names.ly}
651 @node Non-standard staves
652 @section Non-standard staves
654 OrchestralLily also supports other staff types than the default. For example,
655 a DrumStaff and a RhythmicStaff can easily be generated by a proper score 
656 structure definition. As the voice of a DrumStaff needs to be a DrumVoice, 
657 we also have to set this voice type once in our definitions. 
659 The supported staff group types are: 
660 @itemize
661 @item "GrandStaff"
662 @item "PianoStaff"
663 @item "ChoirStaff"
664 @item "StaffGroup"
665 @item "InnerChoirStaff"
666 @item "InnerStaffGroup"
667 @item "ParallelMusic" and its equivalent "SimultaneousMusic".
668 @end itemize
670 The supported staff types are: 
671 @itemize 
672 @item "Staff"
673 @item "DrumStaff"
674 @item "RhythmicStaff"
675 @item "TabStaff"
676 @item "GregorianTranscriptionStaff"
677 @item "MensuralStaff"
678 @item "VaticanaStaff"
679 @item "PartCombinedStaff"
680 @item "ParallelVoicesStaff"
681 @item "FiguredBass"
682 @end itemize
684 The supported voice types are: 
685 @itemize
686 @item "Voice"
687 @item "CueVoice" (for smaller notes)
688 @item "DrumVoice"
689 @item "FiguredBass"
690 @item "GregorianTranscriptionVoice"
691 @item "NoteNames"
692 @item "TabVoice"
693 @item "VaticanaVoice"
694 @end itemize
696 @lilypondfile[quote,verbatim,line-width=10\cm]{../testsuite/non-standard-staff-voice-types.ly}
699 @node Using your custom context definitions
700 @section Using your custom context definitions
702 Suppose, you want to define your own staff group type called "SquareStaffGroup", which uses a rectangle 
703 for the bracket, and your own staff type "ThreeStaff", which uses only three 
704 staff lines. Also, we want to define our own voice type "RedVoice", which prints
705 all note heads in red and the stems in blue.
706 Of course, you could simply use @code{\set} and @code{\override} with the corresponding
707 properties somewhere inside your music definitions, but the cleaner way is to 
708 define your own contexts with these settings. The further advantage is then 
709 that you can OrchestralLily to use these context without much additional work:
711 @lilypondfile[quote,verbatim]{../testsuite/custom-contexts-handlers.ly}
715 @node Settings defined by OrchestralLily
716 @chapter Settings defined/changed by OrchestralLily
718 @itemize
719 @item Proper rest combination for staves with two voices:
720 @lilypond
721 \include "../orchestrallily.ly"
722 \score {
723   \context Staff << { c''4 r d'' r } \\ { f'4 r r r } >>
725 @end lilypond
726 @item modern-cautionary style for auto-accidentals. Cautionary accidentals are shown in brackets for one bar, after that no cautionary accidental is shown any more.
727 @lilypond
728 \include "../orchestrallily.ly"
729 \relative c' { cis dis es fis | d d f f | c d e f }
730 @end lilypond
731 @item FIXME lots of other things (not yet documented) in the context hierarchy. See the orchestrallily.ly file (at the end of the file)
732 @end itemize
735 @node Available functions
736 @chapter Available functions
738 \paragraph "text"
739 \piece-titlepage "markup"
740 \orchestralScoreStructure '(structure list)
741 \orchestralVoiceTypes '(voice type list)
742 (oly:register_staff_type_handler type func)
743 (oly:register_voice_type_handler type func)
744 \setUseBook #t/#f
745 \setCreateMIDI #t/#f
746 \setCreatePDF #t/#f
747 \createScore #"Piece" '("Instrument"...)
748 \createNoCuesScore #"Piece" '("Instrument"...)
749 \createHeadline "text of the headline"
751 \setCue "cueString"
752 \setClefCue "cueString" clef
753 \namedCueDuring "CueVoice" #DIR "InstrCue" "Instr" music
754 \namedTransposedCueDuring "CueVoice" #DIR "InstrCue" "Instr" Transposition music
755 \cleffedCueDuring "CueVoice" #DIR "InstrCue" ClefCue "Instr" ClefInst Transposition music
757 \tempoMark '(padding . padding) #"Marktext"
758 \shiftDynamics #x #y
760 Dynamic text: \ffz, \pf, \sempp, \parenf, \parenp
761 Dynamic spanners: \setDim, \dim, \enddim, \setDecresc, \decresc, \enddecresc, \setCresc, \cresc, \endcresc
763 \newOrOldClef "new" "old" (depending on (ly:get-option 'old-clefs))
764 \filterArticulations music (removed all articulations, dynamics, text scripts and multi-measure text events)
766 \when-property symbol markup
767 \vspace #space
769 \markupWithHeader markupVariable
770 \columns markup-list
772 \newInstrument "instrumentName" (set cue name with "+")
773 \cueText (= \setCue !!!!!)
775 \scoreNumber nr
777 Settings:
778 \contentsTitle (title for the TOC)
779 \titlePageMarkup (book title as header)
780 \titleHeaderMarkup (book title as title page)
781 \titleScoreMarkup (score title as markup)
783 @menu
784 * createScore::
785 * createNoCuesScore::
786 * orchestralScoreStructure::
787 * setUseBook::
788 * setCreateMIDI::
789 * setCreatePDF::
790 * namedCueDuring::
791 * namedTransposedCueDuring::
792 * cleffedCueDuring::
793 * piece-title::
794 * markupWithHeaders::
795 * Other functions::
796 @end menu
799 @node createScore
800 @unnumberedsec \createScore
802 Generates the score for the given piece and the given instrument(s). If no appropriate *Staff or *Music can be found, a header with the *PieceName (or the *PieceNameTacet) string will be printed.
803 @example
804 \createScore #"PieceID" #'("Instrument1" "Instrument2" ...)
805 @end example
806 @itemize
807 @item Typical call: @code{\createScore #"IIIChor" #'("T")}
808 @item Parameters: 
809 @table @var
810 @item @b{PieceID}
811 The identifier for the piece/movement, which is part of the variable names used to generate the score
812 @item @b{Instrument list}
813 The list of instruments/staff identifiers to be shown in the score. These identifiers either indicate a staff group (as defined in the score structure list) or a single instrument (where the *Staff or *Music variables are used to create the staff).
814 @end table
815 @end itemize
818 @node createNoCuesScore
819 @unnumberedsec \createNoCuesScore
821 Like @code{\createScore}, except that @code{\killCues} and @code{\removeWithTag 'cued} is applied to all the music/staves
822 @example
823 \createNoCuesScore #"PieceID" #'("Instrument1" "Instrument2" ...)
824 @end example
825 @itemize
826 @item Typical call: @code{\createNoCuesScore #"IIIChor" #'("T")}
827 @end itemize
830 @node orchestralScoreStructure
831 @unnumberedsec \orchestralScoreStructure
833 @example
834 \orchestralScoreStructure #'( ("ID" 'StaffType ("List" "Of" "Instruments"))... ))
835 @end example
836   * Typical call: 
837 @example
838 \orchestralScoreStructure #'(
839 ; Part-combined staves (one staff with two voices)
840   ("Fl" #t ("FlI" "FlII"))
841 ; Grouped staves (multiple staves either in a StaffGroup, or parallel without a bracket)
842   ("Str" 'StaffGroup ("V" "Va"))
843   ("Solo" 'ParallelMusic ("SSolo" "TSolo"))
844   ("Ch" 'ChoirStaff ("S" "A" "T" "B"))
845   ("Vocal" 'SimultaneousMusic ("Solo" "Ch"))
846 ; full scores, again as grouped staves, no over-all bracket
847   ("FullScore" 'ParallelMusic ("Fl" "Str" "Solo" "Ch"))
849 @end example
850   * Description: Defines the hierarchy tree of the score. Each staff group (or part-combined staff with two voices) is identified by an ID (the first element of each entry). 
851   * Parameters: @b{Score structure} ... A list of group descriptions. Each entry describes such a group and has three possible forms:
852 @code{
853   ("Identifier" StaffGroupType ("List" "of" "child" "identifiers"))    ; Staff group of given type
854   ("Identifier" SimultaneousMusic|ParallelMusic ("List" "children" ))  ; Staves connected without a bracket
855   ("Identifier" #f ("List" "of" "voices"))                             ; One staff with multiple voices (not yet implemented!)
856   ("Identifier" #t ("Two" "voices"))                                   ; Staff with two part-combined voices
858 The list can contain each identifier only once, but they do not have to form only one tree, you can define several different hierarchy trees in one list!
861 @node setUseBook
862 @unnumberedsec \setUseBook
864 @example
865 \setUseBook ##t
866 @end example
867   * Typical call: @code{\setUseBook ##t}
868   * Description: Declare whether the scores are called within a @code{\book} section or as top-level. 
869   * Explanation: Internally, a score needs to be created differently if it should be printed inside a @code{\book} environment. Unfortunately, it is not possible in lilypond to detect the current environment, so this function is needed to explicitly declare that the following scores are inserted inside a @code{\book} environment.
870   * Parameters: 
871     * @b{inside book} ... @code{##t} if the following scores are inside a @code{\book} environment, @code{##f} if not (default)
872 setUseBook = #(define-music-function (parser location usebook) (boolean?) 
875 @node setCreateMIDI
876 @unnumberedsec \setCreateMIDI
878 Set a flag to determine whether MIDI output should be generated (default: NO). If YES, then an empty @code{\midi@{@}} block is generated in the score to trigger the creation of the midi file.
879 @example
880 \setCreateMIDI ##t
881 @end example
882   * Typical call: @code{\setCreateMidi ##t}
886 @node setCreatePDF
887 @unnumberedsec \setCreatePDF
889 Set a flag to determine whether PDF output should be generated (default: YES). If no, no @code{\layout@{@}} block will be generated in the score. If create @code{MIDI == #t}, then only MIDI will be created. If create @code{MIDI == #f}, then the PDF output will still be generated (similar to the existence/non-existence of a @code{\midi} and @code{\layout} block in a score!).
890 @example
891 \setCreatePDF ##t
892 @end example
893   * Typical call: @code{\setCreatePDF ##t}
897 @node namedCueDuring
898 @unnumberedsec \namedCueDuring
900 Like @code{\cueDuring}, but also adds the instrument name of the cue instrument at the beginning of the cue notes and the original instrument name after the cue notes.
901 @example
902 \namedCueDuring #"QuoteName" #DIR #"cue instrument" #"original instrument"  music
903 @end example
904   * Typical call: @code{\namedCueDuring #"vIQuote" #UP #"V.I" #"Sop." @{ R1*3 @}}
905   * Parameters: 
906     * @b{quote name}, @b{direction}, @b{music} ... Parameters of @code{\cueDuring}
907     * @b{cue instrument}, @b{original instrument} ... Instrument names (strings) to be printed as cue instrument name at the beginning of the cues and as original instrument name after the cue notes
910 @node namedTransposedCueDuring
911 @unnumberedsec \namedTransposedCueDuring
913 Like @code{\namedCueDuring}, but uses @code{\transposedCueDuring} instead of @code{\cueDuring}.
914 @example
915 \namedTransposedCueDuring #"QuoteName" #DIR #"cue instrument" #"original instrument" centralCNote music
916 @end example
917   * Typical call: @code{\namedTransposedCueDuring #"vIQuote" #UP #"Piccolo" #"Sop." c' @{ R1*3 @}}
920 @node cleffedCueDuring
921 @unnumberedsec \cleffedCueDuring
923 Like @code{\namedCudDuring}, but shows the cue notes with a different clef.
924 @example
925 \cleffedCueDuring NameOfQuote CueDirection CueInstrument CueClef OriginalInstrument OriginalClef music
926 @end example
927   * Typical call: @code{\cleffedCueDuring #"vIQuote" #UP #"V.I" @{\clef "treble"@} #"Basso" @{\clef "bass"@} @{ R1*3 @}}
929 % Parameters: \cleffedCueDuring NameOfQuote CueDirection CueInstrument CueClef OriginalInstrument OriginalClef music
930 %                 -) NameOfQuote CueDirection music are the parameters for \cueDuring
931 %                 -) CueInstrument and OriginalInstrument are the displayed instrument names
932 %                 -) CueClef and OriginalClef are the clefs for the the cue notes and the clef of the containing voice
934 %      This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
935 %      the beginning of the cue notes and "Basso" at the end. The clef is changed to treble at the 
936 %      beginning of the cue notes and reset to bass at the end
939 @node piece-title
940 @unnumberedsec \piece-title
942 @example
943 \piece-title pieceTitleString
944 @end example
945 FIXME
947 @node markupWithHeaders
948 @unnumberedsec \markupWithHeaders
951 @node Other functions
952 @unnumberedsec Other functions
953 FIXME: not yet documented
956 @node Extending OrchestralLily
957 @chapter Extending OrchestralLily
959 To produce a staff group, staff or voice of a given type as specified in the 
960 score structure, OrchestralLily internally uses so-called handler functions. 
961 In particular, each known staff or group type is assigned to a scheme function
962 with the signature
963 @example
964 (staff_group_handler_function parser piece name type children)
965 @end example
966 where parser is the internal parser (needed by some of the subsequently called 
967 functions), piece is the name of the current score part (i.e. the first 
968 argument given in @code{\createScore}), name. type and children are the three
969 entried given in the score structure. Each handler generates either a staff 
970 music expression, a list of staff music expressions or an empty list.
972 Similarly, to produce a voice object (to be used as children of a staff), 
973 OrchestralLily internally uses voice type handler functions, which have a 
974 function signature of 
975 @example
976 (voice_handler_function parser piece name type)
977 @end example
979 To register a staff/group or a voice handler with OrchestralLily, there are two functions:
980 @example
981 #(oly:register_staff_type_handler type func)
982 #(oly:register_voice_type_handler type func)
983 @end example
986 If you want to add your own staff group, staff type or voice type, in most cases
987 you can use the internal functions provided by OrchestralLily: 
988 If you own type can be treated exactly like any other staff, 
989 group or voice, only with a different context name (i.e. because all the 
990 settings are in the @code{\layout} section and the staff/group/voice definition
991 itself does not need any special settings), you can simply re-use the internal
992 functions @code{oly:staff_group_handler}, @code{oly:staff_handler} or 
993 @code{oly:voice_handler}. For example
994 @example
995 #(oly:register_staff_type_handler "MyOwnGroup" oly:staff_group_handler)
996 \orchestral-score-structure #'(
997   ("Group" "MyOwnGroup" ("InstrI" "InstrII" "InstrIII"))
999 \createScore #"Test" #'("group")
1000 @end example
1001 will produce the same as 
1002 @example
1003 \context MyOwnGroup="TestGroupStaff" << 
1004     \TestInstrIStaff 
1005     \TestInstrIIStaff 
1006     \TestInstrIIIStaff
1008 @end example
1009 (notice that the only difference to the default case is that the context is now
1010 MyOwnGroup instead of StaffGroup).
1012 If your staves, groups or voices need special settings or should be created 
1013 differently, of course, you'll have to implement your own handler function. 
1014 As a guide, you can take a look at the implementation of the built-in handlers.
1018 @node Frequently asked questions
1019 @chapter Frequently asked questions
1021 @menu
1022 * Can I use different variable names?::
1023 * Can I change the structure of the score hierarchy list?::
1024 @end menu
1026 @node Can I use different variable names?
1027 @unnumberedsec I don't like the variable names, can I use a different order?
1029 If you don't like that the variables are generated as @code{\PieceInstrumentVarname}, you can override this behavior by redefining the scheme function @code{(namedPieceInstrObject piece instr name)}. The default implementation is:
1030 @example
1031 #(define (namedPieceInstrObject piece instr name)
1032   (let* (
1033          (fullname  (string->symbol (string-append piece instr name)))
1034          (instrname (string->symbol (string-append instr name)))
1035          (piecename (string->symbol (string-append piece name)))
1036         )
1037     (cond
1038       ((defined? fullname) (primitive-eval fullname))
1039       ((defined? instrname) (primitive-eval instrname))
1040       ((defined? piecename) (primitive-eval piecename))
1041       (else '())
1042     )
1043   )
1045 @end example
1046 Now it's up to you to write a different implementation... (e.g. use varnames of the style @code{\VarnameInstrPiece})
1047 But be careful with the order of evaluation, since some large scores might depend on @code{instrname} overriding @code{piecename} (e.g. a globally-defined key for transposing instruments!).
1050 @node Can I change the structure of the score hierarchy list?
1051 @unnumberedsec I don't like the structure of the score hierarchy list, can I change it?
1053 Sure, there is only one function that interprets the entries (factory pattern!): @code{(oly:create_staff_or_group parser piece instr)}. It looks up the @code{\PieceInstrumentStaff} variable and if that does not exist, it looks at a possible entry in the score structure descriptions and depending on its form, calls different methods to create a staff, a group, a part-combined staff or a staff with multiple voices. 
1055 If you redefine this function, you have complete control about the decision when to create each type of staff/group.
1058 @node Version History
1059 @chapter Version History
1061 @table @asis
1062 @item @uref{releases/orchestrallily_0.01.ly, 0.01 (2008-03-02)}: 
1063 Initial Version
1064 @item @uref{releases/orchestrallily_0.02.ly, 0.02 (2008-03-06)}: 
1065 Added basic MIDI support (...MidiInstrument and \setCreateMIDI)
1066 @item @uref{releases/orchestrallily_0.03.ly, 0.03 (2008-06-??)}:
1067 @itemize
1068 @item Add *TimeSignature variable, split settings for full/vocal/instrumental scores
1069 @item [Piece][Instrument]TransposeTo, if set, now specifies the pitch where c' should be shown in the applicable voices.
1070 @item interpreting markup using header fields
1071 @item Automatically add score title to TOC
1072 @item \createHeadline to create a headline and add it to the TOC
1073 @item Adapted cresc spanners to new syntax
1074 @item Nice title page (full page) and nicer title header (for instrumental scores)
1075 @item Default clefs and Instrument names for lots of common abbreviations
1076 @item Default cue names fo lots of instruments, function to show cue name
1077 @item Default score numbers for each instrument
1078 @item one can also specify voice types
1079 @item parallel voices in one staff work,
1080 @item Group types are given as strings
1081 @item Adding handlers for new group/staff or voice types supported
1082 @item Support for Drum staves/voices and figured bass
1083 @end itemize
1084 @end table
1087 @node Known limitations and missing features
1088 @chapter Known limitations and missing features
1090 @itemize
1091 @item FIXME @b{Staves with multiple voices} (using @code{\voiceOne}, @code{\voiceTwo}), mess up the \voiceOne and \voiceTwo setting for some weird reason.
1092 @item FIXME Add support for MIDI instrument names
1093 @end itemize
1097 @node Credits
1098 @appendix Credits
1100 Of course, a huge project like OrchestralLily would have never been possible
1101 without the help of many others. In particular, I'm indebted to Han-Wen 
1102 Niewenhuis and Jan Nieuwenhuizen, the two authors of Lilypond. The folks over at
1103 the lilypond-user and lilypond-devel mailinglist were also of great importance
1104 and helped me solve lots of problems I ran into. A particular thanks goes to
1105 Nicolas Sceaux, who help me enourmously with his deeps insight into the Lilypond
1106 internals and the tricks he provided on the mailinglist and in his own Lilypond
1107 package for operas. Of course, all the authors of snippets posted at the LSR 
1108 (Lilypond Snippet Repository) also contributed their share to the success of
1109 OrchestralLily.
1111 @node OrchestralLily index
1112 @appendix OrchestralLily index
1114 @printindex cp
1116 @bye