3 @c A menu is needed before every deeper *section nesting of @node's; run
4 @c M-x texinfo-all-menus-update
5 @c to automagically fill in these menus before saving changes
7 @c FIXME: singular vs. plural: Beams/Beam
15 @c .{Reference Manual}
17 @node Reference Manual
18 @chapter Reference Manual
21 <!--- @@WEB-TITLE@@=Reference Manual --->
25 This document describes GNU LilyPond and its input format. The last
26 revision of this document was made for LilyPond 1.7.10. It assumes
27 that you already know a little bit about LilyPond input (how to
28 make an input file, how to create sheet music from that input file,
29 etc). New users are encouraged to study the tutorial before reading
35 * Easier music entry::
50 * Contemporary notation::
56 @c FIXME: Note entry vs Music entry at top level menu is confusing.
62 Notes constitute the most basic elements of LilyPond input, but they do
63 not form valid input on their own without a @code{\score} block. However,
64 for the sake of brevity and simplicity we will generally omit
65 @code{\score} blocks and @code{\paper} declarations in this manual.
71 * Chromatic alterations::
76 * Automatic note splitting ::
78 * Easy Notation note heads ::
86 A note is printed by specifying its pitch and then its duration.
87 @lilypond[fragment,verbatim]
96 @cindex Note specification
98 @cindex entering notes
100 The verbose syntax for pitch specification is
102 @cindex @code{\pitch}
104 \pitch @var{scmpitch}
107 where @var{scmpitch} is a pitch scheme object.
109 In Note and Chord mode, pitches may be designated by names. The default
110 names are the Dutch note names. The notes are specified by the letters
111 @code{a} through @code{g}, while the octave is formed with notes ranging
112 from @code{c} to @code{b}. The pitch @code{c} is an octave below
113 middle C and the letters span the octave above that C. Here's an example
114 which should make things more clear:
116 @lilypond[fragment,verbatim]
118 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
121 @cindex note names, Dutch
123 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
124 name and a flat is formed by adding @code{-es}. Double sharps and double
125 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
126 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
127 both forms are accepted.
129 LilyPond has predefined sets of note names for various other languages.
130 To use them, simply include the language specific init file. For
131 example: @code{\include "english.ly"}. The available language files and
132 the note names they define are:
137 Note Names sharp flat
138 nederlands.ly c d e f g a bes b -is -es
139 english.ly c d e f g a bf b -s/-sharp -f/-flat
140 deutsch.ly c d e f g a b h -is -es
141 norsk.ly c d e f g a b h -iss/-is -ess/-es
142 svenska.ly c d e f g a b h -iss -ess
143 italiano.ly do re mi fa sol la sib si -d -b
144 catalan.ly do re mi fa sol la sib si -d/-s -b
145 espanol.ly do re mi fa sol la sib si -s -b
154 The optional octave specification takes the form of a series of
155 single quote (`@code{'}') characters or a series of comma
156 (`@code{,}') characters. Each @code{'} raises the pitch by one
157 octave; each @code{,} lowers the pitch by an octave.
159 @lilypond[fragment,verbatim,center]
160 c' c'' es' g' as' gisis' ais'
163 @node Chromatic alterations
164 @subsection Chromatic alterations
166 Normally accidentals are printed automatically, but you may also
167 print them manually. A reminder accidental
168 @cindex reminder accidental
170 can be forced by adding an exclamation mark @code{!}
171 after the pitch. A cautionary accidental
172 @cindex cautionary accidental
173 @cindex parenthesized accidental
174 (an accidental within parentheses) can be obtained by adding the
175 question mark `@code{?}' after the pitch.
177 @lilypond[fragment,verbatim]
178 cis' cis' cis'! cis'?
182 The automatic production of accidentals can be tuned in many
183 ways. For more information, refer to @ref{Accidentals}.
190 Rests are entered like notes, with a ``note name'' of `@code{r}':
192 @lilypond[singleline,verbatim]
196 Whole bar rests, centered in middle of the bar, are specified using
197 @code{R} (capital R); see @ref{Multi measure rests}. See also
200 For some music, you may wish to explicitly specify the rest's vertical
201 position. This can be achieved by entering a note with the @code{\rest}
202 keyword appended. Rest collision testing will leave these rests alone.
204 @lilypond[singleline,verbatim]
214 @cindex Invisible rest
217 An invisible rest (also called a `skip') can be entered like a note
218 with note name `@code{s}' or with @code{\skip @var{duration}}:
220 @lilypond[singleline,verbatim]
224 @c FIXME: in Lyrics mode, we have " " and _
226 In Lyrics mode, you can make invisible syllables by entering `@code{" "}'
228 @lilypond[singleline,verbatim,quote]
230 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
231 \notes\relative c'' { a2 a4 a a2 a4 a }
234 In this case, syllables containing a space will be printed. In the
235 case that you really need an invisible space (i.e. something taking up
236 time, but not space), you should use @code{\skip}.
238 Note that the @code{s} syntax is only available in Note mode and Chord
239 mode. In other situations, you should use the @code{\skip} command,
240 which will work outside of those two modes:
242 @lilypond[singleline,verbatim]
245 { \time 4/8 \skip 2 \time 4/4 }
246 \notes\relative c'' { a2 a1 }
251 The skip command is merely an empty musical placeholder. It doesn't
252 produce any output, not even transparent output.
258 @subsection Durations
262 @cindex @code{\duration}
265 In Note, Chord, and Lyrics mode, durations are designated by numbers
266 and dots: durations are entered as their reciprocal values. For example,
267 a quarter note is entered using a @code{4} (since it's a 1/4 note), while
268 a half note is entered using a @code{2} (since it's a 1/2 note). For notes
269 longer than a whole you must use identifiers.
270 @c FIXME: what's an identifier? I don't think it's been introduced yet.
271 @c and if it has, I obviously skipped that part. - Graham
275 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
277 r1 r2 r4 r8 r16 r32 r64 r64
282 \notes \relative c'' {
284 a1 a2 a4 a8 a16 a32 a64 a64
286 r1 r2 r4 r8 r16 r32 r64 r64
291 \remove "Clef_engraver"
292 \remove "Staff_symbol_engraver"
293 \remove "Time_signature_engraver"
294 \consists "Pitch_squash_engraver"
301 If the duration is omitted then it is set to the previously entered
302 duration. At the start of parsing, a quarter note is assumed. The
303 duration can be followed by dots (`@code{.}') in order to obtain dotted
307 @lilypond[fragment,verbatim,center]
308 a' b' c''8 b' a'4 a'4. b'4.. c'8.
313 You can alter the length of duration by a fraction @var{N/M}
314 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
315 won't affect the appearance of the notes or rests produced.
317 @lilypond[fragment,verbatim]
318 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
321 Durations can also be produced through GUILE extension mechanism.
322 @lilypond[verbatim,fragment]
323 c'\duration #(ly:make-duration 2 1)
329 Dot placement for chords is not perfect. In some cases, dots overlap:
342 A tie connects two adjacent note heads of the same pitch. The tie in
343 effect extends the length of a note. Ties should not be confused with
344 slurs, which indicate articulation, or phrasing slurs, which indicate
345 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
347 @lilypond[fragment,verbatim,center]
348 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
351 When a tie is applied to a chord, all note heads (whose pitches match) are
352 connected. If you try to tie together chords that have no common pitches,
353 no ties will be created.
355 If you want less ties created for a chord, you can set
356 @code{Voice.sparseTies} to true. In this case, a single tie is used
357 for every tied chord.
358 @lilypond[fragment,verbatim,center]
359 \property Voice.sparseTies = ##t
360 <<c' e' g'>> ~ <<c' e' g'>>
363 In its meaning a tie is just a way of extending a note duration, similar
364 to the augmentation dot: the following example are two ways of notating
365 exactly the same concept.
367 @lilypond[fragment, singleline,quote]
368 \time 3/4 c'2. c'2 ~ c'4
370 If you need to tie notes over bars, it may be easier to use
371 @ref{Automatic note splitting}.
373 See also @seeinternals{Tie}.
378 At present, the tie is represented as a separate event, temporally
379 located in between the notes. Tying only a subset of the note heads
380 of a chord is not supported in a simple way. It can be achieved by
381 moving the tie-engraver into the Thread context and turning on and off
384 Switching staves when a tie is active will not work.
386 @node Automatic note splitting
387 @subsection Automatic note splitting
388 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
390 LilyPond can automatically converting long notes to tied notes. This
391 is done by replacing the @code{Note_heads_engraver} by the
392 @code{Completion_heads_engraver}.
394 @lilypond[verbatim,noindent]
396 \notes\relative c'{ \time 2/4
397 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
401 \remove "Note_heads_engraver"
402 \consists "Completion_heads_engraver"
406 This engraver splits all running notes at the bar line, and inserts
407 ties. One of its uses is to debug complex scores: if the measures are
408 not entirely filled, then the ties exactly show how much each measure
413 Not all durations (especially those containing tuplets) can be
414 represented exactly; the engraver will not insert tuplets.
421 @cindex @code{\times}
423 Tuplets are made out of a music expression by multiplying all durations
426 @cindex @code{\times}
428 \times @var{fraction} @var{musicexpr}
431 The duration of @var{musicexpr} will be multiplied by the fraction.
432 In the sheet music, the fraction's denominator will be printed over
433 the notes, optionally with a bracket. The most common tuplet is the
434 triplet in which 3 notes have the length of 2, so the notes are 2/3
435 of their written length:
437 @lilypond[fragment,verbatim,center]
438 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
441 The property @code{tupletSpannerDuration} specifies how long each bracket
442 should last. With this, you can make lots of tuplets while typing
443 @code{\times} only once, saving you lots of typing.
445 @lilypond[fragment, relative, singleline, verbatim]
446 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
447 \times 2/3 { c'8 c c c c c }
450 The format of the number is determined by the property
451 @code{tupletNumberFormatFunction}. The default prints only the
452 denominator, but if you set it to the Scheme function
453 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
457 @cindex @code{tupletNumberFormatFunction}
458 @cindex tuplet formatting
460 See also @seeinternals{TupletBracket}.
464 Nested tuplets are not formatted automatically. In this case, outer
465 tuplet brackets should be moved automatically.
467 @node Easy Notation note heads
468 @subsection Easy Notation note heads
470 @cindex easy notation
473 A entirely different type of note head is the "easyplay" note head: a
474 note head that includes a note name. It is used in some publications by
475 Hal-Leonard Inc. music publishers.
477 @lilypond[singleline,verbatim,26pt]
479 \notes { c'2 e'4 f' | g'1 }
480 \paper { \translator { \EasyNotation } }
484 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
485 probably will want to print it with magnification or a large font size to
486 make it more readable. To print with magnification, you must create a dvi
487 (with @file{ly2dvi}) and then enlarge it with something like @file{dvips -x
488 2000 file.dvi}. See @file{man dvips} for details. To print with a larger
489 font, see @ref{Font Size}.
495 If you view the result with Xdvi, then staff lines will show through
496 the letters. Printing the PostScript file obtained with ly2dvi does
497 produce the correct result.
500 @node Easier music entry
501 @section Easier music entry
504 * Graphical interfaces::
508 * Skipping corrected music::
511 When entering music with LilyPond, it is easy to introduce errors. This
512 section deals with tricks and features that help you enter music, and
513 find and correct mistakes.
515 @node Graphical interfaces
516 @subsection Graphical interfaces
519 @cindex graphical interface
526 One way to avoid entering notes using the keyboard is to use a
527 graphical user interface. The following programs are known to have
528 a lilypond export option:
532 Denemo was once intended as
533 a LilyPond graphical user interface. It run on Gnome/GTK.
536 @uref{http://denemo.sourceforge.net/}
540 Noteedit, a graphical score editor that runs under KDE/Qt.
542 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
546 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
547 has been rewritten from scratch and supports LilyPond export as of
551 @uref{http://rosegarden.sf.net/}
555 Another option is to enter the music using your favorite
556 sequencer/notation editor, and then export it as MIDI or MusicXML.
557 You can then import it in lilypond by using either midi2ly or
559 xml2ly. midi2ly is described in @ref{Invoking midi2ly}. @code{xml2ly}
561 is a tool to convert from the MusicXML music representation format
562 (@uref{http://www.musicxml.org}) to LilyPond format. @code{xml2ly} is
563 described at @uref{http://www.nongnu.org/xml2ly/}.
567 @node Relative octaves
568 @subsection Relative octaves
570 @cindex relative octave specification
572 Octaves are specified by adding @code{'} and @code{,} to pitch names.
573 When you copy existing music, it is easy to accidentally put a pitch in
574 the wrong octave and hard to find such an error. To prevent these
575 errors, LilyPond features octave entry.
577 @cindex @code{\relative}
579 \relative @var{startpitch} @var{musicexpr}
582 The octave of notes that appear in @var{musicexpr} are calculated as
583 follows: If no octave changing marks are used, the basic interval
584 between this and the last note is always taken to be a fourth or less
585 (This distance is determined without regarding alterations; a
586 @code{fisis} following a @code{ceses} will be put above the
589 The octave changing marks @code{'} and @code{,} can be added to raise or
590 lower the pitch by an extra octave. Upon entering relative mode, an
591 absolute starting pitch must be specified that will act as the
592 predecessor of the first note of @var{musicexpr}.
594 Entering music that changes octave frequently is easy in relative mode.
595 @lilypond[fragment,singleline,verbatim,center]
601 And octave changing marks are used for intervals greater than a fourth.
602 @lilypond[fragment,verbatim,center]
607 If the preceding item is a chord, the first note of the chord is used
608 to determine the first note of the next chord. However, other notes
609 within the second chord are determined by looking at the immediately
612 @lilypond[fragment,verbatim,center]
619 @cindex @code{\notes}
621 The pitch after the @code{\relative} contains a note name. To parse
622 the pitch as a note name, you have to be in note mode, so there must
623 be a surrounding @code{\notes} keyword (which is not
626 The relative conversion will not affect @code{\transpose},
627 @code{\chords} or @code{\relative} sections in its argument. If you
628 want to use relative within transposed music, you must place an
629 additional @code{\relative} inside the @code{\transpose}.
634 @subsection Bar check
638 @cindex @code{barCheckSynchronize}
642 Whenever a bar check is encountered during interpretation, a warning
643 message is issued if it doesn't fall at a measure boundary. This can
644 help you find errors in the input. Depending on the value of
645 @code{barCheckSynchronize}, the beginning of the measure will be
646 relocated, so this can also be used to shorten measures.
648 A bar check is entered using the bar symbol, @code{|}:
650 \time 3/4 c2 e4 | g2.
655 @cindex skipTypesetting
657 Failed bar checks are most often caused by entering incorrect
658 durations. Incorrect durations often completely garble up the score,
659 especially if it is polyphonic, so you should start correcting the score
660 by scanning for failed bar checks and incorrect durations. To speed up
661 this process, you can use @code{skipTypesetting} (See @ref{Skipping
664 @c . {Point and click}
665 @node Point and click
666 @subsection Point and click
667 @cindex poind and click
669 Point and click lets you find notes in the input by clicking on them in
670 the Xdvi window. This makes it very easy to find input that causes some
671 error in the sheet music.
673 To use it, you need the following software
675 @item A dvi viewer that supports src specials.
677 @item Xdvi, version 22.36 or newer. Available from
678 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
680 Note that most @TeX{} distributions ship with xdvik, which is always
681 a few versions behind the official Xdvi. To find out which xdvi you
682 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
683 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
684 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
693 @item An editor with a client/server interface (or a lightweight GUI
699 @item Emacs. Emacs is an extensible text-editor. It is available from
700 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
703 @c move this elsewhere?
705 LilyPond also comes with support files for emacs: lilypond-mode for
706 emacs provides indentation, autocompletion, syntax coloring, handy
707 compile short-cuts and reading Info documents of lilypond inside emacs.
708 If lilypond-mode is not installed on your platform,
709 then refer to the installation instructions for more information.
713 @cindex lilypond-mode for emacs
714 @cindex syntax coloring
716 @item XEmacs. Xemacs is very similar to emacs.
720 @item NEdit. NEdit runs under Windows, and Unix.
721 It is available from @uref{http://www.nedit.org}.
725 @item GVim. GVim is a GUI variant of VIM, the popular VI
726 clone. It is available from @uref{http://www.vim.org}.
735 Xdvi must be configured to find the @TeX{} fonts and music
736 fonts. Refer to the Xdvi documentation for more information.
738 To use point-and-click, add one of these lines to the top of your .ly
741 #(ly:set-point-and-click 'line)
743 @cindex line-location
745 When viewing, Control-Mousebutton 1 will take you to the originating
746 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
749 If you correct large files with point-and-click, be sure to start
750 correcting at the end of the file. When you start at the top, and
751 insert one line, all following locations will be off by a line.
754 For using point-and-click with emacs, add the following
755 In your emacs startup file (usually @file{~/.emacs}),
760 Make sure that the environment variable @var{XEDITOR} is set to
762 emacsclient --no-wait +%l %f
764 @cindex @var{XEDITOR}
765 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
766 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
768 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
769 use this argument with xdvi's @code{-editor} option.
772 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
773 use this argument with xdvi's @code{-editor} option.
775 If can also make your editor jump to the exact location of the note
776 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
777 20 must apply the patch @file{emacsclient.patch}. Users of version 21
778 must apply @file{server.el.patch} (version 21.2 and earlier). At the
779 top of the @code{ly} file, replace the @code{set-point-and-click} line
780 with the following line,
782 #(ly:set-point-and-click 'line-column)
784 @cindex line-colomn-location
785 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. Vim
786 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
792 When you convert the @TeX{} file to PostScript using @code{dvips}, it
793 will complain about not finding @code{src:X:Y} files. These complaints
794 are harmless, and can be ignored.
796 @node Skipping corrected music
797 @subsection Skipping corrected music
799 The property @code{Score.skipTypesetting} can be used to switch on and
800 off typesetting completely during the interpretation phase. When
801 typesetting is switched off, the music is processed much more quickly.
802 You can use this to skip over the parts of a score that you have already
805 @lilypond[fragment,singleline,verbatim]
807 \property Score.skipTypesetting = ##t
809 \property Score.skipTypesetting = ##f
817 @section Staff notation
819 This section deals with music notation that occurs on staff level,
820 such as keys, clefs and time signatures.
822 @cindex Staff notation
834 @subsection Staff symbol
837 @cindex adjusting staff symbol
838 @cindex StaffSymbol, using \property
839 @cindex staff lines, setting number of
842 The lines of the staff symbol are formed by the
843 @internalsref{StaffSymbol} object. This object is created at the moment
844 that their context is created. You can not change the appearance of
845 the staff symbol by using @code{\override} or @code{\set}. At the
846 moment that @code{\property Staff} is interpreted, a Staff context is
847 made, and the StaffSymbol is created before any @code{\override} is
848 effective. You can deal with this either overriding properties in a
849 @code{\translator} definition, or by using @code{\outputproperty}.
854 If you end a staff half way a piece, the staff symbol may not end
855 exactly on the barline.
860 @subsection Key signature
865 Setting or changing the key signature is done with the @code{\key}
868 @code{\key} @var{pitch} @var{type}
871 @cindex @code{\minor}
872 @cindex @code{\major}
873 @cindex @code{\minor}
874 @cindex @code{\ionian}
875 @cindex @code{\locrian}
876 @cindex @code{\aeolian}
877 @cindex @code{\mixolydian}
878 @cindex @code{\lydian}
879 @cindex @code{\phrygian}
880 @cindex @code{\dorian}
882 Here, @var{type} should be @code{\major} or @code{\minor} to get
883 @var{pitch}-major or @var{pitch}-minor, respectively.
884 The standard mode names @code{\ionian},
885 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
886 @code{\phrygian}, and @code{\dorian} are also defined.
888 This command sets the context property @code{Staff.keySignature}.
889 Non-standard key signatures can be specified by setting this property
892 The printed signature is a @internalsref{KeySignature} object, typically
893 created in @internalsref{Staff} context.
895 @cindex @code{keySignature}
902 The clef can be set or changed with the @code{\clef} command:
903 @lilypond[fragment,verbatim]
904 \key f\major c''2 \clef alto g'2
907 Supported clef-names include
908 @c Moved standard clefs to the top /MB
910 @item treble, violin, G, G2
919 G clef on 1st line, so-called French violin clef
934 By adding @code{_8} or @code{^8} to the clef name, the clef is
935 transposed one octave down or up, respectively. Note that you have to
936 enclose @var{clefname} in quotes if you use underscores or digits in the
942 The object for this symbol is @internalsref{Clef}.
945 This command is equivalent to setting @code{clefGlyph},
946 @code{clefPosition} (which controls the Y position of the clef),
947 @code{centralCPosition} and @code{clefOctavation}. A clef is created
948 when any of these properties are changed.
951 @c . {Time signature}
953 @subsection Time signature
954 @cindex Time signature
958 The time signature is set or changed by the @code{\time}
960 @lilypond[fragment,verbatim]
961 \time 2/4 c'2 \time 3/4 c'2.
964 The actual symbol that's printed can be customized with the @code{style}
965 property. Setting it to @code{#'()} uses fraction style for 4/4 and
969 The object for this symbol is @internalsref{TimeSignature}. There are
970 many more options for its layout. They are selected through the
971 @code{style} object property. See @file{input/test/time.ly} for more
974 This command sets the property @code{timeSignatureFraction},
975 @code{beatLength} and @code{measureLength} in the @code{Timing}
976 context, which is normally aliased to @internalsref{Score}. The property
977 @code{timeSignatureFraction} determine where bar lines should be
978 inserted, and how automatic beams should be generated. Changing the
979 value of @code{timeSignatureFraction} also causes a time signature
980 symbol to be printed.
982 More options are available through the Scheme function
983 @code{set-time-signature}. In combination with the
984 @internalsref{Measure_grouping_engraver}, it will create
985 @internalsref{MeasureGrouping} signs. Such signs ease reading
986 rhythmically complex modern music. In the following example, the 9/8
987 measure is subdivided in 2, 2, 2 and 3. This is passed to
988 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
991 \score { \notes \relative c'' {
992 #(set-time-signature 9 8 '(2 2 2 3))
993 g8 g d d g g a8-[-( bes g-]-) |
994 #(set-time-signature 5 8 '(3 2))
999 \translator { \StaffContext
1000 \consists "Measure_grouping_engraver"
1009 @cindex partial measure
1010 @cindex measure, partial
1011 @cindex shorten measures
1012 @cindex @code{\partial}
1014 Partial measures, for example in upbeats, are entered using the
1015 @code{\partial} command:
1016 @lilypond[fragment,verbatim]
1017 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
1020 The syntax for this command is
1022 \partial @var{duration}
1024 This is internally translated into
1026 \property Timing.measurePosition = -@var{length of duration}
1029 The property @code{measurePosition} contains a rational number
1030 indicating how much of the measure has passed at this point.
1033 @node Unmetered music
1034 @subsection Unmetered music
1036 Bar lines and bar numbers are calculated automatically. For unmetered
1037 music (e.g. cadenzas), this is not desirable. The commands
1038 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
1041 @lilypond[fragment,relative,singleline,verbatim]
1049 The property @code{Score.timing} can be used to switch off this
1054 @subsection Bar lines
1058 @cindex measure lines
1061 Bar lines are inserted automatically, but if you need a special type
1062 of barline, you can force one using the @code{\bar} command:
1063 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1066 The following bar types are available
1067 @lilypond[fragment, relative, singleline, verbatim]
1079 You are encouraged to use @code{\repeat} for repetitions. See
1082 In scores with many staves, the barlines are automatically placed at
1083 top level, and they are connected between different staves of a
1084 @internalsref{StaffGroup}:
1085 @lilypond[fragment, verbatim]
1086 < \context StaffGroup <
1087 \context Staff = up { e'4 d'
1090 \context Staff = down { \clef bass c4 g e g } >
1091 \context Staff = pedal { \clef bass c2 c2 } >
1094 The objects that are created at @internalsref{Staff} level. The name is
1095 @internalsref{BarLine}.
1097 The command @code{\bar @var{bartype}} is a short cut for
1098 doing @code{\property Score.whichBar = @var{bartype}}
1099 Whenever @code{whichBar} is set to a string, a bar line of that type is
1100 created. @code{whichBar} is usually set automatically: at the start of
1101 a measure it is set to @code{defaultBarType}. The contents of
1102 @code{repeatCommands} is used to override default measure bars.
1104 @code{whichBar} can also be set directly, using @code{\property} or
1105 @code{\bar }. These settings take precedence over the automatic
1106 @code{whichBar} settings.
1109 @cindex Bar_line_engraver
1111 @cindex repeatCommands
1112 @cindex defaultBarType
1121 The easiest way to enter such fragments with more than one voice on a
1122 staff is to split chords using the separator @code{\\}. You can use
1123 it for small, short-lived voices (make a chord of voices) or for
1126 @lilypond[verbatim,fragment]
1127 \context Voice = VA \relative c'' {
1128 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1132 The separator causes @internalsref{Voice} contexts to be instantiated,
1133 bearing the names @code{"1"}, @code{"2"}, etc.
1135 Sometimes, it is necessary to instantiate these contexts by hand: For
1136 Instantiate a separate Voice context for each part, and use
1137 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1138 and horizontal shift for each part.
1141 @lilypond[singleline, verbatim]
1143 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1144 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1145 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1148 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1149 ties, slurs and stems, and set shift directions.
1151 If you want more than four voices, you can also manually set
1152 horizontal shifts and stem directions, as is shown in the following example:
1153 @lilypond[fragment, verbatim]
1154 \context Staff \notes\relative c''<
1155 \context Voice=one {
1156 \shiftOff \stemUp e4
1158 \context Voice=two {
1159 \shiftOn \stemUp cis
1161 \context Voice=three {
1162 \shiftOnn \stemUp ais
1164 \context Voice=four {
1165 \shiftOnnn \stemUp fis
1171 Normally, note heads with a different number of dots are not merged, but
1172 if you set the object property @code{merge-differently-dotted}, they are:
1173 @lilypond[verbatim,fragment,singleline]
1176 \property Staff.NoteCollision \override
1177 #'merge-differently-dotted = ##t
1179 } \\ { [g'8. f16] [g'8. f'16] }
1183 Similarly, you can merge half note heads with eighth notes, by setting
1184 @code{merge-differently-headed}:
1185 @lilypond[fragment, relative=2,verbatim]
1188 \property Staff.NoteCollision
1189 \override #'merge-differently-headed = ##t
1190 c8 c4. } \\ { c2 c2 } >
1193 LilyPond also vertically shifts rests that are opposite of a stem.
1195 @lilypond[singleline,fragment,verbatim]
1196 \context Voice < c''4 \\ r4 >
1199 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1203 Resolving collisions is a very intricate subject, and LilyPond only
1204 handles a few situations. When it can not cope, you are advised to use
1205 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1206 rests to override typesetting decisions.
1211 Beams are used to group short notes into chunks that are aligned with
1212 the metrum. They are inserted automatically in most cases.
1214 @lilypond[fragment,verbatim, relative=2]
1215 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1218 If you're not satisfied with the automatic beaming, you can enter the
1219 beams explicitly. If you have beaming patterns that differ from the
1220 defaults, you can also set the patterns for automatic beamer.
1222 See also @internalsref{Beam}.
1225 @cindex Automatic beams
1226 @subsection Manual beams
1227 @cindex beams, manual
1231 In some cases it may be necessary to override LilyPond's automatic
1232 beaming algorithm. For example, the auto beamer will not beam over
1233 rests or bar lines, If you want that, specify the begin and end point
1234 manually using a @code{[} before the first beamed note and a @code{]}
1235 after the last note:
1237 @lilypond[fragment,relative,verbatim]
1239 r4 r8-[ g' a r8-] r8 g-[ | a-] r8
1243 @cindex @code{stemLeftBeamCount}
1245 Normally, beaming patterns within a beam are determined automatically.
1246 When this mechanism fouls up, the properties
1247 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1248 be used to control the beam subdivision on a stem. If you set either
1249 property, its value will be used only once, and then it is erased.
1251 @lilypond[fragment,relative,verbatim]
1254 f8-[ r16 \property Voice.stemLeftBeamCount = #1 f g a-]
1257 @cindex @code{stemRightBeamCount}
1260 The property @code{subdivideBeams} can be set in order to subdivide
1261 all 16th or shorter beams at beat positions. This accomplishes the
1262 same effect as twiddling with @code{stemLeftBeamCount} and
1263 @code{stemRightBeamCount}, but it take less typing.
1267 c16-[ c c c c c c c-]
1268 \property Voice.subdivideBeams = ##t
1269 c16-[ c c c c c c c-]
1270 c32-[ c c c c c c c c c c c c c c c-]
1271 \property Score.beatLength = #(ly:make-moment 1 8)
1272 c32-[ c c c c c c c c c c c c c c c-]
1276 \notes \relative c' {
1277 c16-[ c c c c c c c-]
1278 \property Voice.subdivideBeams = ##t
1279 c16-[ c c c c c c c-]
1280 c32-[ c c c c c c c c c c c c c c c-]
1281 \property Score.beatLength = #(ly:make-moment 1 8)
1282 c32-[ c c c c c c c c c c c c c c c-]
1286 @cindex subdivideBeams
1288 Kneed beams are inserted automatically, when a large gap between two
1289 adjacent beamed notes is detected. This behavior can be tuned through
1290 the object property @code{auto-knee-gap}.
1292 @cindex beams, kneed
1294 @cindex auto-knee-gap
1297 @c TODO -> why this ref? Document?
1298 @cindex @code{neutral-direction}
1304 Auto knee beams can not be used together with hara kiri staves.
1308 The Automatic beamer does not put @strong{unfinished} beams on the
1309 last notes of a score.
1311 Formatting of ties is a difficult subject. LilyPond often does not
1312 give optimal results.
1315 * Setting automatic beam behavior ::
1319 @no de Beam typography
1320 @sub section Beam typography
1322 One of the strong points of LilyPond is how beams are formatted. Beams
1323 are quantized, meaning that the left and right endpoints beams start
1324 exactly on staff lines. Without quantization, small wedges of white
1325 space appear between the beam and staff line, and this looks untidy.
1327 Beams are also slope-damped: melodies that go up or down should also
1328 have beams that go up or down, but the slope of the beams should be
1329 less than the slope of the notes themselves.
1331 Some beams should be horizontal. These are so-called concave beams.
1333 [TODO: some pictures.]
1336 @c . {Automatic beams}
1337 @node Setting automatic beam behavior
1338 @subsection Setting automatic beam behavior
1340 @cindex @code{autoBeamSettings}
1341 @cindex @code{(end * * * *)}
1342 @cindex @code{(begin * * * *)}
1343 @cindex automatic beams, tuning
1344 @cindex tuning automatic beaming
1346 In normal time signatures, automatic beams can start on any note but can
1347 only end in a few positions within the measure: beams can end on a beat,
1348 or at durations specified by the properties in
1349 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1350 are defined in @file{scm/auto-beam.scm}.
1352 The value of @code{autoBeamSettings} is changed using
1353 @code{\override} and unset using @code{\revert}:
1355 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1356 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1358 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1359 whether the rule applies to begin or end-points. The quantity
1360 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1361 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1362 signature (wildcards, `@code{* *}' may be entered to designate all time
1365 For example, if you want automatic beams to end on every quarter note,
1366 you can use the following:
1368 \property Voice.autoBeamSettings \override
1369 #'(end * * * *) = #(ly:make-moment 1 4)
1371 Since the duration of a quarter note is 1/4 of a whole note, it is
1372 entered as @code{(ly:make-moment 1 4)}.
1374 The same syntax can be used to specify beam starting points. In this
1375 example, automatic beams can only end on a dotted quarter note.
1377 \property Voice.autoBeamSettings \override
1378 #'(end * * * *) = #(ly:make-moment 3 8)
1380 In 4/4 time signature, this means that automatic beams could end only on
1381 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1382 3/8 has passed within the measure).
1384 You can also restrict rules to specific time signatures. A rule that
1385 should only be applied in @var{N}/@var{M} time signature is formed by
1386 replacing the second asterisks by @var{N} and @var{M}. For example, a
1387 rule for 6/8 time exclusively looks like
1389 \property Voice.autoBeamSettings \override
1390 #'(begin * * 6 8) = ...
1393 If you want a rule to apply to certain types of beams, you can use the
1394 first pair of asterisks. Beams are classified according to the shortest
1395 note they contain. For a beam ending rule that only applies to beams
1396 with 32nd notes (and no shorter notes), you would use @code{(end 1
1400 @c Automatic beams can not be put on the last note in a score.
1402 If a score ends while an automatic beam has not been ended and is still
1403 accepting notes, this last beam will not be typeset at all.
1405 @cindex automatic beam generation
1407 @cindex @code{Voice.autoBeaming}
1410 For melodies that have lyrics, you may want to switch off
1411 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1417 It is not possible to specify beaming parameters for beams with mixed
1418 durations, that differ from the beaming parameters of all separate
1419 durations, i.e., you'll have to specify manual beams to get:
1421 @lilypond[singleline,fragment,relative,noverbatim,quote]
1422 \property Voice.autoBeamSettings
1423 \override #'(end * * * *) = #(ly:make-moment 3 8)
1424 \time 12/8 c'8 c c c16 c c c c c c-[ c c c-] c8 c c4
1426 It is not possible to specify beaming parameters that act differently in
1427 different parts of a measure. This means that it is not possible to use
1428 automatic beaming in irregular meters such as @code{5/8}.
1431 @section Accidentals
1433 This section describes how to change the way that LilyPond automatically
1434 inserts accidentals before the running notes.
1437 * Using the predefined accidental macros::
1438 * Defining your own accidental typesettings::
1441 @node Using the predefined accidental macros
1442 @subsection Using the predefined accidental macros
1443 The constructs for describing the accidental typesetting rules are
1444 quite hairy, so non-experts should stick to the macros defined in
1445 @file{ly/property-init.ly}.
1446 @cindex @file{property-init.ly}
1448 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1449 means that the macros shuold normally be invoked right after the
1450 creation of the context in which the accidental typesetting described
1451 by the macro is to take effect. I.e. if you want to use
1452 piano-accidentals in a pianostaff then you issue
1453 @code{\pianoAccidentals} first thing after the creation of the piano
1457 \notes \relative c'' <
1458 \context Staff = sa @{ cis4 d e2 @}
1459 \context GrandStaff <
1461 \context Staff = sb @{ cis4 d e2 @}
1462 \context Staff = sc @{ es2 c @}
1464 \context Staff = sd @{ es2 c @}
1468 @lilypond[singleline]
1470 \notes \relative c'' <
1471 \context Staff = sa { cis4 d e2 }
1472 \context GrandStaff <
1474 \context Staff = sb { cis4 d e2 }
1475 \context Staff = sc { es2 c }
1477 \context Staff = sd { es2 c }
1482 minimumVerticalExtent = #'(-4.0 . 4.0)
1490 @item \defaultAccidentals
1491 @cindex @code{\defaultAccidentals}
1492 This is the default typesetting behaviour. It should correspond
1493 to 18th century common practice: Accidentals are
1494 remembered to the end of the measure in which they occur and
1495 only on their own octave.
1497 @item \voiceAccidentals
1498 @cindex @code{\voiceAccidentals}
1499 The normal behaviour is to remember the accidentals on
1501 This macro, however, typesets accidentals individually for each
1503 Apart from that the rule is similar to
1504 @code{\defaultAccidentals}.
1506 Warning: This leads to some weird and often unwanted results
1507 because accidentals from one voice DO NOT get cancelled in other
1509 @lilypond[singleline,relative,fragment,verbatim,quote]
1512 \context Voice=va { \voiceOne es g }
1513 \context Voice=vb { \voiceTwo c, e }
1516 Hence you should only use @code{\voiceAccidentals}
1517 if the voices are to be read solely by
1518 individual musicians. if the staff should be readable also
1519 by one musician/conductor then you should use
1520 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1523 @item \modernAccidentals
1524 @cindex @code{\modernAccidentals}
1525 This rule should correspond to the common practice in the 20th
1527 The rule is a bit more complex than @code{\defaultAccidentals}:
1528 You get all the same accidentals, but temporary
1529 accidentals also get cancelled in other octaves. Further more,
1530 in the same octave, they also get cancelled in the following measure:
1531 @lilypond[singleline,fragment,verbatim]
1533 cis' c'' cis'2 | c'' c'
1536 @item \modernCautionaries
1537 @cindex @code{\modernCautionaries}
1538 This rule is similar to @code{\modernAccidentals}, but the
1539 ``extra'' accidentals (the ones not typeset by
1540 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1541 (i.e. in reduced size):
1542 @lilypond[singleline,fragment,verbatim]
1544 cis' c'' cis'2 | c'' c'
1547 @item \modernVoiceAccidentals
1548 @cindex @code{\modernVoiceAccidentals}
1549 Multivoice accidentals to be read both by musicians playing one voice
1550 and musicians playing all voices.
1552 Accidentals are typeset for each voice, but they ARE cancelled
1553 across voices in the same @internalsref{Staff}.
1555 @item \modernVoiceCautionaries
1556 @cindex @code{\modernVoiceCautionaries}
1557 The same as @code{\modernVoiceAccidentals}, but with the
1558 extra accidentals (the ones not typeset by
1559 @code{\voiceAccidentals}) typeset as cautionaries.
1560 Notice that even though all accidentals typeset by
1561 @code{\defaultAccidentals} ARE typeset by this macro then some
1562 of them are typeset as cautionaries.
1564 @item \pianoAccidentals
1565 @cindex @code{\pianoAccidentals}
1566 20th century practice for piano notation. Very similar to
1567 @code{\modernAccidentals} but accidentals also get cancelled
1568 across the staves in the same @internalsref{GrandStaff} or
1569 @internalsref{PianoStaff}.
1571 @item \pianoCautionaries
1572 @cindex @code{\pianoCautionaries}
1573 As @code{\pianoAccidentals} but with the extra accidentals
1574 typeset as cautionaries.
1577 @cindex @code{\noResetKey}
1578 Same as @code{\defaultAccidentals} but with accidentals lasting
1579 ``forever'' and not only until the next measure:
1580 @lilypond[singleline,fragment,verbatim,relative]
1585 @item \forgetAccidentals
1586 @cindex @code{\forgetAccidentals}
1587 This is sort of the opposite of @code{\noResetKey}: Accidentals
1588 are not remembered at all - and hence all accidentals are
1589 typeset relative to the key signature, regardless of what was
1590 before in the music:
1591 @lilypond[singleline,fragment,verbatim,relative]
1593 \key d\major c4 c cis cis d d dis dis
1597 @node Defining your own accidental typesettings
1598 @subsection Defining your own accidental typesettings
1600 This section must be considered gurus-only, and hence it must be
1601 sufficient with a short description of the system and a reference to
1602 the internal documentation.
1604 The idea of the algorithm is to try several different rules and then
1605 use the rule that gives the highest number of accidentals.
1606 Each rule cosists of
1609 In which context is the rule applied. I.e. if context is
1610 @internalsref{Score} then all staves share accidentals, and if
1611 context is @internalsref{Staff} then all voices in the same
1612 staff share accidentals, but staves don't - like normally.
1614 Whether the accidental changes all octaves or only the current
1617 Over how many barlines the accidental lasts.
1618 If lazyness is @code{-1} then the accidental is forget
1619 immidiately, and if lazyness is @code{#t} then the accidental
1623 As described in the internal documentation of
1624 @reng{Accidental_engraver}, the properties @code{autoAccidentals} and
1625 @code{autoCautionaries} contain lists of rule descriptions. Notice
1626 that the contexts must be listed from in to out - that is
1627 @internalsref{Thread} before @internalsref{Voice},
1628 @internalsref{Voice} before @internalsref{Staff}, etc.
1629 see the macros in @file{ly/property-init.ly} for examples of how the
1634 Currently the simultaneous notes are considered to be entered in
1635 sequential mode. This means that in a chord the accidentals are
1636 typeset as if the notes in the chord happened one at a time - in the
1637 order in which they appear in the input file.
1639 Of course this is only a problem when you have simultainous notes
1640 which accidentals should depend on each other.
1641 Notice that the problem only occurs when using non-default accidentals
1642 - as the default accidentals only depend on other accidentals on the
1643 same staff and same pitch and hence cannot depend on other
1646 This example shows two examples of the same music giving different
1647 accidentals depending on the order in which the notes occur in the
1650 @lilypond[singleline,fragment,verbatim]
1651 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1652 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2 | <<cis' c''>> r | <<c'' cis'>> r |
1655 The only solution is to manually insert the problematic
1656 accidentals using @code{!} and @code{?}.
1658 @node Expressive marks
1659 @section Expressive marks
1668 * Analysis brackets::
1675 A slur indicates that notes are to be played bound or @emph{legato}.
1676 They are entered using parentheses:
1677 @lilypond[fragment,verbatim,center]
1678 f'-( g'-)-( a'-) [a'8 b'-(-] a'4 g'2 f'4-)
1679 <<c' e'>>2-( <<b d'>>2-)
1682 See also @seeinternals{Slur}.
1684 Slurs avoid crossing stems, and are generally attached to note heads.
1685 However, in some situations with beams, slurs may be attached to stem
1686 ends. If you want to override this layout you can do this through the
1687 object property @code{attachment} of @internalsref{Slur} in
1688 @internalsref{Voice} context It's value is a pair of symbols, specifying
1689 the attachment type of the left and right end points.
1691 @lilypond[fragment,relative,verbatim]
1693 \property Voice.Stem \set #'length = #5.5
1695 \property Voice.Slur \set #'attachment = #'(stem . stem)
1699 If a slur would strike through a stem or beam, the slur will be moved
1700 away upward or downward. If this happens, attaching the slur to the
1701 stems might look better:
1703 @lilypond[fragment,relative,verbatim]
1706 \property Voice.Slur \set #'attachment = #'(stem . stem)
1711 Similarly, the curvature of a slur is adjusted to stay clear of note
1712 heads and stems. When that would increase the curvature too much, the
1713 slur is reverted to its default shape. The threshold for this
1714 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1715 It is loosely related to the enclosed area between the slur and the
1716 notes. Usually, the default setting works well, but in some cases you
1717 may prefer a curved slur when LilyPond decides for a vertically moved
1718 one. You can indicate this preference by increasing the
1719 @code{beautiful} value:
1721 @lilyp ond[verbatim,singleline,relative]
1723 c16-( a' f' a a f a, c,-)
1724 c-( a' f' a a f d, c-)
1725 \property Voice.Slur \override #'beautiful = #5.0
1726 c-( a' f' a a f d, c-)
1732 Producing nice slurs is a difficult problem, and LilyPond currently
1733 uses a simple, empiric method to produce slurs. In some cases, the
1734 results of this method are ugly.
1737 This is reflected by the
1738 @code{beautiful} property, which it is an arbitrary parameter in the
1739 slur formatter. Useful values can only be determined by trial and
1743 @cindex Adjusting slurs
1745 @node Phrasing slurs
1746 @subsection Phrasing slurs
1748 @cindex phrasing slurs
1749 @cindex phrasing marks
1751 A phrasing slur (or phrasing mark) connects chords and is used to
1752 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1755 @lilypond[fragment,verbatim,center,relative]
1756 \time 6/4 c' \( d ( e-) f ( e-) d-\)
1759 Typographically, the phrasing slur behaves almost exactly like a normal
1760 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1761 similarily to normal slurs, phrasing slurs count as different objects.
1762 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1763 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1764 @code{\phrasingSlurBoth}.
1766 Note that the commands
1767 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1768 normal slurs and not phrasing slurs.
1771 @subsection Breath marks
1773 Breath marks are entered using @code{\breathe}. See also
1774 @seeinternals{BreathingSign}.
1776 @lilypond[fragment,relative]
1785 @cindex beats per minute
1786 @cindex metronome marking
1788 Metronome settings can be entered as follows:
1790 @cindex @code{\tempo}
1792 \tempo @var{duration} = @var{perminute}
1795 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1800 The tempo setting is not printed, but is only used in the MIDI
1801 output. You can trick lily into producing a metronome mark,
1802 though. Details are in @ref{Text markup}.
1807 @subsection Text spanners
1808 @cindex Text spanners
1810 Some textual indications, e.g. rallentando or accelerando, often extend
1811 over many measures. This is indicated by following the text with a
1812 dotted line. You can create such texts using text spanners. The syntax
1818 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1819 in @internalsref{Voice} context). The string to be printed, as well as the
1820 style is set through object properties.
1822 An application---or rather, a hack---is to fake octavation indications.
1823 @lilypond[fragment,relative,verbatim]
1824 \relative c' { a''' b c a
1825 \property Voice.TextSpanner \set #'type = #'dotted-line
1826 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1827 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1828 \property Staff.centralCPosition = #-13
1829 a\startTextSpan b c a \stopTextSpan }
1833 @node Analysis brackets
1834 @subsection Analysis brackets
1836 @cindex phrasing brackets
1837 @cindex musicological analysis
1838 @cindex note grouping bracket
1840 Brackets are used in musical analysis to indicate structure in musical
1841 pieces. LilyPond supports a simple form of nested horizontal brackets.
1842 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1843 @internalsref{Staff} context. A bracket is started with
1844 @code{\groupOpen} and closed with @code{\groupClose}. This produces
1845 @internalsref{HorizontalBracket} objects.
1847 @lilypond[singleline,verbatim]
1848 \score { \notes \relative c'' {
1849 c4-\groupOpen-\groupOpen
1852 c4-\groupClose-\groupClose
1854 \paper { \translator {
1855 \StaffContext \consists "Horizontal_bracket_engraver"
1873 @subsection Articulations
1874 @cindex Articulations
1876 @cindex articulations
1880 A variety of symbols can appear above and below notes to indicate
1881 different characteristics of the performance. They are added to a note
1882 by adding a dash and the the character signifying the
1883 articulation. They are demonstrated here.
1884 @lilypond[singleline]
1886 \notes \context Voice {
1887 \property Voice.TextScript \set #'font-family = #'typewriter
1888 \property Voice.TextScript \set #'font-shape = #'upright
1894 c''4-^_"c-\\^{ }" s4
1900 The script is automatically placed, but if you need to force
1901 directions, you can use @code{_} to force them down, or @code{^} to
1903 @lilypond[fragment, verbatim]
1908 Other symbols can be added using the syntax
1909 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1910 using @code{^} and @code{_}.
1914 @cindex staccatissimo
1923 @cindex organ pedal marks
1932 @cindex prallmordent
1936 @cindex thumb marking
1943 \property Score.LyricText \override #'font-family =#'typewriter
1944 \property Score.LyricText \override #'font-shape = #'upright
1945 \context Staff \notes {
1946 c''-\accent c''-\marcato c''-\staccatissimo c''^\fermata
1947 c''-\stopped c''-\staccato c''-\tenuto c''-\portato
1949 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1950 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1951 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1952 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1953 c''-\upmordent c''-\downmordent c''-\pralldown c''-\prallup
1954 c''-\lineprall c''-\thumb c''-\segno c''-\coda
1956 \context Lyrics \lyrics {
1957 accent__ marcato__ staccatissimo__ fermata
1958 stopped__ staccato__ tenuto__ portato
1960 downbow__ lheel__ rheel__ ltoe
1961 rtoe__ turn__ open__ flageolet
1962 reverseturn__ trill__ prall__ mordent
1963 prallprall__ prallmordent__ uprall__ downprall
1964 upmordent__ downmordent__ pralldown__ prallup__
1965 lineprall__ thumb__ segno__ coda
1978 Fingering instructions can also be entered in this shorthand. For
1979 finger changes, use markup texts:
1981 @lilypond[verbatim, singleline, fragment]
1982 c'4-1 c'4-2 c'4-3 c'4-4
1983 c^\markup { \fontsize #-3 \number "2-3" }
1986 @cindex finger change
1991 See also @seeinternals{Script} and @seeinternals{Fingering}.
1995 All of these note ornaments appear in the printed output but have no
1996 effect on the MIDI rendering of the music.
1998 Unfortunately, there is no support for adding fingering instructions or
1999 ornaments to individual note heads. Some hacks exist, though. See
2000 @file{input/test/script-horizontal.ly}.
2005 @subsection Text scripts
2006 @cindex Text scripts
2008 In addition, it is possible to place arbitrary strings of text or markup
2009 text (see @ref{Text markup}) above or below notes by using a string:
2012 By default, these indications do not influence the note spacing, but
2013 by using the command @code{\fatText}, the widths will be taken into
2016 @lilypond[fragment,singleline,verbatim] \relative c' {
2017 c4^"longtext" \fatText c4_"longlongtext" c4 }
2020 It is possible to use @TeX{} commands in the strings, but this should be
2021 avoided because it makes it impossible for LilyPond to compute the
2022 exact length of the string, which may lead to collisions. Also, @TeX{}
2023 commands won't work with direct PostScript output.
2024 @c (see @ref{PostScript output}).
2026 Text scripts are created in form of @internalsref{TextScript} objects, in
2027 @internalsref{Voice} context.
2029 @ref{Text markup} describes how to change the font or access
2030 special symbols in text scripts.
2035 @subsection Grace notes
2039 @cindex @code{\grace}
2043 Grace notes are ornaments that are written out
2044 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
2048 In normal notation, grace notes are supposed to take up no logical
2049 time in a measure. Such an idea is practical for normal notation, but
2050 is not strict enough to put it into a program. The model that LilyPond
2051 uses for grace notes internally is that all timing is done in two
2054 Every point in musical time consists of two rational numbers: one
2055 denotes the logical time, one denotes the grace timing. The above
2056 example is shown here with timing tuples.
2059 \score { \notes \relative c''{
2060 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
2061 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2063 \paper { linewidth = 8.\cm }
2067 The advantage of this approach is that you can use almost any lilypond
2068 construction together with grace notes, for example slurs and clef
2069 changes may appear halfway in between grace notes:
2071 @lilypond[relative=2,verbatim,fragment]
2072 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2075 The placement of these grace notes is synchronized between different
2076 staves, using this grace timing.
2078 @lilypond[relative=2,verbatim,fragment]
2079 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2080 \context Staff = SB { c4 \grace { g8 b } c4 } >
2084 Unbeamed eighth notes and shorter by default have a slash through the
2085 stem. This can be controlled with object property @code{stroke-style} of
2086 @internalsref{Stem}. The change in formatting is accomplished by
2087 inserting @code{\startGraceMusic} before handling the grace notes, and
2088 @code{\stopGraceMusic} after finishing the grace notes.
2089 You can add to these definitions to globally change grace note
2090 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2092 [TODO discuss Scheme functionality.]
2095 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2100 @lilypond[fragment,verbatim]
2101 \relative c'' \context Voice {
2102 \grace c8 c4 \grace { [c16 c16] } c4
2104 \property Voice.Stem \override #'stroke-style = #'()
2106 \property Voice.Stem \revert #'stroke-style
2113 If you want to end a note with a grace note, then the standard trick
2114 is to put the grace notes before a phantom ``space note'', e.g.
2115 @lilypond[fragment,verbatim, relative=2]
2118 { s2 \grace { [c16 d] } } >
2123 A @code{\grace} section has some default values, and LilyPond will
2124 use those default values unless you specify otherwise inside the
2125 @code{\grace} section. For example, if you specify \slurUp
2126 @emph{before} your @code{\grace} section, a slur which starts inside
2127 the @code{\grace} won't be forced up, even if the slur ends outside
2128 of the @code{\grace}. Note the difference between the first and
2129 second bars in this example:
2131 @lilypond[fragment,verbatim]
2132 \relative c'' \context Voice {
2151 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2153 Grace note synchronization can also lead to surprises. Staff notation,
2154 such as key signatures, barlines, etc. are also synchronized. Take
2155 care when you mix staves with grace notes and staves without.
2157 @lilypond[relative=2,verbatim,fragment]
2158 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2159 \context Staff = SB { c4 \bar "|:" d4 } >
2162 Grace sections should only be used within sequential music
2163 expressions. Nesting, juxtaposing, or ending sequential music with a
2164 grace section is not supported, and might produce crashes or other
2169 @subsection Glissando
2172 @cindex @code{\glissando}
2174 A glissando line can be requested by attaching a @code{\glissando} to
2177 @lilypond[fragment,relative,verbatim]
2183 Printing of an additional text (such as @emph{gliss.}) must be done
2184 manually. See also @seeinternals{Glissando}.
2190 @subsection Dynamics
2203 @cindex @code{\ffff}
2213 Absolute dynamic marks are specified using an identifier after a
2214 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2215 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2216 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2217 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2219 @lilypond[verbatim,singleline,fragment,relative]
2220 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2226 @cindex @code{\decr}
2227 @cindex @code{\rced}
2233 A crescendo mark is started with @code{\cr} and terminated with
2234 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2235 started with @code{\decr} and terminated with @code{\rced}. There are
2236 also shorthands for these marks. A crescendo can be started with
2237 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2238 can be terminated with @code{\!}. Note that @code{\!} must go before
2239 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2240 after the last note. Because these marks are bound to notes, if you
2241 want several marks during one note, you have to use spacer notes.
2243 @lilypond[fragment,verbatim,center,quote]
2244 c'' \< \! c'' d'' \decr e'' \rced
2245 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2247 This may give rise to very short hairpins. Use @code{minimum-length}
2248 in Voice.HairPin to lengthen these, e.g.
2251 \property Staff.Hairpin \override #'minimum-length = #5
2254 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2255 is an example how to do it:
2257 @lilypond[fragment,relative=2,verbatim]
2258 c4 \cresc c4 \endcresc c4
2265 You can also supply your own texts:
2266 @lilypond[fragment,relative,verbatim]
2268 \property Voice.crescendoText = "cresc. poco"
2269 \property Voice.crescendoSpanner = #'dashed-line
2276 Dynamics are objects of @internalsref{DynamicText} and
2277 @internalsref{Hairpin}. Vertical positioning of these symbols is
2278 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2279 adjust padding or vertical direction of the dynamics, you must set
2280 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2281 identifiers to set the vertical direction are \dynamicUp and
2284 @cindex direction, of dynamics
2285 @cindex @code{\dynamicDown}
2286 @cindex @code{\dynamicUp}
2294 @cindex @code{\repeat}
2296 To specify repeats, use the @code{\repeat} keyword. Since repeats
2297 should work differently when played or printed, there are a few
2298 different variants of repeats.
2302 Repeated music is fully written (played) out. Useful for MIDI
2303 output, and entering repetitive music.
2306 This is the normal notation: Repeats are not written out, but
2307 alternative endings (voltas) are printed, left to right.
2310 Alternative endings are written stacked. This has limited use but may be
2311 used to typeset two lines of lyrics in songs with repeats, see
2312 @file{input/star-spangled-banner.ly}.
2318 Make beat or measure repeats. These look like percent signs.
2324 * Repeats and MIDI::
2325 * Manual repeat commands::
2327 * Tremolo subdivisions::
2332 @subsection Repeat syntax
2334 The syntax for repeats is
2337 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2340 If you have alternative endings, you may add
2341 @cindex @code{\alternative}
2343 \alternative @code{@{} @var{alternative1}
2345 @var{alternative3} @dots{} @code{@}}
2347 where each @var{alternative} is a music expression.
2349 Normal notation repeats are used like this:
2350 @lilypond[fragment,verbatim]
2352 \repeat volta 2 { c'4 d' e' f' }
2353 \repeat volta 2 { f' e' d' c' }
2356 With alternative endings:
2357 @lilypond[fragment,verbatim]
2359 \repeat volta 2 {c'4 d' e' f'}
2360 \alternative { {d'2 d'} {f' f} }
2363 Folded repeats look like this:
2366 @lilypond[fragment,verbatim]
2368 \repeat fold 2 {c'4 d' e' f'}
2369 \alternative { {d'2 d'} {f' f} }
2373 If you don't give enough alternatives for all of the repeats, then
2374 the first alternative is assumed to be repeated often enough to equal
2375 the specified number of repeats.
2377 @lilypond[fragment,verbatim]
2381 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2382 \alternative { { g4 g g } { a | a a a a | b2. } }
2387 @node Repeats and MIDI
2388 @subsection Repeats and MIDI
2390 @cindex expanding repeats
2392 For instructions on how to unfoldi repeats for MIDI output, see
2393 the example file @file{input/test/unfold-all-repeats.ly}.
2398 Notice that timing information is not remembered at the start of an
2399 alternative, so you have to reset timing information after a repeat,
2400 e.g. using a bar-check (See @ref{Bar check}), setting
2401 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2402 are also not repeated.
2404 It is possible to nest @code{\repeat}s, although this probably is only
2405 meaningful for unfolded repeats.
2407 Folded repeats offer little more over simultaneous music.
2409 @node Manual repeat commands
2410 @subsection Manual repeat commands
2412 @cindex @code{repeatCommands}
2414 The property @code{repeatCommands} can be used to control the layout of
2415 repeats. Its value is a Scheme list of repeat commands, where each repeat
2423 @item (volta . @var{text})
2424 Print a volta bracket saying @var{text}. The text can be specified as
2425 a text string or as a markup text, see @ref{Text markup}. Do not
2426 forget to change the font, as the default number font does not contain
2427 alphabetic characters.
2429 Stop a running volta bracket
2432 @lilypond[verbatim, fragment]
2434 \property Score.repeatCommands = #'((volta "93") end-repeat)
2436 \property Score.repeatCommands = #'((volta #f))
2441 Repeats brackets are @internalsref{VoltaBracket} objects.
2443 @node Tremolo repeats
2444 @subsection Tremolo repeats
2445 @cindex tremolo beams
2447 To place tremolo marks between notes, use @code{\repeat} with tremolo
2449 @lilypond[verbatim,center,singleline]
2451 \context Voice \notes\relative c' {
2452 \repeat "tremolo" 8 { c16 d16 }
2453 \repeat "tremolo" 4 { c16 d16 }
2454 \repeat "tremolo" 2 { c16 d16 }
2455 \repeat "tremolo" 4 c16
2460 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2461 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2462 entered without @code{@{} and @code{@}}.
2466 Only powers of two and undotted notes are supported repeat counts.
2468 @node Tremolo subdivisions
2469 @subsection Tremolo subdivisions
2470 @cindex tremolo marks
2471 @cindex @code{tremoloFlags}
2473 Tremolo marks can be printed on a single note by adding
2474 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2475 A @var{length} value of 8 gives one line across the note stem. If the
2476 length is omitted, then then the last value (stored in
2477 @code{Voice.tremoloFlags}) is used.
2479 @lilypond[verbatim,fragment,center]
2480 c'2:8 c':32 | c': c': |
2486 Tremolos in this style do not carry over into the MIDI output.
2489 @node Measure repeats
2490 @subsection Measure repeats
2492 @cindex percent repeats
2493 @cindex measure repeats
2495 In the @code{percent} style, a note pattern can be repeated. It is
2496 printed once, and then the pattern is replaced with a special sign.
2497 Patterns of a one and two measures are replaced by percent-like signs,
2498 patterns that divide the measure length are replaced by slashes.
2500 @lilypond[verbatim,singleline]
2501 \context Voice { \repeat "percent" 4 { c'4 }
2502 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2506 The signs are represented by these objects: @internalsref{RepeatSlash} and
2507 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2511 You can not nest percent repeats, e.g. by filling in the first measure
2512 with slashes, and repeating that measure with percents.
2514 @node Rhythmic music
2515 @section Rhythmic music
2517 Sometimes you might want to show only the rhythm of a melody. This can
2518 be done with the rhythmic staff. All pitches of notes on such a staff
2519 are squashed, and the staff itself looks has a single staff line:
2521 @lilypond[fragment,relative,verbatim]
2522 \context RhythmicStaff {
2524 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2529 * Percussion staves::
2532 @node Percussion staves
2533 @subsection Percussion staves
2536 To typeset more than one piece of percussion to be played by the same
2537 musician one typically uses a multiline staff where each staff
2538 position refers to a specific piece of percussion.
2540 LilyPond is shipped with a bunch of scheme functions which allows you
2541 to do this fairly easily.
2543 The system is based on the general midi drum-pitches.
2544 In order to use the drum pitches you include
2545 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2546 variable @code{drum-pitch-names} - which definition can be read in
2547 @file{scm/drums.scm}. You see that each piece of percussion has a full
2548 name and an abbreviated name - and you may freely select whether to
2549 refer to the full name or the abbreviation in your music definition.
2551 To typeset the music on a staff you apply the scheme function
2552 @code{drums->paper} to the percussion music. This function takes a
2553 list of percussion instrument names, notehead scripts and staff
2554 positions (that is: pitches relative to the C-clef) and uses this to
2555 transform the input music by moving the pitch, changing the notehead
2556 and (optionally) adding a script:
2557 @lilypond[singleline,verbatim,quote]
2558 \include "drumpitch-init.ly"
2559 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2560 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2562 \apply #(drums->paper 'drums) \context Staff <
2564 \context Voice = up { \voiceOne \up }
2565 \context Voice = down { \voiceTwo \down }
2570 In the above example the music was transformed using the list @code{'drums}.
2571 Currently the following lists are defined in @file{scm/drums.scm}:
2574 To typeset a typical drum kit on a five-line staff.
2577 \include "drumpitch-init.ly"
2578 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2579 bd sn ss tomh tommh tomml toml tomfh tomfl }
2580 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2581 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2584 \apply #(drums->paper 'drums) \context Staff <
2588 \context Lyrics \nam
2591 linewidth = 100.0\mm
2594 \remove Bar_engraver
2595 \remove Time_signature_engraver
2596 minimumVerticalExtent = #'(-4.0 . 5.0)
2600 \remove Stem_engraver
2606 Notice that the scheme supports six different toms.
2607 If you are using fewer toms then you simply select the toms that produce
2608 the desired result - i.e. to get toms on the three middle lines you
2609 use @code{tommh}, @code{tomml} and @code{tomfh}.
2611 Because the general midi contain no rimshots we use the sidestick for
2612 this purpose instead.
2614 To typeset timbales on a two line staff.
2615 @lilypond[singleline]
2616 \include "drumpitch-init.ly"
2617 nam = \lyrics { timh ssh timl ssl cb }
2618 mus = \notes { timh ssh timl ssl cb s16 }
2621 \apply #(drums->paper 'timbales) \context Staff <
2625 \context Lyrics \nam
2630 \remove Bar_engraver
2631 \remove Time_signature_engraver
2632 StaffSymbol \override #'line-count = #2
2633 StaffSymbol \override #'staff-space = #2
2634 minimumVerticalExtent = #'(-3.0 . 4.0)
2638 \remove Stem_engraver
2645 To typeset congas on a two line staff.
2646 @lilypond[singleline]
2647 \include "drumpitch-init.ly"
2648 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2649 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2652 \apply #(drums->paper 'congas) \context Staff <
2656 \context Lyrics \nam
2661 \remove Bar_engraver
2662 \remove Time_signature_engraver
2663 StaffSymbol \override #'line-count = #2
2664 StaffSymbol \override #'staff-space = #2
2665 minimumVerticalExtent = #'(-3.0 . 4.0)
2669 \remove Stem_engraver
2675 To typeset bongos on a two line staff.
2676 @lilypond[singleline]
2677 \include "drumpitch-init.ly"
2678 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2679 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2682 \apply #(drums->paper 'bongos) \context Staff <
2686 \context Lyrics \nam
2691 \remove Bar_engraver
2692 \remove Time_signature_engraver
2693 StaffSymbol \override #'line-count = #2
2694 StaffSymbol \override #'staff-space = #2
2695 minimumVerticalExtent = #'(-3.0 . 4.0)
2699 \remove Stem_engraver
2705 To typeset all kinds of simple percussion on one line staves.
2706 @lilypond[singleline]
2707 \include "drumpitch-init.ly"
2708 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2709 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2712 \apply #(drums->paper 'percussion) \context Staff <
2716 \context Lyrics \nam
2721 \remove Bar_engraver
2722 \remove Time_signature_engraver
2723 StaffSymbol \override #'line-count = #1
2724 minimumVerticalExtent = #'(-2.0 . 3.0)
2728 \remove Stem_engraver
2735 If you don't like any of the predefined lists you can define your own
2736 list at the top of your file:
2738 @lilypond[singleline, verbatim]
2740 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2741 (snare default #f ,(ly:make-pitch 0 1 0))
2742 (hihat cross #f ,(ly:make-pitch 0 5 0))
2743 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2744 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2746 \include "drumpitch-init.ly"
2747 up = \notes { hh8 hh hh hh hhp4 hhp }
2748 down = \notes { bd4 sn bd toml8 toml }
2750 \apply #(drums->paper 'mydrums) \context Staff <
2752 \context Voice = up { \voiceOne \up }
2753 \context Voice = down { \voiceTwo \down }
2758 To use a modified existing list instead of building your own from
2759 scratch you can append your modifications to the start of the existing
2763 #(define mydrums (append `(
2764 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2765 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2769 @c FIXME: Too many levels of headers when using subsubsections.
2770 @c Perhaps junk subsection ``Percussion staves''
2771 @subsubsection Percussion staves with normal staves
2772 When you include @file{drumpitch-init.ly} then the default pitches
2773 are overridden so that you after the inclusion cannot use the common
2774 dutch pitch names anymore. Hence you might wan't to reinclude
2775 @file{nederlands.ly} after the drum-pattern-definitions:
2776 @lilypond[singleline,verbatim]
2777 \include "drumpitch-init.ly"
2778 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2779 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2780 \include "nederlands.ly"
2781 bass = \notes \transpose c c,, { a4. e8 r e g e }
2784 \apply #(drums->paper 'drums) \context Staff = drums <
2786 \context Voice = up { \voiceOne \up }
2787 \context Voice = down { \voiceTwo \down }
2789 \context Staff = bass { \clef "F_8" \bass }
2794 @subsubsection Percussion midi output
2795 In order to produce correct midi output you need to produce two score
2796 blocks - one for the paper and one for the midi.
2797 To use the percussion channel you set the property @code{instrument}
2798 to @code{'drums}. Because the drum-pitches themself are similar to the
2799 general midi pitches all you have to do is to insert the voices with
2800 none of the scheme functions to get the correct midi output:
2804 \apply #(drums->paper 'mydrums) \context Staff <
2806 \context Voice = up @{ \voiceOne \up @}
2807 \context Voice = down @{ \voiceTwo \down @}
2813 \property Staff.instrument = #'drums
2822 This scheme is to be considered a temporary implementation. Even
2823 though the scheme will probably keep on working then the future might
2824 bring some other way of typesetting drums, and probably
2825 there will be made no great efforts in keeping things downwards
2830 @section Piano music
2832 Piano music is an odd type of notation. Piano staves are two normal
2833 staves coupled with a brace. The staves are largely independent, but
2834 sometimes voices can cross between the two staves. The
2835 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2836 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2837 other pianistic peculiarities.
2841 * Automatic staff changes::
2842 * Manual staff switches::
2845 * Voice follower lines::
2850 There is no support for putting chords across staves. You can get
2851 this result by increasing the length of the stem in the lower stave so
2852 it reaches the stem in the upper stave, or vice versa. An example is
2853 included with the distribution as @file{input/test/stem-cross-staff.ly}.
2855 @cindex cross staff stem
2856 @cindex stem, cross staff
2859 @c fixme: should have hyperlinks as well.
2864 @c . {Automatic staff changes}
2865 @node Automatic staff changes
2866 @subsection Automatic staff changes
2867 @cindex Automatic staff changes
2869 Voices can switch automatically between the top and the bottom
2870 staff. The syntax for this is
2872 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2874 The autochanger switches on basis of pitch (central C is the turning
2875 point), and it looks ahead skipping over rests to switch rests in
2876 advance. Here is a practical example:
2878 @lilypond[verbatim,singleline,quote]
2879 \score { \notes \context PianoStaff <
2880 \context Staff = "up" {
2881 \autochange Staff \context Voice = VA < \relative c' {
2882 g4 a b c d r4 a g } > }
2883 \context Staff = "down" {
2888 Spacer rests are used to prevent the bottom staff from
2889 terminating too soon.
2892 @node Manual staff switches
2893 @subsection Manual staff switches
2895 @cindex manual staff switches
2896 @cindex staff switch, manual
2898 Voices can be switched between staves manually, using the following command:
2900 \translator Staff = @var{staffname} @var{music}
2902 The string @var{staffname} is the name of the staff. It switches the
2903 current voice from its current staff to the Staff called
2904 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2912 Piano pedal instruction can be expressed using
2913 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2914 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2916 The symbols that are printed can be modified by setting
2917 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2918 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2919 @internalsref{SustainPedal}, for example, for more information.
2921 Pedals can also be indicated by a sequence of brackets, by setting the
2922 @code{pedal-type} property of SustainPedal objects:
2924 @lilypond[fragment,verbatim]
2925 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2926 c''4 \sustainDown d''4 e''4 a'4
2927 \sustainUp \sustainDown
2928 f'4 g'4 a'4 \sustainUp
2931 A third style of pedal notation is a mixture of text and brackets,
2932 obtained by setting @code{pedal-type} to @code{mixed}:
2934 @lilypond[fragment,verbatim]
2935 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2936 c''4 \sustainDown d''4 e''4 c'4
2937 \sustainUp \sustainDown
2938 f'4 g'4 a'4 \sustainUp
2941 The default '*Ped' style for sustain and damper pedals corresponds to
2942 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2943 for a sostenuto pedal:
2945 @lilypond[fragment,verbatim]
2946 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2949 For fine-tuning of the appearance of a pedal bracket, the properties
2950 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2951 @code{PianoPedalBracket} objects (see the detailed documentation of
2952 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2953 may be extended to the end of the note head.
2955 @lilypond[fragment,verbatim]
2956 \property Staff.PianoPedalBracket \override
2957 #'shorten-pair = #'(0 . -1.0)
2958 c''4 \sostenutoDown d''4 e''4 c'4
2959 f'4 g'4 a'4 \sostenutoUp
2963 @subsection Arpeggio
2966 @cindex broken arpeggio
2967 @cindex @code{\arpeggio}
2969 You can specify an arpeggio sign on a chord by attaching an
2970 @code{\arpeggio} to a chord.
2973 @lilypond[fragment,relative,verbatim]
2974 <<c e g c>>-\arpeggio
2977 When an arpeggio crosses staves in piano music, you attach an arpeggio
2978 to the chords in both staves, and set
2979 @code{PianoStaff.connectArpeggios}.
2981 @lilypond[fragment,relative,verbatim]
2982 \context PianoStaff <
2983 \property PianoStaff.connectArpeggios = ##t
2984 \context Voice = one { <<c' e g c>>-\arpeggio }
2985 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio}
2989 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2990 are @code{PianoStaff.Arpeggio}.
2992 To add an arrow head to explicitly specify the direction of the
2993 arpeggio, you should set the arpeggio object property
2994 @code{arpeggio-direction}.
2996 @lilypond[fragment,relative,verbatim]
2998 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2999 <<c e g c>>-\arpeggio
3000 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
3001 <<c e g c>>-\arpeggio
3005 A square bracket on the left indicates that the player should not
3006 arpeggiate the chord. To draw these brackets, set the
3007 @code{molecule-callback} property of @code{Arpeggio} or
3008 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
3009 @code{\arpeggio} statements within the chords as before.
3011 @lilypond[fragment,relative,verbatim]
3012 \context PianoStaff <
3013 \property PianoStaff.connectArpeggios = ##t
3014 \property PianoStaff.Arpeggio \override
3015 #'molecule-callback = \arpeggioBracket
3016 \context Voice = one { <<c' e g c>>-\arpeggio }
3017 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
3024 It is not possible to mix connected arpeggios and unconnected
3025 arpeggios in one PianoStaff at the same time.
3029 @node Voice follower lines
3030 @subsection Voice follower lines
3032 @cindex follow voice
3033 @cindex staff switching
3036 @cindex @code{followVoice}
3038 Whenever a voice switches to another staff a line connecting the notes
3039 can be printed automatically. This is enabled if the property
3040 @code{PianoStaff.followVoice} is set to true:
3042 @lilypond[fragment,relative,verbatim]
3043 \context PianoStaff <
3044 \property PianoStaff.followVoice = ##t
3045 \context Staff \context Voice {
3047 \translator Staff=two
3050 \context Staff=two {\clef bass \skip 1*2 }
3054 The associated object is @internalsref{VoiceFollower}.
3058 @section Vocal music
3060 For a discussion of how to put lyrics into a score, see section
3061 @code{Printing lyrics} in the tutorial.
3063 [TODO: Move lyrics section from tutorial to here?]
3065 See also the sections on @ref{Slurs} and @ref{Breath marks}.
3067 [TODO: Move slurs / breath marks section to here?]
3069 [TODO: Write subsection upon usage of ChoirStaff.]
3071 For entering quotes in Lyrics mode, use the following
3073 "\"God\"" is "`King'"
3076 You can use empty syllables, e.g. @code{_4} or @code{" "4} to enter
3077 lyrics. This can confuse the LilyPond -- for example, this might put
3078 (empty) lyrics under rests. To remedy this, use @code{\skip}.
3089 The term @emph{ambitus} denotes a range of pitches for a given voice in
3090 a part of music. It also may denote the pitch range that a musical
3091 instrument is capable of playing. Most musical instruments have their
3092 ambitus standardized (or at least there is agreement upon the minimal
3093 ambitus of a particular type of instrument), such that a composer or
3094 arranger of a piece of music can easily meet the ambitus constraints of
3095 the targeted instrument. However, the ambitus of the human voice
3096 depends on individual physiological state, including education and
3097 training of the voice. Therefore, a singer potentially has to check for
3098 each piece of music if the ambitus of that piece meets his individual
3099 capabilities. This is why the ambitus of a piece may be of particular
3100 value to vocal performers.
3102 The ambitus is typically notated on a per-voice basis at the very
3103 beginning of a piece, e.g. nearby the initial clef or time signature of
3104 each staff. The range is graphically specified by two noteheads, that
3105 represent the minimum and maximum pitch. Some publishers use a textual
3106 notation: they put the range in words in front of the corresponding
3107 staff. Lilypond currently only supports the graphical ambitus notation.
3109 To apply, simply add the @internalsref{Ambitus_engraver} to the
3110 @internalsref{Voice} context, as shown in the below example:
3112 @lilypond[singleline,verbatim]
3113 upper = \notes \relative c {
3116 as'' c e2 bes f cis d4 e f2 g
3118 lower = \notes \relative c {
3121 e'4 b g a c es fis a cis b a g f e d2
3124 \context ChoirStaff {
3126 \context Staff = one { \upper }
3127 \context Staff = three { \lower }
3133 \consists Ambitus_engraver
3139 The shape of the note heads to use can be changed via the
3140 @code{note-head-style} property, which holds the glyph name of the note
3141 head (see also @ref{Ancient note heads}). The vertical line between the
3142 upper and lower head can be switched on or off via the @code{join-heads}
3148 \consists Ambitus_engraver
3149 Ambitus \set #'note-head-style = #'noteheads-2mensural
3150 Ambitus \set #'join-heads = ##f
3154 By default, the ambitus grob is put before the clef. You can control
3155 this behaviour through the @code{breakAlignOrder} property of the score
3156 context by redefining the order, e.g. with the following addition to the
3162 breakAlignOrder = #'(
3180 Tablature notation is used for notating music for plucked string
3181 instruments. It notates pitches not by using note heads, but by
3182 indicating on which string and fret a note must be played. LilyPond
3183 offers limited support for tablature.
3186 * Tablatures basic::
3187 * Non-guitar tablatures::
3188 * Tablature in addition to normal staff::
3191 @node Tablatures basic
3192 @subsection Tablatures basic
3193 @cindex Tablatures basic
3195 Tablature can be typeset with Lilypond by using the
3196 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3197 tablature is a recent feature in Lilypond, most of the guitar special
3198 effects such as bend are not yet supported.
3200 With the @internalsref{TabStaff}, the string number associated to a note
3201 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3202 quarter on the third string. By default, string 1 is the highest one, and the
3203 tuning defaults to the standard guitar tuning (with 6 strings).
3205 @lilypond[fragment,verbatim]
3214 If you do not specify a string number then lilypond automatically selects one.
3215 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3216 simply selects the first string that does not give a fret number less than
3217 @code{minimumFret}. Default is 0.
3219 Notice that LilyPond does not handle chords in any special way, and hence
3220 the automatic string selector may easily select the same string to two notes in a chord.
3223 e8 fis gis a b cis' dis' e'
3224 \property TabStaff.minimumFret = #8
3225 e8 fis gis a b cis' dis' e'
3230 e8 fis gis a b cis' dis' e'
3231 \property TabStaff.minimumFret = #8
3232 e8 fis gis a b cis' dis' e'
3235 \context StaffGroup <
3236 \context Staff { \clef "G_8" \frag }
3237 \context TabStaff { \frag }
3242 @node Non-guitar tablatures
3243 @subsection Non-guitar tablatures
3244 @cindex Non-guitar tablatures
3246 There are many ways to customize Lilypond tablatures.
3248 First you can change the number of strings, by setting the number of
3249 lines in the @internalsref{TabStaff} (the @code{line-count} property
3250 of TabStaff can only be changed using @code{\outputproperty}, for more
3251 information, see @ref{Tuning per object}. You can change the strings
3252 tuning. A string tuning is given as a Scheme list with one integer
3253 number for each string, the number being the pitch of an open string.
3255 (The numbers specified for stringTuning are the numbers of semitons
3256 to subtract --- or add --- starting the specified pitch by default
3257 middle C, in string order: thus the notes are e, a, d & g)
3259 @lilypond[fragment,verbatim]
3262 \outputproperty #(make-type-checker 'staff-symbol-interface)
3264 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3267 a,4 c' a e' e c' a e'
3272 Finally, it is possible to change the Scheme function to format the
3273 tablature note text. The default is @var{fret-number-tablature-format},
3274 which uses the fret number, but for some instruments that may not use
3275 this notation, just create your own tablature-format function. This
3276 function takes three argument: the string number, the string tuning and
3280 @node Tablature in addition to normal staff
3281 @subsection Tablature in addition to normal staff
3282 @cindex Tablature in addition to normal staff
3284 It is possible to typeset both tablature and a "normal" staff, as
3285 commonly done in many parts.
3287 A common trick for that is to put the notes in a variables, and to hide
3288 the fingering information (which correspond to the string number) for
3292 @c @lily pond[verbatim]
3299 \context StaffGroup <
3301 % Hide fingering number
3302 \property Staff.Fingering \override #'transparent = ##t
3307 \property Staff.Stem \override #'direction = #1
3321 LilyPond has support for both entering and printing chords.
3322 @lilypond[verbatim,singleline]
3323 twoWays = \notes \transpose c c' {
3333 < \context ChordNames \twoWays
3334 \context Voice \twoWays > }
3337 This example also shows that the chord printing routines do not try to
3338 be intelligent. If you enter @code{f bes d}, it does not interpret
3339 this as an inversion.
3341 As you can see chords really are a set of pitches. They are internally
3342 stored as simultaneous music expressions. This means you can enter
3343 chords by name and print them as notes, enter them as notes and print
3344 them as chord names, or (the most common case) enter them by name, and
3349 * Printing named chords::
3354 @subsection Chords mode
3357 Chord mode is a mode where you can input sets of pitches using common
3358 names. It is introduced by the keyword @code{\chords}.
3359 In chords mode, a chord is entered by the root, which is entered
3360 like a common pitch, for example,
3361 @lilypond[fragment,verbatim,quote]
3364 is the notation for an E-flat major chord.
3369 Other chords may be entered
3370 by suffixing a colon, and introducing a modifier, and optionally, a
3372 @lilypond[fragment,verbatim,quote]
3373 \chords { e1:m e1:7 e1:m7 }
3375 The first number following the root is taken to be the `type' of the
3376 chord, thirds are added to the root until it reaches the specified
3377 number, for example.
3378 @lilypond[fragment,verbatim]
3379 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
3382 @cindex root of chord
3383 @cindex additions, in chords
3384 @cindex removals, in chords
3386 More complex chords may also be constructed adding separate steps
3387 to a chord. Additions are added after the number following
3388 the colon, and are separated by dots. For example
3390 @lilypond[verbatim,fragment,quote]
3391 \chords { c:5.6 c:3.7.8 c:3.6.13 }
3393 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
3394 to the number, for example:
3395 @lilypond[verbatim,fragment,quote]
3396 \chords { c:7+ c:5+.3- c:3-.5-.7- }
3398 Removals are specified similarly, and are introduced by a caret. They
3399 must come after the additions.
3400 @lilypond[verbatim,fragment]
3401 \chords { c^3 c:7^5 c:9^3.5 }
3404 Modifiers can be used to change pitches. The following modifiers are
3408 Minor chord. Lowers the 3rd and (if present) the 7th step.
3410 Diminished chord. Lowers the 3rd, 5th and (if present) the 7th step
3412 Augmented chord. Raises the 5th step.
3414 Major 7th chord. Raises the 7th step, if present.
3416 Suspended 4th or 2nd. This modifier removes the 3rd step. Append
3417 either @code{2} or @code{4} to add the 2nd or 4th step to the chord.
3419 Modifiers can be mixed with additions.
3420 @lilypond[verbatim,fragment]
3421 \chords { c:sus4 c:7sus4 c:dim7 c:m6 }
3424 @cindex modifiers, in chords.
3431 Since the unaltered 11 does sound well when combined with the
3432 unaltered 3, the 11 is removed in this case, unless it is added
3433 explicitly). For example,
3434 @lilypond[fragment,verbatim]
3435 \chords { c:13 c:13.11 c:m13 }
3440 An inversion (putting one pitch of the chord on the bottom), as well
3441 as bass notes, can be specified by appending
3442 @code{/}@var{pitch} to the chord.
3443 @lilypond[fragment,verbatim,center]
3444 \chords { c1 c/g c/f }
3447 If you do not want to remove the bass note from the chord, but rather
3448 add the note, then you can use @code{/+}@var{pitch}.
3450 @lilypond[fragment,verbatim,center]
3451 \chords { c1 c/+g c/+f }
3454 The chords mode is a mode similar to @code{\lyrics}, @code{\notes}
3455 etc. Most of the commands continue to work, for example, @code{r} and
3456 @code{\skip} can be used to insert spaces, and @code{\property} to
3457 change various settings.
3463 Each step can only be present in a chord once. The following
3464 simply produces the augmented chord, since @code{5+} is interpreted
3467 @lilypond[verbatim,fragment]
3468 \chords { c:5.5-.5+ }
3471 In chord mode, dashes and carets are used to indicate chord additions
3472 and subtractions, so articulation scripts can not be entered.
3478 @c . {Printing named chords}
3479 @node Printing named chords
3480 @subsection Printing named chords
3482 @cindex printing chord names
3486 For displaying printed chord names, use the @internalsref{ChordNames} context.
3487 The chords may be entered either using the notation described above, or
3488 directly using simultaneous music.
3490 @lilypond[verbatim,singleline]
3492 \chords {a1 b c} <<d f g>> <<e g b>>
3496 \context ChordNames \scheme
3497 \context Staff \transpose c c' \scheme
3502 You can make the chord changes stand out by setting
3503 @code{ChordNames.chordChanges} to true. This will only display chord
3504 names when there's a change in the chords scheme and at the start of a
3509 c1:m c:m \break c:m c:m d
3513 \context ChordNames {
3514 \property ChordNames.chordChanges = ##t
3516 \context Staff \transpose c c' \scheme
3518 \paper{linewidth= 9.\cm}
3522 LilyPond examines chords specified as lists of notes to determine a name
3523 to give the chord. LilyPond will not try to identify chord inversions or
3524 an added bass note, which may result in strange chord names when chords
3525 are entered as a list of pitches:
3527 @lilypond[verbatim,center,singleline]
3536 \context ChordNames \scheme
3537 \context Staff \scheme
3542 The default chord name layout is a system for Jazz music, proposed by
3543 Klaus Ignatzek (See @ref{Literature}).
3545 [TODO: add description for banter other jazz.]
3547 The Ignatzek chord name formatting can be tuned in a number of ways
3548 through the following properties:
3550 @item chordNameExceptions
3551 This is a list that contains the chords that have special formatting.
3553 @lilypond[verbatim,singleline]
3554 chExceptionMusic = \notes { <<c f g bes>>1-\markup { \super "7" "wahh" }}
3555 chExceptions = #(append
3556 (sequential-music-to-chord-exceptions chExceptionMusic)
3559 \score { \context ChordNames
3562 \property ChordNames.chordNameExceptions = #chExceptions
3566 Putting the exceptions list encoded as
3568 \notes @{ <<c f g bes>>1-\markup @{ \super "7" "wahh" @} @}
3570 into the property takes a little manoeuvring. The following code
3571 transforms @code{chExceptionMusic} (which is a sequential music)
3572 into a list of exceptions.
3574 (sequential-music-to-chord-exceptions chExceptionMusic)
3579 ... ignatzekExceptions)
3581 adds the new exceptions to the default ones, which are defined in
3582 @file{ly/chord-modifier-init.ly}.
3584 @item majorSevenSymbol
3585 This property contains the markup object used for the 7th step, when
3586 it is major. Predefined options are @code{whiteTriangleMarkup},
3587 @code{blackTriangleMarkup}. The following uses another popular shorthand.
3588 @lilypond[fragment,verbatim]
3589 \context ChordNames \chords {
3591 \property ChordNames.majorSevenSymbol = \markup { "j7" }
3594 @item chordNameSeparator
3595 Different parts of a chord name are normally separated by a
3596 slash. By setting @code{chordNameSeparator}, you can specify other
3598 @lilypond[fragment,verbatim]
3599 \context ChordNames \chords {
3601 \property ChordNames.chordNameSeparator = \markup { "|" }
3611 @section Writing parts
3613 Orchestral music involves some special notation, both in the full score,
3614 as in the individual parts. This section explains how to tackle common
3615 problems in orchestral music.
3622 * Instrument names::
3624 * Multi measure rests::
3625 * Automatic part combining::
3626 * Hara kiri staves::
3627 * Sound output for transposing instruments::
3630 @c . {Rehearsal marks}
3631 @node Rehearsal marks
3632 @subsection Rehearsal marks
3633 @cindex Rehearsal marks
3635 @cindex @code{\mark}
3637 To print a rehearsal mark, use the @code{\mark} command.
3638 @lilypond[fragment,verbatim]
3649 As you can see, the mark is incremented automatically if you use
3650 @code{\mark \default}. The value to use is stored in the property
3651 @code{rehearsalMark} is used and automatically incremented. The object
3652 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3653 @code{input/test/boxed-molecule.ly} if you need boxes around the
3656 The @code{\mark} command can also be used to put signs like coda,
3657 segno and fermatas on a barline. The trick is to use the text markup
3658 mechanism to access the fermata symbol.
3659 @lilypond[fragment,verbatim,relative=1]
3660 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
3665 The problem is that marks that occur at a line break are typeset only
3666 at the beginning of the next line, opposite to what you want for the
3667 fermata. This can be corrected by the following property setting
3669 \property Score.RehearsalMark \override
3670 #'break-visibility = #begin-of-line-invisible
3676 @cindex barlines, putting symbols on
3680 @subsection Bar numbers
3684 @cindex measure numbers
3685 @cindex currentBarNumber
3687 Bar numbers are printed by default at the start of the line. The
3688 number itself is a property that can be set by modifying the
3689 @code{currentBarNumber} property, although that is usually not
3692 \property Score.currentBarNumber = #217
3695 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3696 you need to change the grob property @code{break-visibility} as well as the translator
3697 property @code{barNumberVisibility}, as illustrated in the following example which also
3698 adds a box around the bar numbers:
3700 \property Score.BarNumber \override #'break-visibility =
3701 #end-of-line-invisible
3702 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3703 \property Score.BarNumber \override #'molecule-callback =
3704 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3705 \property Score.BarNumber \override #'font-relative-size = #0
3709 \context Staff \notes \transpose c c'' {
3710 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3711 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3712 \property Score.BarNumber \override #'molecule-callback =
3713 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3714 \property Score.BarNumber \override #'font-relative-size = #0
3716 \repeat unfold 16 c1 \bar "|."
3721 If you would like the bar numbers to appear at regular intervals, but
3722 not starting from measure zero, you can use the context function,
3723 @code{set-bar-number-visibility}, to automatically set
3724 @code{barNumberVisibility} so that the bar numbers appear at regular
3725 intervals, starting from the @code{\applycontext}:
3728 resetBarnum = \context Score \applycontext
3729 #(set-bar-number-visibility 4)
3731 \property Score.BarNumber \override #'break-visibility =
3732 #end-of-line-invisible
3733 \mark "A" \resetBarnum
3734 \repeat unfold 10 c1
3735 \mark \default \resetBarnum
3739 resetBarnum = \context Score \applycontext
3740 #(set-bar-number-visibility 4)
3743 \notes \transpose c c'' {
3744 \property Score.BarNumber \override #'break-visibility =#end-of-line-invisible
3745 \property Score.RehearsalMark \override #'padding = #2.5
3746 \mark "A" \resetBarnum
3747 \repeat unfold 10 c1
3748 \mark \default \resetBarnum
3756 See also @seeinternals{BarNumber}.
3760 Barnumbers can collide with the StaffGroup, if there is one at the
3761 top. To solve this, You have to twiddle with the
3762 @internalsref{padding} property of @internalsref{BarNumber} if your
3763 score starts with a @internalsref{StaffGroup}.
3765 @node Instrument names
3766 @subsection Instrument names
3768 In scores, the instrument name is printed before the staff. This can
3769 be done by setting @code{Staff.instrument} and
3770 @code{Staff.instr}. This will print a string before the start of the
3771 staff. For the first start, @code{instrument} is used, for the next
3772 ones @code{instr} is used.
3774 @lilypond[verbatim,singleline]
3775 \property Staff.instrument = "ploink " { c''4 }
3778 You can also use markup texts to construct more complicated instrument
3782 @lilypond[verbatim,singleline]
3784 \notes \context Staff = treble {
3785 \property Staff.instrument
3786 = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
3789 \paper { linewidth= 8.0\cm }
3796 When you put a name on a grand staff or piano staff the width of the
3797 brace is not taken into account. You must add extra spaces to the end of
3798 the name to avoid a collision.
3801 @subsection Transpose
3803 @cindex transposition of pitches
3804 @cindex @code{\transpose}
3806 A music expression can be transposed with @code{\transpose}. The syntax
3809 \transpose @var{from} @var{to} @var{musicexpr}
3812 This means that @var{musicexpr} is transposed to by the interval
3813 between @var{from} is @var{to}.
3815 @code{\transpose} distinguishes between enharmonic pitches: both
3816 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3817 half a tone. The first version will print sharps and the second
3818 version will print flats.
3820 @lilypond[singleline, verbatim]
3821 mus =\notes { \key d \major cis d fis g }
3822 \score { \notes \context Staff {
3825 \transpose c g' \mus
3826 \transpose c f' \mus
3830 If you want to use both @code{\transpose} and @code{\relative}, then
3831 you must use @code{\transpose} first. @code{\relative} will have no
3832 effect music that appears inside a @code{\transpose}.
3834 @c . {Multi measure rests}
3835 @node Multi measure rests
3836 @subsection Multi measure rests
3837 @cindex Multi measure rests
3841 Multi measure rests are entered using `@code{R}'. It is specifically
3842 meant for full bar rests and for entering parts: the rest can expand to
3843 fill a score with rests, or it can be printed as a single multimeasure
3844 rest This expansion is controlled by the property
3845 @code{Score.skipBars}. If this is set to true, Lily will not expand
3846 empty measures, and the appropriate number is added automatically.
3848 @lilypond[fragment,verbatim]
3849 \time 4/4 r1 | R1 | R1*2
3850 \property Score.skipBars = ##t R1*17 R1*4
3853 The @code{1} in @code{R1} is similar to the duration notation used for
3854 notes. Hence, for time signatures other than 4/4, you must enter other
3855 durations. This can be done with augmentation dots, or with
3858 @lilypond[fragment,verbatim]
3859 \property Score.skipBars = ##t
3867 Notice that a @code{R} spanning a single measure is printed as a whole
3868 rest centered in the measure, regardless of the time signature.
3870 [ add note about breves.]
3873 @cindex text on multi-measure rest
3874 @cindex script on multi-measure rest
3875 @cindex fermata on multi-measure rest
3877 Texts can be added to multi-measure rests by using the
3878 @var{note}-@code{markup} syntax. An identifier
3879 is provided for a fermata.
3881 @lilypond[verbatim,fragment]
3883 R2._\markup { \roman "Ad lib" }
3887 By default, the multi-measure rest uses the number font, which does
3888 not contain any letters. This is the reason for the explicit
3889 @code{\roman} in the above example.
3891 @cindex whole rests for a full measure
3893 The object for this object is @internalsref{MultiMeasureRest}, and
3894 @internalsref{MultiMeasureRestNumber}.
3898 Only one text can be put on a multi-measure rest with
3899 @var{note}-@var{text} syntax, since this is internally converted to
3900 setting @code{#'text} in @internalsref{MultiMeasureRestNumber}. It is
3901 not possible to use fingerings (e.g. @code{R1-4}) to put numbers over
3902 multi-measure rests.
3905 @cindex condensing rests
3907 Currently, there is no way to automatically condense multiple rests
3908 into a single multimeasure rest. Multi measure rests do not take part
3912 @node Automatic part combining
3913 @subsection Automatic part combining
3914 @cindex automatic part combining
3915 @cindex part combiner
3918 Automatic part combining is used to merge two parts of music onto a
3919 staff in an intelligent way. It is aimed primarily at typesetting
3920 orchestral scores. When the two parts are identical for a period of
3921 time, only one is shown. In places where the two parts differ, they
3922 are typeset as separate voices, and stem directions are set
3923 automatically. Also, solo and @emph{a due} parts can be identified
3926 The syntax for part combining is
3929 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3931 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3932 combined into one context of type @var{context}. The music expressions
3933 must be interpreted by contexts whose names should start with @code{one}
3936 The most useful function of the part combiner is to combine parts into
3937 one voice, as common for wind parts in orchestral scores:
3939 @lilypond[verbatim,singleline,fragment]
3941 \context Voice=one \partcombine Voice
3942 \context Thread=one \relative c'' {
3945 \context Thread=two \relative c'' {
3951 Notice that the first @code{g} appears only once, although it was
3952 specified twice (once in each part). Stem, slur and tie directions are
3953 set automatically, depending whether there is a solo or unisono. The
3954 first part (with context called @code{one}) always gets up stems, and
3955 `solo', while the second (called @code{two}) always gets down stems and
3958 If you just want the merging parts, and not the textual markings, you
3959 may set the property @var{soloADue} to false.
3961 @lilypond[verbatim,singleline,fragment]
3963 \property Staff.soloADue = ##f
3964 \context Voice=one \partcombine Voice
3965 \context Thread=one \relative c'' {
3968 \context Thread=two \relative c'' {
3974 There are a number of other properties that you can use to tweak the
3975 behavior of part combining, refer to the automatically generated
3976 documentation of @reng{Thread_devnull_engraver} and
3977 @reng{Voice_devnull_engraver}. Look at the documentation of the
3978 responsible engravers, @code{Thread_devnull_engraver},
3979 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3983 In @code{soloADue} mode, when the two voices play the same notes on and
3984 off, the part combiner may typeset @code{a2} more than once in a
3987 @lilypond[fragment,singleline]
3989 \context Voice=one \partcombine Voice
3990 \context Thread=one \relative c'' {
3993 \context Thread=two \relative c'' {
3999 @cindex @code{Thread_devnull_engraver}
4000 @cindex @code{Voice_engraver}
4001 @cindex @code{A2_engraver}
4003 @node Hara kiri staves
4004 @subsection Hara kiri staves
4006 In orchestral scores, staff lines that only have rests are usually removed.
4007 This saves some space. LilyPond also supports this through the hara
4008 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
4009 the Japanese Samourai warriors.} staff. This staff commits suicide when
4010 it finds itself to be empty after the line-breaking process. It will
4011 not disappear when it contains normal rests, you must use multi measure
4014 The hara kiri staff is specialized version of the @internalsref{Staff}
4015 context. It is available as the context identifier
4016 @code{\HaraKiriStaffContext}. Observe how the second staff in this
4017 example disappears in the second line.
4021 \notes \relative c' <
4022 \context Staff = SA { e4 f g a \break c1 }
4023 \context Staff = SB { c4 d e f \break R1 }
4027 \translator { \HaraKiriStaffContext }
4032 For @internalsref{Lyrics}, @internalsref{LyricsVoice},
4033 @internalsref{ChordNames} and @internalsref{FiguredBass}, hara-kiri is
4034 switched on by default.
4037 @node Sound output for transposing instruments
4038 @subsection Sound output for transposing instruments
4040 When you want to make a MIDI file from a score containing transposed
4041 and untransposed instruments, you have to instruct LilyPond the pitch
4042 offset (in semitones) for the transposed instruments. This is done
4043 using the @code{transposing} property. It does not affect printed
4046 @cindex @code{transposing}
4049 \property Staff.instrument = #"Cl. in B-flat"
4050 \property Staff.transposing = #-2
4056 @node Ancient notation
4057 @section Ancient notation
4059 @cindex Vaticana, Editio
4060 @cindex Medicaea, Editio
4066 * Ancient note heads::
4074 @node Ancient note heads
4075 @subsection Ancient note heads
4077 To get a longa note head, you have to use mensural note heads. This
4078 is accomplished by setting the @code{style} property of the
4079 NoteHead object to @code{mensural}. There is also a note head style
4080 @code{baroque} which gives mensural note heads for @code{\longa} and
4081 @code{\breve} but standard note heads for shorter notes.
4083 @lilypond[fragment,singleline,verbatim]
4084 \property Voice.NoteHead \set #'style = #'mensural
4089 @subsection Ancient clefs
4091 LilyPond supports a variety of clefs, many of them ancient.
4093 For modern clefs, see section @ref{Clef}. For the percussion clef, see
4094 section @ref{Percussion staves}. For the @code{TAB} clef, see section
4097 The following table shows all ancient clefs that are supported via the
4098 @code{\clef} command. Some of the clefs use the same glyph, but differ
4099 only with respect to the line they are printed on. In such cases, a
4100 trailing number in the name is used to enumerate these clefs. Still,
4101 you can manually force a clef glyph to be typeset on an arbitrary line,
4102 as described in section @ref{Clef}. The note printed to the right side
4103 of each clef denotes the @code{c'} with respect to the clef.
4107 @c --- This should go somewhere else: ---
4108 @c @item modern style G clef (glyph: @code{clefs-G})
4111 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
4113 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
4115 @c @item modern style F clef (glyph: @code{clefs-F})
4118 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
4120 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
4122 @c @item modern style C clef (glyph: @code{clefs-C})
4125 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
4126 @c @code{tenor}, @code{baritone}
4128 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
4130 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
4133 @code{neo_mensural_c1}, @code{neo_mensural_c2},
4134 @code{neo_mensural_c3}, @code{neo_mensural_c4}
4136 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
4138 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
4144 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
4146 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
4152 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
4154 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
4160 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
4162 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
4168 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
4170 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
4176 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
4178 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
4183 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
4185 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
4190 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
4192 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
4195 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
4198 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
4200 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
4205 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
4207 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
4212 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
4214 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
4217 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
4219 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
4221 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
4224 @code{vaticana_fa1}, @code{vaticana_fa2}
4226 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
4228 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
4231 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
4233 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
4235 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
4238 @code{medicaea_fa1}, @code{medicaea_fa2}
4240 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
4242 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
4245 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
4247 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
4249 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
4252 @code{hufnagel_fa1}, @code{hufnagel_fa2}
4254 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
4256 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
4259 @code{hufnagel_do_fa}
4261 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4263 @c --- This should go somewhere else: ---
4264 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4267 @c @code{percussion}
4269 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4271 @c @item modern style tab clef (glyph: @code{clefs-tab})
4276 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4280 @emph{Modern style} means ``as is typeset in current editions of
4281 transcribed mensural music''.
4283 @emph{Petrucci style} means ``inspired by printings published by the
4284 famous engraver Petrucci (1466-1539)''.
4286 @emph{Historic style} means ``as was typeset or written in contemporary
4287 historic editions (other than those of Petrucci)''.
4289 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4291 Petrucci used C clefs with differently balanced left-side vertical
4292 beams, depending on which staffline it was printed.
4295 @subsection Custodes
4300 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4301 staff context symbol that appears at the end of a staff line. It
4302 anticipates the pitch of the first note(s) of the following line and
4303 thus helps the player or singer to manage line breaks during
4304 performance, thus enhancing readability of a score.
4309 \property Staff.Custos \set #'style = #'mensural
4314 \consists Custos_engraver
4320 Custodes were frequently used in music notation until the 17th century.
4321 There were different appearances for different notation styles.
4322 Nowadays, they have survived only in special forms of musical notation
4323 such as via the @emph{editio vaticana} dating back to the beginning of
4326 For typesetting custodes, just put a @code{Custos_engraver} into the
4327 @internalsref{Staff} context when declaring the @code{\paper} block. In this
4328 block, you can also globally control the appearance of the custos symbol
4329 by setting the custos @code{style} property. Currently supported styles
4330 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4337 \consists Custos_engraver
4338 Custos \override #'style = #'mensural
4343 The property can also be set locally, for example in a @code{\notes}
4348 \property Staff.Custos \override #'style = #'vaticana
4349 c'1 d' e' d' \break c' d' e' d'
4354 @subsection Ligatures
4358 @c TODO: Should double check if I recalled things correctly when I wrote
4359 @c down the following paragraph by heart.
4360 In musical terminology, a ligature is a coherent graphical symbol that
4361 represents at least two different notes. Ligatures originally appeared
4362 in the manuscripts of Gregorian chant notation roughly since the 9th
4363 century as an allusion to the accent symbols of greek lyric poetry to
4364 denote ascending or descending sequences of notes. Both, the shape and
4365 the exact meaning of ligatures changed tremendously during the following
4366 centuries: In early notation, ligatures where used for monophonic tunes
4367 (Gregorian chant) and very soon denoted also the way of performance in
4368 the sense of articulation. With upcoming multiphony, the need for a
4369 metric system arised, since multiple voices of a piece have to be
4370 synchronized some way. New notation systems were invented, that used
4371 the manifold shapes of ligatures to now denote rhythmical patterns
4372 (e.g. black mensural notation, mannered notation, ars nova). With the
4373 invention of the metric system of the white mensural notation, the need
4374 for ligatures to denote such patterns disappeared. Nevertheless,
4375 ligatures were still in use in the mensural system for a couple of
4376 decades until they finally disappeared during the late 16th / early 17th
4377 century. Still, ligatures have survived in contemporary editions of
4378 Gregorian chant such as the Editio Vaticana from 1905/08.
4380 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4381 Some ligature styles (such as Editio Vaticana) may need additional input
4382 syntax specific for this particular type of ligature. By default, the
4383 @internalsref{LigatureBracket} engraver just marks the start and end of
4384 a ligature by small square angles:
4386 @lilypond[singleline,verbatim]
4388 \notes \transpose c c' {
4396 To select a specific style of ligatures, a proper ligature engraver has
4397 to be added to the @internalsref{Voice} context, as explained in the
4398 following subsections. Currently, Lilypond only supports white mensural
4399 ligatures with certain limitations. Support for Editio Vaticana will be
4400 added in the future.
4403 * White mensural ligatures::
4406 @node White mensural ligatures
4407 @subsubsection White mensural ligatures
4409 @cindex Mensural ligatures
4410 @cindex White mensural ligatures
4412 Lilypond has limited support for white mensural ligatures. The
4413 implementation is still experimental; it currently may output strange
4414 warnings or even crash in some cases or produce weird results on more
4415 complex ligatures. To engrave white mensural ligatures, in the paper
4416 block the @internalsref{MensuralLigature} engraver has to be put into
4417 the @internalsref{Voice} context (and you probably want to remove the
4418 @internalsref{LigatureBracket} engraver). There is no additional input
4419 language to describe the shape of a white mensural ligature. The shape
4420 is rather determined solely from the pitch and duration of the enclosed
4421 notes. While this approach may take a new user quite a while to get
4422 accustomed, it has a great advantage: this way, lily has full musical
4423 information about the ligature. This is not only required for correct
4424 MIDI output, but also allows for automatic transcription of the
4429 @lilypond[singleline,verbatim]
4431 \notes \transpose c c' {
4432 \property Score.timing = ##f
4433 \property Score.defaultBarType = "empty"
4434 \property Voice.NoteHead \set #'style = #'neo_mensural
4435 \property Staff.TimeSignature \set #'style = #'neo_mensural
4437 \[ g\longa c\breve a\breve f\breve d'\longa \]
4439 \[ e1 f1 a\breve g\longa \]
4444 \remove Ligature_bracket_engraver
4445 \consists Mensural_ligature_engraver
4451 Without replacing @code{Ligature_bracket_engraver} with
4452 @code{Mensural_ligature_engraver}, the same music transcribes to the
4455 @lilypond[singleline,verbatim]
4457 \notes \transpose c c' {
4458 \property Score.timing = ##f
4459 \property Score.defaultBarType = "empty"
4460 \property Voice.NoteHead \set #'style = #'neo_mensural
4461 \property Staff.TimeSignature \set #'style = #'neo_mensural
4463 \[ g\longa c\breve a\breve f\breve d'\longa \]
4465 \[ e1 f1 a\breve g\longa \]
4471 @subsection Figured bass
4473 @cindex Basso continuo
4475 LilyPond has limited support for figured bass:
4477 @lilypond[verbatim,fragment]
4479 \context Voice \notes { \clef bass dis4 c d ais}
4480 \context FiguredBass
4482 < 6 >4 < 7 >8 < 6+ [_!] >
4488 The support for figured bass consists of two parts: there is an input
4489 mode, introduced by @code{\figures}, where you can enter bass figures
4490 as numbers, and there is a context called @internalsref{FiguredBass}
4491 that takes care of making @internalsref{BassFigure} objects.
4493 In figures input mode, a group of bass figures is delimited by
4494 @code{<} and @code{>}. The duration is entered after the @code{>}.
4499 \context FiguredBass
4503 Accidentals are added to the numbers if you alterate them by
4504 appending @code{-}, @code{!} and @code{+}.
4510 \context FiguredBass
4511 \figures { <4- 6+ 7!> }
4514 Spaces or dashes may be inserted by using @code{_}. Brackets are
4515 introduced with @code{[} and @code{]}.
4521 \context FiguredBass
4522 \figures { < [4 6] 8 [_ 12]> }
4525 Although the support for figured bass may superficially resemble chord
4526 support, it works much simpler: in figured bass simply stores the
4527 numbers, and then prints the numbers you entered. There is no
4528 conversion to pitches, and no realizations of the bass are played in
4531 Internally, the code produces markup texts internally. You can use any
4532 of the markup text properties to override formatting. For example, the
4533 vertical spacing of the figures may be set with @code{baseline-skip}.
4535 @c . {Contemporary notation}
4536 @node Contemporary notation
4537 @section Contemporary notation
4544 @subsection Clusters
4548 In musical terminology, a @emph{cluster} denotes a range of
4549 simultaneously sounding pitches that may change over time. The set of
4550 available pitches to apply usually depends on the accoustic source.
4551 Thus, in piano music, a cluster typically consists of a continous range
4552 of the semitones as provided by the piano's fixed set of a chromatic
4553 scale. In choral music, each singer of the choir typically may sing an
4554 arbitrary pitch within the cluster's range that is not bound to any
4555 diatonic, chromatic or other scale. In electronic music, a cluster
4556 (theoretically) may even cover a continuous range of pitches, thus
4557 resulting in coloured noise, such as pink noise.
4559 Clusters can be notated in the context of ordinary staff notation by
4560 engraving simple geometrical shapes that replace ordinary notation of
4561 notes. Ordinary notes as musical events specify starting time and
4562 duration of pitches; however, the duration of a note is expressed by the
4563 shape of the note head rather than by the horizontal graphical extent of
4564 the note symbol. In contrast, the shape of a cluster geometrically
4565 describes the development of a range of pitches (vertical extent) over
4566 time (horizontal extent). Still, the geometrical shape of a cluster
4567 covers the area in wich any single pitch contained in the cluster would
4568 be notated as an ordinary note. From this point of view, it is
4569 reasonable to specify a cluster as the envelope of a set of notes. This
4570 is exactly how to construct a cluster with lilypond.
4572 @lilypond[singleline,verbatim]
4574 \context PianoStaff <
4575 \context Voice = voiceI { % same as voiceII, but with ordinary notes
4576 \notes \relative c' {
4578 a4 <e4 d'4> | \break
4579 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4583 \context Voice = voiceII { % same as voiceI, but with cluster notation
4584 \notes \relative c' {
4586 % hide notes, accidentals, etc.
4587 \property Thread.NoteHead \set #'transparent = ##t
4588 \property Voice.Stem \set #'transparent = ##t
4589 \property Voice.Beam \set #'transparent = ##t
4590 \property Staff.Accidental \set #'transparent = ##t
4592 \property Voice.Cluster \set #'padding = #0.01
4593 \property Voice.Cluster \set #'shape = #'ramp
4597 a4 <e4 d'4> | \break
4598 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4599 c4 \stopCluster a4 f4 g4 a4
4606 Note that the second voice differs from the first one only by the
4607 additional keywords @code{\startCluster} and @code{\stopCluster} and the
4608 fact that notes, accidentals, etc. are hidden. A future version of
4609 lilypond may automatically hide notes, accidentals, etc. within the
4612 Also note that a music expression like @code{< @{ g8 e8 @} a4 >} is
4613 illegal; in such a case, you can instead use the expression @code{< g8
4616 By default, cluster engraver is in the voice context. This allows
4617 putting ordinary notes and clusters together in the same staff, even
4618 simultaneously. However, in such a case no attempt is made to
4619 automatically avoid collisions between ordinary notes and clusters.
4621 The geometrical shape can be further controlled with grob properties
4622 @code{padding} and @code{shape}. @code{padding} adds to the vertical
4623 extent of the shape (top and bottom) and is expressed in units of
4624 staffspace. Since the pitch range of a single pitch is infinitely
4625 small, if padding is set to @code{0.0}, this possibly results in an
4626 invisible shape, if you,for example, say @code{ \startCluster c d e
4627 \endCluster}. The default value for @code{padding} therefore is
4628 @code{0.25}, such that a single pitch roughly shows the same height as a
4629 note head. Property @code{shape} controls how the overall shape of the
4630 cluster is constructed from the set of notes. Currently supported
4631 values are @code{leftsided-stairs}, @code{rightsided-stairs},
4632 @code{centered-stairs}, and @code{ramp}.
4634 @c . {Tuning output}
4636 @section Tuning output
4638 LilyPond tries to take as much formatting as possible out of your
4639 hands. Nevertheless, there are situations where it needs some help, or
4640 where you want to override its decisions. In this section we discuss
4641 ways to do just that.
4643 Formatting is internally done by manipulating so called objects (graphic
4644 objects). Each object carries with it a set of properties (object
4645 properties) specific to that object. For example, a stem object has
4646 properties that specify its direction, length and thickness.
4648 The most direct way of tuning the output is by altering the values of
4649 these properties. There are two ways of doing that: first, you can
4650 temporarily change the definition of a certain type of object, thus
4651 affecting a whole set of objects. Second, you can select one specific
4652 object, and set a object property in that object.
4655 * Tuning groups of objects ::
4656 * Tuning per object ::
4661 @node Tuning groups of objects
4662 @subsection Tuning groups of objects
4664 @cindex object description
4666 A object definition is a Scheme association list, that is stored in a
4667 context property. By assigning to that property (using plain
4668 @code{\property}), you can change the resulting objects.
4670 @lilypond[verbatim, fragment,quote]
4671 c'4 \property Voice.NoteHead = #'() c'4
4673 This mechanism is fairly crude, since you can only set, but not modify,
4674 the definition of an object. Also, it will thoroughly confuse LilyPond.
4676 The definition of an object is actually a list of default object
4677 properties. For example, the definition of the Stem object (available
4678 in @file{scm/grob-description.scm}), includes the following definitions for
4683 (beamed-lengths . (0.0 2.5 2.0 1.5))
4684 (Y-extent-callback . ,Stem::height)
4688 You can add a property on top of the existing definition, or remove a
4689 property, thus overriding the system defaults:
4690 @lilypond[verbatim,quote]
4691 c'4 \property Voice.Stem \override #'thickness = #4.0
4692 c'4 \property Voice.Stem \revert #'thickness
4695 You should balance @code{\override} and @code{\revert}. If that's too
4696 much work, you can use the @code{\set} shorthand. It performs a revert
4697 followed by an override. The following example gives exactly the same
4698 result as the previous one.
4699 @lilypond[verbatim,quote]
4700 c'4 \property Voice.Stem \set #'thickness = #4.0
4701 c'4 \property Voice.Stem \set #'thickness = #0.8
4704 If you use @code{\set}, you must explicitly restore the default.
4707 Formally the syntax for these constructions is
4709 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4710 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4711 \property @var{context}.@var{grobname} \revert @var{symbol}
4713 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4714 and @var{grobname} are strings and @var{value} is a Scheme expression.
4717 If you revert a setting which was not set in the first place, then it
4718 has no effect. However, if the setting was set as a system default, it
4719 may remove the default value, and this may give surprising results,
4720 including crashes. In other words, @code{\override} and @code{\revert},
4721 must be carefully balanced.
4723 These are examples of correct nesting of @code{\override}, @code{\set},
4726 A clumsy but correct form:
4728 \override \revert \override \revert \override \revert
4731 Shorter version of the same:
4733 \override \set \set \revert
4736 A short form, using only @code{\set}. This requires you to know the
4739 \set \set \set \set @var{to default value}
4742 If there is no default (i.e. by default, the object property is unset),
4745 \set \set \set \revert
4748 For the digirati, the object description is an Scheme association
4749 list. Since a Scheme list is a singly linked list, we can treat it as a
4750 stack, and @code{\override} and @code{\revert} are just push and pop
4751 operations. This pushing and popping is also used for overriding
4752 automatic beaming settings.
4756 LilyPond will hang or crash if @var{value} contains cyclic references.
4757 The backend is not very strict in type-checking object properties. If you
4758 @code{\revert} properties that are expected to be set by default,
4764 @node Tuning per object
4765 @subsection Tuning per object
4768 Tuning a single object is most often done with @code{\property}. The
4771 \once \property @dots{}
4774 applies a setting only during one moment in the score: notice how the
4775 original setting for stem thickness is restored automatically in the
4778 @lilypond[verbatim, fragment, relative=1]
4780 \once \property Voice.Stem \set #'thickness = #4
4786 @cindex \outputproperty
4788 A second way of tuning objects is the more arcane @code{\outputproperty}
4789 feature. The syntax is as follows:
4791 \outputproperty @var{predicate} @var{symbol} = @var{value}
4793 Here @code{predicate} is a Scheme function taking a object argument, and
4794 returning a boolean. This statement is processed by the
4795 @code{Output_property_engraver}. It instructs the engraver to feed all
4796 objects that it sees to @var{predicate}. Whenever the predicate returns
4797 true, the object property @var{symbol} will be set to @var{value}.
4799 This command is only single shot, in contrast to @code{\override} and
4802 You will need to combine this statement with @code{\context} to select
4803 the appropriate context to apply this to.
4805 In the following example, all note heads occurring at current staff
4806 level, are shifted up and right by setting their @code{extra-offset}
4809 @lilypond[fragment,verbatim,singleline]
4811 \context Staff \outputproperty
4812 #(make-type-checker 'note-head-interface)
4813 #'extra-offset = #'(0.5 . 0.75)
4817 @cindex @code{extra-offset}
4819 In this example, the predicate checks the @code{text} object property, to
4820 shift only the `m.d.' text, but not the fingering instruction "2".
4821 @lilypond[verbatim,singleline]
4822 #(define (make-text-checker text)
4823 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
4826 \notes\relative c''' {
4827 \property Voice.Stem \set #'direction = #1
4828 \outputproperty #(make-text-checker "m.d.")
4829 #'extra-offset = #'(-3.5 . -4.5)
4837 If possible, avoid this feature: the semantics are not very clean, and
4838 the syntax and semantics are up for rewrite.
4843 @node Font selection
4844 @subsection Font selection
4846 The most common thing to change about the appearance of fonts is
4847 their size. The font size of a @internalsref{Voice},
4848 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4849 changed by setting the @code{fontSize} property for that context:
4850 @lilypond[fragment,relative=1,verbatim,quote]
4851 c4 c4 \property Voice.fontSize = #-1
4854 This command will not change the size of variable symbols, such as
4855 beams or slurs. You can use this command to get smaller symbol for
4856 cue notes, but that involves some more subtleties. An elaborate
4857 example of those is in @file{input/test/cue-notes.ly}.
4865 The font used for printing a object can be selected by setting
4866 @code{font-name}, e.g.
4868 \property Staff.TimeSignature
4869 \set #'font-name = #"cmr17"
4871 You may use any font which is available to @TeX{}, such as foreign
4872 fonts or fonts that do not belong to the Computer Modern font family.
4873 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4874 can also be adjusted with a more fine-grained mechanism. By setting
4875 the object properties described below, you can select a different font.
4876 All three mechanisms work for every object that supports
4877 @code{font-interface}.
4881 A symbol indicating the general class of the typeface. Supported are
4882 @code{roman} (Computer Modern), @code{braces} (for piano staff
4883 braces), @code{music} (the standard music font), @code{ancient} (the
4884 ancient notation font) @code{dynamic} (font for dynamic signs) and
4888 A symbol indicating the shape of the font, there are typically several
4889 font shapes available for each font family. Choices are @code{italic},
4890 @code{caps} and @code{upright}
4893 A symbol indicating the series of the font. There are typically several
4894 font series for each font family and shape. Choices are @code{medium}
4897 @item font-relative-size
4898 A number indicating the size relative the standard size. For example,
4899 with 20pt staff height, relative size -1 corresponds to 16pt staff
4900 height, and relative size +1 corresponds to 23 pt staff height.
4902 @item font-design-size
4903 A number indicating the design size of the font.
4905 This is a feature of the Computer Modern Font: each point size has a
4906 slightly different design. Smaller design sizes are relatively wider,
4907 which enhances readability.
4910 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4911 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4912 to override default setting, which are always present. For example:
4914 \property Lyrics.LyricText \override #'font-series = #'bold
4915 \property Lyrics.LyricText \override #'font-family = #'typewriter
4916 \property Lyrics.LyricText \override #'font-shape = #'*
4919 @cindex @code{font-style}
4921 There are also pre-cooked font selection qualifiers. These are
4922 selected through the object property @code{font-style}. For example,
4923 the style @code{finger} selects family @code{number} and relative size
4924 @code{-3}. Styles available include @code{volta}, @code{finger},
4925 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4926 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4927 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4928 to this file for more information.
4930 @cindex magnification
4932 The size of the font may be scaled with the object property
4933 @code{font-magnification}. For example, @code{2.0} blows up all
4934 letters by a factor 2 in both directions.
4938 Relative size is not linked to any real size.
4940 There is no style sheet provided for other fonts besides the @TeX{}
4941 family, and the style sheet can not be modified easily.
4943 @cindex font selection
4944 @cindex font magnification
4945 @cindex @code{font-interface}
4949 @subsection Text markup
4954 @cindex typeset text
4956 LilyPond has an internal mechanism to typeset texts. You can access it
4957 with the keyword @code{\markup}. Within markup mode, you can enter texts
4958 similar to lyrics: simply enter them, surrounded by spaces.
4961 @lilypond[verbatim,fragment,relative=1]
4962 c1^\markup { hello }
4963 c1_\markup { hi there }
4964 c1^\markup { hi \bold there, is \italic anyone home? }
4967 @cindex font switching
4969 The line of the example demonstrates font switching commands. Notice
4970 that the command only apply to the first following word; enclose a set
4971 of texts with braces to apply a command to more words.
4973 \markup @{ \bold @{ hi there @} @}
4975 For clarity, you can also do this for single arguments, e.g.
4977 \markup @{ is \italic @{ anyone @} home @}
4980 @cindex font size, texts
4983 The following size commands set abolute sizes
4999 You can also make letter larger or smaller relative to their neighbors,
5000 with the commands @code{\larger} and @code{\smaller}.
5004 @cindex font style, for texts
5010 The following font change commands are defined:
5013 This changes to the font used for dynamic signs. Note that this font
5014 doesn't contain all characters of the alphabet.
5016 This changes to the font used for time signatures. It only contains
5017 numbers and a few punctuation marks.
5022 @cindex raising text
5023 @cindex lowering text
5025 @cindex translating text
5030 Raising and lowering texts can be done with @code{\super} and
5033 @lilypond[verbatim,fragment,relative=1]
5034 c1^\markup { E "=" mc \super "2" }
5039 If you want to give an explicit amount for lowering or raising, use
5040 @code{\raise}. This command takes a Scheme valued argument,
5041 @lilypond[verbatim,fragment,relative=1,quote]
5042 c1^\markup { C \small \raise #1.0 { "9/7+" }}
5044 The argument to @code{\raise} is the vertical displacement amount,
5045 measured in (global) staff spaces.
5047 Other commands taking single arguments include
5050 @item \bracket, \hbracket
5051 Bracket the argument markup.
5055 This is converted to a musical symbol, e.g. @code{\musicglyph
5056 #"accidentals-0"} will select the natural sign from the music font.
5057 See @ref{The Feta font} for a complete listing of the possible glyphs.
5059 This produces a single character, e.g. @code{\char #65} produces the
5062 @item \hspace #@var{amount}
5064 This produces a invisible object taking horizontal space.
5066 \markup @{ A \hspace #2.0 B @}
5068 will put extra space between A and B. Note that lilypond
5069 inserts space before and after @code{\hspace}.
5071 @item \fontsize #@var{size}
5073 This sets the relative font size, eg.
5075 A \fontsize #2 @{ B C @} D
5079 This will enlarge the B and the C by two steps.
5080 @item \translate #(cons @var{x} @var{y})
5082 This translates an object. It's first argument is a cons of numbers
5084 A \translate #(cons 2 -3) @{ B C @} D
5086 This moves `B C' 2 spaces to the right, and 3 down.
5088 @item \magnify #@var{mag}
5090 This sets the font magnification for the its argument. In the following
5091 example, the middle A will be 10% larger.
5093 A \magnify #1.1 @{ A @} A
5097 @item \override #(@var{key} . @var{value})
5099 This overrides a formatting property for its argument. The argument
5100 should be a key/value pair, e.g.
5102 m \override #'(font-family . math) m m
5106 In markup mode you can compose expressions, similar to mathematical
5107 expressions, XML documents and music expressions. The braces group
5108 notes into horizontal lines. Other types of lists also exist: you can
5109 stack expressions grouped with @code{<<}, and @code{>>} vertically with
5110 the command @code{\column}. Similarly, @code{\center} aligns texts by
5113 @lilypond[verbatim,fragment,relative=1]
5114 c1^\markup { \column << a bbbb c >> }
5115 c1^\markup { \center << a bbbb c >> }
5116 c1^\markup { \line << a b c >> }
5121 The markup mechanism is very flexible and extensible. Refer to
5122 @file{scm/new-markup.scm} for more information on extending the markup
5126 @cindex metronome mark
5128 One practical application of complicated markup is to fake a metronome
5132 eighthStem = \markup \combine
5133 \musicglyph #"flags-stem"
5134 \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
5135 eighthNote = \markup
5136 \override #'(word-space . 0.0)
5137 { \musicglyph #"noteheads-2"
5138 \translate #'(-0.05 . 0.1) \eighthStem }
5141 \notes\relative c'' {
5142 a1^\markup { \magnify #0.9 \eighthNote " = 64" }
5151 LilyPond does not account for kerning in its text formatting, so it
5152 spaces texts slightly too wide.
5154 Syntax errors for markup mode are confusing.
5158 @section Global layout
5160 The global layout determined by three factors: the page layout, the
5161 line breaks and the spacing. These all influence each other: The
5162 choice of spacing determines how densely each system of music is set,
5163 where line breaks breaks are chosen, and thus ultimately how many
5164 pages a piece of music takes. In this section we will explain how the
5165 lilypond spacing engine works, and how you can tune its results.
5167 Globally spoken, this procedure happens in three steps: first,
5168 flexible distances (``springs'') are chosen, based on durations. All
5169 possible line breaking combination are tried, and the one with the
5170 best results---a layout that has uniform density and requires as
5171 little stretching or cramping as possible---is chosen. When the score
5172 is processed by @TeX{}, page are filled with systems, and page breaks
5173 are chosen whenever the page gets full.
5176 * Vertical spacing::
5177 * Horizontal spacing::
5184 @node Vertical spacing
5185 @subsection Vertical spacing
5187 @cindex vertical spacing
5188 @cindex distance between staves
5189 @cindex staff distance
5190 @cindex between staves, distance
5191 @cindex staffs per page
5194 The height of each system is determined automatically by lilypond, to
5195 keep systems from bumping into each other, some minimum distances are
5196 set. By changing these, you can put staves closer together, and thus
5197 put more systems onto one page.
5199 Normally staves are stacked vertically. To make
5200 staves maintain a distance, their vertical size is padded. This is
5201 done with the property @code{minimumVerticalExtent}. It takes a pair
5202 of numbers, so if you want to make it smaller from its, then you could
5205 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5207 This sets the vertical size of the current staff to 4 staff-space on
5208 either side of the center staff line. The argument of
5209 @code{minimumVerticalExtent} is interpreted as an interval, where the
5210 center line is the 0, so the first number is generally negative. you
5211 could also make the staff larger at the bottom by setting it to
5212 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
5214 Vertical aligment of staves is handled by the
5215 @internalsref{VerticalAlignment} object, which lives at
5216 @internalsref{Score} level.
5218 The piano staves are handled a little differently: to make cross-staff
5219 beaming work correctly, it necessary that the distance between staves
5220 is fixed. This is also done with a @internalsref{VerticalAlignment}
5221 object, created in @internalsref{PianoStaff}, but a forced distance is
5222 set. This is done with the object property #'forced-distance. If you
5223 want to override this, use a @code{\translator} block as follows:
5227 VerticalAlignment \override #'forced-distance = #9
5230 This would bring the staves together at a distance of 9 staff spaces,
5231 and again this is measured from the center line of each staff.
5235 @node Horizontal spacing
5236 @subsection Horizontal Spacing
5238 The spacing engine translates differences in durations into
5239 stretchable distances (``springs'') of differing lengths. Longer
5240 durations get more space, shorter durations get less. The basis for
5241 assigning spaces to durations, is that the shortest durations get a
5242 fixed amount of space, and the longer durations get more: doubling a
5243 duration adds a fixed amount of space to the note.
5245 For example, the following piece contains lots of half, quarter and
5246 8th notes, the eighth note is followed by 1 note head width. The The
5247 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5248 @lilypond[fragment, verbatim, relative=1]
5249 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
5252 These two amounts of space are @code{shortest-duration-space}
5253 @code{spacing-increment}, object properties of
5254 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
5255 set to 1.2, which is the width of a note head, and
5256 @code{shortest-duration-space} is set to 2.0, meaning that the
5257 shortest note gets 2 noteheads of space. For normal notes, this space
5258 is always counted from the left edge of the symbol, so the short notes
5259 in a score is generally followed by one note head width of space.
5261 If one would follow the above procedure exactly, then adding a single
5262 32th note to a score that uses 8th and 16th notes, would widen up the
5263 entire score a lot. The shortest note is no longer a 16th, but a 64th,
5264 thus adding 2 noteheads of space to every note. To prevent this, the
5265 shortest duration for spacing is not the shortest note in the score,
5266 but the most commonly found shortest note. Notes that are even
5267 shorter this are followed by a space that is proportonial to their
5268 duration relative to the common shortest note. So if we were to add
5269 only a few 16th notes to the example above, they would be followed by
5272 @lilypond[fragment, verbatim, relative=1]
5273 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
5276 The most common shortest duration is determined as follows: in every
5277 measure, the shortest duration is determined. The most common short
5278 duration, is taken as the basis for the spacing, with the stipulation
5279 that this shortest duration should always be equal to or shorter than
5280 1/8th note. The shortest duration is printed when you run lilypond
5281 with @code{--verbose}. These durations may also be customized. If you
5282 set the @code{common-shortest-duration} in
5283 @internalsref{SpacingSpanner}, then this sets the base duration for
5284 spacing. The maximum duration for this base (normally 1/8th), is set
5285 through @code{base-shortest-duration}.
5287 @cindex @code{common-shortest-duration}
5288 @cindex @code{base-shortest-duration}
5289 @cindex @code{stem-spacing-correction}
5290 @cindex @code{spacing}
5292 In the introduction it was explained that stem directions influence
5293 spacing. This is controlled with @code{stem-spacing-correction} in
5294 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
5295 same property for controlling the stem/barline spacing. In the
5296 following example shows these corrections, once with default settings,
5297 and once with exaggerated corrections.
5303 \property Staff.NoteSpacing \override #'stem-spacing-correction
5305 \property Staff.StaffSpacing \override #'stem-spacing-correction
5310 \paper { linewidth = -1. } }
5313 @cindex SpacingSpanner, overriding properties
5315 The @internalsref{SpacingSpanner}, is score wide, so its properties
5316 must be overriden from the @code{\paper} block, e.g.
5318 \paper @{ \translator @{
5320 SpacingSpanner \override #'spacing-increment = #3.0
5327 Spacing is determined on a score wide basis. If you have a score that
5328 changes its character (measured in durations) half way during the
5329 score, the part containing the longer durations will be spaced too
5332 Generating optically pleasing spacing is black magic. LilyPond tries
5333 to deal with a number of frequent cases. Here is an example that is
5334 not handled correctly, due to the combination of chord collisions and
5339 \context PianoStaff \notes \transpose c c'' <
5340 \context Staff = up { s1 }
5341 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
5342 \translator Staff=down c c c] }
5344 \paper { linewidth = -1 }
5351 @subsection Font size
5352 @cindex font size, setting
5353 @cindex staff size, setting
5354 @cindex @code{paper} file
5356 The Feta font provides musical symbols at seven different sizes.
5357 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5358 point, and 26 point. The point size of a font is the height of the
5359 five lines in a staff when displayed in the font.
5361 Definitions for these sizes are the files @file{paperSZ.ly}, where
5362 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5363 of these files, the identifiers @code{paperEleven},
5364 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5365 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5366 are defined respectively. The default @code{\paper} block is also
5367 set. These files should be imported at toplevel, i.e.
5369 \include "paper26.ly"
5373 The font definitions are generated using a Scheme function. For more
5374 details, see the file @file{scm/font.scm}.
5379 @subsection Line breaking
5382 @cindex breaking lines
5384 Line breaks are normally computed automatically. They are chosen such
5385 that it looks neither cramped nor loose, and that consecutive lines have
5388 Occasionally you might want to override the automatic breaks; you can
5389 do this by specifying @code{\break}. This will force a line break at
5390 this point. Line breaks can only occur at places where there are bar
5391 lines. If you want to have a line break where there is no bar line,
5392 you can force an invisible bar line by entering @code{\bar
5393 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
5397 @cindex regular line breaks
5398 @cindex four bar music.
5400 If you want linebreaks at regular intervals, you can use the following:
5402 < \repeat 7 unfold @{ s1 * 4 \break @}
5406 This makes the following 28 measures (assuming 4/4 time) be broken every
5410 @subsection Page layout
5413 @cindex breaking pages
5415 @cindex @code{indent}
5416 @cindex @code{linewidth}
5418 The most basic settings influencing the spacing are @code{indent} and
5419 @code{linewidth}. They are set in the @code{\paper} block. They
5420 control the indentation of the first line of music, and the lengths of
5421 the lines. If @code{linewidth} set to a negative value, a single
5422 unjustified line is produced. A similar effect for scores that are
5423 longer than one line, can be produced by setting @code{raggedright} to
5424 true in the @code{\paper} block.
5427 @cindex vertical spacing
5429 The page layout process happens outside lilypond. Ly2dvi sets page
5430 layout instructions. Ly2dvi responds to the following variables in the
5431 @code{\paper} block. The variable @code{textheight} sets the total
5432 height of the music on each page. The spacing between systems is
5433 controlled with @code{interscoreline}, its default is 16pt.
5434 The distance between the score lines will stretch in order to fill the
5435 full page @code{interscorelinefill} is set to a positive number. In
5436 that case @code{interscoreline} specifies the minimum spacing.
5438 @cindex @code{textheight}
5439 @cindex @code{interscoreline}
5440 @cindex @code{interscorelinefill}
5442 If the variable @code{lastpagefill} is defined (that is, it gets any
5443 value assigned in the @code{\paper} block), systems are evenly
5444 distributed vertically on the last page. This might produce ugly
5445 results in case there are not enough systems on the last page. Note
5446 that @command{lilypond-book} ignores @code{lastpagefill}. See
5447 @ref{Integrating text and music with lilypond-book} for
5450 @cindex @code{lastpagefill}
5452 Page breaks are normally computed by @TeX{}, so they are not under
5453 direct control of LilyPond. However, you can insert a commands into
5454 the @file{.tex} output to instruct @TeX{} where to break pages. You
5455 can insert a @code{\newpage} from within lilypond. This is done by
5456 setting the @code{between-systems-strings} on the
5457 @internalsref{NonMusicalPaperColumn} where the system is broken.
5461 @cindex @code{papersize}
5463 To change the paper size, you must first set the
5464 @code{papersize} paper variable variable. Set it to
5465 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5466 specification, you must set the font as described above. If you want
5467 the default font, then use the 20 point font.
5470 \paper@{ papersize = "a4" @}
5471 \include "paper16.ly"
5474 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5475 will set the paper variables @code{hsize} and @code{vsize} (used by
5476 Lilypond and @code{ly2dvi})
5486 LilyPond can produce MIDI output. The performance lacks lots of
5487 interesting effects, such as swing, articulation, slurring, etc., but it
5488 is good enough for proof-hearing the music you have entered. Ties,
5489 dynamics and tempo changes are interpreted.
5491 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5492 levels. Dynamic marks translate to a fixed fraction of the available
5493 MIDI volume range, crescendi and decrescendi make the the volume vary
5494 linearly between their two extremities. The fractions be adjusted by
5495 overriding the @code{absolute-volume-alist} defined in
5496 @file{scm/midi.scm}.
5498 For each type of musical instrument (that MIDI supports), a volume range
5499 can be defined. This gives you basic equalizer control, which can
5500 enhance the quality of the MIDI output remarkably. You can add
5501 instruments and ranges or change the default settings by overriding the
5502 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5504 Both loudness controls are combined to produce the final MIDI volume.
5508 * MIDI instrument names::
5513 @subsection MIDI block
5517 The MIDI block is analogous to the paper block, but it is somewhat
5518 simpler. The @code{\midi} block can contain:
5522 @item a @code{\tempo} definition
5523 @item context definitions
5526 Assignments in the @code{\midi} block are not allowed.
5530 @cindex context definition
5532 Context definitions follow precisely the same syntax as within the
5533 \paper block. Translation modules for sound are called performers.
5534 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5537 @node MIDI instrument names
5538 @subsection MIDI instrument names
5540 @cindex instrument names
5541 @cindex @code{Staff.midiInstrument}
5542 @cindex @code{Staff.instrument}
5544 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5545 property or, if that property is not set, the @code{Staff.instrument}
5546 property. The instrument name should be chosen from the list in
5547 @ref{MIDI instruments}.
5551 If the selected string does not exactly match, then LilyPond uses the
5552 default (Grand Piano). It is not possible to select an instrument by