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 An 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
1944 \property Score.LyricText \override #'font-family = #'typewriter
1945 \property Score.LyricText \override #'font-shape = #'upright
1946 \context Staff \notes {
1947 \property Score.timing = ##f
1948 \property Score.barAlways = ##t
1949 \property Staff.BarLine \override #'transparent = ##t
1950 c''-\accent c''-\marcato c''-\staccatissimo
1951 c''-\staccato c''-\tenuto c''-\portato
1952 c''-\upbow c''-\downbow c''-\flageolet
1953 c''-\thumb c''^\lheel c''-\rheel
1954 c''^\ltoe c''-\rtoe c''-\open
1955 c''-\stopped c''-\turn c''-\reverseturn
1956 c''-\trill c''-\prall c''-\mordent
1957 c''-\prallprall c''-\prallmordent c''-\upprall
1958 c''-\downprall c''-\upmordent c''-\downmordent
1959 c''-\pralldown c''-\prallup c''-\lineprall
1960 c''-\shortfermata c''-\fermata c''-\longfermata
1961 c''-\verylongfermata c''-\segno c''-\coda
1964 \context Lyrics \lyrics {
1965 accent__ marcato__ staccatissimo__
1966 staccato__ tenuto__ portato__
1967 upbow__ downbow__ flageolet__
1968 thumb__ lheel__ rheel__
1969 ltoe__ rtoe__ open__
1970 stopped__ turn__ reverseturn__
1971 trill__ prall__ mordent__
1972 prallprall__ prallmordent__ uprall__
1973 downprall__ upmordent__ downmordent__
1974 pralldown__ prallup__ lineprall__
1975 shortfermata__ fermata__ longfermata__
1976 verylongfermata__ segno__ coda__
1990 Fingering instructions can also be entered in this shorthand. For
1991 finger changes, use markup texts:
1993 @lilypond[verbatim, singleline, fragment]
1994 c'4-1 c'4-2 c'4-3 c'4-4
1995 c'^\markup { \fontsize #-3 \number "2-3" }
1998 @cindex finger change
2003 See also @seeinternals{Script} and @seeinternals{Fingering}.
2007 All of these note ornaments appear in the printed output but have no
2008 effect on the MIDI rendering of the music.
2010 Unfortunately, there is no support for adding fingering instructions or
2011 ornaments to individual note heads. Some hacks exist, though. See
2012 @file{input/test/script-horizontal.ly}.
2017 @subsection Text scripts
2018 @cindex Text scripts
2020 In addition, it is possible to place arbitrary strings of text or markup
2021 text (see @ref{Text markup}) above or below notes by using a string:
2024 By default, these indications do not influence the note spacing, but
2025 by using the command @code{\fatText}, the widths will be taken into
2028 @lilypond[fragment,singleline,verbatim] \relative c' {
2029 c4^"longtext" \fatText c4_"longlongtext" c4 }
2032 It is possible to use @TeX{} commands in the strings, but this should be
2033 avoided because it makes it impossible for LilyPond to compute the
2034 exact length of the string, which may lead to collisions. Also, @TeX{}
2035 commands won't work with direct PostScript output.
2036 @c (see @ref{PostScript output}).
2038 Text scripts are created in form of @internalsref{TextScript} objects, in
2039 @internalsref{Voice} context.
2041 @ref{Text markup} describes how to change the font or access
2042 special symbols in text scripts.
2047 @subsection Grace notes
2051 @cindex @code{\grace}
2055 Grace notes are ornaments that are written out
2056 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
2060 In normal notation, grace notes are supposed to take up no logical
2061 time in a measure. Such an idea is practical for normal notation, but
2062 is not strict enough to put it into a program. The model that LilyPond
2063 uses for grace notes internally is that all timing is done in two
2066 Every point in musical time consists of two rational numbers: one
2067 denotes the logical time, one denotes the grace timing. The above
2068 example is shown here with timing tuples.
2071 \score { \notes \relative c''{
2072 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
2073 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2075 \paper { linewidth = 8.\cm }
2079 The advantage of this approach is that you can use almost any lilypond
2080 construction together with grace notes, for example slurs and clef
2081 changes may appear halfway in between grace notes:
2083 @lilypond[relative=2,verbatim,fragment]
2084 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2087 The placement of these grace notes is synchronized between different
2088 staves, using this grace timing.
2090 @lilypond[relative=2,verbatim,fragment]
2091 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2092 \context Staff = SB { c4 \grace { g8 b } c4 } >
2096 Unbeamed eighth notes and shorter by default have a slash through the
2097 stem. This can be controlled with object property @code{stroke-style} of
2098 @internalsref{Stem}. The change in formatting is accomplished by
2099 inserting @code{\startGraceMusic} before handling the grace notes, and
2100 @code{\stopGraceMusic} after finishing the grace notes.
2101 You can add to these definitions to globally change grace note
2102 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2104 [TODO discuss Scheme functionality.]
2107 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2112 @lilypond[fragment,verbatim]
2113 \relative c'' \context Voice {
2114 \grace c8 c4 \grace { [c16 c16] } c4
2116 \property Voice.Stem \override #'stroke-style = #'()
2118 \property Voice.Stem \revert #'stroke-style
2125 If you want to end a note with a grace note, then the standard trick
2126 is to put the grace notes before a phantom ``space note'', e.g.
2127 @lilypond[fragment,verbatim, relative=2]
2130 { s2 \grace { [c16 d] } } >
2135 A @code{\grace} section has some default values, and LilyPond will
2136 use those default values unless you specify otherwise inside the
2137 @code{\grace} section. For example, if you specify \slurUp
2138 @emph{before} your @code{\grace} section, a slur which starts inside
2139 the @code{\grace} won't be forced up, even if the slur ends outside
2140 of the @code{\grace}. Note the difference between the first and
2141 second bars in this example:
2143 @lilypond[fragment,verbatim]
2144 \relative c'' \context Voice {
2163 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2165 Grace note synchronization can also lead to surprises. Staff notation,
2166 such as key signatures, barlines, etc. are also synchronized. Take
2167 care when you mix staves with grace notes and staves without.
2169 @lilypond[relative=2,verbatim,fragment]
2170 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2171 \context Staff = SB { c4 \bar "|:" d4 } >
2174 Grace sections should only be used within sequential music
2175 expressions. Nesting, juxtaposing, or ending sequential music with a
2176 grace section is not supported, and might produce crashes or other
2181 @subsection Glissando
2184 @cindex @code{\glissando}
2186 A glissando line can be requested by attaching a @code{\glissando} to
2189 @lilypond[fragment,relative,verbatim]
2195 Printing of an additional text (such as @emph{gliss.}) must be done
2196 manually. See also @seeinternals{Glissando}.
2202 @subsection Dynamics
2215 @cindex @code{\ffff}
2225 Absolute dynamic marks are specified using an identifier after a
2226 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2227 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2228 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2229 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2231 @lilypond[verbatim,singleline,fragment,relative]
2232 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2238 @cindex @code{\decr}
2239 @cindex @code{\rced}
2245 A crescendo mark is started with @code{\cr} and terminated with
2246 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2247 started with @code{\decr} and terminated with @code{\rced}. There are
2248 also shorthands for these marks. A crescendo can be started with
2249 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2250 can be terminated with @code{\!}. Note that @code{\!} must go before
2251 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2252 after the last note. Because these marks are bound to notes, if you
2253 want several marks during one note, you have to use spacer notes.
2255 @lilypond[fragment,verbatim,center,quote]
2256 c'' \< \! c'' d'' \decr e'' \rced
2257 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2259 This may give rise to very short hairpins. Use @code{minimum-length}
2260 in Voice.HairPin to lengthen these, e.g.
2263 \property Staff.Hairpin \override #'minimum-length = #5
2266 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2267 is an example how to do it:
2269 @lilypond[fragment,relative=2,verbatim]
2270 c4 \cresc c4 \endcresc c4
2277 You can also supply your own texts:
2278 @lilypond[fragment,relative,verbatim]
2280 \property Voice.crescendoText = "cresc. poco"
2281 \property Voice.crescendoSpanner = #'dashed-line
2288 Dynamics are objects of @internalsref{DynamicText} and
2289 @internalsref{Hairpin}. Vertical positioning of these symbols is
2290 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2291 adjust padding or vertical direction of the dynamics, you must set
2292 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2293 identifiers to set the vertical direction are \dynamicUp and
2296 @cindex direction, of dynamics
2297 @cindex @code{\dynamicDown}
2298 @cindex @code{\dynamicUp}
2306 @cindex @code{\repeat}
2308 To specify repeats, use the @code{\repeat} keyword. Since repeats
2309 should work differently when played or printed, there are a few
2310 different variants of repeats.
2314 Repeated music is fully written (played) out. Useful for MIDI
2315 output, and entering repetitive music.
2318 This is the normal notation: Repeats are not written out, but
2319 alternative endings (voltas) are printed, left to right.
2322 Alternative endings are written stacked. This has limited use but may be
2323 used to typeset two lines of lyrics in songs with repeats, see
2324 @file{input/star-spangled-banner.ly}.
2330 Make beat or measure repeats. These look like percent signs.
2336 * Repeats and MIDI::
2337 * Manual repeat commands::
2339 * Tremolo subdivisions::
2344 @subsection Repeat syntax
2346 The syntax for repeats is
2349 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2352 If you have alternative endings, you may add
2353 @cindex @code{\alternative}
2355 \alternative @code{@{} @var{alternative1}
2357 @var{alternative3} @dots{} @code{@}}
2359 where each @var{alternative} is a music expression.
2361 Normal notation repeats are used like this:
2362 @lilypond[fragment,verbatim]
2364 \repeat volta 2 { c'4 d' e' f' }
2365 \repeat volta 2 { f' e' d' c' }
2368 With alternative endings:
2369 @lilypond[fragment,verbatim]
2371 \repeat volta 2 {c'4 d' e' f'}
2372 \alternative { {d'2 d'} {f' f} }
2375 Folded repeats look like this:
2378 @lilypond[fragment,verbatim]
2380 \repeat fold 2 {c'4 d' e' f'}
2381 \alternative { {d'2 d'} {f' f} }
2385 If you don't give enough alternatives for all of the repeats, then
2386 the first alternative is assumed to be repeated often enough to equal
2387 the specified number of repeats.
2389 @lilypond[fragment,verbatim]
2393 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2394 \alternative { { g4 g g } { a | a a a a | b2. } }
2399 @node Repeats and MIDI
2400 @subsection Repeats and MIDI
2402 @cindex expanding repeats
2404 For instructions on how to unfoldi repeats for MIDI output, see
2405 the example file @file{input/test/unfold-all-repeats.ly}.
2410 Notice that timing information is not remembered at the start of an
2411 alternative, so you have to reset timing information after a repeat,
2412 e.g. using a bar-check (See @ref{Bar check}), setting
2413 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2414 are also not repeated.
2416 It is possible to nest @code{\repeat}s, although this probably is only
2417 meaningful for unfolded repeats.
2419 Folded repeats offer little more over simultaneous music.
2421 @node Manual repeat commands
2422 @subsection Manual repeat commands
2424 @cindex @code{repeatCommands}
2426 The property @code{repeatCommands} can be used to control the layout of
2427 repeats. Its value is a Scheme list of repeat commands, where each repeat
2435 @item (volta . @var{text})
2436 Print a volta bracket saying @var{text}. The text can be specified as
2437 a text string or as a markup text, see @ref{Text markup}. Do not
2438 forget to change the font, as the default number font does not contain
2439 alphabetic characters.
2441 Stop a running volta bracket
2444 @lilypond[verbatim, fragment]
2446 \property Score.repeatCommands = #'((volta "93") end-repeat)
2448 \property Score.repeatCommands = #'((volta #f))
2453 Repeats brackets are @internalsref{VoltaBracket} objects.
2455 @node Tremolo repeats
2456 @subsection Tremolo repeats
2457 @cindex tremolo beams
2459 To place tremolo marks between notes, use @code{\repeat} with tremolo
2461 @lilypond[verbatim,center,singleline]
2463 \context Voice \notes\relative c' {
2464 \repeat "tremolo" 8 { c16 d16 }
2465 \repeat "tremolo" 4 { c16 d16 }
2466 \repeat "tremolo" 2 { c16 d16 }
2467 \repeat "tremolo" 4 c16
2472 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2473 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2474 entered without @code{@{} and @code{@}}.
2478 Only powers of two and undotted notes are supported repeat counts.
2480 @node Tremolo subdivisions
2481 @subsection Tremolo subdivisions
2482 @cindex tremolo marks
2483 @cindex @code{tremoloFlags}
2485 Tremolo marks can be printed on a single note by adding
2486 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2487 A @var{length} value of 8 gives one line across the note stem. If the
2488 length is omitted, then then the last value (stored in
2489 @code{Voice.tremoloFlags}) is used.
2491 @lilypond[verbatim,fragment,center]
2492 c'2:8 c':32 | c': c': |
2498 Tremolos in this style do not carry over into the MIDI output.
2501 @node Measure repeats
2502 @subsection Measure repeats
2504 @cindex percent repeats
2505 @cindex measure repeats
2507 In the @code{percent} style, a note pattern can be repeated. It is
2508 printed once, and then the pattern is replaced with a special sign.
2509 Patterns of a one and two measures are replaced by percent-like signs,
2510 patterns that divide the measure length are replaced by slashes.
2512 @lilypond[verbatim,singleline]
2513 \context Voice { \repeat "percent" 4 { c'4 }
2514 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2518 The signs are represented by these objects: @internalsref{RepeatSlash} and
2519 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2523 You can not nest percent repeats, e.g. by filling in the first measure
2524 with slashes, and repeating that measure with percents.
2526 @node Rhythmic music
2527 @section Rhythmic music
2529 Sometimes you might want to show only the rhythm of a melody. This can
2530 be done with the rhythmic staff. All pitches of notes on such a staff
2531 are squashed, and the staff itself looks has a single staff line:
2533 @lilypond[fragment,relative,verbatim]
2534 \context RhythmicStaff {
2536 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2541 * Percussion staves::
2544 @node Percussion staves
2545 @subsection Percussion staves
2548 To typeset more than one piece of percussion to be played by the same
2549 musician one typically uses a multiline staff where each staff
2550 position refers to a specific piece of percussion.
2552 LilyPond is shipped with a bunch of scheme functions which allows you
2553 to do this fairly easily.
2555 The system is based on the general midi drum-pitches.
2556 In order to use the drum pitches you include
2557 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2558 variable @code{drum-pitch-names} - which definition can be read in
2559 @file{scm/drums.scm}. You see that each piece of percussion has a full
2560 name and an abbreviated name - and you may freely select whether to
2561 refer to the full name or the abbreviation in your music definition.
2563 To typeset the music on a staff you apply the scheme function
2564 @code{drums->paper} to the percussion music. This function takes a
2565 list of percussion instrument names, notehead scripts and staff
2566 positions (that is: pitches relative to the C-clef) and uses this to
2567 transform the input music by moving the pitch, changing the notehead
2568 and (optionally) adding a script:
2569 @lilypond[singleline,verbatim,quote]
2570 \include "drumpitch-init.ly"
2571 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2572 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2574 \apply #(drums->paper 'drums) \context Staff <
2576 \context Voice = up { \voiceOne \up }
2577 \context Voice = down { \voiceTwo \down }
2582 In the above example the music was transformed using the list @code{'drums}.
2583 Currently the following lists are defined in @file{scm/drums.scm}:
2586 To typeset a typical drum kit on a five-line staff.
2589 \include "drumpitch-init.ly"
2590 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2591 bd sn ss tomh tommh tomml toml tomfh tomfl }
2592 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2593 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2596 \apply #(drums->paper 'drums) \context Staff <
2600 \context Lyrics \nam
2603 linewidth = 100.0\mm
2606 \remove Bar_engraver
2607 \remove Time_signature_engraver
2608 minimumVerticalExtent = #'(-4.0 . 5.0)
2612 \remove Stem_engraver
2618 Notice that the scheme supports six different toms.
2619 If you are using fewer toms then you simply select the toms that produce
2620 the desired result - i.e. to get toms on the three middle lines you
2621 use @code{tommh}, @code{tomml} and @code{tomfh}.
2623 Because the general midi contain no rimshots we use the sidestick for
2624 this purpose instead.
2626 To typeset timbales on a two line staff.
2627 @lilypond[singleline]
2628 \include "drumpitch-init.ly"
2629 nam = \lyrics { timh ssh timl ssl cb }
2630 mus = \notes { timh ssh timl ssl cb s16 }
2633 \apply #(drums->paper 'timbales) \context Staff <
2637 \context Lyrics \nam
2642 \remove Bar_engraver
2643 \remove Time_signature_engraver
2644 StaffSymbol \override #'line-count = #2
2645 StaffSymbol \override #'staff-space = #2
2646 minimumVerticalExtent = #'(-3.0 . 4.0)
2650 \remove Stem_engraver
2657 To typeset congas on a two line staff.
2658 @lilypond[singleline]
2659 \include "drumpitch-init.ly"
2660 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2661 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2664 \apply #(drums->paper 'congas) \context Staff <
2668 \context Lyrics \nam
2673 \remove Bar_engraver
2674 \remove Time_signature_engraver
2675 StaffSymbol \override #'line-count = #2
2676 StaffSymbol \override #'staff-space = #2
2677 minimumVerticalExtent = #'(-3.0 . 4.0)
2681 \remove Stem_engraver
2687 To typeset bongos on a two line staff.
2688 @lilypond[singleline]
2689 \include "drumpitch-init.ly"
2690 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2691 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2694 \apply #(drums->paper 'bongos) \context Staff <
2698 \context Lyrics \nam
2703 \remove Bar_engraver
2704 \remove Time_signature_engraver
2705 StaffSymbol \override #'line-count = #2
2706 StaffSymbol \override #'staff-space = #2
2707 minimumVerticalExtent = #'(-3.0 . 4.0)
2711 \remove Stem_engraver
2717 To typeset all kinds of simple percussion on one line staves.
2718 @lilypond[singleline]
2719 \include "drumpitch-init.ly"
2720 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2721 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2724 \apply #(drums->paper 'percussion) \context Staff <
2728 \context Lyrics \nam
2733 \remove Bar_engraver
2734 \remove Time_signature_engraver
2735 StaffSymbol \override #'line-count = #1
2736 minimumVerticalExtent = #'(-2.0 . 3.0)
2740 \remove Stem_engraver
2747 If you don't like any of the predefined lists you can define your own
2748 list at the top of your file:
2750 @lilypond[singleline, verbatim]
2752 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2753 (snare default #f ,(ly:make-pitch 0 1 0))
2754 (hihat cross #f ,(ly:make-pitch 0 5 0))
2755 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2756 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2758 \include "drumpitch-init.ly"
2759 up = \notes { hh8 hh hh hh hhp4 hhp }
2760 down = \notes { bd4 sn bd toml8 toml }
2762 \apply #(drums->paper 'mydrums) \context Staff <
2764 \context Voice = up { \voiceOne \up }
2765 \context Voice = down { \voiceTwo \down }
2770 To use a modified existing list instead of building your own from
2771 scratch you can append your modifications to the start of the existing
2775 #(define mydrums (append `(
2776 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2777 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2781 @c FIXME: Too many levels of headers when using subsubsections.
2782 @c Perhaps junk subsection ``Percussion staves''
2783 @subsubsection Percussion staves with normal staves
2784 When you include @file{drumpitch-init.ly} then the default pitches
2785 are overridden so that you after the inclusion cannot use the common
2786 dutch pitch names anymore. Hence you might wan't to reinclude
2787 @file{nederlands.ly} after the drum-pattern-definitions:
2788 @lilypond[singleline,verbatim]
2789 \include "drumpitch-init.ly"
2790 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2791 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2792 \include "nederlands.ly"
2793 bass = \notes \transpose c c,, { a4. e8 r e g e }
2796 \apply #(drums->paper 'drums) \context Staff = drums <
2798 \context Voice = up { \voiceOne \up }
2799 \context Voice = down { \voiceTwo \down }
2801 \context Staff = bass { \clef "F_8" \bass }
2806 @subsubsection Percussion midi output
2807 In order to produce correct midi output you need to produce two score
2808 blocks - one for the paper and one for the midi.
2809 To use the percussion channel you set the property @code{instrument}
2810 to @code{'drums}. Because the drum-pitches themself are similar to the
2811 general midi pitches all you have to do is to insert the voices with
2812 none of the scheme functions to get the correct midi output:
2816 \apply #(drums->paper 'mydrums) \context Staff <
2818 \context Voice = up @{ \voiceOne \up @}
2819 \context Voice = down @{ \voiceTwo \down @}
2825 \property Staff.instrument = #'drums
2834 This scheme is to be considered a temporary implementation. Even
2835 though the scheme will probably keep on working then the future might
2836 bring some other way of typesetting drums, and probably
2837 there will be made no great efforts in keeping things downwards
2842 @section Piano music
2844 Piano music is an odd type of notation. Piano staves are two normal
2845 staves coupled with a brace. The staves are largely independent, but
2846 sometimes voices can cross between the two staves. The
2847 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2848 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2849 other pianistic peculiarities.
2853 * Automatic staff changes::
2854 * Manual staff switches::
2857 * Voice follower lines::
2862 There is no support for putting chords across staves. You can get
2863 this result by increasing the length of the stem in the lower stave so
2864 it reaches the stem in the upper stave, or vice versa. An example is
2865 included with the distribution as @file{input/test/stem-cross-staff.ly}.
2867 @cindex cross staff stem
2868 @cindex stem, cross staff
2871 @c fixme: should have hyperlinks as well.
2876 @c . {Automatic staff changes}
2877 @node Automatic staff changes
2878 @subsection Automatic staff changes
2879 @cindex Automatic staff changes
2881 Voices can switch automatically between the top and the bottom
2882 staff. The syntax for this is
2884 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2886 The autochanger switches on basis of pitch (central C is the turning
2887 point), and it looks ahead skipping over rests to switch rests in
2888 advance. Here is a practical example:
2890 @lilypond[verbatim,singleline,quote]
2891 \score { \notes \context PianoStaff <
2892 \context Staff = "up" {
2893 \autochange Staff \context Voice = VA < \relative c' {
2894 g4 a b c d r4 a g } > }
2895 \context Staff = "down" {
2900 Spacer rests are used to prevent the bottom staff from
2901 terminating too soon.
2904 @node Manual staff switches
2905 @subsection Manual staff switches
2907 @cindex manual staff switches
2908 @cindex staff switch, manual
2910 Voices can be switched between staves manually, using the following command:
2912 \translator Staff = @var{staffname} @var{music}
2914 The string @var{staffname} is the name of the staff. It switches the
2915 current voice from its current staff to the Staff called
2916 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2924 Piano pedal instruction can be expressed using
2925 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2926 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2928 The symbols that are printed can be modified by setting
2929 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2930 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2931 @internalsref{SustainPedal}, for example, for more information.
2933 Pedals can also be indicated by a sequence of brackets, by setting the
2934 @code{pedal-type} property of SustainPedal objects:
2936 @lilypond[fragment,verbatim]
2937 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2938 c''4 \sustainDown d''4 e''4 a'4
2939 \sustainUp \sustainDown
2940 f'4 g'4 a'4 \sustainUp
2943 A third style of pedal notation is a mixture of text and brackets,
2944 obtained by setting @code{pedal-type} to @code{mixed}:
2946 @lilypond[fragment,verbatim]
2947 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2948 c''4 \sustainDown d''4 e''4 c'4
2949 \sustainUp \sustainDown
2950 f'4 g'4 a'4 \sustainUp
2953 The default '*Ped' style for sustain and damper pedals corresponds to
2954 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2955 for a sostenuto pedal:
2957 @lilypond[fragment,verbatim]
2958 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2961 For fine-tuning of the appearance of a pedal bracket, the properties
2962 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2963 @code{PianoPedalBracket} objects (see the detailed documentation of
2964 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2965 may be extended to the end of the note head.
2967 @lilypond[fragment,verbatim]
2968 \property Staff.PianoPedalBracket \override
2969 #'shorten-pair = #'(0 . -1.0)
2970 c''4 \sostenutoDown d''4 e''4 c'4
2971 f'4 g'4 a'4 \sostenutoUp
2975 @subsection Arpeggio
2978 @cindex broken arpeggio
2979 @cindex @code{\arpeggio}
2981 You can specify an arpeggio sign on a chord by attaching an
2982 @code{\arpeggio} to a chord.
2985 @lilypond[fragment,relative,verbatim]
2986 <<c e g c>>-\arpeggio
2989 When an arpeggio crosses staves in piano music, you attach an arpeggio
2990 to the chords in both staves, and set
2991 @code{PianoStaff.connectArpeggios}.
2993 @lilypond[fragment,relative,verbatim]
2994 \context PianoStaff <
2995 \property PianoStaff.connectArpeggios = ##t
2996 \context Voice = one { <<c' e g c>>-\arpeggio }
2997 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio}
3001 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
3002 are @code{PianoStaff.Arpeggio}.
3004 To add an arrow head to explicitly specify the direction of the
3005 arpeggio, you should set the arpeggio object property
3006 @code{arpeggio-direction}.
3008 @lilypond[fragment,relative,verbatim]
3010 \property Voice.Arpeggio \set #'arpeggio-direction = #1
3011 <<c e g c>>-\arpeggio
3012 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
3013 <<c e g c>>-\arpeggio
3017 A square bracket on the left indicates that the player should not
3018 arpeggiate the chord. To draw these brackets, set the
3019 @code{molecule-callback} property of @code{Arpeggio} or
3020 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
3021 @code{\arpeggio} statements within the chords as before.
3023 @lilypond[fragment,relative,verbatim]
3024 \context PianoStaff <
3025 \property PianoStaff.connectArpeggios = ##t
3026 \property PianoStaff.Arpeggio \override
3027 #'molecule-callback = \arpeggioBracket
3028 \context Voice = one { <<c' e g c>>-\arpeggio }
3029 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
3036 It is not possible to mix connected arpeggios and unconnected
3037 arpeggios in one PianoStaff at the same time.
3041 @node Voice follower lines
3042 @subsection Voice follower lines
3044 @cindex follow voice
3045 @cindex staff switching
3048 @cindex @code{followVoice}
3050 Whenever a voice switches to another staff a line connecting the notes
3051 can be printed automatically. This is enabled if the property
3052 @code{PianoStaff.followVoice} is set to true:
3054 @lilypond[fragment,relative,verbatim]
3055 \context PianoStaff <
3056 \property PianoStaff.followVoice = ##t
3057 \context Staff \context Voice {
3059 \translator Staff=two
3062 \context Staff=two {\clef bass \skip 1*2 }
3066 The associated object is @internalsref{VoiceFollower}.
3070 @section Vocal music
3072 For a discussion of how to put lyrics into a score, see section
3073 @code{Printing lyrics} in the tutorial.
3075 [TODO: Move lyrics section from tutorial to here?]
3077 See also the sections on @ref{Slurs} and @ref{Breath marks}.
3079 [TODO: Move slurs / breath marks section to here?]
3081 [TODO: Write subsection upon usage of ChoirStaff.]
3083 For entering quotes in Lyrics mode, use the following
3085 "\"God\"" is "`King'"
3088 You can use empty syllables, e.g. @code{_4} or @code{" "4} to enter
3089 lyrics. This can confuse the LilyPond -- for example, this might put
3090 (empty) lyrics under rests. To remedy this, use @code{\skip}.
3101 The term @emph{ambitus} denotes a range of pitches for a given voice in
3102 a part of music. It also may denote the pitch range that a musical
3103 instrument is capable of playing. Most musical instruments have their
3104 ambitus standardized (or at least there is agreement upon the minimal
3105 ambitus of a particular type of instrument), such that a composer or
3106 arranger of a piece of music can easily meet the ambitus constraints of
3107 the targeted instrument. However, the ambitus of the human voice
3108 depends on individual physiological state, including education and
3109 training of the voice. Therefore, a singer potentially has to check for
3110 each piece of music if the ambitus of that piece meets his individual
3111 capabilities. This is why the ambitus of a piece may be of particular
3112 value to vocal performers.
3114 The ambitus is typically notated on a per-voice basis at the very
3115 beginning of a piece, e.g. nearby the initial clef or time signature of
3116 each staff. The range is graphically specified by two noteheads, that
3117 represent the minimum and maximum pitch. Some publishers use a textual
3118 notation: they put the range in words in front of the corresponding
3119 staff. Lilypond currently only supports the graphical ambitus notation.
3121 To apply, simply add the @internalsref{Ambitus_engraver} to the
3122 @internalsref{Voice} context, as shown in the below example:
3124 @lilypond[singleline,verbatim]
3125 upper = \notes \relative c {
3128 as'' c e2 bes f cis d4 e f2 g
3130 lower = \notes \relative c {
3133 e'4 b g a c es fis a cis b a g f e d2
3136 \context ChoirStaff {
3138 \context Staff = one { \upper }
3139 \context Staff = three { \lower }
3145 \consists Ambitus_engraver
3151 The shape of the note heads to use can be changed via the
3152 @code{note-head-style} property, which holds the glyph name of the note
3153 head (see also @ref{Ancient note heads}). The vertical line between the
3154 upper and lower head can be switched on or off via the @code{join-heads}
3160 \consists Ambitus_engraver
3161 Ambitus \set #'note-head-style = #'noteheads-2mensural
3162 Ambitus \set #'join-heads = ##f
3166 By default, the ambitus grob is put before the clef. You can control
3167 this behaviour through the @code{breakAlignOrder} property of the score
3168 context by redefining the order, e.g. with the following addition to the
3174 breakAlignOrder = #'(
3192 Tablature notation is used for notating music for plucked string
3193 instruments. It notates pitches not by using note heads, but by
3194 indicating on which string and fret a note must be played. LilyPond
3195 offers limited support for tablature.
3198 * Tablatures basic::
3199 * Non-guitar tablatures::
3200 * Tablature in addition to normal staff::
3203 @node Tablatures basic
3204 @subsection Tablatures basic
3205 @cindex Tablatures basic
3207 Tablature can be typeset with Lilypond by using the
3208 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3209 tablature is a recent feature in Lilypond, most of the guitar special
3210 effects such as bend are not yet supported.
3212 With the @internalsref{TabStaff}, the string number associated to a note
3213 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3214 quarter on the third string. By default, string 1 is the highest one, and the
3215 tuning defaults to the standard guitar tuning (with 6 strings).
3217 @lilypond[fragment,verbatim]
3226 If you do not specify a string number then lilypond automatically selects one.
3227 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3228 simply selects the first string that does not give a fret number less than
3229 @code{minimumFret}. Default is 0.
3231 Notice that LilyPond does not handle chords in any special way, and hence
3232 the automatic string selector may easily select the same string to two notes in a chord.
3235 e8 fis gis a b cis' dis' e'
3236 \property TabStaff.minimumFret = #8
3237 e8 fis gis a b cis' dis' e'
3242 e8 fis gis a b cis' dis' e'
3243 \property TabStaff.minimumFret = #8
3244 e8 fis gis a b cis' dis' e'
3247 \context StaffGroup <
3248 \context Staff { \clef "G_8" \frag }
3249 \context TabStaff { \frag }
3254 @node Non-guitar tablatures
3255 @subsection Non-guitar tablatures
3256 @cindex Non-guitar tablatures
3258 There are many ways to customize Lilypond tablatures.
3260 First you can change the number of strings, by setting the number of
3261 lines in the @internalsref{TabStaff} (the @code{line-count} property
3262 of TabStaff can only be changed using @code{\outputproperty}, for more
3263 information, see @ref{Tuning per object}. You can change the strings
3264 tuning. A string tuning is given as a Scheme list with one integer
3265 number for each string, the number being the pitch of an open string.
3267 (The numbers specified for stringTuning are the numbers of semitons
3268 to subtract --- or add --- starting the specified pitch by default
3269 middle C, in string order: thus the notes are e, a, d & g)
3271 @lilypond[fragment,verbatim]
3274 \outputproperty #(make-type-checker 'staff-symbol-interface)
3276 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3279 a,4 c' a e' e c' a e'
3284 Finally, it is possible to change the Scheme function to format the
3285 tablature note text. The default is @var{fret-number-tablature-format},
3286 which uses the fret number, but for some instruments that may not use
3287 this notation, just create your own tablature-format function. This
3288 function takes three argument: the string number, the string tuning and
3292 @node Tablature in addition to normal staff
3293 @subsection Tablature in addition to normal staff
3294 @cindex Tablature in addition to normal staff
3296 It is possible to typeset both tablature and a "normal" staff, as
3297 commonly done in many parts.
3299 A common trick for that is to put the notes in a variables, and to hide
3300 the fingering information (which correspond to the string number) for
3304 @c @lily pond[verbatim]
3311 \context StaffGroup <
3313 % Hide fingering number
3314 \property Staff.Fingering \override #'transparent = ##t
3319 \property Staff.Stem \override #'direction = #1
3333 LilyPond has support for both entering and printing chords.
3334 @lilypond[verbatim,singleline]
3335 twoWays = \notes \transpose c c' {
3345 < \context ChordNames \twoWays
3346 \context Voice \twoWays > }
3349 This example also shows that the chord printing routines do not try to
3350 be intelligent. If you enter @code{f bes d}, it does not interpret
3351 this as an inversion.
3353 As you can see chords really are a set of pitches. They are internally
3354 stored as simultaneous music expressions. This means you can enter
3355 chords by name and print them as notes, enter them as notes and print
3356 them as chord names, or (the most common case) enter them by name, and
3361 * Printing named chords::
3366 @subsection Chords mode
3369 Chord mode is a mode where you can input sets of pitches using common
3370 names. It is introduced by the keyword @code{\chords}.
3371 In chords mode, a chord is entered by the root, which is entered
3372 like a common pitch, for example,
3373 @lilypond[fragment,verbatim,quote]
3376 is the notation for an E-flat major chord.
3381 Other chords may be entered
3382 by suffixing a colon, and introducing a modifier, and optionally, a
3384 @lilypond[fragment,verbatim,quote]
3385 \chords { e1:m e1:7 e1:m7 }
3387 The first number following the root is taken to be the `type' of the
3388 chord, thirds are added to the root until it reaches the specified
3389 number, for example.
3390 @lilypond[fragment,verbatim]
3391 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
3394 @cindex root of chord
3395 @cindex additions, in chords
3396 @cindex removals, in chords
3398 More complex chords may also be constructed adding separate steps
3399 to a chord. Additions are added after the number following
3400 the colon, and are separated by dots. For example
3402 @lilypond[verbatim,fragment,quote]
3403 \chords { c:5.6 c:3.7.8 c:3.6.13 }
3405 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
3406 to the number, for example:
3407 @lilypond[verbatim,fragment,quote]
3408 \chords { c:7+ c:5+.3- c:3-.5-.7- }
3410 Removals are specified similarly, and are introduced by a caret. They
3411 must come after the additions.
3412 @lilypond[verbatim,fragment]
3413 \chords { c^3 c:7^5 c:9^3.5 }
3416 Modifiers can be used to change pitches. The following modifiers are
3420 Minor chord. Lowers the 3rd and (if present) the 7th step.
3422 Diminished chord. Lowers the 3rd, 5th and (if present) the 7th step
3424 Augmented chord. Raises the 5th step.
3426 Major 7th chord. Raises the 7th step, if present.
3428 Suspended 4th or 2nd. This modifier removes the 3rd step. Append
3429 either @code{2} or @code{4} to add the 2nd or 4th step to the chord.
3431 Modifiers can be mixed with additions.
3432 @lilypond[verbatim,fragment]
3433 \chords { c:sus4 c:7sus4 c:dim7 c:m6 }
3436 @cindex modifiers, in chords.
3443 Since the unaltered 11 does sound well when combined with the
3444 unaltered 3, the 11 is removed in this case, unless it is added
3445 explicitly). For example,
3446 @lilypond[fragment,verbatim]
3447 \chords { c:13 c:13.11 c:m13 }
3452 An inversion (putting one pitch of the chord on the bottom), as well
3453 as bass notes, can be specified by appending
3454 @code{/}@var{pitch} to the chord.
3455 @lilypond[fragment,verbatim,center]
3456 \chords { c1 c/g c/f }
3459 If you do not want to remove the bass note from the chord, but rather
3460 add the note, then you can use @code{/+}@var{pitch}.
3462 @lilypond[fragment,verbatim,center]
3463 \chords { c1 c/+g c/+f }
3466 The chords mode is a mode similar to @code{\lyrics}, @code{\notes}
3467 etc. Most of the commands continue to work, for example, @code{r} and
3468 @code{\skip} can be used to insert spaces, and @code{\property} to
3469 change various settings.
3475 Each step can only be present in a chord once. The following
3476 simply produces the augmented chord, since @code{5+} is interpreted
3479 @lilypond[verbatim,fragment]
3480 \chords { c:5.5-.5+ }
3483 In chord mode, dashes and carets are used to indicate chord additions
3484 and subtractions, so articulation scripts can not be entered.
3490 @c . {Printing named chords}
3491 @node Printing named chords
3492 @subsection Printing named chords
3494 @cindex printing chord names
3498 For displaying printed chord names, use the @internalsref{ChordNames} context.
3499 The chords may be entered either using the notation described above, or
3500 directly using simultaneous music.
3502 @lilypond[verbatim,singleline]
3504 \chords {a1 b c} <<d f g>> <<e g b>>
3508 \context ChordNames \scheme
3509 \context Staff \transpose c c' \scheme
3514 You can make the chord changes stand out by setting
3515 @code{ChordNames.chordChanges} to true. This will only display chord
3516 names when there's a change in the chords scheme and at the start of a
3521 c1:m c:m \break c:m c:m d
3525 \context ChordNames {
3526 \property ChordNames.chordChanges = ##t
3528 \context Staff \transpose c c' \scheme
3530 \paper{linewidth= 9.\cm}
3534 LilyPond examines chords specified as lists of notes to determine a name
3535 to give the chord. LilyPond will not try to identify chord inversions or
3536 an added bass note, which may result in strange chord names when chords
3537 are entered as a list of pitches:
3539 @lilypond[verbatim,center,singleline]
3548 \context ChordNames \scheme
3549 \context Staff \scheme
3554 The default chord name layout is a system for Jazz music, proposed by
3555 Klaus Ignatzek (See @ref{Literature}).
3557 [TODO: add description for banter other jazz.]
3559 The Ignatzek chord name formatting can be tuned in a number of ways
3560 through the following properties:
3562 @item chordNameExceptions
3563 This is a list that contains the chords that have special formatting.
3565 @lilypond[verbatim,singleline]
3566 chExceptionMusic = \notes { <<c f g bes>>1-\markup { \super "7" "wahh" }}
3567 chExceptions = #(append
3568 (sequential-music-to-chord-exceptions chExceptionMusic)
3571 \score { \context ChordNames
3574 \property ChordNames.chordNameExceptions = #chExceptions
3578 Putting the exceptions list encoded as
3580 \notes @{ <<c f g bes>>1-\markup @{ \super "7" "wahh" @} @}
3582 into the property takes a little manoeuvring. The following code
3583 transforms @code{chExceptionMusic} (which is a sequential music)
3584 into a list of exceptions.
3586 (sequential-music-to-chord-exceptions chExceptionMusic)
3591 ... ignatzekExceptions)
3593 adds the new exceptions to the default ones, which are defined in
3594 @file{ly/chord-modifier-init.ly}.
3596 @item majorSevenSymbol
3597 This property contains the markup object used for the 7th step, when
3598 it is major. Predefined options are @code{whiteTriangleMarkup},
3599 @code{blackTriangleMarkup}. The following uses another popular shorthand.
3600 @lilypond[fragment,verbatim]
3601 \context ChordNames \chords {
3603 \property ChordNames.majorSevenSymbol = \markup { "j7" }
3606 @item chordNameSeparator
3607 Different parts of a chord name are normally separated by a
3608 slash. By setting @code{chordNameSeparator}, you can specify other
3610 @lilypond[fragment,verbatim]
3611 \context ChordNames \chords {
3613 \property ChordNames.chordNameSeparator = \markup { "|" }
3623 @section Writing parts
3625 Orchestral music involves some special notation, both in the full score,
3626 as in the individual parts. This section explains how to tackle common
3627 problems in orchestral music.
3634 * Instrument names::
3636 * Multi measure rests::
3637 * Automatic part combining::
3638 * Hara kiri staves::
3639 * Sound output for transposing instruments::
3642 @c . {Rehearsal marks}
3643 @node Rehearsal marks
3644 @subsection Rehearsal marks
3645 @cindex Rehearsal marks
3647 @cindex @code{\mark}
3649 To print a rehearsal mark, use the @code{\mark} command.
3650 @lilypond[fragment,verbatim]
3661 As you can see, the mark is incremented automatically if you use
3662 @code{\mark \default}. The value to use is stored in the property
3663 @code{rehearsalMark} is used and automatically incremented. The object
3664 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3665 @code{input/test/boxed-molecule.ly} if you need boxes around the
3668 The @code{\mark} command can also be used to put signs like coda,
3669 segno and fermatas on a barline. The trick is to use the text markup
3670 mechanism to access the fermata symbol.
3671 @lilypond[fragment,verbatim,relative=1]
3672 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
3677 The problem is that marks that occur at a line break are typeset only
3678 at the beginning of the next line, opposite to what you want for the
3679 fermata. This can be corrected by the following property setting
3681 \property Score.RehearsalMark \override
3682 #'break-visibility = #begin-of-line-invisible
3688 @cindex barlines, putting symbols on
3692 @subsection Bar numbers
3696 @cindex measure numbers
3697 @cindex currentBarNumber
3699 Bar numbers are printed by default at the start of the line. The
3700 number itself is a property that can be set by modifying the
3701 @code{currentBarNumber} property, although that is usually not
3704 \property Score.currentBarNumber = #217
3707 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3708 you need to change the grob property @code{break-visibility} as well as the translator
3709 property @code{barNumberVisibility}, as illustrated in the following example which also
3710 adds a box around the bar numbers:
3712 \property Score.BarNumber \override #'break-visibility =
3713 #end-of-line-invisible
3714 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3715 \property Score.BarNumber \override #'molecule-callback =
3716 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3717 \property Score.BarNumber \override #'font-relative-size = #0
3721 \context Staff \notes \transpose c c'' {
3722 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3723 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3724 \property Score.BarNumber \override #'molecule-callback =
3725 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3726 \property Score.BarNumber \override #'font-relative-size = #0
3728 \repeat unfold 16 c1 \bar "|."
3733 If you would like the bar numbers to appear at regular intervals, but
3734 not starting from measure zero, you can use the context function,
3735 @code{set-bar-number-visibility}, to automatically set
3736 @code{barNumberVisibility} so that the bar numbers appear at regular
3737 intervals, starting from the @code{\applycontext}:
3740 resetBarnum = \context Score \applycontext
3741 #(set-bar-number-visibility 4)
3743 \property Score.BarNumber \override #'break-visibility =
3744 #end-of-line-invisible
3745 \mark "A" \resetBarnum
3746 \repeat unfold 10 c1
3747 \mark \default \resetBarnum
3751 resetBarnum = \context Score \applycontext
3752 #(set-bar-number-visibility 4)
3755 \notes \transpose c c'' {
3756 \property Score.BarNumber \override #'break-visibility =#end-of-line-invisible
3757 \property Score.RehearsalMark \override #'padding = #2.5
3758 \mark "A" \resetBarnum
3759 \repeat unfold 10 c1
3760 \mark \default \resetBarnum
3768 See also @seeinternals{BarNumber}.
3772 Barnumbers can collide with the StaffGroup, if there is one at the
3773 top. To solve this, You have to twiddle with the
3774 @internalsref{padding} property of @internalsref{BarNumber} if your
3775 score starts with a @internalsref{StaffGroup}.
3777 @node Instrument names
3778 @subsection Instrument names
3780 In scores, the instrument name is printed before the staff. This can
3781 be done by setting @code{Staff.instrument} and
3782 @code{Staff.instr}. This will print a string before the start of the
3783 staff. For the first start, @code{instrument} is used, for the next
3784 ones @code{instr} is used.
3786 @lilypond[verbatim,singleline]
3787 \property Staff.instrument = "ploink " { c''4 }
3790 You can also use markup texts to construct more complicated instrument
3794 @lilypond[verbatim,singleline]
3796 \notes \context Staff = treble {
3797 \property Staff.instrument
3798 = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
3801 \paper { linewidth= 8.0\cm }
3808 When you put a name on a grand staff or piano staff the width of the
3809 brace is not taken into account. You must add extra spaces to the end of
3810 the name to avoid a collision.
3813 @subsection Transpose
3815 @cindex transposition of pitches
3816 @cindex @code{\transpose}
3818 A music expression can be transposed with @code{\transpose}. The syntax
3821 \transpose @var{from} @var{to} @var{musicexpr}
3824 This means that @var{musicexpr} is transposed to by the interval
3825 between @var{from} is @var{to}.
3827 @code{\transpose} distinguishes between enharmonic pitches: both
3828 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3829 half a tone. The first version will print sharps and the second
3830 version will print flats.
3832 @lilypond[singleline, verbatim]
3833 mus =\notes { \key d \major cis d fis g }
3834 \score { \notes \context Staff {
3837 \transpose c g' \mus
3838 \transpose c f' \mus
3842 If you want to use both @code{\transpose} and @code{\relative}, then
3843 you must use @code{\transpose} first. @code{\relative} will have no
3844 effect music that appears inside a @code{\transpose}.
3846 @c . {Multi measure rests}
3847 @node Multi measure rests
3848 @subsection Multi measure rests
3849 @cindex Multi measure rests
3853 Multi measure rests are entered using `@code{R}'. It is specifically
3854 meant for full bar rests and for entering parts: the rest can expand to
3855 fill a score with rests, or it can be printed as a single multimeasure
3856 rest This expansion is controlled by the property
3857 @code{Score.skipBars}. If this is set to true, Lily will not expand
3858 empty measures, and the appropriate number is added automatically.
3860 @lilypond[fragment,verbatim]
3861 \time 4/4 r1 | R1 | R1*2
3862 \property Score.skipBars = ##t R1*17 R1*4
3865 The @code{1} in @code{R1} is similar to the duration notation used for
3866 notes. Hence, for time signatures other than 4/4, you must enter other
3867 durations. This can be done with augmentation dots, or with
3870 @lilypond[fragment,verbatim]
3871 \property Score.skipBars = ##t
3879 Notice that a @code{R} spanning a single measure is printed as a whole
3880 rest centered in the measure, regardless of the time signature.
3882 [ add note about breves.]
3885 @cindex text on multi-measure rest
3886 @cindex script on multi-measure rest
3887 @cindex fermata on multi-measure rest
3889 Texts can be added to multi-measure rests by using the
3890 @var{note}-@code{markup} syntax. An identifier
3891 is provided for a fermata.
3893 @lilypond[verbatim,fragment]
3895 R2._\markup { \roman "Ad lib" }
3899 By default, the multi-measure rest uses the number font, which does
3900 not contain any letters. This is the reason for the explicit
3901 @code{\roman} in the above example.
3903 @cindex whole rests for a full measure
3905 The object for this object is @internalsref{MultiMeasureRest}, and
3906 @internalsref{MultiMeasureRestNumber}.
3910 Only one text can be put on a multi-measure rest with
3911 @var{note}-@var{text} syntax, since this is internally converted to
3912 setting @code{#'text} in @internalsref{MultiMeasureRestNumber}. It is
3913 not possible to use fingerings (e.g. @code{R1-4}) to put numbers over
3914 multi-measure rests.
3917 @cindex condensing rests
3919 Currently, there is no way to automatically condense multiple rests
3920 into a single multimeasure rest. Multi measure rests do not take part
3924 @node Automatic part combining
3925 @subsection Automatic part combining
3926 @cindex automatic part combining
3927 @cindex part combiner
3930 Automatic part combining is used to merge two parts of music onto a
3931 staff in an intelligent way. It is aimed primarily at typesetting
3932 orchestral scores. When the two parts are identical for a period of
3933 time, only one is shown. In places where the two parts differ, they
3934 are typeset as separate voices, and stem directions are set
3935 automatically. Also, solo and @emph{a due} parts can be identified
3938 The syntax for part combining is
3941 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3943 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3944 combined into one context of type @var{context}. The music expressions
3945 must be interpreted by contexts whose names should start with @code{one}
3948 The most useful function of the part combiner is to combine parts into
3949 one voice, as common for wind parts in orchestral scores:
3951 @lilypond[verbatim,singleline,fragment]
3953 \context Voice=one \partcombine Voice
3954 \context Thread=one \relative c'' {
3957 \context Thread=two \relative c'' {
3963 Notice that the first @code{g} appears only once, although it was
3964 specified twice (once in each part). Stem, slur and tie directions are
3965 set automatically, depending whether there is a solo or unisono. The
3966 first part (with context called @code{one}) always gets up stems, and
3967 `solo', while the second (called @code{two}) always gets down stems and
3970 If you just want the merging parts, and not the textual markings, you
3971 may set the property @var{soloADue} to false.
3973 @lilypond[verbatim,singleline,fragment]
3975 \property Staff.soloADue = ##f
3976 \context Voice=one \partcombine Voice
3977 \context Thread=one \relative c'' {
3980 \context Thread=two \relative c'' {
3986 There are a number of other properties that you can use to tweak the
3987 behavior of part combining, refer to the automatically generated
3988 documentation of @reng{Thread_devnull_engraver} and
3989 @reng{Voice_devnull_engraver}. Look at the documentation of the
3990 responsible engravers, @code{Thread_devnull_engraver},
3991 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3995 In @code{soloADue} mode, when the two voices play the same notes on and
3996 off, the part combiner may typeset @code{a2} more than once in a
3999 @lilypond[fragment,singleline]
4001 \context Voice=one \partcombine Voice
4002 \context Thread=one \relative c'' {
4005 \context Thread=two \relative c'' {
4011 @cindex @code{Thread_devnull_engraver}
4012 @cindex @code{Voice_engraver}
4013 @cindex @code{A2_engraver}
4015 @node Hara kiri staves
4016 @subsection Hara kiri staves
4018 In orchestral scores, staff lines that only have rests are usually removed.
4019 This saves some space. LilyPond also supports this through the hara
4020 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
4021 the Japanese Samourai warriors.} staff. This staff commits suicide when
4022 it finds itself to be empty after the line-breaking process. It will
4023 not disappear when it contains normal rests, you must use multi measure
4026 The hara kiri staff is specialized version of the @internalsref{Staff}
4027 context. It is available as the context identifier
4028 @code{\HaraKiriStaffContext}. Observe how the second staff in this
4029 example disappears in the second line.
4033 \notes \relative c' <
4034 \context Staff = SA { e4 f g a \break c1 }
4035 \context Staff = SB { c4 d e f \break R1 }
4039 \translator { \HaraKiriStaffContext }
4044 For @internalsref{Lyrics}, @internalsref{LyricsVoice},
4045 @internalsref{ChordNames} and @internalsref{FiguredBass}, hara-kiri is
4046 switched on by default.
4049 @node Sound output for transposing instruments
4050 @subsection Sound output for transposing instruments
4052 When you want to make a MIDI file from a score containing transposed
4053 and untransposed instruments, you have to instruct LilyPond the pitch
4054 offset (in semitones) for the transposed instruments. This is done
4055 using the @code{transposing} property. It does not affect printed
4058 @cindex @code{transposing}
4061 \property Staff.instrument = #"Cl. in B-flat"
4062 \property Staff.transposing = #-2
4066 @node Ancient notation
4067 @section Ancient notation
4069 @cindex Vaticana, Editio
4070 @cindex Medicaea, Editio
4076 * Ancient note heads::
4085 @node Ancient note heads
4086 @subsection Ancient note heads
4088 To get a longa note head, you have to use mensural note heads. This
4089 is accomplished by setting the @code{style} property of the
4090 NoteHead object to @code{mensural}. There is also a note head style
4091 @code{baroque} which gives mensural note heads for @code{\longa} and
4092 @code{\breve} but standard note heads for shorter notes.
4094 @lilypond[fragment,singleline,verbatim]
4095 \property Voice.NoteHead \set #'style = #'mensural
4100 @subsection Ancient clefs
4102 LilyPond supports a variety of clefs, many of them ancient.
4104 For modern clefs, see section @ref{Clef}. For the percussion clef, see
4105 section @ref{Percussion staves}. For the @code{TAB} clef, see section
4108 The following table shows all ancient clefs that are supported via the
4109 @code{\clef} command. Some of the clefs use the same glyph, but differ
4110 only with respect to the line they are printed on. In such cases, a
4111 trailing number in the name is used to enumerate these clefs. Still,
4112 you can manually force a clef glyph to be typeset on an arbitrary line,
4113 as described in section @ref{Clef}. The note printed to the right side
4114 of each clef denotes the @code{c'} with respect to the clef.
4118 @c --- This should go somewhere else: ---
4119 @c @item modern style G clef (glyph: @code{clefs-G})
4122 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
4124 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
4126 @c @item modern style F clef (glyph: @code{clefs-F})
4129 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
4131 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
4133 @c @item modern style C clef (glyph: @code{clefs-C})
4136 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
4137 @c @code{tenor}, @code{baritone}
4139 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
4141 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
4144 @code{neo_mensural_c1}, @code{neo_mensural_c2},
4145 @code{neo_mensural_c3}, @code{neo_mensural_c4}
4147 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
4149 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
4155 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
4157 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
4163 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
4165 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
4171 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
4173 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
4179 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
4181 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
4187 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
4189 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
4194 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
4196 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
4201 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
4203 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
4206 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
4209 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
4211 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
4216 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
4218 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
4223 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
4225 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
4228 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
4230 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
4232 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
4235 @code{vaticana_fa1}, @code{vaticana_fa2}
4237 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
4239 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
4242 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
4244 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
4246 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
4249 @code{medicaea_fa1}, @code{medicaea_fa2}
4251 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
4253 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
4256 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
4258 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
4260 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
4263 @code{hufnagel_fa1}, @code{hufnagel_fa2}
4265 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
4267 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
4270 @code{hufnagel_do_fa}
4272 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4274 @c --- This should go somewhere else: ---
4275 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4278 @c @code{percussion}
4280 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4282 @c @item modern style tab clef (glyph: @code{clefs-tab})
4287 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4291 @emph{Modern style} means ``as is typeset in current editions of
4292 transcribed mensural music''.
4294 @emph{Petrucci style} means ``inspired by printings published by the
4295 famous engraver Petrucci (1466-1539)''.
4297 @emph{Historic style} means ``as was typeset or written in contemporary
4298 historic editions (other than those of Petrucci)''.
4300 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4302 Petrucci used C clefs with differently balanced left-side vertical
4303 beams, depending on which staffline it was printed.
4307 @subsection Custodes
4312 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4313 staff context symbol that appears at the end of a staff line. It
4314 anticipates the pitch of the first note(s) of the following line and
4315 thus helps the player or singer to manage line breaks during
4316 performance, thus enhancing readability of a score.
4321 \property Staff.Custos \set #'style = #'mensural
4326 \consists Custos_engraver
4332 Custodes were frequently used in music notation until the 17th century.
4333 There were different appearances for different notation styles.
4334 Nowadays, they have survived only in special forms of musical notation
4335 such as via the @emph{editio vaticana} dating back to the beginning of
4338 For typesetting custodes, just put a @code{Custos_engraver} into the
4339 Staff context when declaring the @code{\paper} block, as shown in the
4340 following example. In the @code{\paper} block, you can also globally
4341 control the appearance of the custos symbol by setting the custos
4342 @code{style} property.
4348 \consists Custos_engraver
4349 Custos \override #'style = #'mensural
4354 The property can also be set locally, for example in a @code{\notes}
4359 \property Staff.Custos \override #'style = #'vaticana
4360 c'1 d' e' d' \break c' d' e' d'
4364 Currently, the following styles are supported:
4371 ^\markup { "vaticana" }
4372 ^\markup { \musicglyph #"custodes-vaticana-u0" }
4374 ^\markup { "medicaea" }
4375 ^\markup { \musicglyph #"custodes-medicaea-u0" }
4377 ^\markup { "hufnagel" }
4378 ^\markup { \musicglyph #"custodes-hufnagel-u0" }
4380 ^\markup { "mensural" }
4381 ^\markup { \musicglyph #"custodes-mensural-u0" }
4388 \remove "Bar_number_engraver"
4389 TextScript \override #'extra-X-extent = #'(-1 . 1)
4393 \remove "Clef_engraver"
4394 \remove "Key_engraver"
4395 \remove "Time_signature_engraver"
4396 \remove "Staff_symbol_engraver"
4397 minimumVerticalExtent = ##f
4403 If the boolean property @code{adjust-if-on-staffline} is set to
4404 @code{#t} (which it is by default), lily typesets slightly different
4405 variants of the custos glyph, depending on the pitch of the custos,
4406 i.e. depending on the glyph being typeset either on a staffline or
4407 between two stafflines. The idea is that the glyph will optically fit
4408 well into the staff, with the appendage on the right of the custos
4409 always ending at the same vertical position between two stafflines
4410 regardless of the pitch. If you set @code{adjust-if-on-staffline} to
4411 @code{#f}, then lily takes regardless of the pitch always a glyph that
4412 is a compromise of the former two variants.
4414 Just like stems can be attached to noteheads in two directions
4415 @emph{up} and @emph{down}, each custos glyph is available with its
4416 appendage pointing either up or down. If the pitch of a custos is
4417 above a selectable position, the appendage will point downwards; if
4418 the pitch is below this position, the appendage will point upwards.
4419 Use property @code{neutral-position} to select this position. By
4420 default, it is set to @code{0}, such that the neutral position is the
4421 center of the staff. Use property @code{neutral-direction} to control
4422 what happens if a custos is typeset on the neutral position itself.
4423 By default, this property is set to @code{-1}, such that the appendage
4424 will point downwards. If set to @code{1}, the appendage will point
4425 upwards. Other values such as @code{0} are reserved for future
4426 extensions and should not be used.
4429 @subsection Divisiones
4435 A @emph{divisio} (plural: @emph{divisiones}; latin word for
4436 `division') is a staff context symbol that is used to structure
4437 Gregorian music into phrases and sections. The musical meaning of
4438 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
4439 can be characterized as short, medium and long pause, somewhat like
4440 @ref{Breath marks}. The @emph{finalis} sign not only marks the end of
4441 a chant, but is also frequently used within a single
4442 antiphonal/responsorial chant to mark the end of each section.
4444 To use divisiones, just include the file @code{gregorian-init.ly}. It
4445 contains definitions that you can apply by just inserting
4446 @code{\divisiominima}, @code{\divisiomaior}, @code{\divisiomaxima},
4447 and @code{\finalis} at proper places into your lilypond files.
4450 \include "gregorian-init.ly"
4453 \context Staff = staff \addlyrics \notes \transpose c c' {
4454 \property Score.timing = ##f
4455 \property Score.barAlways = ##t
4456 \property Staff.BarLine \override #'transparent = ##t
4457 \property Voice.Stem \override #'transparent = ##t
4459 ^\markup { "divisio minima" }
4462 ^\markup { "divisio maior" }
4465 ^\markup { "divisio maxima" }
4468 ^\markup { "finalis" }
4472 \context Lyrics = lyrics \lyrics {
4473 Blah blub, blah blam.
4474 Blah blub, blah blam.
4475 Blah blub, blah blam.
4476 Blah blub, blah blam.
4477 Blah blub, blah blam.
4483 Some editions use @emph{virgula} or @emph{caesura} instead of divisio
4484 minima. Therefore, @code{gregorian-init.ly} also defines
4485 @code{\virgula} and @code{\caesura}.
4488 \include "gregorian-init.ly"
4491 \context Staff = staff \addlyrics \notes \transpose c c' {
4492 \property Score.timing = ##f
4493 \property Score.barAlways = ##t
4494 \property Staff.BarLine \override #'transparent = ##t
4495 \property Voice.Stem \override #'transparent = ##t
4497 ^\markup { "virgula" }
4500 ^\markup { "caesura" }
4504 \context Lyrics = lyrics \lyrics {
4505 Blah blub, blah blam.
4506 Blah blub, blah blam.
4507 Blah blub, blah blam.
4514 @subsection Ligatures
4518 @c TODO: Should double check if I recalled things correctly when I wrote
4519 @c down the following paragraph by heart.
4520 In musical terminology, a ligature is a coherent graphical symbol that
4521 represents at least two different notes. Ligatures originally appeared
4522 in the manuscripts of Gregorian chant notation roughly since the 9th
4523 century as an allusion to the accent symbols of greek lyric poetry to
4524 denote ascending or descending sequences of notes. Both, the shape and
4525 the exact meaning of ligatures changed tremendously during the following
4526 centuries: In early notation, ligatures where used for monophonic tunes
4527 (Gregorian chant) and very soon denoted also the way of performance in
4528 the sense of articulation. With upcoming multiphony, the need for a
4529 metric system arised, since multiple voices of a piece have to be
4530 synchronized some way. New notation systems were invented, that used
4531 the manifold shapes of ligatures to now denote rhythmical patterns
4532 (e.g. black mensural notation, mannered notation, ars nova). With the
4533 invention of the metric system of the white mensural notation, the need
4534 for ligatures to denote such patterns disappeared. Nevertheless,
4535 ligatures were still in use in the mensural system for a couple of
4536 decades until they finally disappeared during the late 16th / early 17th
4537 century. Still, ligatures have survived in contemporary editions of
4538 Gregorian chant such as the Editio Vaticana from 1905/08.
4540 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4541 Some ligature styles (such as Editio Vaticana) may need additional input
4542 syntax specific for this particular type of ligature. By default, the
4543 @internalsref{LigatureBracket} engraver just marks the start and end of
4544 a ligature by small square angles:
4546 @lilypond[singleline,verbatim]
4548 \notes \transpose c c' {
4556 To select a specific style of ligatures, a proper ligature engraver has
4557 to be added to the @internalsref{Voice} context, as explained in the
4558 following subsections. Currently, Lilypond only supports white mensural
4559 ligatures with certain limitations. Support for Editio Vaticana will be
4560 added in the future.
4563 * White mensural ligatures::
4566 @node White mensural ligatures
4567 @subsubsection White mensural ligatures
4569 @cindex Mensural ligatures
4570 @cindex White mensural ligatures
4572 Lilypond has limited support for white mensural ligatures. The
4573 implementation is still experimental; it currently may output strange
4574 warnings or even crash in some cases or produce weird results on more
4575 complex ligatures. To engrave white mensural ligatures, in the paper
4576 block the @internalsref{MensuralLigature} engraver has to be put into
4577 the @internalsref{Voice} context (and you probably want to remove the
4578 @internalsref{LigatureBracket} engraver). There is no additional input
4579 language to describe the shape of a white mensural ligature. The shape
4580 is rather determined solely from the pitch and duration of the enclosed
4581 notes. While this approach may take a new user quite a while to get
4582 accustomed, it has a great advantage: this way, lily has full musical
4583 information about the ligature. This is not only required for correct
4584 MIDI output, but also allows for automatic transcription of the
4589 @lilypond[singleline,verbatim]
4591 \notes \transpose c c' {
4592 \property Score.timing = ##f
4593 \property Score.defaultBarType = "empty"
4594 \property Voice.NoteHead \set #'style = #'neo_mensural
4595 \property Staff.TimeSignature \set #'style = #'neo_mensural
4597 \[ g\longa c\breve a\breve f\breve d'\longa \]
4599 \[ e1 f1 a\breve g\longa \]
4604 \remove Ligature_bracket_engraver
4605 \consists Mensural_ligature_engraver
4611 Without replacing @code{Ligature_bracket_engraver} with
4612 @code{Mensural_ligature_engraver}, the same music transcribes to the
4615 @lilypond[singleline,verbatim]
4617 \notes \transpose c c' {
4618 \property Score.timing = ##f
4619 \property Score.defaultBarType = "empty"
4620 \property Voice.NoteHead \set #'style = #'neo_mensural
4621 \property Staff.TimeSignature \set #'style = #'neo_mensural
4623 \[ g\longa c\breve a\breve f\breve d'\longa \]
4625 \[ e1 f1 a\breve g\longa \]
4631 @subsection Figured bass
4633 @cindex Basso continuo
4635 LilyPond has limited support for figured bass:
4637 @lilypond[verbatim,fragment]
4639 \context Voice \notes { \clef bass dis4 c d ais}
4640 \context FiguredBass
4642 < 6 >4 < 7 >8 < 6+ [_!] >
4648 The support for figured bass consists of two parts: there is an input
4649 mode, introduced by @code{\figures}, where you can enter bass figures
4650 as numbers, and there is a context called @internalsref{FiguredBass}
4651 that takes care of making @internalsref{BassFigure} objects.
4653 In figures input mode, a group of bass figures is delimited by
4654 @code{<} and @code{>}. The duration is entered after the @code{>}.
4659 \context FiguredBass
4663 Accidentals are added to the numbers if you alterate them by
4664 appending @code{-}, @code{!} and @code{+}.
4670 \context FiguredBass
4671 \figures { <4- 6+ 7!> }
4674 Spaces or dashes may be inserted by using @code{_}. Brackets are
4675 introduced with @code{[} and @code{]}.
4681 \context FiguredBass
4682 \figures { < [4 6] 8 [_ 12]> }
4685 Although the support for figured bass may superficially resemble chord
4686 support, it works much simpler: in figured bass simply stores the
4687 numbers, and then prints the numbers you entered. There is no
4688 conversion to pitches, and no realizations of the bass are played in
4691 Internally, the code produces markup texts internally. You can use any
4692 of the markup text properties to override formatting. For example, the
4693 vertical spacing of the figures may be set with @code{baseline-skip}.
4695 @c . {Contemporary notation}
4696 @node Contemporary notation
4697 @section Contemporary notation
4705 @subsection Clusters
4709 In musical terminology, a @emph{cluster} denotes a range of
4710 simultaneously sounding pitches that may change over time. The set of
4711 available pitches to apply usually depends on the accoustic source.
4712 Thus, in piano music, a cluster typically consists of a continous range
4713 of the semitones as provided by the piano's fixed set of a chromatic
4714 scale. In choral music, each singer of the choir typically may sing an
4715 arbitrary pitch within the cluster's range that is not bound to any
4716 diatonic, chromatic or other scale. In electronic music, a cluster
4717 (theoretically) may even cover a continuous range of pitches, thus
4718 resulting in coloured noise, such as pink noise.
4720 Clusters can be notated in the context of ordinary staff notation by
4721 engraving simple geometrical shapes that replace ordinary notation of
4722 notes. Ordinary notes as musical events specify starting time and
4723 duration of pitches; however, the duration of a note is expressed by the
4724 shape of the note head rather than by the horizontal graphical extent of
4725 the note symbol. In contrast, the shape of a cluster geometrically
4726 describes the development of a range of pitches (vertical extent) over
4727 time (horizontal extent). Still, the geometrical shape of a cluster
4728 covers the area in wich any single pitch contained in the cluster would
4729 be notated as an ordinary note. From this point of view, it is
4730 reasonable to specify a cluster as the envelope of a set of notes. This
4731 is exactly how to construct a cluster with lilypond.
4733 @lilypond[singleline,verbatim]
4735 \context PianoStaff <
4736 \context Voice = voiceI { % same as voiceII, but with ordinary notes
4737 \notes \relative c' {
4739 a4 <e4 d'4> | \break
4740 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4744 \context Voice = voiceII { % same as voiceI, but with cluster notation
4745 \notes \relative c' {
4747 % hide notes, accidentals, etc.
4748 \property Thread.NoteHead \set #'transparent = ##t
4749 \property Voice.Stem \set #'transparent = ##t
4750 \property Voice.Beam \set #'transparent = ##t
4751 \property Staff.Accidental \set #'transparent = ##t
4753 \property Voice.Cluster \set #'padding = #0.01
4754 \property Voice.Cluster \set #'shape = #'ramp
4758 a4 <e4 d'4> | \break
4759 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4760 c4 \stopCluster a4 f4 g4 a4
4767 Note that the second voice differs from the first one only by the
4768 additional keywords @code{\startCluster} and @code{\stopCluster} and the
4769 fact that notes, accidentals, etc. are hidden. A future version of
4770 lilypond may automatically hide notes, accidentals, etc. within the
4773 Also note that a music expression like @code{< @{ g8 e8 @} a4 >} is
4774 illegal; in such a case, you can instead use the expression @code{< g8
4777 By default, cluster engraver is in the voice context. This allows
4778 putting ordinary notes and clusters together in the same staff, even
4779 simultaneously. However, in such a case no attempt is made to
4780 automatically avoid collisions between ordinary notes and clusters.
4782 The geometrical shape can be further controlled with grob properties
4783 @code{padding} and @code{shape}. @code{padding} adds to the vertical
4784 extent of the shape (top and bottom) and is expressed in units of
4785 staffspace. Since the pitch range of a single pitch is infinitely
4786 small, if padding is set to @code{0.0}, this possibly results in an
4787 invisible shape, if you,for example, say @code{ \startCluster c d e
4788 \endCluster}. The default value for @code{padding} therefore is
4789 @code{0.25}, such that a single pitch roughly shows the same height as a
4790 note head. Property @code{shape} controls how the overall shape of the
4791 cluster is constructed from the set of notes. Currently supported
4792 values are @code{leftsided-stairs}, @code{rightsided-stairs},
4793 @code{centered-stairs}, and @code{ramp}.
4796 @subsection Fermatas
4800 Currently, lilypond supports the following fermata symbols that are
4801 frequently used in contemporary music notation:
4803 @lilypond[singleline,verbatim]
4810 ^\markup { short fermata }
4815 ^\markup { fermata }
4820 ^\markup { long fermata }
4825 ^\markup { very long fermata }
4831 See @ref{Articulations} for general instructions how to apply scripts
4832 such as fermatas to a @code{\notes@{@}} block.
4834 @c . {Tuning output}
4836 @section Tuning output
4838 LilyPond tries to take as much formatting as possible out of your
4839 hands. Nevertheless, there are situations where it needs some help, or
4840 where you want to override its decisions. In this section we discuss
4841 ways to do just that.
4843 Formatting is internally done by manipulating so called objects (graphic
4844 objects). Each object carries with it a set of properties (object
4845 properties) specific to that object. For example, a stem object has
4846 properties that specify its direction, length and thickness.
4848 The most direct way of tuning the output is by altering the values of
4849 these properties. There are two ways of doing that: first, you can
4850 temporarily change the definition of a certain type of object, thus
4851 affecting a whole set of objects. Second, you can select one specific
4852 object, and set a object property in that object.
4855 * Tuning groups of objects ::
4856 * Tuning per object ::
4861 @node Tuning groups of objects
4862 @subsection Tuning groups of objects
4864 @cindex object description
4866 A object definition is a Scheme association list, that is stored in a
4867 context property. By assigning to that property (using plain
4868 @code{\property}), you can change the resulting objects.
4870 @lilypond[verbatim, fragment,quote]
4871 c'4 \property Voice.NoteHead = #'() c'4
4873 This mechanism is fairly crude, since you can only set, but not modify,
4874 the definition of an object. Also, it will thoroughly confuse LilyPond.
4876 The definition of an object is actually a list of default object
4877 properties. For example, the definition of the Stem object (available
4878 in @file{scm/grob-description.scm}), includes the following definitions for
4883 (beamed-lengths . (0.0 2.5 2.0 1.5))
4884 (Y-extent-callback . ,Stem::height)
4888 You can add a property on top of the existing definition, or remove a
4889 property, thus overriding the system defaults:
4890 @lilypond[verbatim,quote]
4891 c'4 \property Voice.Stem \override #'thickness = #4.0
4892 c'4 \property Voice.Stem \revert #'thickness
4895 You should balance @code{\override} and @code{\revert}. If that's too
4896 much work, you can use the @code{\set} shorthand. It performs a revert
4897 followed by an override. The following example gives exactly the same
4898 result as the previous one.
4899 @lilypond[verbatim,quote]
4900 c'4 \property Voice.Stem \set #'thickness = #4.0
4901 c'4 \property Voice.Stem \set #'thickness = #0.8
4904 If you use @code{\set}, you must explicitly restore the default.
4907 Formally the syntax for these constructions is
4909 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4910 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4911 \property @var{context}.@var{grobname} \revert @var{symbol}
4913 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4914 and @var{grobname} are strings and @var{value} is a Scheme expression.
4917 If you revert a setting which was not set in the first place, then it
4918 has no effect. However, if the setting was set as a system default, it
4919 may remove the default value, and this may give surprising results,
4920 including crashes. In other words, @code{\override} and @code{\revert},
4921 must be carefully balanced.
4923 These are examples of correct nesting of @code{\override}, @code{\set},
4926 A clumsy but correct form:
4928 \override \revert \override \revert \override \revert
4931 Shorter version of the same:
4933 \override \set \set \revert
4936 A short form, using only @code{\set}. This requires you to know the
4939 \set \set \set \set @var{to default value}
4942 If there is no default (i.e. by default, the object property is unset),
4945 \set \set \set \revert
4948 For the digirati, the object description is an Scheme association
4949 list. Since a Scheme list is a singly linked list, we can treat it as a
4950 stack, and @code{\override} and @code{\revert} are just push and pop
4951 operations. This pushing and popping is also used for overriding
4952 automatic beaming settings.
4956 LilyPond will hang or crash if @var{value} contains cyclic references.
4957 The backend is not very strict in type-checking object properties. If you
4958 @code{\revert} properties that are expected to be set by default,
4964 @node Tuning per object
4965 @subsection Tuning per object
4968 Tuning a single object is most often done with @code{\property}. The
4971 \once \property @dots{}
4974 applies a setting only during one moment in the score: notice how the
4975 original setting for stem thickness is restored automatically in the
4978 @lilypond[verbatim, fragment, relative=1]
4980 \once \property Voice.Stem \set #'thickness = #4
4986 @cindex \outputproperty
4988 A second way of tuning objects is the more arcane @code{\outputproperty}
4989 feature. The syntax is as follows:
4991 \outputproperty @var{predicate} @var{symbol} = @var{value}
4993 Here @code{predicate} is a Scheme function taking a object argument, and
4994 returning a boolean. This statement is processed by the
4995 @code{Output_property_engraver}. It instructs the engraver to feed all
4996 objects that it sees to @var{predicate}. Whenever the predicate returns
4997 true, the object property @var{symbol} will be set to @var{value}.
4999 This command is only single shot, in contrast to @code{\override} and
5002 You will need to combine this statement with @code{\context} to select
5003 the appropriate context to apply this to.
5005 In the following example, all note heads occurring at current staff
5006 level, are shifted up and right by setting their @code{extra-offset}
5009 @lilypond[fragment,verbatim,singleline]
5011 \context Staff \outputproperty
5012 #(make-type-checker 'note-head-interface)
5013 #'extra-offset = #'(0.5 . 0.75)
5017 @cindex @code{extra-offset}
5019 In this example, the predicate checks the @code{text} object property, to
5020 shift only the `m.d.' text, but not the fingering instruction "2".
5021 @lilypond[verbatim,singleline]
5022 #(define (make-text-checker text)
5023 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
5026 \notes\relative c''' {
5027 \property Voice.Stem \set #'direction = #1
5028 \outputproperty #(make-text-checker "m.d.")
5029 #'extra-offset = #'(-3.5 . -4.5)
5037 If possible, avoid this feature: the semantics are not very clean, and
5038 the syntax and semantics are up for rewrite.
5043 @node Font selection
5044 @subsection Font selection
5046 The most common thing to change about the appearance of fonts is
5047 their size. The font size of a @internalsref{Voice},
5048 @internalsref{Staff} or @internalsref{Thread} context, can be easily
5049 changed by setting the @code{fontSize} property for that context:
5050 @lilypond[fragment,relative=1,verbatim,quote]
5051 c4 c4 \property Voice.fontSize = #-1
5054 This command will not change the size of variable symbols, such as
5055 beams or slurs. You can use this command to get smaller symbol for
5056 cue notes, but that involves some more subtleties. An elaborate
5057 example of those is in @file{input/test/cue-notes.ly}.
5065 The font used for printing a object can be selected by setting
5066 @code{font-name}, e.g.
5068 \property Staff.TimeSignature
5069 \set #'font-name = #"cmr17"
5071 You may use any font which is available to @TeX{}, such as foreign
5072 fonts or fonts that do not belong to the Computer Modern font family.
5073 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
5074 can also be adjusted with a more fine-grained mechanism. By setting
5075 the object properties described below, you can select a different font.
5076 All three mechanisms work for every object that supports
5077 @code{font-interface}.
5081 A symbol indicating the general class of the typeface. Supported are
5082 @code{roman} (Computer Modern), @code{braces} (for piano staff
5083 braces), @code{music} (the standard music font), @code{ancient} (the
5084 ancient notation font) @code{dynamic} (font for dynamic signs) and
5088 A symbol indicating the shape of the font, there are typically several
5089 font shapes available for each font family. Choices are @code{italic},
5090 @code{caps} and @code{upright}
5093 A symbol indicating the series of the font. There are typically several
5094 font series for each font family and shape. Choices are @code{medium}
5097 @item font-relative-size
5098 A number indicating the size relative the standard size. For example,
5099 with 20pt staff height, relative size -1 corresponds to 16pt staff
5100 height, and relative size +1 corresponds to 23 pt staff height.
5102 @item font-design-size
5103 A number indicating the design size of the font.
5105 This is a feature of the Computer Modern Font: each point size has a
5106 slightly different design. Smaller design sizes are relatively wider,
5107 which enhances readability.
5110 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
5111 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
5112 to override default setting, which are always present. For example:
5114 \property Lyrics.LyricText \override #'font-series = #'bold
5115 \property Lyrics.LyricText \override #'font-family = #'typewriter
5116 \property Lyrics.LyricText \override #'font-shape = #'*
5119 @cindex @code{font-style}
5121 There are also pre-cooked font selection qualifiers. These are
5122 selected through the object property @code{font-style}. For example,
5123 the style @code{finger} selects family @code{number} and relative size
5124 @code{-3}. Styles available include @code{volta}, @code{finger},
5125 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
5126 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
5127 tables for selecting fonts are located in @file{scm/font.scm}. Refer
5128 to this file for more information.
5130 @cindex magnification
5132 The size of the font may be scaled with the object property
5133 @code{font-magnification}. For example, @code{2.0} blows up all
5134 letters by a factor 2 in both directions.
5138 Relative size is not linked to any real size.
5140 There is no style sheet provided for other fonts besides the @TeX{}
5141 family, and the style sheet can not be modified easily.
5143 @cindex font selection
5144 @cindex font magnification
5145 @cindex @code{font-interface}
5149 @subsection Text markup
5154 @cindex typeset text
5156 LilyPond has an internal mechanism to typeset texts. You can access it
5157 with the keyword @code{\markup}. Within markup mode, you can enter texts
5158 similar to lyrics: simply enter them, surrounded by spaces.
5161 @lilypond[verbatim,fragment,relative=1]
5162 c1^\markup { hello }
5163 c1_\markup { hi there }
5164 c1^\markup { hi \bold there, is \italic anyone home? }
5167 @cindex font switching
5169 The line of the example demonstrates font switching commands. Notice
5170 that the command only apply to the first following word; enclose a set
5171 of texts with braces to apply a command to more words.
5173 \markup @{ \bold @{ hi there @} @}
5175 For clarity, you can also do this for single arguments, e.g.
5177 \markup @{ is \italic @{ anyone @} home @}
5180 @cindex font size, texts
5183 The following size commands set abolute sizes
5199 You can also make letter larger or smaller relative to their neighbors,
5200 with the commands @code{\larger} and @code{\smaller}.
5204 @cindex font style, for texts
5210 The following font change commands are defined:
5213 This changes to the font used for dynamic signs. Note that this font
5214 doesn't contain all characters of the alphabet.
5216 This changes to the font used for time signatures. It only contains
5217 numbers and a few punctuation marks.
5222 @cindex raising text
5223 @cindex lowering text
5225 @cindex translating text
5230 Raising and lowering texts can be done with @code{\super} and
5233 @lilypond[verbatim,fragment,relative=1]
5234 c1^\markup { E "=" mc \super "2" }
5239 If you want to give an explicit amount for lowering or raising, use
5240 @code{\raise}. This command takes a Scheme valued argument,
5241 @lilypond[verbatim,fragment,relative=1,quote]
5242 c1^\markup { C \small \raise #1.0 { "9/7+" }}
5244 The argument to @code{\raise} is the vertical displacement amount,
5245 measured in (global) staff spaces.
5247 Other commands taking single arguments include
5250 @item \bracket, \hbracket
5251 Bracket the argument markup.
5255 This is converted to a musical symbol, e.g. @code{\musicglyph
5256 #"accidentals-0"} will select the natural sign from the music font.
5257 See @ref{The Feta font} for a complete listing of the possible glyphs.
5259 This produces a single character, e.g. @code{\char #65} produces the
5262 @item \hspace #@var{amount}
5264 This produces a invisible object taking horizontal space.
5266 \markup @{ A \hspace #2.0 B @}
5268 will put extra space between A and B. Note that lilypond
5269 inserts space before and after @code{\hspace}.
5271 @item \fontsize #@var{size}
5273 This sets the relative font size, eg.
5275 A \fontsize #2 @{ B C @} D
5279 This will enlarge the B and the C by two steps.
5280 @item \translate #(cons @var{x} @var{y})
5282 This translates an object. It's first argument is a cons of numbers
5284 A \translate #(cons 2 -3) @{ B C @} D
5286 This moves `B C' 2 spaces to the right, and 3 down.
5288 @item \magnify #@var{mag}
5290 This sets the font magnification for the its argument. In the following
5291 example, the middle A will be 10% larger.
5293 A \magnify #1.1 @{ A @} A
5297 @item \override #(@var{key} . @var{value})
5299 This overrides a formatting property for its argument. The argument
5300 should be a key/value pair, e.g.
5302 m \override #'(font-family . math) m m
5306 In markup mode you can compose expressions, similar to mathematical
5307 expressions, XML documents and music expressions. The braces group
5308 notes into horizontal lines. Other types of lists also exist: you can
5309 stack expressions grouped with @code{<<}, and @code{>>} vertically with
5310 the command @code{\column}. Similarly, @code{\center} aligns texts by
5313 @lilypond[verbatim,fragment,relative=1]
5314 c1^\markup { \column << a bbbb c >> }
5315 c1^\markup { \center << a bbbb c >> }
5316 c1^\markup { \line << a b c >> }
5321 The markup mechanism is very flexible and extensible. Refer to
5322 @file{scm/new-markup.scm} for more information on extending the markup
5326 @cindex metronome mark
5328 One practical application of complicated markup is to fake a metronome
5332 eighthStem = \markup \combine
5333 \musicglyph #"flags-stem"
5334 \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
5335 eighthNote = \markup
5336 \override #'(word-space . 0.0)
5337 { \musicglyph #"noteheads-2"
5338 \translate #'(-0.05 . 0.1) \eighthStem }
5341 \notes\relative c'' {
5342 a1^\markup { \magnify #0.9 \eighthNote " = 64" }
5351 LilyPond does not account for kerning in its text formatting, so it
5352 spaces texts slightly too wide.
5354 Syntax errors for markup mode are confusing.
5358 @section Global layout
5360 The global layout determined by three factors: the page layout, the
5361 line breaks and the spacing. These all influence each other: The
5362 choice of spacing determines how densely each system of music is set,
5363 where line breaks breaks are chosen, and thus ultimately how many
5364 pages a piece of music takes. In this section we will explain how the
5365 lilypond spacing engine works, and how you can tune its results.
5367 Globally spoken, this procedure happens in three steps: first,
5368 flexible distances (``springs'') are chosen, based on durations. All
5369 possible line breaking combination are tried, and the one with the
5370 best results---a layout that has uniform density and requires as
5371 little stretching or cramping as possible---is chosen. When the score
5372 is processed by @TeX{}, page are filled with systems, and page breaks
5373 are chosen whenever the page gets full.
5376 * Vertical spacing::
5377 * Horizontal spacing::
5384 @node Vertical spacing
5385 @subsection Vertical spacing
5387 @cindex vertical spacing
5388 @cindex distance between staves
5389 @cindex staff distance
5390 @cindex between staves, distance
5391 @cindex staffs per page
5394 The height of each system is determined automatically by lilypond, to
5395 keep systems from bumping into each other, some minimum distances are
5396 set. By changing these, you can put staves closer together, and thus
5397 put more systems onto one page.
5399 Normally staves are stacked vertically. To make
5400 staves maintain a distance, their vertical size is padded. This is
5401 done with the property @code{minimumVerticalExtent}. It takes a pair
5402 of numbers, so if you want to make it smaller from its, then you could
5405 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5407 This sets the vertical size of the current staff to 4 staff-space on
5408 either side of the center staff line. The argument of
5409 @code{minimumVerticalExtent} is interpreted as an interval, where the
5410 center line is the 0, so the first number is generally negative. you
5411 could also make the staff larger at the bottom by setting it to
5412 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
5414 Vertical aligment of staves is handled by the
5415 @internalsref{VerticalAlignment} object, which lives at
5416 @internalsref{Score} level.
5418 The piano staves are handled a little differently: to make cross-staff
5419 beaming work correctly, it necessary that the distance between staves
5420 is fixed. This is also done with a @internalsref{VerticalAlignment}
5421 object, created in @internalsref{PianoStaff}, but a forced distance is
5422 set. This is done with the object property #'forced-distance. If you
5423 want to override this, use a @code{\translator} block as follows:
5427 VerticalAlignment \override #'forced-distance = #9
5430 This would bring the staves together at a distance of 9 staff spaces,
5431 and again this is measured from the center line of each staff.
5435 @node Horizontal spacing
5436 @subsection Horizontal Spacing
5438 The spacing engine translates differences in durations into
5439 stretchable distances (``springs'') of differing lengths. Longer
5440 durations get more space, shorter durations get less. The basis for
5441 assigning spaces to durations, is that the shortest durations get a
5442 fixed amount of space, and the longer durations get more: doubling a
5443 duration adds a fixed amount of space to the note.
5445 For example, the following piece contains lots of half, quarter and
5446 8th notes, the eighth note is followed by 1 note head width. The The
5447 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5448 @lilypond[fragment, verbatim, relative=1]
5449 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
5452 These two amounts of space are @code{shortest-duration-space}
5453 @code{spacing-increment}, object properties of
5454 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
5455 set to 1.2, which is the width of a note head, and
5456 @code{shortest-duration-space} is set to 2.0, meaning that the
5457 shortest note gets 2 noteheads of space. For normal notes, this space
5458 is always counted from the left edge of the symbol, so the short notes
5459 in a score is generally followed by one note head width of space.
5461 If one would follow the above procedure exactly, then adding a single
5462 32th note to a score that uses 8th and 16th notes, would widen up the
5463 entire score a lot. The shortest note is no longer a 16th, but a 64th,
5464 thus adding 2 noteheads of space to every note. To prevent this, the
5465 shortest duration for spacing is not the shortest note in the score,
5466 but the most commonly found shortest note. Notes that are even
5467 shorter this are followed by a space that is proportonial to their
5468 duration relative to the common shortest note. So if we were to add
5469 only a few 16th notes to the example above, they would be followed by
5472 @lilypond[fragment, verbatim, relative=1]
5473 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
5476 The most common shortest duration is determined as follows: in every
5477 measure, the shortest duration is determined. The most common short
5478 duration, is taken as the basis for the spacing, with the stipulation
5479 that this shortest duration should always be equal to or shorter than
5480 1/8th note. The shortest duration is printed when you run lilypond
5481 with @code{--verbose}. These durations may also be customized. If you
5482 set the @code{common-shortest-duration} in
5483 @internalsref{SpacingSpanner}, then this sets the base duration for
5484 spacing. The maximum duration for this base (normally 1/8th), is set
5485 through @code{base-shortest-duration}.
5487 @cindex @code{common-shortest-duration}
5488 @cindex @code{base-shortest-duration}
5489 @cindex @code{stem-spacing-correction}
5490 @cindex @code{spacing}
5492 In the introduction it was explained that stem directions influence
5493 spacing. This is controlled with @code{stem-spacing-correction} in
5494 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
5495 same property for controlling the stem/barline spacing. In the
5496 following example shows these corrections, once with default settings,
5497 and once with exaggerated corrections.
5503 \property Staff.NoteSpacing \override #'stem-spacing-correction
5505 \property Staff.StaffSpacing \override #'stem-spacing-correction
5510 \paper { linewidth = -1. } }
5513 @cindex SpacingSpanner, overriding properties
5515 The @internalsref{SpacingSpanner}, is score wide, so its properties
5516 must be overriden from the @code{\paper} block, e.g.
5518 \paper @{ \translator @{
5520 SpacingSpanner \override #'spacing-increment = #3.0
5527 Spacing is determined on a score wide basis. If you have a score that
5528 changes its character (measured in durations) half way during the
5529 score, the part containing the longer durations will be spaced too
5532 Generating optically pleasing spacing is black magic. LilyPond tries
5533 to deal with a number of frequent cases. Here is an example that is
5534 not handled correctly, due to the combination of chord collisions and
5539 \context PianoStaff \notes \transpose c c'' <
5540 \context Staff = up { s1 }
5541 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
5542 \translator Staff=down c c c] }
5544 \paper { linewidth = -1 }
5551 @subsection Font size
5552 @cindex font size, setting
5553 @cindex staff size, setting
5554 @cindex @code{paper} file
5556 The Feta font provides musical symbols at seven different sizes.
5557 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5558 point, and 26 point. The point size of a font is the height of the
5559 five lines in a staff when displayed in the font.
5561 Definitions for these sizes are the files @file{paperSZ.ly}, where
5562 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5563 of these files, the identifiers @code{paperEleven},
5564 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5565 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5566 are defined respectively. The default @code{\paper} block is also
5567 set. These files should be imported at toplevel, i.e.
5569 \include "paper26.ly"
5573 The font definitions are generated using a Scheme function. For more
5574 details, see the file @file{scm/font.scm}.
5579 @subsection Line breaking
5582 @cindex breaking lines
5584 Line breaks are normally computed automatically. They are chosen such
5585 that it looks neither cramped nor loose, and that consecutive lines have
5588 Occasionally you might want to override the automatic breaks; you can
5589 do this by specifying @code{\break}. This will force a line break at
5590 this point. Line breaks can only occur at places where there are bar
5591 lines. If you want to have a line break where there is no bar line,
5592 you can force an invisible bar line by entering @code{\bar
5593 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
5597 @cindex regular line breaks
5598 @cindex four bar music.
5600 If you want linebreaks at regular intervals, you can use the following:
5602 < \repeat 7 unfold @{ s1 * 4 \break @}
5606 This makes the following 28 measures (assuming 4/4 time) be broken every
5610 @subsection Page layout
5613 @cindex breaking pages
5615 @cindex @code{indent}
5616 @cindex @code{linewidth}
5618 The most basic settings influencing the spacing are @code{indent} and
5619 @code{linewidth}. They are set in the @code{\paper} block. They
5620 control the indentation of the first line of music, and the lengths of
5621 the lines. If @code{linewidth} set to a negative value, a single
5622 unjustified line is produced. A similar effect for scores that are
5623 longer than one line, can be produced by setting @code{raggedright} to
5624 true in the @code{\paper} block.
5627 @cindex vertical spacing
5629 The page layout process happens outside lilypond. Ly2dvi sets page
5630 layout instructions. Ly2dvi responds to the following variables in the
5631 @code{\paper} block. The variable @code{textheight} sets the total
5632 height of the music on each page. The spacing between systems is
5633 controlled with @code{interscoreline}, its default is 16pt.
5634 The distance between the score lines will stretch in order to fill the
5635 full page @code{interscorelinefill} is set to a positive number. In
5636 that case @code{interscoreline} specifies the minimum spacing.
5638 @cindex @code{textheight}
5639 @cindex @code{interscoreline}
5640 @cindex @code{interscorelinefill}
5642 If the variable @code{lastpagefill} is defined (that is, it gets any
5643 value assigned in the @code{\paper} block), systems are evenly
5644 distributed vertically on the last page. This might produce ugly
5645 results in case there are not enough systems on the last page. Note
5646 that @command{lilypond-book} ignores @code{lastpagefill}. See
5647 @ref{Integrating text and music with lilypond-book} for
5650 @cindex @code{lastpagefill}
5652 Page breaks are normally computed by @TeX{}, so they are not under
5653 direct control of LilyPond. However, you can insert a commands into
5654 the @file{.tex} output to instruct @TeX{} where to break pages. You
5655 can insert a @code{\newpage} from within lilypond. This is done by
5656 setting the @code{between-systems-strings} on the
5657 @internalsref{NonMusicalPaperColumn} where the system is broken.
5661 @cindex @code{papersize}
5663 To change the paper size, you must first set the
5664 @code{papersize} paper variable variable. Set it to
5665 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5666 specification, you must set the font as described above. If you want
5667 the default font, then use the 20 point font.
5670 \paper@{ papersize = "a4" @}
5671 \include "paper16.ly"
5674 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5675 will set the paper variables @code{hsize} and @code{vsize} (used by
5676 Lilypond and @code{ly2dvi})
5686 LilyPond can produce MIDI output. The performance lacks lots of
5687 interesting effects, such as swing, articulation, slurring, etc., but it
5688 is good enough for proof-hearing the music you have entered. Ties,
5689 dynamics and tempo changes are interpreted.
5691 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5692 levels. Dynamic marks translate to a fixed fraction of the available
5693 MIDI volume range, crescendi and decrescendi make the the volume vary
5694 linearly between their two extremities. The fractions be adjusted by
5695 overriding the @code{absolute-volume-alist} defined in
5696 @file{scm/midi.scm}.
5698 For each type of musical instrument (that MIDI supports), a volume range
5699 can be defined. This gives you basic equalizer control, which can
5700 enhance the quality of the MIDI output remarkably. You can add
5701 instruments and ranges or change the default settings by overriding the
5702 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5704 Both loudness controls are combined to produce the final MIDI volume.
5708 * MIDI instrument names::
5713 @subsection MIDI block
5717 The MIDI block is analogous to the paper block, but it is somewhat
5718 simpler. The @code{\midi} block can contain:
5722 @item a @code{\tempo} definition
5723 @item context definitions
5726 Assignments in the @code{\midi} block are not allowed.
5730 @cindex context definition
5732 Context definitions follow precisely the same syntax as within the
5733 \paper block. Translation modules for sound are called performers.
5734 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5737 @node MIDI instrument names
5738 @subsection MIDI instrument names
5740 @cindex instrument names
5741 @cindex @code{Staff.midiInstrument}
5742 @cindex @code{Staff.instrument}
5744 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5745 property or, if that property is not set, the @code{Staff.instrument}
5746 property. The instrument name should be chosen from the list in
5747 @ref{MIDI instruments}.
5751 If the selected string does not exactly match, then LilyPond uses the
5752 default (Grand Piano). It is not possible to select an instrument by