]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/global.itely
Remove duplicate info.
[lilypond.git] / Documentation / user / global.itely
1 @c -*- coding: latin-1; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run 
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8 @node Output formats
9 @chapter Output formats
10
11 This is a placeholder until I can write a nice intro for this chapter.
12
13 @menu
14 * Paper output::                
15 * Sound output::                
16 @end menu
17
18
19 @node Paper output
20 @section Paper output
21
22 The global paper layout is determined by three factors: the page layout, the
23 line breaks, and the spacing.  These all influence each other.  The
24 choice of spacing determines how densely each system of music is set.
25 This influences where line breaks are chosen, and thus ultimately, how
26 many pages a piece of music takes.
27
28 Globally spoken, this procedure happens in three steps: first,
29 flexible distances (``springs'') are chosen, based on durations.  All
30 possible line breaking combinations are tried, and the one with the
31 best results -- a layout that has uniform density and requires as
32 little stretching or cramping as possible -- is chosen.
33
34 After spacing and linebreaking, the systems are distributed across
35 pages, taking into account the size of the page, and the size of the
36 titles.
37
38
39
40 @menu
41 * Setting global staff size::   
42 * Paper size::                  
43 * Page layout::                 
44 * Vertical spacing::            
45 * Vertical spacing of piano staves::  
46 * Horizontal spacing::          
47 * Line length::                 
48 * Line breaking::               
49 * Page breaking::               
50 * Multiple movements::          
51 * Creating titles::             
52 @end menu
53
54
55 @node Setting global staff size
56 @subsection Setting global staff size
57
58 @cindex font size, setting
59 @cindex staff size, setting
60 @cindex @code{layout} file
61
62 To set the global staff size, use @code{set-global-staff-size}.
63
64 @example
65 #(set-global-staff-size 14)
66 @end example
67
68 @noindent
69 This sets the global default size to 14pt staff height and scales all
70 fonts accordingly.
71
72 The Feta font provides musical symbols at eight different
73 sizes.  Each font is tuned for a different staff size: at a smaller size
74 the font becomes heavier, to match the relatively heavier staff lines.
75 The recommended font sizes are listed in the following table:
76
77 @quotation
78 @multitable @columnfractions .15 .2 .22 .2
79
80 @item @b{font name}
81 @tab @b{staff height (pt)}
82 @tab @b{staff height (mm)}
83 @tab @b{use}
84
85 @item feta11
86 @tab 11.22
87 @tab 3.9 
88 @tab pocket scores
89
90 @item feta13
91 @tab 12.60
92 @tab 4.4
93 @tab
94  
95 @item feta14
96 @tab 14.14
97 @tab 5.0
98 @tab 
99
100 @item feta16
101 @tab 15.87
102 @tab 5.6
103 @tab 
104
105 @item feta18
106 @tab 17.82
107 @tab 6.3
108 @tab song books
109
110 @item feta20
111 @tab 20
112 @tab 7.0
113 @tab standard parts 
114
115 @item feta23
116 @tab 22.45 
117 @tab 7.9
118 @tab 
119
120 @item feta26
121 @tab 25.2 
122 @tab 8.9
123 @tab
124 @c modern rental material?
125
126 @end multitable
127 @end quotation
128
129 These fonts are available in any sizes.  The context property
130 @code{fontSize} and the layout property @code{staff-space} (in
131 @internalsref{StaffSymbol}) can be used to tune the size for individual
132 staves.  The sizes of individual staves are relative to the global size.
133
134 @example
135
136 @end example
137
138 @seealso
139
140 This manual: @ref{Selecting font sizes}.
141
142
143 @node Paper size
144 @subsection Paper size
145
146 @cindex paper size
147 @cindex page size
148 @cindex @code{papersize}
149
150 To change the paper size, there are two commands,
151 @example
152 #(set-default-paper-size "a4")
153 \paper @{
154   #(set-paper-size "a4")
155 @}
156 @end example
157
158 The first command sets the size of all pages.  The second command sets the size
159 of the pages that the @code{\paper} block applies to -- if the @code{\paper}
160 block is at the top of the file, then it will apply to all pages.  If the
161 @code{\paper} block is inside a @code{\score}, then the paper size will only
162 apply to that score.
163
164 The following paper sizes are supported: @code{a6}, @code{a5}, @code{a4},
165 @code{a3}, @code{legal}, @code{letter}, @code{tabloid}.
166
167 @cindex orientation
168 @cindex landscape
169
170 If the symbol @code{landscape} is supplied as an argument to
171 @code{set-default-paper-size}, the pages will be rotated by 90 degrees,
172 and wider line widths will be set correspondingly.
173
174 @example
175 #(set-default-paper-size "a6" 'landscape)
176 @end example 
177
178
179 @node Page layout
180 @subsection Page layout
181
182 @cindex page layout
183 @cindex margins
184 @cindex header, page
185 @cindex footer, page
186
187 LilyPond will do page layout, set margins, and add headers and
188 footers to each page.
189
190 The default layout responds to the following settings in the
191 @code{\paper} block.
192
193 @cindex \paper
194
195 @quotation
196 @table @code
197 @item firstpagenumber
198 The value of the page number of the first page.  Default is@tie{}1.
199
200 @item printfirstpagenumber
201 If set to true, will print the page number in the first page.  Default is
202 false.
203
204 @item hsize
205 The width of the page.
206
207 @item vsize
208 The height of the page.
209
210 @item topmargin
211 Margin between header and top of the page.
212
213 @item bottommargin
214 Margin between footer and bottom of the page.
215
216 @item leftmargin
217 Margin between the left side of the page and the beginning of the music.
218
219 @item linewidth
220 The length of the systems.
221
222 @item headsep
223 Distance between the top-most music system and the page header.
224
225 @item footsep
226 Distance between the bottom-most music system and the page footer.
227
228 @item raggedbottom
229 If set to true, systems will not be spread across the page.
230
231 This should be set false for pieces that have only two or three
232 systems per page, for example orchestral scores.
233  
234 @item raggedlastbottom
235 If set to false, systems will be spread to fill the last page.
236
237 Pieces that amply fill two pages or more should have this set to
238 true.
239
240 @item betweensystemspace
241 This dimensions determines the distance between systems.  It is the
242 ideal distance between the center of the bottom staff of one system
243 and the center of the top staff of the next system.
244
245 Increasing this will provide a more even appearance of the page at the
246 cost of using more vertical space.
247
248 @item betweensystempadding
249 This dimension is the minimum amount of white space that will always
250 be present between the bottom-most symbol of one system, and the
251 top-most of the next system.
252
253 Increasing this will put systems whose bounding boxes almost touch
254 farther apart.
255
256 @item aftertitlespace
257 Amount of space between the title and the first system.
258
259 @item beforetitlespace 
260 Amount of space between the last system of the previous piece and the
261 title of the next.
262
263 @item betweentitlespace
264 Amount of space between consecutive titles (e.g., the title of the
265 book and the title of a piece).
266
267 @item systemSeparatorMarkup
268 This contains a markup object, which will be inserted between
269 systems.  This is often used for orchestral scores.
270
271 The markup command @code{\slashSeparator} is provided as a sensible
272 default,  for example
273
274 @lilypond[raggedright]
275 \paper {
276   systemSeparatorMarkup = \slashSeparator
277 }
278
279 \relative { c1 \break c1 }
280 @end lilypond
281
282
283 @end table
284 @end quotation
285
286 Example:
287
288 @example
289 \paper@{
290   hsize = 2\cm
291   topmargin = 3\cm
292   bottommargin = 3\cm
293   raggedlastbottom = ##t
294 @}
295 @end example
296
297 You can also define these values in Scheme.  In that case @code{mm},
298 @code{in}, @code{pt}, and @code{cm} are variables defined in
299 @file{paper-defaults.ly} with values in millimeters.  That's why the
300 value has to be multiplied in the example
301
302 @example
303 \paper @{
304   #(define bottommargin (* 2 cm)) 
305 @}
306 @end example
307
308 @cindex copyright
309 @cindex tagline
310
311 The default footer is empty, except for the first page, where the
312 @code{copyright} field from @code{\header} is inserted, and the last
313 page, where @code{tagline} from @code{\header} is added.  The default
314 tagline is ``Music engraving by LilyPond (@var{version})''.@footnote{Nicely
315 printed parts are good PR for us, so please leave the tagline if you
316 can.}
317
318 The header and footer are created by the functions @code{make-footer}
319 and @code{make-header}, defined in @code{\paper}.  The default
320 implementations are in @file{scm/@/page@/-layout@/.scm}.
321
322 The page layout itself is done by two functions in the
323 @code{\paper} block, @code{page-music-height} and
324 @code{page-make-stencil}.  The former tells the line-breaking algorithm
325 how much space can be spent on a page, the latter creates the actual
326 page given the system to put on it.
327
328
329 @refbugs
330
331 The option rightmargin is defined but doesn't set the right margin
332 yet.  The value for the right margin has to be defined adjusting the
333 values of the leftmargin and linewidth.
334
335 The default page header puts the page number and the @code{instrument}
336 field from the @code{\header} block on a line.
337
338
339 @node Vertical spacing
340 @subsection Vertical spacing
341
342 @cindex vertical spacing
343 @cindex distance between staves
344 @cindex staff distance
345 @cindex between staves, distance
346 @cindex staves per page
347 @cindex space between staves
348
349 The height of each system is determined automatically.  To prevent
350 systems from bumping into each other, some minimum distances are set.
351 By changing these, you can put staves closer together, and thus put
352 more systems onto one page.
353
354 Normally staves are stacked vertically.  To make staves maintain a
355 distance, their vertical size is padded.  This is done with the
356 property @code{minimumVerticalExtent}.  It takes a pair of numbers, so
357 if you want to make it smaller than its default @code{#'(-4 . 4)},
358 then you could set
359
360 @example
361 \set Staff.minimumVerticalExtent = #'(-3 . 3)
362 @end example
363
364 @noindent
365 This sets the vertical size of the current staff to 3 staff spaces on
366 either side of the center staff line.  The argument of
367 @code{minimumVerticalExtent} is interpreted as an interval, where the
368 center line is the 0, so the first number is generally negative.  The
369 staff can be made larger at the bottom by setting it to @code{(-6 . 4)}. 
370
371 To change the amount of space between systems, use
372 @code{betweensystemspace}.  A score with only one staff is still
373 considered to have systems, so setting @code{betweensystemspace}
374 will be much more useful than changing @code{minimumVerticalExtent}.
375
376 @example
377 \layout @{
378   betweensystemspace = 10\mm
379 @}
380 @end example
381
382
383 @seealso
384
385 Internals: Vertical alignment of staves is handled by the
386 @internalsref{VerticalAlignment} object.
387
388 @refbugs
389
390 @code{minimumVerticalExtent} is syntactic sugar for setting
391 @code{minimum-Y-extent} of the @internalsref{VerticalAxisGroup} of the
392 current context.  It can only be changed score wide.
393
394
395
396
397 @node Vertical spacing of piano staves
398 @subsection Vertical spacing of piano staves
399
400 The distance between staves of a @internalsref{PianoStaff} cannot be
401 computed during formatting.  Rather, to make cross-staff beaming work
402 correctly, that distance has to be fixed beforehand.
403  
404 The distance of staves in a @code{PianoStaff} is set with the
405 @code{forced-distance} property of the
406 @internalsref{VerticalAlignment} object, created in
407 @internalsref{PianoStaff}.
408
409 It can be adjusted as follows
410 @example
411 \new PianoStaff \with @{
412   \override VerticalAlignment #'forced-distance = #7
413 @} @{
414   ...
415 @}
416 @end example
417
418 @noindent
419 This would bring the staves together at a distance of 7 staff spaces,
420 measured from the center line of each staff.
421
422 The difference is demonstrated in the following example,
423 @lilypond[quote,verbatim]
424 \relative <<
425   \new PianoStaff \with {
426     \override VerticalAlignment #'forced-distance = #7
427   } <<
428     \new Staff { c1 }
429     \new Staff { c }
430   >>
431   \new PianoStaff <<
432     \new Staff { c }
433     \new Staff { c }
434   >>
435 >>    
436 @end lilypond
437
438
439
440 @refbugs
441
442 @code{forced-distance} cannot be changed per system.
443
444
445 @node Horizontal spacing
446 @subsection Horizontal Spacing
447
448 The spacing engine translates differences in durations into
449 stretchable distances (``springs'') of differring lengths.  Longer
450 durations get more space, shorter durations get less.  The shortest
451 durations get a fixed amount of space (which is controlled by
452 @code{shortest-duration-space} in the @internalsref{SpacingSpanner} object). 
453 The longer the duration, the more space it gets: doubling a
454 duration adds a fixed amount (this amount is controlled by
455 @code{spacing-increment}) of space to the note.
456
457 For example, the following piece contains lots of half, quarter, and
458 8th notes; the eighth note is followed by 1 note head width (NHW). 
459 The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
460
461 @lilypond[quote,fragment,verbatim,relative=1]
462 c2 c4. c8 c4. c8 c4. c8 c8
463 c8 c4 c4 c4
464 @end lilypond
465
466 Normally, @code{spacing-increment} is set to 1.2 staff space, which is
467 approximately the width of a note head, and
468 @code{shortest-duration-space} is set to 2.0, meaning that the
469 shortest note gets 2.4 staff space (2.0 times the
470 @code{spacing-increment}) of horizontal space.  This space is counted
471 from the left edge of the symbol, so the shortest notes are generally
472 followed by one NHW of space.
473
474 If one would follow the above procedure exactly, then adding a single
475 32nd note to a score that uses 8th and 16th notes, would widen up the
476 entire score a lot.  The shortest note is no longer a 16th, but a 32nd,
477 thus adding 1 NHW to every note.  To prevent this, the shortest
478 duration for spacing is not the shortest note in the score, but rather
479 the one which occurs most frequently.
480
481
482 The most common shortest duration is determined as follows: in every
483 measure, the shortest duration is determined.  The most common shortest
484 duration is taken as the basis for the spacing, with the stipulation
485 that this shortest duration should always be equal to or shorter than
486 an 8th note.  The shortest duration is printed when you run
487 @code{lilypond} with the @code{--verbose} option.
488
489 These durations may also be customized.  If you set the
490 @code{common-shortest-duration} in @internalsref{SpacingSpanner}, then
491 this sets the base duration for spacing.  The maximum duration for this
492 base (normally an 8th), is set through @code{base-shortest-duration}.
493
494 @cindex @code{common-shortest-duration}
495 @cindex @code{base-shortest-duration}
496 @cindex @code{stem-spacing-correction}
497 @cindex @code{spacing}
498
499 Notes that are even shorter than the common shortest note are
500 followed by a space that is proportional to their duration relative to
501 the common shortest note.  So if we were to add only a few 16th notes
502 to the example above, they would be followed by half a NHW:
503
504 @lilypond[quote,fragment,verbatim,relative=2]
505 c2 c4. c8 c4. c16[ c] c4. c8 c8 c8 c4 c4 c4
506 @end lilypond
507
508
509 In the introduction (see @ref{Engraving}), it was explained that stem
510 directions influence spacing.  This is controlled with the
511 @code{stem-spacing-correction} property in the
512 @internalsref{NoteSpacing}, object.  These are generated for every
513 @internalsref{Voice} context.  The @code{StaffSpacing} object
514 (generated in @internalsref{Staff} context) contains the same property
515 for controlling the stem/bar line spacing.  The following example shows
516 these corrections, once with default settings, and once with
517 exaggerated corrections:
518
519 @lilypond[quote,raggedright]
520 {
521   c'4 e''4 e'4 b'4 |
522   b'4 e''4 b'4 e''4|
523   \override Staff.NoteSpacing #'stem-spacing-correction = #1.5
524   \override Staff.StaffSpacing #'stem-spacing-correction = #1.5
525   c'4 e''4 e'4 b'4 |
526   b'4 e''4 b'4 e''4|      
527 }
528 @end lilypond
529
530
531 @seealso
532
533 Internals: @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
534 @internalsref{StaffSpacing}, @internalsref{SeparationItem}, and
535 @internalsref{SeparatingGroupSpanner}.
536
537 @refbugs
538
539 Spacing is determined on a score wide basis.  If you have a score that
540 changes its character (measured in durations) halfway during the
541 score, the part containing the longer durations will be spaced too
542 widely.
543
544 There is no convenient mechanism to manually override spacing.  The
545 following work-around may be used to insert extra space into a score.
546 @example
547  \once \override Score.SeparationItem #'padding = #1
548 @end example
549
550 No work-around exists for decreasing the amount of space.
551
552 @node Line length
553 @subsection Line length
554
555 @cindex page breaks
556 @cindex breaking pages
557
558 @cindex @code{indent}
559 @cindex @code{linewidth}
560
561 @c Although linewidth can be set in \layout, it should be set in paper
562 @c block, to get page layout right.
563 @c Setting indent in \paper block makes not much sense, but it works.
564
565 @c Bit verbose and vague, use examples?
566 The most basic settings influencing the spacing are @code{indent} and
567 @code{linewidth}.  They are set in the @code{\layout} block.  They
568 control the indentation of the first line of music, and the lengths of
569 the lines.
570
571 If @code{raggedright} is set to true in the @code{\layout} block, then
572 the lines are justified at their natural length.  This is useful for
573 short fragments, and for checking how tight the natural spacing is.
574
575 @cindex page layout
576 @cindex vertical spacing
577
578 The option @code{raggedlast} is similar to @code{raggedright}, but
579 only affects the last line of the piece.  No restrictions are put on
580 that line.  The result is similar to formatting text paragraphs.  In a
581 paragraph, the last line simply takes its natural length.
582 @c Note that for text there are several options for the last line.
583 @c While Knuth TeX uses natural length, lead typesetters use the same
584 @c stretch as the previous line.  eTeX uses \lastlinefit to
585 @c interpolate between both these solutions.
586
587 @node Line breaking
588 @subsection Line breaking
589
590 @cindex line breaks
591 @cindex breaking lines
592
593 Line breaks are normally computed automatically.  They are chosen so
594 that lines look neither cramped nor loose, and that consecutive lines
595 have similar density.
596
597 Occasionally you might want to override the automatic breaks; you can
598 do this by specifying @code{\break}.  This will force a line break at
599 this point.  Line breaks can only occur at places where there are bar
600 lines.  If you want to have a line break where there is no bar line,
601 you can force an invisible bar line by entering @code{\bar
602 ""}.  Similarly, @code{\noBreak} forbids a line break at a 
603 point.
604
605
606 @cindex regular line breaks
607 @cindex four bar music. 
608
609 For line breaks at regular intervals use @code{\break} separated by
610 skips and repeated with @code{\repeat}:
611 @example
612 << \repeat unfold 7 @{
613          s1 \noBreak s1 \noBreak
614          s1 \noBreak s1 \break @}
615    @emph{the real music}
616 >> 
617 @end example
618
619 @noindent
620 This makes the following 28 measures (assuming 4/4 time) be broken every
621 4 measures, and only there.
622
623 @refcommands
624
625 @code{\break}, and @code{\noBreak}.
626 @cindex @code{\break}
627 @cindex @code{\noBreak}
628
629 @seealso
630
631 Internals: @internalsref{BreakEvent}.
632
633
634 @node Page breaking
635 @subsection Page breaking
636
637 The default page breaking may be overriden by inserting
638 @code{\pageBreak} or @code{\noPageBreak} commands.  These commands are
639 analogous to @code{\break} and @code{\noBreak}.  They should be
640 inserted at a bar line.  These commands force and forbid a page-break
641 from happening.  Of course, the @code{\pageBreak} command also forces
642 a line break.
643
644 Page breaks are computed by the @code{page-breaking} function in the
645 @code{\paper} block. 
646
647 To force a new page for a new piece (in a collection of pieces or a
648 piece in several movements), use @code{breakbefore} in the header.
649
650 @example
651 \header@{
652   breakbefore = ##t
653 @}
654 @end example
655
656 @refcommands
657
658 @cindex @code{\pageBreak}
659 @code{\pageBreak}
660 @cindex @code{\noPageBreak} 
661 @code{\noPageBreak} 
662
663
664 @node Multiple movements
665 @subsection Multiple movements
666
667 @cindex bibliographic information
668 @cindex titles
669 @cindex composer
670 @cindex Music engraiving by LilyPond
671
672 A document may contain multiple pieces of music and texts.  Examples
673 of these are an etude book, or an orchestral part with multiple
674 movements.  Each movement is entered with a @code{\score} block,
675
676 @example
677 \score @{
678   @var{..music..}
679 @}
680 @end example
681
682 and texts are entered with a @code{\markup} block,
683
684 @example
685 \markup @{
686   @var{..text..}
687 @}
688 @end example
689
690 @cindex @code{\book}
691
692 The movements and texts are combined together in a @code{\book} block,
693 like
694
695 @example
696 \book @{
697   \score @{
698     @var{..}
699   @}
700   \markup @{
701     @var{..}
702   @}
703   \score @{
704     @var{..}
705   @}
706 @}
707 @end example
708
709
710 The header for each piece of music can be put inside the @code{\score}
711 block.  The @code{piece} name from the header will be printed before
712 each movement.  The title for the entire book can be put inside the
713 @code{\book}, but if it is not present, the @code{\header} which is at
714 the top of the file is inserted.
715
716 @cindex Engraved by LilyPond
717 @cindex signature line
718
719 @example 
720 \book @{
721   \header @{
722     title = "Eight miniatures" 
723     composer = "Igor Stravinsky"
724   @}
725   \score @{
726     @dots{}
727     \header @{ piece = "Romanze" @}
728   @}
729   \markup @{
730      ..text of second verse..
731   @}
732   \markup @{
733      ..text of third verse..
734   @}
735   \score @{
736     @dots{}
737     \header @{ piece = "Menuetto" @}
738   @}
739 @}
740 @end example
741
742
743 @node Creating titles
744 @subsection Creating titles
745
746 Titles are created for each @code{\score} block, and over a
747 @code{\book}.
748
749 The contents of the titles are taken from the @code{\header} blocks.
750 The header block for a book supports the following
751 @table @code
752 @item dedication
753 The dedicatee of the music, centered at the top of the first page.
754
755 @item title
756 The title of the music, centered just below the dedication.
757
758 @item subtitle
759 Subtitle, centered below the title.
760
761 @item subsubtitle
762 Subsubtitle, centered below the subtitle.
763
764 @item poet
765 Name of the poet, flush-left below the subtitle.
766
767 @item composer
768 Name of the composer, flush-right below the subtitle.
769
770 @item meter
771 Meter string, flush-left below the poet.
772
773 @item opus
774 Name of the opus, flush-right below the composer.
775
776 @item arranger
777 Name of the arranger, flush-right below the opus.
778
779 @item instrument
780 Name of the instrument, centered below the arranger.
781
782 @item piece
783 Name of the piece, flush-left below the instrument.
784
785 @cindex page breaks, forcing
786 @item breakbefore
787   This forces the title to start on a new page (set to ##t or ##f).
788 @end table
789
790 Here is a demonstration of the fields available.  Note that you
791 may use any @ref{Text markup} commands in the header.
792
793 @lilypond[quote,verbatim,linewidth=11.0\cm]
794 \paper {
795   linewidth = 9.0\cm
796   vsize = 10.0\cm
797 }
798
799 \book {
800   \header {
801     dedication = "dedicated to me"
802     title = \markup \center-align { "Title first line" "Title second line, longer" }
803     subtitle = "the subtitle,"
804     subsubtitle = #(string-append "subsubtitle LilyPond version " (lilypond-version))
805     poet = "Poet"
806     composer =  \markup \center-align { "composer" \small "(1847-1973)" }
807     texttranslator = "Text Translator"
808     meter = \markup { \teeny "m" \tiny "e" \normalsize "t" \large "e" \huge "r" }
809     arranger = "Arranger"
810     opus = \markup { \fontsize #8.5 "o" \fontsize #2.5 "p" \fontsize #-2.5 "u" \fontsize #-5.3 "s" \fontsize #7.5 "       " }
811     instrument = \markup \bold \italic "instrument"
812     piece = "Piece"
813   }
814
815   \score {
816     \header {
817       piece = "piece1"
818       opus = "opus1" 
819     }
820     { c'1 }
821   }
822   \markup {
823       and now...
824   }
825   \score {
826     \header {
827       piece = "piece2"
828       opus = "opus2" 
829     }
830     { c'1 }
831   }
832 }
833 @end lilypond
834
835 A more advanced option is to change the definitions of the following
836 variables in the @code{\paper} block.  The init file
837 @file{ly/titling-init.ly} lists the default layout.
838
839 @table @code
840 @item bookTitleMarkup
841   This is the title put over an entire @code{\book} block.  Typically,
842   it has the composer and the title of the piece
843   
844 @item scoreTitleMarkup
845   This is the title put over a @code{\score} block within a
846 @code{\book}.  Typically, it has the name of the movement (@code{piece}
847 field).
848
849 @item oddHeaderMarkup
850   This is the page header for odd-numbered pages. 
851
852   @item evenHeaderMarkup
853   This is the page header for even-numbered pages.  If unspecified,
854   the odd header is used instead.
855
856   By default, headers are defined such that the page number is on the
857   outside edge, and the instrument is centered.
858
859 @item oddFooterMarkup
860   This is the page footer for odd-numbered pages. 
861   
862 @item evenFooterMarkup
863   This is the page footer for even-numbered pages.  If unspecified,
864   the odd header is used instead.
865
866   By default, the footer has the copyright notice on the first, and
867   the tagline on the last page.
868 @end table
869
870
871 @cindex \paper
872 @cindex header
873 @cindex footer
874 @cindex page layout
875 @cindex titles
876
877 The following definition will put the title flush left, and the
878 composer flush right on a single line.
879
880 @verbatim
881 \paper {
882   bookTitleMarkup = \markup {
883    \fill-line @{
884      \fromproperty #'header:title
885      \fromproperty #'header:composer
886    @}
887   }
888 }
889 @end verbatim
890
891
892
893 @node Sound output
894 @section Sound output
895
896 @cindex Sound
897 @cindex MIDI
898
899 MIDI (Musical Instrument Digital Interface) is a standard for
900 connecting and controlling digital instruments.  A MIDI file is a
901 series of notes in a number of tracks.  It is not an actual
902 sound file; you need special software to translate between the
903 series of notes and actual sounds.
904
905 Pieces of music can be converted to MIDI files, so you can listen to
906 what was entered.  This is convenient for checking the music; octaves
907 that are off or accidentals that were mistyped stand out very much
908 when listening to the MIDI output.
909
910 @refbugs
911
912 Many musically interesting effects, such as swing, articulation,
913 slurring, etc., are not translated to midi.
914
915 The midi output allocates a channel for each staff, and one for global
916 settings.  Therefore the midi file should not have more than 15 staves
917 (or 14 if you do not use drums).  Other staves will remain silent.
918
919 Not all midi players correctly handle tempo changes in the midi
920 output.  Players that are known to work include
921 @uref{http://@/timidity@/.sourceforge@/.net/,timidity}.
922
923 @menu
924 * Creating MIDI files::         
925 * MIDI block::                  
926 * MIDI instrument names::       
927 @end menu
928
929 @node Creating MIDI files
930 @subsection Creating MIDI files 
931
932 To create a MIDI from a music piece of music, add a @code{\midi} block
933 to a score, for example,
934
935 @example 
936 \score @{
937   @var{...music...}
938   \midi @{ \tempo 4=72 @}
939 @}
940 @end example 
941
942 The tempo is specified using the @code{\tempo} command.  In this
943 example the tempo of quarter notes is set to 72 beats per minute.
944
945
946 If there is a @code{\midi} command in a @code{\score}, only MIDI will
947 be produced.  When notation is needed too, a @code{\layout} block must
948 be added
949
950 @example 
951 \score @{
952   @var{...music...}
953   \midi @{ \tempo 4=72 @}
954   \layout @{ @}
955 @}
956 @end example 
957 @cindex layout block
958
959
960
961 Ties, dynamics, and tempo changes are interpreted.  Dynamic marks,
962 crescendi and decrescendi translate into MIDI volume levels.  Dynamic
963 marks translate to a fixed fraction of the available MIDI volume
964 range, crescendi and decrescendi make the volume vary linearly between
965 their two extremes.  The fractions can be adjusted by
966 @code{dynamicAbsoluteVolumeFunction} in @internalsref{Voice} context.
967 For each type of MIDI instrument, a volume range can be defined.  This
968 gives a basic equalizer control, which can enhance the quality of
969 the MIDI output remarkably.  The equalizer can be controlled by
970 setting @code{instrumentEqualizer}.
971
972
973 @node MIDI block
974 @subsection MIDI block
975 @cindex MIDI block
976
977
978 The MIDI block is analogous to the layout block, but it is somewhat
979 simpler.  The @code{\midi} block can contain
980 @cindex MIDI block
981
982 @itemize @bullet
983   @item a @code{\tempo} definition, and
984   @item context definitions.
985 @end itemize
986
987 A number followed by a period is interpreted as a real number, so
988 for setting the tempo for dotted notes, an extra space should be
989 inserted, for example
990
991 @example
992 \midi @{ \tempo 4 . = 120 @} 
993 @end example
994
995
996 @cindex context definition
997
998 Context definitions follow precisely the same syntax as within the
999 \layout block.  Translation modules for sound are called performers.
1000 The contexts for MIDI output are defined in @file{ly/@/performer@/-init@/.ly}.
1001
1002
1003 @node MIDI instrument names
1004 @subsection MIDI instrument names
1005
1006 @cindex instrument names
1007 @cindex @code{Staff.midiInstrument}
1008
1009 The MIDI instrument name is set by the @code{Staff.midiInstrument}
1010 property.  The instrument name should be chosen from the list in
1011 @ref{MIDI instruments}.
1012
1013 @example
1014 \set Staff.midiInstrument = "glockenspiel"
1015 @var{...notes...}
1016 @end example
1017
1018 If the selected instrument does not exactly match an instrument from
1019 the list of MIDI instruments, the Grand Piano (@code{"acoustic grand"})
1020 instrument is used.
1021