]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/non-music.itely
Merge branch 'master' of git://git.sv.gnu.org/lilypond
[lilypond.git] / Documentation / user / non-music.itely
1 @c -*- coding: utf-8; 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 Non-musical notation
9 @chapter Non-musical notation
10
11 This section deals with general lilypond issues, rather than
12 specific notation.
13
14 @menu
15 * Input files::                 
16 * Titles and headers::          
17 * MIDI output::                 
18 * Displaying LilyPond notation::  
19 * Skipping corrected music::    
20 @end menu
21
22
23 @node Input files
24 @section Input files
25
26 The main format of input for LilyPond are text files.  By convention,
27 these files end with ``@code{.ly}''.
28
29 @menu
30 * File structure (introduction)::  
31 * Multiple scores in a book::   
32 * Extracting fragments of notation::  
33 * File structure::              
34 * A single music expression::   
35 * Including LilyPond files::    
36 * Text encoding::               
37 @end menu
38
39
40 @node File structure (introduction)
41 @subsection File structure (introduction)
42
43 A basic example of a lilypond input file is
44
45 @example
46 \version "2.9.13"
47 \score @{
48   @{ @}     % this is a single music expression;
49             % all the music goes in here.
50   \header @{ @}
51   \layout @{ @}
52   \midi @{ @}
53 @}
54 @end example
55
56 @noindent
57 There are many variations of this basic pattern, but this
58 example serves as a useful starting place.
59
60 The major part of this manual is concerned with entering various
61 forms of music in LilyPond.  However, many music expressions are not
62 valid input on their own, for example, a @code{.ly} file containing
63 only a note
64 @example
65 c'4
66 @end example
67
68 @noindent
69 will result in a parsing error.  Instead, music should be inside other
70 expressions, which may be put in a file by themselves.  Such
71 expressions are called toplevel expressions.  The next section enumerates
72 them all.
73
74
75 @node Multiple scores in a book
76 @subsection Multiple scores in a book
77
78 @funindex \book
79 @cindex movements, multiple
80
81 A document may contain multiple pieces of music and texts.  Examples
82 of these are an etude book, or an orchestral part with multiple
83 movements.  Each movement is entered with a @code{\score} block,
84
85 @example
86 \score @{
87   @var{..music..}
88 @}
89 @end example
90
91 and texts are entered with a @code{\markup} block,
92
93 @example
94 \markup @{
95   @var{..text..}
96 @}
97 @end example
98
99 @funindex \book
100
101 All the movements and texts which appear in the same @code{.ly} file 
102 will normally be typeset in the form of a single output file. 
103
104 @example
105 \score @{
106   @var{..}
107 @}
108 \markup @{
109   @var{..}
110 @}
111 \score @{
112   @var{..}
113 @}
114 @end example
115
116 However, if you want multiple output files from the same @code{.ly}
117 file, then you can add multiple @code{\book} blocks, where each such
118 @code{\book} block will result in a separate output. If you do not
119 specify any @code{\book} block in the file, LilyPond will implicitly
120 treat the full file as a single @code{\book} block, see @ref{File
121 structure}. One important exception is within lilypond-book documents,
122 where you explicitly have to add a @code{\book} block, otherwise only
123 the first @code{\score} or @code{\markup} will appear in the output.
124
125 The header for each piece of music can be put inside the @code{\score}
126 block.  The @code{piece} name from the header will be printed before
127 each movement.  The title for the entire book can be put inside the
128 @code{\book}, but if it is not present, the @code{\header} which is at
129 the top of the file is inserted.
130
131 @example
132 \header @{
133   title = "Eight miniatures"
134   composer = "Igor Stravinsky"
135 @}
136 \score @{
137   @dots{}
138   \header @{ piece = "Romanze" @}
139 @}
140 \markup @{
141    ..text of second verse..
142 @}
143 \markup @{
144    ..text of third verse..
145 @}
146 \score @{
147   @dots{}
148   \header @{ piece = "Menuetto" @}
149 @}
150 @end example
151
152 @node Extracting fragments of notation
153 @subsection Extracting fragments of notation
154
155 It is possible to quote small fragments of a large score directly from
156 the output. This can be compared to clipping a piece of a paper score
157 with scissors.
158
159 This is done by definining the measures that need to be cut out
160 separately. For example, including the following definition
161
162
163 @verbatim
164 \layout {
165   clip-regions
166   = #(list
167       (cons
168        (make-rhythmic-location 5 1 2)
169        (make-rhythmic-location 7 3 4)))
170 }       
171 @end verbatim
172
173 @noindent
174 will extract a fragment starting halfway the fifth measure, ending in
175 the seventh measure. The meaning of @code{5 1 2} is: after a 1/2 note
176 in measure 5, and @code{7 3 4} after 3 quarter notes in measure 7.
177
178 More clip regions can be defined by adding more pairs of
179 rhythmic-locations to the list. 
180
181 In order to use this feature, LilyPond must be invoked with
182 @code{-dclip-systems}. The clips are output as EPS files, and are
183 converted to PDF and PNG if these formats are switched on as well.
184
185 For more information on output formats, see @ref{Invoking lilypond}.
186
187 @seealso
188
189 Examples: @inputfileref{input/regression/,clip-systems.ly}
190
191
192 @node File structure
193 @subsection File structure
194
195 A @code{.ly} file contains any number of toplevel expressions, where a
196 toplevel expression is one of the following
197
198 @itemize @bullet
199 @item
200 An output definition, such as @code{\paper}, @code{\midi}, and
201 @code{\layout}.  Such a definition at the toplevel changes the default
202 settings for the block entered.
203
204 @item
205 A direct scheme expression, such as
206 @code{#(set-default-paper-size "a7" 'landscape)} or
207 @code{#(ly:set-option 'point-and-click #f)}.
208
209 @item
210 A @code{\header} block.  This sets the global header block.  This
211 is the block containing the definitions for book-wide settings, like
212 composer, title, etc.
213
214 @item
215 A @code{\score} block.  This score will be collected with other
216 toplevel scores, and combined as a single @code{\book}.
217
218 This behavior can be changed by setting the variable
219 @code{toplevel-score-handler} at toplevel.  The default handler is
220 defined in the init file @file{scm/@/lily@/.scm}.
221
222 The @code{\score} must begin with a music expression, and may
223 contain only one music expression.
224
225 @item
226 A @code{\book} block logically combines multiple movements
227 (i.e., multiple @code{\score} blocks) in one document.  If there are
228 a number of @code{\scores}, one output file will be created for
229 each @code{\book} block, in which all corresponding movements are
230 concatenated. The only reason to explicitly specify @code{\book} blocks
231 in a @code{.ly} file is if you wish multiple output files from a single
232 input file. One exception is within lilypond-book documents, where you
233 explicitly have to add a @code{\book} block if you want more than a
234 single @code{\score} or @code{\markup} in the same example.
235
236 This behavior can be changed by setting the variable
237 @code{toplevel-book-handler} at toplevel.  The default handler is
238 defined in the init file @file{scm/@/lily@/.scm}.
239
240 @item
241 A compound music expression, such as
242 @example
243 @{ c'4 d' e'2 @}
244 @end example
245
246 This will add the piece in a @code{\score} and format it in a
247 single book together with all other toplevel @code{\score}s and music
248 expressions.  In other words, a file containing only the above
249 music expression will be translated into
250
251 @example
252 \book @{
253   \score @{
254     \new Staff @{
255       \new Voice @{
256         @{ c'4 d' e'2 @}
257       @}
258     @}
259   @}
260         \layout @{ @}
261         \header @{ @}
262 @}
263 @end example
264
265 This behavior can be changed by setting the variable
266 @code{toplevel-music-handler} at toplevel.  The default handler is
267 defined in the init file @file{scm/@/lily@/.scm}.
268
269 @item
270 A markup text, a verse for example
271 @example
272 \markup @{
273    2.  The first line verse two.
274 @}
275 @end example
276
277 Markup texts are rendered above, between or below the scores or music
278 expressions, wherever they appear.
279
280 @cindex variables
281 @cindex identifiers
282
283 @item
284 An identifier, such as
285 @example
286 foo = @{ c4 d e d @}
287 @end example
288
289 This can be used later on in the file by entering @code{\foo}.  The
290 name of an identifier should have alphabetic characters only; no
291 numbers, underscores or dashes.
292
293 @end itemize
294
295 The following example shows three things that may be entered at
296 toplevel
297
298 @example
299 \layout @{
300   % movements are non-justified by default
301   ragged-right = ##t
302 @}
303
304 \header @{
305    title = "Do-re-mi"
306 @}
307
308 @{ c'4 d' e2 @}
309 @end example
310
311
312 At any point in a file, any of the following lexical instructions can
313 be entered:
314
315 @itemize @bullet
316 @item @code{\version}
317 @item @code{\include}
318 @item @code{\sourcefilename}
319 @item @code{\sourcefileline}
320
321 @end itemize
322
323
324 @node A single music expression
325 @subsection A single music expression
326
327 A @code{\score} must contain a single music expression.  However,
328 this music expression may be of any size.  Recall that music
329 expressions may be included inside other expressions to form
330 larger expressions.  All of these examples are single music
331 expressions; note the curly braces @{ @} or angle brackets <<
332 >> at the beginning and ending of the music.
333
334 @example
335 @{ c'4 c' c' c' @}
336 @end example
337
338 @lilypond[ragged-right,verbatim,quote]
339 {
340   { c'4 c' c' c'}
341   { d'4 d' d' d'}
342 }
343 @end lilypond
344
345 @lilypond[ragged-right,verbatim,quote]
346 <<
347   \new Staff { c'4 c' c' c' }
348   \new Staff { d'4 d' d' d' }
349 >>
350 @end lilypond
351
352 @example
353 @{
354   \new GrandStaff <<
355     \new StaffGroup <<
356       \new Staff @{ \flute @}
357       \new Staff @{ \oboe @}
358     >>
359     \new StaffGroup <<
360       \new Staff @{ \violinI @}
361       \new Staff @{ \violinII @}
362     >>
363   >>
364 @}
365 @end example
366
367
368 @node Including LilyPond files
369 @subsection Including LilyPond files
370
371 @funindex \include
372 @cindex including files
373
374 A large project may be split up into separate files.  To refer to another
375 file, use
376
377 @example
378 \include "otherfile.ly"
379 @end example
380
381 The line @code{\include "file.ly"} is equivalent to pasting the contents
382 of file.ly into the current file at the place where you have the
383 \include.  For example, for a large project you might write separate files
384 for each instrument part and create a ``full score'' file which brings
385 together the individual instrument files.
386
387 The initialization of LilyPond is done in a number of files that are
388 included by default when you start the program, normally transparent to the
389 user.  Run lilypond --verbose to see a list of paths and files that Lily
390 finds.
391
392 Files placed in directory @file{PATH/TO/share/lilypond/VERSION/ly/} (where
393 VERSION is in the form ``2.6.1'') are on the path and available to
394 @code{\include}.  Files in the
395 current working directory are available to \include, but a file of the same
396 name in LilyPond's installation takes precedence.  Files are
397 available to \include from directories in the search path specified as an
398 option when invoking @code{lilypond --include=DIR} which adds DIR to the
399 search path.
400
401 The @code{\include} statement can use full path information, but with the Unix
402 convention @code{"/"} rather than the DOS/Windows @code{"\"}.  For example,
403 if @file{stuff.ly} is located one directory higher than the current working
404 directory, use
405
406 @example
407 \include "../stuff.ly"
408 @end example
409
410
411 @node Text encoding
412 @subsection Text encoding
413
414 LilyPond uses the Pango library to format multi-lingual texts, and
415 does not perform any input-encoding conversions.  This means that any
416 text, be it title, lyric text, or musical instruction containing
417 non-ASCII characters, must be utf-8.  The easiest way to enter such text is
418 by using a Unicode-aware editor and saving the file with utf-8 encoding.  Most
419 popular modern editors have utf-8 support, for example, vim, Emacs,
420 jEdit, and GEdit do.
421
422 @c  Currently not working
423 @ignore
424 Depending on the fonts installed, the following fragment shows Hebrew
425 and Cyrillic lyrics,
426
427 @cindex Cyrillic
428 @cindex Hebrew
429 @cindex ASCII, non
430
431 @li lypondfile[fontload]{utf-8.ly}
432
433 The @TeX{} backend does not handle encoding specially at all.  Strings
434 in the input are put in the output as-is.  Extents of text items in the
435 @TeX{} backend, are determined by reading a file created via the
436 @file{texstr} backend,
437
438 @example
439 lilypond -b texstr input/les-nereides.ly
440 latex les-nereides.texstr
441 @end example
442
443 The last command produces @file{les-nereides.textmetrics}, which is
444 read when you execute
445
446 @example
447 lilypond -b tex input/les-nereides.ly
448 @end example
449
450 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
451 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
452 interpreting non-ASCII strings.
453
454 @end ignore
455
456 To use a Unicode escape sequence, use
457
458 @example
459 #(ly:export (ly:wide-char->utf-8 #x2014))
460 @end example
461
462
463 @seealso
464
465 @inputfileref{input/regression,utf-8.ly}
466
467
468
469 @node Titles and headers
470 @section Titles and headers
471
472 Almost all printed music includes a title and the composer's name;
473 some pieces include a lot more information.
474
475 @menu
476 * Creating titles::             
477 * Custom titles::               
478 @end menu
479
480
481 @node Creating titles
482 @subsection Creating titles
483
484 Titles are created for each @code{\score} block, and for the full input
485 file (or @code{\book} block).
486
487 The contents of the titles are taken from the @code{\header} blocks.
488 The header block for a book supports the following
489
490
491 @table @code
492 @funindex dedication
493 @item dedication
494 The dedicatee of the music, centered at the top of the first page.
495
496 @funindex title
497 @item title
498 The title of the music, centered just below the dedication.
499
500 @funindex subtitle
501 @item subtitle
502 Subtitle, centered below the title.
503
504 @funindex subsubtitle
505 @item subsubtitle
506 Subsubtitle, centered below the subtitle.
507
508 @funindex poet
509 @item poet
510 Name of the poet, flush-left below the subtitle.
511
512 @funindex composer
513 @item composer
514 Name of the composer, flush-right below the subtitle.
515
516 @funindex meter
517 @item meter
518 Meter string, flush-left below the poet.
519
520 @funindex opus
521 @item opus
522 Name of the opus, flush-right below the composer.
523
524 @funindex arranger
525 @item arranger
526 Name of the arranger, flush-right below the opus.
527
528 @funindex instrument
529 @item instrument
530 Name of the instrument, centered below the arranger.  Also
531 centered at the top of pages (other than the first page).
532
533 @funindex piece
534 @item piece
535 Name of the piece, flush-left below the instrument.
536
537 @cindex page breaks, forcing
538 @funindex breakbefore
539 @item breakbefore
540 This forces the title to start on a new page (set to ##t or ##f).
541
542 @funindex copyright
543 @item copyright
544 Copyright notice, centered at the bottom of the first page.  To
545 insert the copyright symbol, see @ref{Text encoding}.
546
547 @funindex tagline
548 @item tagline
549 Centered at the bottom of the last page.
550
551 @end table
552
553 Here is a demonstration of the fields available.  Note that you
554 may use any @ref{Text markup} commands in the header.
555
556 @lilypond[quote,verbatim,line-width=11.0\cm]
557 \paper {
558   line-width = 9.0\cm
559   paper-height = 10.0\cm
560 }
561
562 \book {
563   \header {
564     dedication = "dedicated to me"
565     title = \markup \center-align { "Title first line" "Title second line,
566 longer" }
567     subtitle = "the subtitle,"
568     subsubtitle = #(string-append "subsubtitle LilyPond version "
569 (lilypond-version))
570     poet = "Poet"
571     composer =  \markup \center-align { "composer" \small "(1847-1973)" }
572     texttranslator = "Text Translator"
573     meter = \markup { \teeny "m" \tiny "e" \normalsize "t" \large "e" \huge
574 "r" }
575     arranger = \markup { \fontsize #8.5 "a" \fontsize #2.5 "r" \fontsize
576 #-2.5 "r" \fontsize #-5.3 "a" \fontsize #7.5 "nger" }
577     instrument = \markup \bold \italic "instrument"
578     piece = "Piece"
579   }
580
581   \score {
582     { c'1 }
583     \header {
584       piece = "piece1"
585       opus = "opus1"
586     }
587   }
588   \markup {
589       and now...
590   }
591   \score {
592     { c'1 }
593     \header {
594       piece = "piece2"
595       opus = "opus2"
596     }
597   }
598 }
599 @end lilypond
600
601 As demonstrated before, you can use multiple @code{\header} blocks.
602 When same fields appear in different blocks, the latter is used.
603 Here is a short example.
604
605 @example
606 \header @{
607   composer = "Composer"
608 @}
609 \header @{
610   piece = "Piece"
611 @}
612 \score @{
613   \new Staff @{ c'4 @}
614   \header @{
615     piece = "New piece"  % overwrite previous one
616   @}
617 @}
618 @end example
619
620 If you define the @code{\header} inside the @code{\score} block, then
621 normally only the @code{piece} and @code{opus} headers will be printed.
622 Note that the music expression must come before the @code{\header}.
623
624 @lilypond[quote,verbatim,line-width=11.0\cm]
625 \score {
626   { c'4 }
627   \header {
628     title = "title"  % not printed
629     piece = "piece"
630     opus = "opus"
631   }
632 }
633 @end lilypond
634
635 @funindex printallheaders
636 @noindent
637 You may change this behavior (and print all the headers when defining
638 @code{\header} inside @code{\score}) by using
639
640 @example
641 \paper@{
642   printallheaders=##t
643 @}
644 @end example
645
646 @cindex copyright
647 @cindex tagline
648
649 The default footer is empty, except for the first page, where the
650 @code{copyright} field from @code{\header} is inserted, and the last
651 page, where @code{tagline} from @code{\header} is added.  The default
652 tagline is ``Music engraving by LilyPond (@var{version})''.@footnote{Nicely
653 printed parts are good PR for us, so please leave the tagline if you
654 can.}
655
656 Headers may be completely removed by setting them to false.
657
658 @example
659 \header @{
660   tagline = ##f
661   composer = ##f
662 @}
663 @end example
664
665
666 @node Custom titles
667 @subsection Custom titles
668
669 A more advanced option is to change the definitions of the following
670 variables in the @code{\paper} block.  The init file
671 @file{ly/titling-init.ly} lists the default layout.
672
673 @table @code
674 @funindex bookTitleMarkup
675 @item bookTitleMarkup
676   This is the title added at the top of the entire output document.
677 Typically, it has the composer and the title of the piece
678
679 @funindex scoreTitleMarkup
680 @item scoreTitleMarkup
681   This is the title put over a @code{\score} block.  Typically, it has
682 the name of the movement (@code{piece} field).
683
684 @funindex oddHeaderMarkup
685 @item oddHeaderMarkup
686   This is the page header for odd-numbered pages.
687
688 @funindex evenHeaderMarkup
689 @item evenHeaderMarkup
690   This is the page header for even-numbered pages.  If unspecified,
691   the odd header is used instead.
692
693   By default, headers are defined such that the page number is on the
694   outside edge, and the instrument is centered.
695
696 @funindex oddFooterMarkup
697 @item oddFooterMarkup
698   This is the page footer for odd-numbered pages.
699
700 @funindex evenFooterMarkup
701 @item evenFooterMarkup
702   This is the page footer for even-numbered pages.  If unspecified,
703   the odd header is used instead.
704
705   By default, the footer has the copyright notice on the first, and
706   the tagline on the last page.
707 @end table
708
709
710 @cindex \paper
711 @cindex header
712 @cindex footer
713 @cindex page layout
714 @cindex titles
715
716 The following definition will put the title flush left, and the
717 composer flush right on a single line.
718
719 @verbatim
720 \paper {
721   bookTitleMarkup = \markup {
722    \fill-line {
723      \fromproperty #'header:title
724      \fromproperty #'header:composer
725    }
726   }
727 }
728 @end verbatim
729
730
731
732 @node MIDI output
733 @section MIDI output
734
735 @cindex Sound
736 @cindex MIDI
737
738 MIDI (Musical Instrument Digital Interface) is a standard for
739 connecting and controlling digital instruments.  A MIDI file is a
740 series of notes in a number of tracks.  It is not an actual
741 sound file; you need special software to translate between the
742 series of notes and actual sounds.
743
744 Pieces of music can be converted to MIDI files, so you can listen to
745 what was entered.  This is convenient for checking the music; octaves
746 that are off or accidentals that were mistyped stand out very much
747 when listening to the MIDI output.
748
749 @refbugs
750
751 Many musically interesting effects, such as swing, articulation,
752 slurring, etc., are not translated to midi.
753
754 The midi output allocates a channel for each staff, and one for global
755 settings.  Therefore the midi file should not have more than 15 staves
756 (or 14 if you do not use drums).  Other staves will remain silent.
757
758 Not all midi players correctly handle tempo changes in the midi
759 output.  Players that are known to work include
760 @uref{http://@/timidity@/.sourceforge@/.net/,timidity}.
761
762 @menu
763 * Creating MIDI files::         
764 * MIDI block::                  
765 * MIDI instrument names::       
766 @end menu
767
768 @node Creating MIDI files
769 @subsection Creating MIDI files
770
771 To create a MIDI from a music piece of music, add a @code{\midi} block
772 to a score, for example,
773
774 @example
775 \score @{
776   @var{...music...}
777    \midi @{
778      \context @{
779        \Score
780        tempoWholesPerMinute = #(ly:make-moment 72 4)
781        @}
782      @}
783 @}
784 @end example
785
786 The tempo can be specified using the @code{\tempo} command within the 
787 actual music, see @ref{Metronome marks}.  An alternative, which does not
788 result in a metronome mark in the printed score, is shown in the example
789 above. In this example the tempo of quarter notes is set to 72 beats per
790 minute. 
791 This kind of tempo
792 specification can not take dotted note lengths as an argument. In this
793 case, break the dotted notes into smaller units. For example, a tempo
794 of 90 dotted quarter notes per minute can be specified as 270 eighth
795 notes per minute
796
797 @example
798 tempoWholesPerMinute = #(ly:make-moment 270 8)
799 @end example
800
801 If there is a @code{\midi} command in a @code{\score}, only MIDI will
802 be produced.  When notation is needed too, a @code{\layout} block must
803 be added
804
805 @example
806 \score @{
807   @var{...music...}
808   \midi @{ @}
809   \layout @{ @}
810 @}
811 @end example
812 @cindex layout block
813
814
815
816 Ties, dynamics, and tempo changes are interpreted.  Dynamic marks,
817 crescendi and decrescendi translate into MIDI volume levels.  Dynamic
818 marks translate to a fixed fraction of the available MIDI volume
819 range, crescendi and decrescendi make the volume vary linearly between
820 their two extremes.  The fractions can be adjusted by
821 @code{dynamicAbsoluteVolumeFunction} in @internalsref{Voice} context.
822 For each type of MIDI instrument, a volume range can be defined.  This
823 gives a basic equalizer control, which can enhance the quality of
824 the MIDI output remarkably.  The equalizer can be controlled by
825 setting @code{instrumentEqualizer}, or by setting
826
827 @example
828 \set Staff.midiMinimumVolume = #0.2
829 \set Staff.midiMaximumVolume = #0.8
830 @end example
831
832 To remove dynamics from the MIDI output, insert the following lines
833 in the @code{\midi@{@}} section.
834
835 @example
836 \midi @{
837   ...
838   \context @{
839     \Voice
840     \remove "Dynamic_performer"
841     \remove "Span_dynamic_performer"
842   @}
843 @}
844 @end example
845
846
847 @refbugs
848
849 Unterminated (de)crescendos will not render properly in the midi file,
850 resulting in silent passages of music.  The workaround is to explicitly
851 terminate the (de)crescendo.  For example,
852
853 @example
854 @{ a\< b c d\f @}
855 @end example
856
857 @noindent
858 will not work properly but
859
860 @example
861 @{ a\< b c d\!\f @}
862 @end example
863
864 @noindent
865 will.
866
867
868 @node MIDI block
869 @subsection MIDI block
870 @cindex MIDI block
871
872
873 The MIDI block is analogous to the layout block, but it is somewhat
874 simpler.  The @code{\midi} block is similar to @code{\layout}. It can contain
875 context definitions.
876
877
878 @cindex context definition
879
880 Context definitions follow precisely the same syntax as within the
881 \layout block.  Translation modules for sound are called performers.
882 The contexts for MIDI output are defined in @file{ly/@/performer@/-init@/.ly}.
883
884
885 @node MIDI instrument names
886 @subsection MIDI instrument names
887
888 @cindex instrument names
889 @funindex Staff.midiInstrument
890
891 The MIDI instrument name is set by the @code{Staff.midiInstrument}
892 property.  The instrument name should be chosen from the list in
893 @ref{MIDI instruments}.
894
895 @example
896 \set Staff.midiInstrument = "glockenspiel"
897 @var{...notes...}
898 @end example
899
900 If the selected instrument does not exactly match an instrument from
901 the list of MIDI instruments, the Grand Piano (@code{"acoustic grand"})
902 instrument is used.
903
904
905 @c  Yes, this is a cop-out; this info doesn't belong in the Scheme
906 @c  chapter, but I'm not certain where to stick it.
907 @c  I think I'll eventually split this chapter into a "paper/layout"
908 @c  chapter and a "misc issues" chapter.  -gp
909 @node Displaying LilyPond notation
910 @section Displaying LilyPond notation
911
912 @funindex \displayLilyMusc
913 Displaying a music expression in LilyPond notation can be
914 done using the music function @code{\displayLilyMusic}.  For example,
915
916 @example
917 @{
918   \displayLilyMusic \transpose c a, @{ c e g a bes @}
919 @}
920 @end example
921
922 will display
923
924 @example
925 @{ a, cis e fis g @}
926 @end example
927
928 By default, LilyPond will print these messages to the console along
929 with all the other messages.  To split up these messages and save
930 the results of @code{\display@{STUFF@}}, redirect the output to
931 a file.
932
933 @example
934 lilypond file.ly >display.txt
935 @end example
936
937
938 @node Skipping corrected music
939 @section Skipping corrected music
940
941
942 @funindex skipTypesetting
943 @funindex showLastLength
944
945 When entering or copying music, usually only the music near the end (where
946 you
947 are adding notes) is interesting to view and correct.  To speed up
948 this correction process, it is possible to skip typesetting of all but
949 the last few measures. This is achieved by putting
950
951 @verbatim
952 showLastLength = R1*5
953 \score { ... }
954 @end verbatim
955
956 @noindent
957 in your source file. This will render only the last 5 measures
958 (assuming 4/4 time signature) of every @code{\score} in the input
959 file. For longer pieces, rendering only a small part is often an order
960 of magnitude quicker than rendering it completely
961
962 Skipping parts of a score can be controlled in a more fine-grained
963 fashion with the property @code{Score.skipTypesetting}.  When it is
964 set, no typesetting is performed at all.
965
966 This property is also used to control output to the MIDI file. Note that
967 it skips all events, including tempo and instrument changes. You have
968 been warned.
969
970 @lilypond[quote,fragment,ragged-right,verbatim]
971 \relative c'' {
972   c8 d
973   \set Score.skipTypesetting = ##t
974   e e e e e e e e
975   \set Score.skipTypesetting = ##f
976   c d b bes a g c2 }
977 @end lilypond
978
979 In polyphonic music, @code{Score.skipTypesetting} will affect all
980 voices and staves, saving even more time.
981
982
983