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 --->
24 This document describes GNU LilyPond and its input format. The last
25 revision of this document was made for LilyPond 1.4.1. It supposes a
26 passing familiarity with how LilyPond input works. New users are
27 encouraged to study the tutorial first.
32 * Easier music entry::
51 @c FIXME: Note entry vs Music entry at top level menu is confusing.
57 Notes constitute the most basic form of music, but they do not form
58 valid input on their own. Yet for the sake of brevity and simplicity,
59 we'll generally omit @code{\score} blocks and @code{\paper} declarations.
65 * Chromatic alterations::
70 * Automatic note splitting ::
72 * Easy Notation note heads ::
80 A note is printed by specifying its pitch, and then its duration.
81 @lilypond[fragment,verbatim]
90 @cindex Note specification
92 @cindex entering notes
94 The verbose syntax for pitch specification is
101 @var{scmpitch} is a pitch scheme object.
103 In Note and Chord mode, pitches may be designated by names. The default
104 names are the Dutch note names. The notes are specified by the letters
105 @code{a} through @code{g} (where the octave is formed by notes ranging
106 from @code{c} to @code{b}). The pitch @code{c} is an octave below
107 middle C and the letters span the octave above that C.
109 @cindex note names, Dutch
111 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
112 name and a flat is formed by adding @code{-es}. Double sharps and double
113 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
114 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
115 both forms are accepted.
117 LilyPond has predefined sets of note names for various other languages.
118 To use them, simply include the language specific init file. For
119 example: @code{\include "english.ly"}. The available language files and
120 the note names they define are:
123 Note Names sharp flat
124 nederlands.ly c d e f g a bes b -is -es
125 english.ly c d e f g a bf b -s/-sharp -f/-flat
126 deutsch.ly c d e f g a b h -is -es
127 norsk.ly c d e f g a b h -iss/-is -ess/-es
128 svenska.ly c d e f g a b h -iss -ess
129 italiano.ly do re mi fa sol la sib si -d -b
130 catalan.ly do re mi fa sol la sib si -d/-s -b
131 espanol.ly do re mi fa sol la sib si -s -b
140 The optional octave specification takes the form of a series of
141 single quote (`@code{'}') characters or a series of comma
142 (`@code{,}') characters. Each @code{'} raises the pitch by one
143 octave; each @code{,} lowers the pitch by an octave.
145 @lilypond[fragment,verbatim,center]
146 c' c'' es' g' as' gisis' ais'
149 @node Chromatic alterations
150 @subsection Chromatic alterations
152 Normally, accidentals are automatically printed, but you may force
153 them in the following ways: a reminder accidental
154 @cindex reminder accidental
156 can be forced by adding an exclamation mark @code{!} after the pitch. A
157 cautionary accidental,
158 @cindex cautionary accidental
159 @cindex parenthesized accidental
160 i.e., an accidental within parentheses can be obtained by adding the
161 question mark `@code{?}' after the pitch.
163 The automatic production of accidentals can be tuned in many
164 ways. For more information, refer to @ref{Accidentals}.
171 Rests are entered like notes, with an `@code{r}' note name:
173 @lilypond[singleline,verbatim]
177 Whole bar rests, centered in the bar, are specified using @code{R}, see
178 @ref{Multi measure rests}. See also @seeinternals{Rest}.
180 For polyphonic music, it can be convenient to explicitly specify the rest's
181 vertical position. This can be achieved by entering a note, with the @code{\rest}
182 keyword appended. Rest collision testing will leave these rests alone.
184 @lilypond[singleline,verbatim]
194 @cindex Invisible rest
197 An invisible rest, or skip, can be entered like a note with note name
198 @code{s}, or with @code{\skip @var{duration}}:
200 @lilypond[singleline,verbatim]
204 @c FIXME: in Lyrics mode, we have " " and _
206 In Lyrics mode, invisible rests are entered using either `@code{" "}'
208 @lilypond[singleline,verbatim]
210 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
211 \notes\relative c'' { a2 a4 a a2 a4 a }
215 Note that the @code{s} syntax is only available in Note mode and Chord
216 mode. In other situations, you should use the @code{\skip} command, which
217 also works outside of those two modes:
219 @lilypond[singleline,verbatim]
222 { \time 4/8 \skip 2 \time 4/4 }
223 \notes\relative c'' { a2 a1 }
228 The skip command is merely an empty musical placeholder. It doesn't
229 produce any output, not even transparent output.
235 @subsection Durations
239 @cindex @code{\duration}
242 In Note, Chord, and Lyrics mode, durations are designated by numbers
243 and dots: durations are entered as their reciprocal values. For notes
244 longer than a whole you must use identifiers.
248 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
250 r1 r2 r4 r8 r16 r32 r64 r64
256 \notes \relative c'' {
258 a1 a2 a4 a8 a16 a32 a64 a64
260 r1 r2 r4 r8 r16 r32 r64 r64
265 \remove "Clef_engraver"
266 \remove "Staff_symbol_engraver"
267 \remove "Time_signature_engraver"
268 \consists "Pitch_squash_engraver"
275 If the duration is omitted then it is set to the previously entered
276 duration. At the start of parsing, a quarter note is assumed. The
277 duration can be followed by dots (`@code{.}') in order to obtain dotted
281 @lilypond[fragment,verbatim,center]
287 You can alter the length of duration by a fraction @var{N/M}
288 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
289 won't affect the appearance of the notes or rests produced.
291 Durations can also be produced through GUILE extension mechanism.
292 @lilypond[verbatim,fragment]
293 c\duration #(make-duration 2 1)
299 Dot placement for chords is not perfect. In some cases, dots overlap:
301 \context Voice { <f,4. c'' d e f> }
312 A tie connects two adjacent note heads of the same pitch. The tie in
313 effect extends the length of a note. Ties should not be confused with
314 slurs, which indicate articulation, and phrasing slurs, which indicate
315 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
317 @lilypond[fragment,verbatim,center]
318 e' ~ e' <c' e' g'> ~ <c' e' g'>
321 When a tie is applied to a chord, all note heads, whose pitches match, are
322 connected. If you try to tie together chords that have no common pitches,
323 no ties will be created.
325 If you want less ties created for a chord, you can set
326 @code{Voice.sparseTies} to true. In this case, a single tie is used
327 for every tied chord.
328 @lilypond[fragment,verbatim,center]
329 \property Voice.sparseTies = ##t
330 <c' e' g'> ~ <c' e' g'>
333 In its meaning a tie is just a way of extending a note duration, similar
334 to the augmentation dot: the following example are two ways of notating
335 exactly the same concept.
337 @lilypond[fragment, singleline]
338 \time 3/4 c'2. c'2 ~ c'4
340 And if you need to tie notes over bars, it may be easier to use
341 @ref{Automatic note splitting}.
343 See also @seeinternals{Tie}.
348 At present, the tie is represented as a separate event, temporally
349 located in between the notes. Tying only a subset of the note heads
350 of a chord is not supported in a simple way. It can be achieved by
351 moving the tie-engraver into the Thread context and turning on and off
354 Switching staves when a tie is active will not work.
356 @node Automatic note splitting
357 @subsection Automatic note splitting
358 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
360 There is a facility for automatically converting long notes to tied
361 notes. This is done by replacing the @code{Note_heads_engraver} by the
362 @code{Completion_heads_engraver}.
364 @lilypond[verbatim,center]
366 \notes\relative c'{ \time 2/4
367 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
371 \remove "Note_heads_engraver"
372 \consists "Completion_heads_engraver"
376 This engraver splits all running notes at the bar line, and inserts
377 ties. One of its uses is to debug complex scores: if the measures are
378 not entirely filled, then the ties exactly show how much each measure
383 Not all durations (especially those containing tuplets) can be
384 represented exactly; the engraver will not insert tuplets.
391 @cindex @code{\times}
393 Tuplets are made out of a music expression by multiplying all durations
396 @cindex @code{\times}
398 \times @var{fraction} @var{musicexpr}
401 The duration of @var{musicexpr} will be multiplied by the fraction.
402 In print, the fraction's denominator will be printed over the notes,
403 optionally with a bracket. The most common tuplet is the triplet in
404 which 3 notes have the length of 2, so the notes are 2/3 of
405 their written length:
407 @lilypond[fragment,verbatim,center]
408 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
411 The property @code{tupletSpannerDuration} specifies how long each bracket
412 should last. With this, you can make lots of tuplets while typing
413 @code{\times} only once, thus saving typing work.
415 @lilypond[fragment, relative, singleline, verbatim]
416 \property Voice.tupletSpannerDuration = #(make-moment 1 4)
417 \times 2/3 { c'8 c c c c c }
420 The format of the number is determined by the property
421 @code{tupletNumberFormatFunction}. The default prints only the
422 denominator, but if you set it to the Scheme function
423 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
427 @cindex @code{tupletNumberFormatFunction}
428 @cindex tuplet formatting
430 See also @seeinternals{TupletBracket}.
434 Nested tuplets are not formatted automatically. In this case, outer
435 tuplet brackets should be moved automatically.
437 @node Easy Notation note heads
438 @subsection Easy Notation note heads
440 @cindex easy notation
443 A entirely different type of note head is the "easyplay" note head: a
444 note head that includes a note name. It is used in some publications by
445 Hal-Leonard Inc. music publishers.
447 @lilypond[singleline,verbatim,26pt]
449 \notes { c'2 e'4 f' | g'1 }
450 \paper { \translator { \EasyNotation } }
454 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
455 probably will want to print it with magnification or a large font size to make it more
462 If you view the result with Xdvi, then staff lines will show through
463 the letters. Printing the PostScript file obtained with ly2dvi does
464 produce the correct result.
467 @node Easier music entry
468 @section Easier music entry
471 * Graphical interfaces::
475 * Skipping corrected music::
478 When entering music with LilyPond, it is easy to introduce errors. This
479 section deals with tricks and features that help you enter music, and
480 find and correct mistakes.
482 @node Graphical interfaces
483 @subsection Graphical interfaces
486 @cindex graphical interface
493 One way to avoid entering notes using the keyboard is to use a
494 graphical user interface. The following programs are known to have
495 a lilypond export option:
499 Denemo was once intended as
500 a LilyPond graphical user interface. It run on Gnome/GTK.
503 @uref{http://denemo.sourceforge.net/}
507 Noteedit, a graphical score editor that runs under KDE/Qt.
509 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
513 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
514 has been rewritten from scratch and supports LilyPond export as of
518 @uref{http://rosegarden.sf.net/}
522 Another option is to enter the music using your favorite MIDI
523 sequencer, and then import it using midi2ly. midi2ly is described in
524 @ref{Invoking midi2ly}.
528 @node Relative octaves
529 @subsection Relative octaves
531 @cindex relative octave specification
533 Octaves are specified by adding @code{'} and @code{,} to pitch names.
534 When you copy existing music, it is easy to accidentally put a pitch in
535 the wrong octave and hard to find such an error. To prevent these
536 errors, LilyPond features octave entry.
538 @cindex @code{\relative}
540 \relative @var{startpitch} @var{musicexpr}
543 The octave of notes that appear in @var{musicexpr} are calculated as
544 follows: If no octave changing marks are used, the basic interval
545 between this and the last note is always taken to be a fourth or less
546 (This distance is determined without regarding alterations; a
547 @code{fisis} following a @code{ceses} will be put above the
550 The octave changing marks @code{'} and @code{,} can be added to raise or
551 lower the pitch by an extra octave. Upon entering relative mode, an
552 absolute starting pitch must be specified that will act as the
553 predecessor of the first note of @var{musicexpr}.
555 Entering music that changes octave frequently is easy in relative mode.
556 @lilypond[fragment,singleline,verbatim,center]
562 And octave changing marks are used for intervals greater than a fourth.
563 @lilypond[fragment,verbatim,center]
568 If the preceding item is a chord, the first note of the chord is used
569 to determine the first note of the next chord. However, other notes
570 within the second chord are determined by looking at the immediately
573 @lilypond[fragment,verbatim,center]
580 @cindex @code{\notes}
582 The pitch after the @code{\relative} contains a note name. To parse
583 the pitch as a note name, you have to be in note mode, so there must
584 be a surrounding @code{\notes} keyword (which is not
587 The relative conversion will not affect @code{\transpose},
588 @code{\chords} or @code{\relative} sections in its argument. If you
589 want to use relative within transposed music, you must place an
590 additional @code{\relative} inside the @code{\transpose}.
595 @subsection Bar check
599 @cindex @code{barCheckSynchronize}
603 Whenever a bar check is encountered during interpretation, a warning
604 message is issued if it doesn't fall at a measure boundary. This can
605 help you find errors in the input. Depending on the value of
606 @code{barCheckSynchronize}, the beginning of the measure will be
607 relocated, so this can also be used to shorten measures.
609 A bar check is entered using the bar symbol, @code{|}:
611 \time 3/4 c2 e4 | g2.
616 @cindex skipTypesetting
618 Failed bar checks are most often caused by entering incorrect
619 durations. Incorrect durations often completely garble up the score,
620 especially if it is polyphonic, so you should start correcting the score
621 by scanning for failed bar checks and incorrect durations. To speed up
622 this process, you can use @code{skipTypesetting} (See @ref{Skipping
625 @c . {Point and click}
626 @node Point and click
627 @subsection Point and click
628 @cindex poind and click
630 Point and click lets you find notes in the input by clicking on them in
631 the Xdvi window. This makes it very easy to find input that causes some
632 error in the sheet music.
634 To use it, you need the following software
636 @item A dvi viewer that supports src specials.
638 @item Xdvi, version 22.36 or newer. Available from
639 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
641 Note that most @TeX{} distributions ship with xdvik, which is always
642 a few versions behind the official Xdvi. To find out which xdvi you
643 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
644 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
645 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
654 @item An editor with a client/server interface (or a lightweight GUI
660 @item Emacs. Emacs is an extensible text-editor. It is available from
661 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
664 @c move this elsewhere?
666 LilyPond also comes with support files for emacs: lilypond-mode for
667 emacs provides indentation, syntax coloring and handy compile
668 short-cuts. If lilypond-mode is not installed on your platform, then
669 refer to the installation instructions for more information
673 @cindex lilypond-mode for emacs
674 @cindex syntax coloring
676 @item XEmacs. Xemacs is very similar to emacs.
680 @item NEdit. NEdit runs under Windows, and Unix.
681 It is available from @uref{http://www.nedit.org}.
685 @item GVim. GVim is a GUI variant of VIM, the popular VI
686 clone. It is available from @uref{http://www.vim.org}.
695 Xdvi must be configured to find the @TeX{} fonts and music
696 fonts. Refer to the Xdvi documentation for more information.
698 To use point-and-click, add one of these lines to the top of your .ly
701 #(set-point-and-click! 'line)
703 @cindex line-location
705 When viewing, Control-Mousebutton 1 will take you to the originating
706 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
709 If you correct large files with point-and-click, be sure to start
710 correcting at the end of the file. When you start at the top, and
711 insert one line, all following locations will be off by a line.
714 For using point-and-click with emacs, add the following
715 In your emacs startup file (usually @file{~/.emacs}),
720 Make sure that the environment variable @var{XEDITOR} is set to
722 emacsclient --no-wait +%l %f
724 @cindex @var{XEDITOR}
725 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
726 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
728 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or use this
729 argument with xdvi's @code{-editor} option.
731 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
732 use this argument with xdvi's @code{-editor} option.
734 If can also make your editor jump to the exact location of the note
735 you clicked. This is only supported on Emacs. Users of version 20 must
736 apply the patch @file{emacsclient.patch}. Users of version 21 must
737 apply @file{server.el.patch} (version 21.2 and earlier). At the top
738 of the @code{ly} file, replace the @code{set!} line with the following
741 #(set-point-and-click! 'line-column)
743 @cindex line-colomn-location
744 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}.
748 When you convert the @TeX{} file to PostScript using @code{dvips}, it
749 will complain about not finding @code{src:X:Y} files. These complaints
750 are harmless, and can be ignored.
752 @node Skipping corrected music
753 @subsection Skipping corrected music
755 The property @code{Score.skipTypesetting} can be used to switch on and
756 off typesetting completely during the interpretation phase. When
757 typesetting is switched off, the music is processed much more quickly.
758 You can use this to skip over the parts of a score that you have already
761 @lilypond[fragment,singleline,verbatim]
763 \property Score.skipTypesetting = ##t
765 \property Score.skipTypesetting = ##f
773 @section Staff notation
775 This section deals with music notation that occurs on staff level,
776 such as keys, clefs and time signatures.
778 @cindex Staff notation
790 @subsection Staff symbol
793 @cindex adjusting staff symbol
794 @cindex StaffSymbol, using \property
795 @cindex staff lines, setting number of
798 The lines of the staff symbol are formed by the
799 @internalsref{StaffSymbol} object. This object is created at the moment
800 that their context is created. You can not change the appearance of
801 the staff symbol by using @code{\override} or @code{\set}. At the
802 moment that @code{\property Staff} is interpreted, a Staff context is
803 made, and the StaffSymbol is created before any @code{\override} is
804 effective. You can deal with this either overriding properties in a
805 @code{\translator} definition, or by using @code{\outputproperty}.
810 If you end a staff half way a piece, the staff symbol may not end
811 exactly on the barline.
816 @subsection Key signature
821 Setting or changing the key signature is done with the @code{\key}
824 @code{\key} @var{pitch} @var{type}
827 @cindex @code{\minor}
828 @cindex @code{\major}
829 @cindex @code{\minor}
830 @cindex @code{\ionian}
831 @cindex @code{\locrian}
832 @cindex @code{\aeolian}
833 @cindex @code{\mixolydian}
834 @cindex @code{\lydian}
835 @cindex @code{\phrygian}
836 @cindex @code{\dorian}
838 Here, @var{type} should be @code{\major} or @code{\minor} to get
839 @var{pitch}-major or @var{pitch}-minor, respectively.
840 The standard mode names @code{\ionian},
841 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
842 @code{\phrygian}, and @code{\dorian} are also defined.
844 This command sets the context property @code{Staff.keySignature}.
845 Non-standard key signatures can be specified by setting this property
848 The printed signature is a @internalsref{KeySignature} object, typically
849 created in @internalsref{Staff} context.
851 @cindex @code{keySignature}
858 The clef can be set or changed with the @code{\clef} command:
859 @lilypond[fragment,verbatim]
860 \key f\major c''2 \clef alto g'2
863 Supported clef-names include
864 @c Moved standard clefs to the top /MB
866 @item treble, violin, G, G2
875 G clef on 1st line, so-called French violin clef
890 By adding @code{_8} or @code{^8} to the clef name, the clef is
891 transposed one octave down or up, respectively. Note that you have to
892 enclose @var{clefname} in quotes if you use underscores or digits in the
898 The object for this symbol is @internalsref{Clef}.
901 This command is equivalent to setting @code{clefGlyph},
902 @code{clefPosition} (which controls the Y position of the clef),
903 @code{centralCPosition} and @code{clefOctavation}. A clef is created
904 when any of these properties are changed.
907 @c . {Time signature}
909 @subsection Time signature
910 @cindex Time signature
914 The time signature is set or changed by the @code{\time}
916 @lilypond[fragment,verbatim]
917 \time 2/4 c'2 \time 3/4 c'2.
920 The actual symbol that's printed can be customized with the @code{style}
921 property. Setting it to @code{#'()} uses fraction style for 4/4 and
925 The object for this symbol is @internalsref{TimeSignature}. There are
926 many more options for its layout. They are selected through the
927 @code{style} object property. See @file{input/test/time.ly} for more
930 This command sets the property @code{timeSignatureFraction},
931 @code{beatLength} and @code{measureLength} in the @code{Timing}
932 context, which is normally aliased to @internalsref{Score}. The property
933 @code{timeSignatureFraction} determine where bar lines should be
934 inserted, and how automatic beams should be generated. Changing the
935 value of @code{timeSignatureFraction} also causes a time signature
936 symbol to be printed.
943 @cindex partial measure
944 @cindex measure, partial
945 @cindex shorten measures
946 @cindex @code{\partial}
948 Partial measures, for example in upbeats, are entered using the
949 @code{\partial} command:
950 @lilypond[fragment,verbatim]
951 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
954 The syntax for this command is
956 \partial @var{duration}
958 This is internally translated into
960 \property Timing.measurePosition = -@var{length of duration}
963 The property @code{measurePosition} contains a rational number
964 indicating how much of the measure has passed at this point.
967 @node Unmetered music
968 @subsection Unmetered music
970 Bar lines and bar numbers are calculated automatically. For unmetered
971 music (e.g. cadenzas), this is not desirable. The commands
972 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
975 @lilypond[fragment,relative,singleline,verbatim]
983 The property @code{Score.timing} can be used to switch off this
988 @subsection Bar lines
992 @cindex measure lines
995 Bar lines are inserted automatically, but if you need a special type
996 of barline, you can force one using the @code{\bar} command:
997 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1000 The following bar types are available
1001 @lilypond[fragment, relative, singleline, verbatim]
1013 You are encouraged to use @code{\repeat} for repetitions. See
1016 In scores with many staves, the barlines are automatically placed at
1017 top level, and they are connected between different staves of a
1018 @internalsref{StaffGroup}:
1019 @lilypond[fragment, verbatim]
1020 < \context StaffGroup <
1021 \context Staff = up { e'4 d'
1024 \context Staff = down { \clef bass c4 g e g } >
1025 \context Staff = pedal { \clef bass c2 c2 } >
1028 The objects that are created at @internalsref{Staff} level. The name is
1029 @internalsref{BarLine}.
1031 The command @code{\bar @var{bartype}} is a short cut for
1032 doing @code{\property Score.whichBar = @var{bartype}}
1033 Whenever @code{whichBar} is set to a string, a bar line of that type is
1034 created. @code{whichBar} is usually set automatically: at the start of
1035 a measure it is set to @code{defaultBarType}. The contents of
1036 @code{repeatCommands} is used to override default measure bars.
1038 @code{whichBar} can also be set directly, using @code{\property} or
1039 @code{\bar }. These settings take precedence over the automatic
1040 @code{whichBar} settings.
1043 @cindex Bar_line_engraver
1045 @cindex repeatCommands
1046 @cindex defaultBarType
1055 The easiest way to enter such fragments with more than one voice on a
1056 staff is to split chords using the separator @code{\\}. You can use
1057 it for small, short-lived voices (make a chord of voices) or for
1060 @lilypond[verbatim,fragment]
1061 \context Voice = VA \relative c'' {
1062 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1066 The separator causes @internalsref{Voice} contexts to be instantiated,
1067 bearing the names @code{"1"}, @code{"2"}, etc.
1069 Sometimes, it is necessary to instantiate these contexts by hand: For
1070 Instantiate a separate Voice context for each part, and use
1071 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1072 and horizontal shift for each part.
1075 @lilypond[singleline, verbatim]
1077 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1078 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1079 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1082 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1083 ties, slurs and stems, and set shift directions.
1085 If you want more than four voices, you can also manually set
1086 horizontal shifts and stem directions, as is shown in the following example:
1087 @lilypond[fragment, verbatim]
1088 \context Staff \notes\relative c''<
1089 \context Voice=one {
1090 \shiftOff \stemUp e4
1092 \context Voice=two {
1093 \shiftOn \stemUp cis
1095 \context Voice=three {
1096 \shiftOnn \stemUp ais
1098 \context Voice=four {
1099 \shiftOnnn \stemUp fis
1105 Normally, note heads with a different number of dots are not merged, but
1106 if you set the object property @code{merge-differently-dotted}, they are:
1107 @lilypond[verbatim,fragment,singleline]
1110 \property Staff.NoteCollision \override
1111 #'merge-differently-dotted = ##t
1113 } \\ { [g'8. f16] [g'8. f'16] }
1117 Similarly, you can merge half note heads with eighth notes, by setting
1118 @code{merge-differently-headed}:
1119 @lilypond[fragment, relative=2,verbatim]
1122 \property Staff.NoteCollision
1123 \override #'merge-differently-headed = ##t
1124 c8 c4. } \\ { c2 c2 } >
1127 LilyPond also vertically shifts rests that are opposite of a stem.
1129 @lilypond[singleline,fragment,verbatim]
1130 \context Voice < c''4 \\ r4 >
1133 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1137 Resolving collisions is a very intricate subject, and LilyPond only
1138 handles a few situations. When it can not cope, you are advised to use
1139 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1140 rests to override typesetting decisions.
1145 Beams are used to group short notes into chunks that are aligned with
1146 the metrum. They are inserted automatically in most cases.
1148 @lilypond[fragment,verbatim, relative=2]
1149 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1152 If you're not satisfied with the automatic beaming, you can enter the
1153 beams explicitly. If you have beaming patterns that differ from the
1154 defaults, you can also set the patterns for automatic beamer.
1156 See also @internalsref{Beam}.
1159 @cindex Automatic beams
1160 @subsection Manual beams
1161 @cindex beams, manual
1165 In some cases it may be necessary to override LilyPond's automatic
1166 beaming algorithm. For example, the auto beamer will not beam over
1167 rests or bar lines, If you want that, specify the begin and end point
1168 manually using a @code{[} before the first beamed note and a @code{]}
1169 after the last note:
1171 @lilypond[fragment,relative,verbatim]
1173 r4 [r8 g' a r8] r8 [g | a] r8
1177 @cindex @code{stemLeftBeamCount}
1179 Normally, beaming patterns within a beam are determined automatically.
1180 When this mechanism fouls up, the properties
1181 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1182 be used to control the beam subdivision on a stem. If you set either
1183 property, its value will be used only once, and then it is erased.
1185 @lilypond[fragment,relative,verbatim]
1188 [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
1191 @cindex @code{stemRightBeamCount}
1194 The property @code{subdivideBeams} can be set in order to subdivide
1195 all 16th or shorter beams at beat positions. This accomplishes the
1196 same effect as twiddling with @code{stemLeftBeamCount} and
1197 @code{stemRightBeamCount}, but it take less typing.
1202 \property Voice.subdivideBeams = ##t
1204 [c32 c c c c c c c c c c c c c c c]
1205 \property Score.beatLength = #(make-moment 1 8)
1206 [c32 c c c c c c c c c c c c c c c]
1210 \notes \relative c' {
1212 \property Voice.subdivideBeams = ##t
1214 [c32 c c c c c c c c c c c c c c c]
1215 \property Score.beatLength = #(make-moment 1 8)
1216 [c32 c c c c c c c c c c c c c c c]
1220 @cindex subdivideBeams
1222 Kneed beams are inserted automatically, when a large gap between two
1223 adjacent beamed notes is detected. This behavior can be tuned through
1224 the object property @code{auto-knee-gap}.
1226 @cindex beams, kneed
1228 @cindex auto-knee-gap
1232 @c TODO -> why this ref? Document?
1233 @cindex @code{neutral-direction}
1237 Auto knee beams can not be used together with hara kiri staves.
1241 The Automatic beamer does not put @strong{unfinished} beams on the
1242 last notes of a score.
1244 Formatting of ties is a difficult subject. LilyPond often does not
1245 give optimal results.
1248 * Setting automatic beam behavior ::
1252 @no de Beam typography
1253 @sub section Beam typography
1255 One of the strong points of LilyPond is how beams are formatted. Beams
1256 are quantized, meaning that the left and right endpoints beams start
1257 exactly on staff lines. Without quantization, small wedges of white
1258 space appear between the beam and staff line, and this looks untidy.
1260 Beams are also slope-damped: melodies that go up or down should also
1261 have beams that go up or down, but the slope of the beams should be
1262 less than the slope of the notes themselves.
1264 Some beams should be horizontal. These are so-called concave beams.
1266 [TODO: some pictures.]
1269 @c . {Automatic beams}
1270 @node Setting automatic beam behavior
1271 @subsection Setting automatic beam behavior
1273 @cindex @code{autoBeamSettings}
1274 @cindex @code{(end * * * *)}
1275 @cindex @code{(begin * * * *)}
1276 @cindex automatic beams, tuning
1277 @cindex tuning automatic beaming
1279 In normal time signatures, automatic beams can start on any note but can
1280 only end in a few positions within the measure: beams can end on a beat,
1281 or at durations specified by the properties in
1282 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1283 are defined in @file{scm/auto-beam.scm}.
1285 The value of @code{autoBeamSettings} is changed using
1286 @code{\override} and unset using @code{\revert}:
1288 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1289 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1291 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1292 whether the rule applies to begin or end-points. The quantity
1293 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1294 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1295 signature (wildcards, `@code{* *}' may be entered to designate all time
1298 For example, if you want automatic beams to end on every quarter note,
1299 you can use the following:
1301 \property Voice.autoBeamSettings \override
1302 #'(end * * * *) = #(make-moment 1 4)
1304 Since the duration of a quarter note is 1/4 of a whole note, it is
1305 entered as @code{(make-moment 1 4)}.
1307 The same syntax can be used to specify beam starting points. In this
1308 example, automatic beams can only end on a dotted quarter note.
1310 \property Voice.autoBeamSettings \override
1311 #'(end * * * *) = #(make-moment 3 8)
1313 In 4/4 time signature, this means that automatic beams could end only on
1314 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1315 3/8 has passed within the measure).
1317 You can also restrict rules to specific time signatures. A rule that
1318 should only be applied in @var{N}/@var{M} time signature is formed by
1319 replacing the second asterisks by @var{N} and @var{M}. For example, a
1320 rule for 6/8 time exclusively looks like
1322 \property Voice.autoBeamSettings \override
1323 #'(begin * * 6 8) = ...
1326 If you want a rule to apply to certain types of beams, you can use the
1327 first pair of asterisks. Beams are classified according to the shortest
1328 note they contain. For a beam ending rule that only applies to beams
1329 with 32nd notes (and no shorter notes), you would use @code{(end 1
1333 @c Automatic beams can not be put on the last note in a score.
1335 If a score ends while an automatic beam has not been ended and is still
1336 accepting notes, this last beam will not be typeset at all.
1338 @cindex automatic beam generation
1340 @cindex @code{Voice.autoBeaming}
1343 For melodies that have lyrics, you may want to switch off
1344 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1350 It is not possible to specify beaming parameters for beams with mixed
1351 durations, that differ from the beaming parameters of all separate
1352 durations, i.e., you'll have to specify manual beams to get:
1354 @lilypond[singleline,fragment,relative,noverbatim]
1355 \property Voice.autoBeamSettings
1356 \override #'(end * * * *) = #(make-moment 3 8)
1357 \time 12/8 c'8 c c c16 c c c c c [c c c c] c8 c c4
1359 It is not possible to specify beaming parameters that act differently in
1360 different parts of a measure. This means that it is not possible to use
1361 automatic beaming in irregular meters such as @code{5/8}.
1364 @section Accidentals
1366 This section describes how to change the way that LilyPond automatically
1367 inserts accidentals before the running notes.
1370 * Using the predefined accidental macros::
1371 * Defining your own accidental typesettings::
1374 @node Using the predefined accidental macros
1375 @subsection Using the predefined accidental macros
1376 The constructs for describing the accidental typesetting rules are
1377 quite hairy, so non-experts should stick to the macros defined in
1378 @file{ly/property-init.ly}.
1379 @cindex @file{property-init.ly}
1381 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1382 means that the macros shuold normally be invoked right after the
1383 creation of the context in which the accidental typesetting described
1384 by the macro is to take effect. I.e. if you want to use
1385 piano-accidentals in a pianostaff then you issue
1386 @code{\pianoAccidentals} first thing after the creation of the piano
1390 \notes \relative c'' <
1391 \context Staff = sa @{ cis4 d e2 @}
1392 \context GrandStaff <
1394 \context Staff = sb @{ cis4 d e2 @}
1395 \context Staff = sc @{ es2 c @}
1397 \context Staff = sd @{ es2 c @}
1401 @lilypond[singleline]
1403 \notes \relative c'' <
1404 \context Staff = sa { cis4 d e2 }
1405 \context GrandStaff <
1407 \context Staff = sb { cis4 d e2 }
1408 \context Staff = sc { es2 c }
1410 \context Staff = sd { es2 c }
1415 minimumVerticalExtent = #'(-4.0 . 4.0)
1423 @item \defaultAccidentals
1424 @cindex @code{\defaultAccidentals}
1425 This is the default typesetting behaviour. It should correspond
1426 to 18th century common practice: Accidentals are
1427 remembered to the end of the measure in which they occur and
1428 only on their own octave.
1430 @item \voiceAccidentals
1431 @cindex @code{\voiceAccidentals}
1432 The normal behaviour is to remember the accidentals on
1434 This macro, however, typesets accidentals individually for each
1436 Apart from that the rule is similar to
1437 @code{\defaultAccidentals}.
1439 Warning: This leads to some weird and often unwanted results
1440 because accidentals from one voice DO NOT get cancelled in other
1442 @lilypond[singleline,relative,fragment,verbatim]
1445 \context Voice=va { \voiceOne es g }
1446 \context Voice=vb { \voiceTwo c, e }
1449 Hence you should only use @code{\voiceAccidentals}
1450 if the voices are to be read solely by
1451 individual musicians. if the staff should be readable also
1452 by one musician/conductor then you should use
1453 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1456 @item \modernAccidentals
1457 @cindex @code{\modernAccidentals}
1458 This rule should correspond to the common practice in the 20th
1460 The rule is a bit more complex than @code{\defaultAccidentals}:
1461 You get all the same accidentals, but temporary
1462 accidentals also get cancelled in other octaves. Further more,
1463 in the same octave, they also get cancelled in the following measure:
1464 @lilypond[singleline,fragment,verbatim]
1466 cis' c'' cis'2 | c'' c'
1469 @item \modernCautionaries
1470 @cindex @code{\modernCautionaries}
1471 This rule is similar to @code{\modernAccidentals}, but the
1472 ``extra'' accidentals (the ones not typeset by
1473 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1474 (i.e. in reduced size):
1475 @lilypond[singleline,fragment,verbatim]
1477 cis' c'' cis'2 | c'' c'
1480 @item \modernVoiceAccidentals
1481 @cindex @code{\modernVoiceAccidentals}
1482 Multivoice accidentals to be read both by musicians playing one voice
1483 and musicians playing all voices.
1485 Accidentals are typeset for each voice, but they ARE cancelled
1486 across voices in the same @internalsref{Staff}.
1488 @item \modernVoiceCautionaries
1489 @cindex @code{\modernVoiceCautionaries}
1490 The same as @code{\modernVoiceAccidentals}, but with the
1491 extra accidentals (the ones not typeset by
1492 @code{\voiceAccidentals}) typeset as cautionaries.
1493 Notice that even though all accidentals typeset by
1494 @code{\defaultAccidentals} ARE typeset by this macro then some
1495 of them are typeset as cautionaries.
1497 @item \pianoAccidentals
1498 @cindex @code{\pianoAccidentals}
1499 20th century practice for piano notation. Very similar to
1500 @code{\modernAccidentals} but accidentals also get cancelled
1501 across the staves in the same @internalsref{GrandStaff} or
1502 @internalsref{PianoStaff}.
1504 @item \pianoCautionaries
1505 @cindex @code{\pianoCautionaries}
1506 As @code{\pianoAccidentals} but with the extra accidentals
1507 typeset as cationaries.
1510 @cindex @code{\noResetKey}
1511 Same as @code{\defaultAccidentals} but with accidentals lasting
1512 ``forever'' and not only until the next measure:
1513 @lilypond[singleline,fragment,verbatim,relative]
1518 @item \forgetAccidentals
1519 @cindex @code{\forgetAccidentals}
1520 This is sort of the opposite of @code{\noResetKey}: Accidentals
1521 are not remembered at all - and hence all accidentals are
1522 typeset relative to the key signature, regardless of what was
1523 before in the music:
1524 @lilypond[singleline,fragment,verbatim,relative]
1526 \key d\major c4 c cis cis d d dis dis
1530 @node Defining your own accidental typesettings
1531 @subsection Defining your own accidental typesettings
1533 This section must be considered gurus-only, and hence it must be
1534 sufficient with a short description of the system and a reference to
1535 the internal documentation.
1537 The idea of the algorithm is to try several different rules and then
1538 use the rule that gives the highest number of accidentals.
1539 Each rule cosists of
1542 In which context is the rule applied. I.e. if context is
1543 @internalsref{Score} then all staves share accidentals, and if
1544 context is @internalsref{Staff} then all voices in the same
1545 staff share accidentals, but staves don't - like normally.
1547 Whether the accidental changes all octaves or only the current
1550 Over how many barlines the accidental lasts.
1551 If lazyness is @code{-1} then the accidental is forget
1552 immidiately, and if lazyness is @code{#t} then the accidental
1556 As described in the internal documentation of
1557 @reng{Accidental_engraver}, the properties @code{autoAccidentals} and
1558 @code{autoCautionaries} contain lists of rule descriptions. Notice
1559 that the contexts must be listed from in to out - that is
1560 @internalsref{Thread} before @internalsref{Voice},
1561 @internalsref{Voice} before @internalsref{Staff}, etc.
1562 see the macros in @file{ly/property-init.ly} for examples of how the
1567 Currently the simultaneous notes are considered to be entered in
1568 sequential mode. This means that in a chord the accidentals are
1569 typeset as if the notes in the chord happened one at a time - in the
1570 order in which they appear in the input file.
1572 Of course this is only a problem when you have simultainous notes
1573 which accidentals should depend on each other.
1574 Notice that the problem only occurs when using non-default accidentals
1575 - as the default accidentals only depend on other accidentals on the
1576 same staff and same pitch and hence cannot depend on other
1579 This example shows two examples of the same music giving different
1580 accidentals depending on the order in which the notes occur in the
1583 @lilypond[singleline,fragment,verbatim]
1584 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1585 cis'4 <c'' c'> r2 | cis'4 <c' c''> r2 | <cis' c''> r | <c'' cis'> r |
1588 The only solution is to manually insert the problematic
1589 accidentals using @code{!} and @code{?}.
1591 @node Expressive marks
1592 @section Expressive marks
1607 A slur indicates that notes are to be played bound or @emph{legato}.
1608 They are entered using parentheses:
1609 @lilypond[fragment,verbatim,center]
1610 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1613 See also @seeinternals{Slur}.
1615 Slurs avoid crossing stems, and are generally attached to note heads.
1616 However, in some situations with beams, slurs may be attached to stem
1617 ends. If you want to override this layout you can do this through the
1618 object property @code{attachment} of @internalsref{Slur} in
1619 @internalsref{Voice} context It's value is a pair of symbols, specifying
1620 the attachment type of the left and right end points.
1622 @lilypond[fragment,relative,verbatim]
1624 \property Voice.Stem \set #'length = #5.5
1626 \property Voice.Slur \set #'attachment = #'(stem . stem)
1630 If a slur would strike through a stem or beam, the slur will be moved
1631 away upward or downward. If this happens, attaching the slur to the
1632 stems might look better:
1634 @lilypond[fragment,relative,verbatim]
1637 \property Voice.Slur \set #'attachment = #'(stem . stem)
1642 Similarly, the curvature of a slur is adjusted to stay clear of note
1643 heads and stems. When that would increase the curvature too much, the
1644 slur is reverted to its default shape. The threshold for this
1645 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1646 It is loosely related to the enclosed area between the slur and the
1647 notes. Usually, the default setting works well, but in some cases you
1648 may prefer a curved slur when LilyPond decides for a vertically moved
1649 one. You can indicate this preference by increasing the
1650 @code{beautiful} value:
1652 @lilyp ond[verbatim,singleline,relative]
1654 c16( a' f' a a f a, )c,
1655 c( a' f' a a f d, )c
1656 \property Voice.Slur \override #'beautiful = #5.0
1657 c( a' f' a a f d, )c
1663 Producing nice slurs is a difficult problem, and LilyPond currently
1664 uses a simple, empiric method to produce slurs. In some cases, the
1665 results of this method are ugly.
1668 This is reflected by the
1669 @code{beautiful} property, which it is an arbitrary parameter in the
1670 slur formatter. Useful values can only be determined by trial and
1674 @cindex Adjusting slurs
1676 @node Phrasing slurs
1677 @subsection Phrasing slurs
1679 @cindex phrasing slurs
1680 @cindex phrasing marks
1682 A phrasing slur (or phrasing mark) connects chords and is used to
1683 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1686 @lilypond[fragment,verbatim,center,relative]
1687 \time 6/4 c' \( d () e f () e \) d
1690 Typographically, the phrasing slur behaves almost exactly like a normal
1691 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1692 similarily to normal slurs, phrasing slurs count as different objects.
1693 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1694 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1695 @code{\phrasingSlurBoth}.
1697 Note that the commands
1698 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1699 normal slurs and not phrasing slurs.
1702 @subsection Breath marks
1704 Breath marks are entered using @code{\breathe}. See also
1705 @seeinternals{BreathingSign}.
1707 @lilypond[fragment,relative]
1716 @cindex beats per minute
1717 @cindex metronome marking
1719 Metronome settings can be entered as follows:
1721 @cindex @code{\tempo}
1723 \tempo @var{duration} = @var{perminute}
1726 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1731 The tempo setting is not printed, but is only used in the MIDI
1732 output. You can trick lily into producing a metronome mark,
1733 though. Details are in @ref{Text markup}.
1738 @subsection Text spanners
1739 @cindex Text spanners
1741 Some textual indications, e.g. rallentando or accelerando, often extend
1742 over many measures. This is indicated by following the text with a
1743 dotted line. You can create such texts using text spanners. The syntax
1746 \spanrequest \start "text"
1747 \spanrequest \stop "text"
1749 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1750 in @internalsref{Voice} context). The string to be printed, as well as the
1751 style is set through object properties.
1753 An application---or rather, a hack---is to fake octavation indications.
1754 @lilypond[fragment,relative,verbatim]
1755 \relative c' { a''' b c a
1756 \property Voice.TextSpanner \set #'type = #'dotted-line
1757 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1758 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1759 \property Staff.centralCPosition = #-13
1760 a\spanrequest \start "text" b c a \spanrequest \stop "text" }
1778 @subsection Articulations
1779 @cindex Articulations
1781 @cindex articulations
1785 A variety of symbols can appear above and below notes to indicate
1786 different characteristics of the performance. They are added to a note
1787 by adding a dash and the the character signifying the
1788 articulation. They are demonstrated here.
1789 @lilypond[singleline]
1791 \notes \context Voice {
1792 \property Voice.TextScript \set #'font-family = #'typewriter
1793 \property Voice.TextScript \set #'font-shape = #'upright
1799 c''4-^_"c-\\^{ }" s4
1805 The script is automatically placed, but if you need to force
1806 directions, you can use @code{_} to force them down, or @code{^} to
1808 @lilypond[fragment, verbatim]
1813 Other symbols can be added using the syntax
1814 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1815 using @code{^} and @code{_}.
1819 @cindex staccatissimo
1828 @cindex organ pedal marks
1837 @cindex prallmordent
1841 @cindex thumb marking
1848 \property Score.LyricText \override #'font-family =#'typewriter
1849 \property Score.LyricText \override #'font-shape = #'upright
1850 \context Staff \notes {
1851 c''-\accent c''-\marcato c''-\staccatissimo c''^\fermata
1852 c''-\stopped c''-\staccato c''-\tenuto c''-\portato
1854 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1855 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1856 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1857 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1858 c''-\upmordent c''-\downmordent c''-\pralldown c''-\prallup
1859 c''-\lineprall c''-\thumb c''-\segno c''-\coda
1861 \context Lyrics \lyrics {
1862 accent__ marcato__ staccatissimo__ fermata
1863 stopped__ staccato__ tenuto__ portato
1865 downbow__ lheel__ rheel__ ltoe
1866 rtoe__ turn__ open__ flageolet
1867 reverseturn__ trill__ prall__ mordent
1868 prallprall__ prallmordent__ uprall__ downprall
1869 upmordent__ downmordent__ pralldown__ prallup__
1870 lineprall__ thumb__ segno__ coda
1874 linewidth = 5.875\in
1883 Fingering instructions can also be entered in this shorthand. For
1884 finger changes, use markup texts:
1886 @lilypond[verbatim, singleline, fragment]
1887 c'4-1 c'4-2 c'4-3 c'4-4
1892 @cindex @code{\script}
1897 See also @seeinternals{Script} and @seeinternals{Fingering}.
1901 All of these note ornaments appear in the printed output but have no
1902 effect on the MIDI rendering of the music.
1904 Unfortunately, there is no support for adding fingering instructions or
1905 ornaments to individual note heads. Some hacks exist, though. See
1906 @file{input/test/script-horizontal.ly}.
1911 @subsection Text scripts
1912 @cindex Text scripts
1914 In addition, it is possible to place arbitrary strings of text or markup
1915 text (see @ref{Text markup}) above or below notes by using a string:
1918 By default, these indications do not influence the note spacing, but
1919 by using the command @code{\fatText}, the widths will be taken into
1922 @lilypond[fragment,singleline,verbatim] \relative c' {
1923 c4^"longtext" \fatText c4_"longlongtext" c4 }
1926 It is possible to use @TeX{} commands in the strings, but this should be
1927 avoided because it makes it impossible for LilyPond to compute the
1928 exact length of the string, which may lead to collisions. Also, @TeX{}
1929 commands won't work with direct PostScript output.
1930 @c (see @ref{PostScript output}).
1932 Text scripts are created in form of @internalsref{TextScript} objects, in
1933 @internalsref{Voice} context.
1935 @ref{Text markup} describes how to change the font or access
1936 special symbols in text scripts.
1941 @subsection Grace notes
1945 @cindex @code{\grace}
1949 Grace notes are ornaments that are written out
1950 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
1954 In normal notation, grace notes are supposed to take up no logical
1955 time in a measure. Such an idea is practical for normal notation, but
1956 is not strict enough to put it into a program. The model that LilyPond
1957 uses for grace notes internally is that all timing is done in two
1960 Every point in musical time consists of two rational numbers: one
1961 denotes the logical time, one denotes the grace timing. The above
1962 example is shown here with timing tuples.
1965 \score { \notes \relative c''{
1966 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
1967 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
1969 \paper { linewidth = 8.\cm }
1973 The advantage of this approach is that you can use almost any lilypond
1974 construction together with grace notes, for example slurs and clef
1975 changes may appear halfway in between grace notes:
1977 @lilypond[relative=2,verbatim,fragment]
1978 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
1981 The placement of these grace notes is synchronized between different
1982 staves, using this grace timing.
1984 @lilypond[relative=2,verbatim,fragment]
1985 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
1986 \context Staff = SB { c4 \grace { g8 b } c4 } >
1990 Unbeamed eighth notes and shorter by default have a slash through the
1991 stem. This can be controlled with object property @code{stroke-style} of
1992 @internalsref{Stem}. The change in formatting is accomplished by
1993 inserting @code{\startGraceMusic} before handling the grace notes, and
1994 @code{\stopGraceMusic} after finishing the grace notes. You can add to
1995 these definitions to globally change grace note formatting. The
1996 standard definitions are in @file{ly/grace-init.ly}.
1998 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2003 @lilypond[fragment,verbatim]
2004 \relative c'' \context Voice {
2005 \grace c8 c4 \grace { [c16 c16] } c4
2007 \property Voice.Stem \override #'stroke-style = #'()
2009 \property Voice.Stem \revert #'stroke-style
2016 If you want to end a note with a grace note, then the standard trick
2017 is to put the grace notes before a phantom ``space note'', e.g.
2018 @lilypond[fragment,verbatim, relative=2]
2021 { s2 \grace { [c16 d] } } >
2026 A @code{\grace} section has some default values, and LilyPond will
2027 use those default values unless you specify otherwise inside the
2028 @code{\grace} section. For example, if you specify \slurUp
2029 @emph{before} your @code{\grace} section, a slur which starts inside
2030 the @code{\grace} won't be forced up, even if the slur ends outside
2031 of the @code{\grace}. Note the difference between the first and
2032 second bars in this example:
2034 @lilypond[fragment,verbatim]
2035 \relative c'' \context Voice {
2054 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2056 Grace note synchronization can also lead to surprises. Staff notation,
2057 such as key signatures, barlines, etc. are also synchronized. Take
2058 care when you mix staves with grace notes and staves without.
2060 @lilypond[relative=2,verbatim,fragment]
2061 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2062 \context Staff = SB { c4 \bar "|:" d4 } >
2065 Grace sections should only be used within sequential music
2066 expressions. Nesting, juxtaposing, or ending sequential music with a
2067 grace section is not supported, and might produce crashes or other
2072 @subsection Glissando
2075 @cindex @code{\glissando}
2077 A glissando line can be requested by attaching a @code{\glissando} to
2080 @lilypond[fragment,relative,verbatim]
2086 Printing of an additional text (such as @emph{gliss.}) must be done
2087 manually. See also @seeinternals{Glissando}.
2093 @subsection Dynamics
2106 @cindex @code{\ffff}
2116 Absolute dynamic marks are specified using an identifier after a
2117 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2118 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2119 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2120 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2122 @lilypond[verbatim,singleline,fragment,relative]
2123 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2129 @cindex @code{\decr}
2130 @cindex @code{\rced}
2136 A crescendo mark is started with @code{\cr} and terminated with
2137 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2138 started with @code{\decr} and terminated with @code{\rced}. There are
2139 also shorthands for these marks. A crescendo can be started with
2140 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2141 can be terminated with @code{\!}. Note that @code{\!} must go before
2142 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2143 after the last note. Because these marks are bound to notes, if you
2144 want several marks during one note, you have to use spacer notes.
2146 @lilypond[fragment,verbatim,center]
2147 c'' \< \! c'' d'' \decr e'' \rced
2148 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2151 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2152 is an example how to do it:
2154 @lilypond[fragment,relative=2,verbatim]
2155 c4 \cresc c4 \endcresc c4
2162 You can also supply your own texts:
2163 @lilypond[fragment,relative,verbatim]
2165 \property Voice.crescendoText = "cresc. poco"
2166 \property Voice.crescendoSpanner = #'dashed-line
2173 Dynamics are objects of @internalsref{DynamicText} and
2174 @internalsref{Hairpin}. Vertical positioning of these symbols is
2175 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2176 adjust padding or vertical direction of the dynamics, you must set
2177 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2178 identifiers to set the vertical direction are \dynamicUp and
2181 @cindex direction, of dynamics
2182 @cindex @code{\dynamicDown}
2183 @cindex @code{\dynamicUp}
2191 @cindex @code{\repeat}
2193 To specify repeats, use the @code{\repeat} keyword. Since repeats
2194 should work differently when played or printed, there are a few
2195 different variants of repeats.
2199 Repeated music is fully written (played) out. Useful for MIDI
2200 output, and entering repetitive music.
2203 This is the normal notation: Repeats are not written out, but
2204 alternative endings (voltas) are printed, left to right.
2207 Alternative endings are written stacked. This has limited use but may be
2208 used to typeset two lines of lyrics in songs with repeats, see
2209 @file{input/star-spangled-banner.ly}.
2215 Make beat or measure repeats. These look like percent signs.
2221 * Repeats and MIDI::
2222 * Manual repeat commands::
2224 * Tremolo subdivisions::
2229 @subsection Repeat syntax
2231 The syntax for repeats is
2234 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2237 If you have alternative endings, you may add
2238 @cindex @code{\alternative}
2240 \alternative @code{@{} @var{alternative1}
2242 @var{alternative3} @dots{} @code{@}}
2244 where each @var{alternative} is a music expression.
2246 Normal notation repeats are used like this:
2247 @lilypond[fragment,verbatim]
2249 \repeat volta 2 { c'4 d' e' f' }
2250 \repeat volta 2 { f' e' d' c' }
2253 With alternative endings:
2254 @lilypond[fragment,verbatim]
2256 \repeat volta 2 {c'4 d' e' f'}
2257 \alternative { {d'2 d'} {f' f} }
2260 Folded repeats look like this:
2263 @lilypond[fragment,verbatim]
2265 \repeat fold 2 {c'4 d' e' f'}
2266 \alternative { {d'2 d'} {f' f} }
2270 If you don't give enough alternatives for all of the repeats, then
2271 the first alternative is assumed to be repeated often enough to equal
2272 the specified number of repeats.
2274 @lilypond[fragment,verbatim]
2278 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2279 \alternative { { g4 g g } { a | a a a a | b2. } }
2284 @node Repeats and MIDI
2285 @subsection Repeats and MIDI
2287 @cindex expanding repeats
2289 For instructions on how to unfoldi repeats for MIDI output, see
2290 the example file @file{input/test/unfold-all-repeats.ly}.
2295 Notice that timing information is not remembered at the start of an
2296 alternative, so you have to reset timing information after a repeat,
2297 e.g. using a bar-check (See @ref{Bar check}), setting
2298 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2299 are also not repeated.
2301 It is possible to nest @code{\repeat}s, although this probably is only
2302 meaningful for unfolded repeats.
2304 Folded repeats offer little more over simultaneous music.
2306 @node Manual repeat commands
2307 @subsection Manual repeat commands
2309 @cindex @code{repeatCommands}
2311 The property @code{repeatCommands} can be used to control the layout of
2312 repeats. Its value is a Scheme list of repeat commands, where each repeat
2320 @item (volta . @var{text})
2321 Print a volta bracket saying @var{text}.
2323 Stop a running volta bracket
2326 @lilypond[verbatim, fragment]
2328 \property Score.repeatCommands = #'((volta "93") end-repeat)
2330 \property Score.repeatCommands = #'((volta #f))
2335 Repeats brackets are @internalsref{VoltaBracket} objects.
2337 @node Tremolo repeats
2338 @subsection Tremolo repeats
2339 @cindex tremolo beams
2341 To place tremolo marks between notes, use @code{\repeat} with tremolo
2343 @lilypond[verbatim,center,singleline]
2345 \context Voice \notes\relative c' {
2346 \repeat "tremolo" 8 { c16 d16 }
2347 \repeat "tremolo" 4 { c16 d16 }
2348 \repeat "tremolo" 2 { c16 d16 }
2349 \repeat "tremolo" 4 c16
2354 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2355 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2356 entered without @code{@{} and @code{@}}.
2360 Only powers of two and undotted notes are supported repeat counts.
2362 @node Tremolo subdivisions
2363 @subsection Tremolo subdivisions
2364 @cindex tremolo marks
2365 @cindex @code{tremoloFlags}
2367 Tremolo marks can be printed on a single note by adding
2368 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2369 A @var{length} value of 8 gives one line across the note stem. If the
2370 length is omitted, then then the last value (stored in
2371 @code{Voice.tremoloFlags}) is used.
2373 @lilypond[verbatim,fragment,center]
2374 c'2:8 c':32 | c': c': |
2380 Tremolos in this style do not carry over into the MIDI output.
2383 @node Measure repeats
2384 @subsection Measure repeats
2386 @cindex percent repeats
2387 @cindex measure repeats
2389 In the @code{percent} style, a note pattern can be repeated. It is
2390 printed once, and then the pattern is replaced with a special sign.
2391 Patterns of a one and two measures are replaced by percent-like signs,
2392 patterns that divide the measure length are replaced by slashes.
2394 @lilypond[verbatim,singleline]
2395 \context Voice { \repeat "percent" 4 { c'4 }
2396 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2400 The signs are represented by these objects: @internalsref{RepeatSlash} and
2401 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2405 You can not nest percent repeats, e.g. by filling in the first measure
2406 with slashes, and repeating that measure with percents.
2408 @node Rhythmic music
2409 @section Rhythmic music
2411 Sometimes you might want to show only the rhythm of a melody. This can
2412 be done with the rhythmic staff. All pitches of notes on such a staff
2413 are squashed, and the staff itself looks has a single staff line:
2415 @lilypond[fragment,relative,verbatim]
2416 \context RhythmicStaff {
2418 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2423 * Percussion staves::
2426 @node Percussion staves
2427 @subsection Percussion staves
2430 To typeset more than one piece of percussion to be played by the same
2431 musician one typically uses a multiline staff where each staff
2432 position refers to a specific piece of percussion.
2434 LilyPond is shipped with a bunch of scheme functions which allows you
2435 to do this fairly easily.
2437 The system is based on the general midi drum-pitches.
2438 In order to use the drum pitches you include
2439 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2440 variable @code{drum-pitch-names} - which definition can be read in
2441 @file{scm/drums.scm}. You see that each piece of percussion has a full
2442 name and an abbreviated name - and you may freely select whether to
2443 refer to the full name or the abbreviation in your music definition.
2445 To typeset the music on a staff you apply the scheme function
2446 @code{drums->paper} to the percussion music. This function takes a
2447 list of percussion instrument names, notehead scripts and staff
2448 positions (that is: pitches relative to the C-clef) and uses this to
2449 transform the input music by moving the pitch, changing the notehead
2450 and (optionally) adding a script:
2451 @lilypond[singleline,verbatim]
2452 \include "drumpitch-init.ly"
2453 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2454 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2456 \apply #(drums->paper 'drums) \context Staff <
2458 \context Voice = up { \voiceOne \up }
2459 \context Voice = down { \voiceTwo \down }
2464 In the above example the music was transformed using the list @code{'drums}.
2465 Currently the following lists are defined in @file{scm/drums.scm}:
2468 To typeset a typical drum kit on a five line staff.
2470 \include "drumpitch-init.ly"
2471 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2472 bd sn ss tomh tommh tomml toml tomfh tomfl }
2473 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2474 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2477 \apply #(drums->paper 'drums) \context Staff <
2481 \context Lyrics \nam
2486 \remove Bar_engraver
2487 \remove Time_signature_engraver
2488 minimumVerticalExtent = #'(-4.0 . 5.0)
2492 \remove Stem_engraver
2497 Notice that the scheme supports six different toms.
2498 If you are using fewer toms then you simply select the toms that produce
2499 the desired result - i.e. to get toms on the three middle lines you
2500 use @code{tommh}, @code{tomml} and @code{tomfh}.
2502 Because the general midi contain no rimshots we use the sidestick for
2503 this purpose instead.
2505 To typeset timbales on a two line staff.
2506 @lilypond[singleline]
2507 \include "drumpitch-init.ly"
2508 nam = \lyrics { timh ssh timl ssl cb }
2509 mus = \notes { timh ssh timl ssl cb s16 }
2512 \apply #(drums->paper 'timbales) \context Staff <
2516 \context Lyrics \nam
2521 \remove Bar_engraver
2522 \remove Time_signature_engraver
2523 StaffSymbol \override #'line-count = #2
2524 StaffSymbol \override #'staff-space = #2
2525 minimumVerticalExtent = #'(-3.0 . 4.0)
2529 \remove Stem_engraver
2536 To typeset congas on a two line staff.
2537 @lilypond[singleline]
2538 \include "drumpitch-init.ly"
2539 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2540 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2543 \apply #(drums->paper 'congas) \context Staff <
2547 \context Lyrics \nam
2552 \remove Bar_engraver
2553 \remove Time_signature_engraver
2554 StaffSymbol \override #'line-count = #2
2555 StaffSymbol \override #'staff-space = #2
2556 minimumVerticalExtent = #'(-3.0 . 4.0)
2560 \remove Stem_engraver
2566 To typeset bongos on a two line staff.
2567 @lilypond[singleline]
2568 \include "drumpitch-init.ly"
2569 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2570 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2573 \apply #(drums->paper 'bongos) \context Staff <
2577 \context Lyrics \nam
2582 \remove Bar_engraver
2583 \remove Time_signature_engraver
2584 StaffSymbol \override #'line-count = #2
2585 StaffSymbol \override #'staff-space = #2
2586 minimumVerticalExtent = #'(-3.0 . 4.0)
2590 \remove Stem_engraver
2596 To typeset all kinds of simple percussion on one line staves.
2597 @lilypond[singleline]
2598 \include "drumpitch-init.ly"
2599 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2600 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2603 \apply #(drums->paper 'percussion) \context Staff <
2607 \context Lyrics \nam
2612 \remove Bar_engraver
2613 \remove Time_signature_engraver
2614 StaffSymbol \override #'line-count = #1
2615 minimumVerticalExtent = #'(-2.0 . 3.0)
2619 \remove Stem_engraver
2626 If you don't like any of the predefined lists you can define your own
2627 list at the top of your file:
2629 @lilypond[singleline, verbatim]
2631 (bassdrum default #f ,(make-pitch -1 2 0))
2632 (snare default #f ,(make-pitch 0 1 0))
2633 (hihat cross #f ,(make-pitch 0 5 0))
2634 (pedalhihat xcircle "stopped" ,(make-pitch 0 5 0))
2635 (lowtom diamond #f ,(make-pitch -1 6 0))
2637 \include "drumpitch-init.ly"
2638 up = \notes { hh8 hh hh hh hhp4 hhp }
2639 down = \notes { bd4 sn bd toml8 toml }
2641 \apply #(drums->paper 'mydrums) \context Staff <
2643 \context Voice = up { \voiceOne \up }
2644 \context Voice = down { \voiceTwo \down }
2649 To use a modified existing list instead of building your own from
2650 scratch you can append your modifications to the start of the existing
2654 #(define mydrums (append `(
2655 (bassdrum default #f ,(make-pitch -1 2 0))
2656 (lowtom diamond #f ,(make-pitch -1 6 0))
2660 @c FIXME: Too many levels of headers when using subsubsections.
2661 @c Perhaps junk subsection ``Percussion staves''
2662 @subsubsection Percussion staves with normal staves
2663 When you include @file{drumpitch-init.ly} then the default pitches
2664 are overridden so that you after the inclusion cannot use the common
2665 dutch pitch names anymore. Hence you might wan't to reinclude
2666 @file{nederlands.ly} after the drum-pattern-definitions:
2667 @lilypond[singleline,verbatim]
2668 \include "drumpitch-init.ly"
2669 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2670 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2671 \include "nederlands.ly"
2672 bass = \notes \transpose c, { a4. e8 r e g e }
2675 \apply #(drums->paper 'drums) \context Staff = drums <
2677 \context Voice = up { \voiceOne \up }
2678 \context Voice = down { \voiceTwo \down }
2680 \context Staff = bass { \clef "F_8" \bass }
2685 @subsubsection Percussion midi output
2686 In order to produce correct midi output you need to produce two score
2687 blocks - one for the paper and one for the midi.
2688 To use the percussion channel you set the property @code{instrument}
2689 to @code{'drums}. Because the drum-pitches themself are similar to the
2690 general midi pitches all you have to do is to insert the voices with
2691 none of the scheme functions to get the correct midi output:
2695 \apply #(drums->paper 'mydrums) \context Staff <
2697 \context Voice = up @{ \voiceOne \up @}
2698 \context Voice = down @{ \voiceTwo \down @}
2704 \property Staff.instrument = #'drums
2713 This scheme is to be considered a temporary implementation. Even
2714 though the scheme will probably keep on working then the future might
2715 bring some other way of typesetting drums, and probably
2716 there will be made no great efforts in keeping things downwards
2721 @section Piano music
2723 Piano music is an odd type of notation. Piano staves are two normal
2724 staves coupled with a brace. The staves are largely independent, but
2725 sometimes voices can cross between the two staves. The
2726 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2727 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2728 other pianistic peculiarities.
2731 * Automatic staff changes::
2732 * Manual staff switches::
2735 * Voice follower lines::
2739 @c . {Automatic staff changes}
2740 @node Automatic staff changes
2741 @subsection Automatic staff changes
2742 @cindex Automatic staff changes
2744 Voices can switch automatically between the top and the bottom
2745 staff. The syntax for this is
2747 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2749 The autochanger switches on basis of pitch (central C is the turning
2750 point), and it looks ahead skipping over rests to switch rests in
2751 advance. Here is a practical example:
2753 @lilypond[verbatim,singleline]
2754 \score { \notes \context PianoStaff <
2755 \context Staff = "up" {
2756 \autochange Staff \context Voice = VA < \relative c' {
2757 g4 a b c d r4 a g } > }
2758 \context Staff = "down" {
2763 Spacer rests are used to prevent the bottom staff from
2764 terminating too soon.
2767 @node Manual staff switches
2768 @subsection Manual staff switches
2770 @cindex manual staff switches
2771 @cindex staff switch, manual
2773 Voices can be switched between staves manually, using the following command:
2775 \translator Staff = @var{staffname} @var{music}
2777 The string @var{staffname} is the name of the staff. It switches the
2778 current voice from its current staff to the Staff called
2779 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2787 Piano pedal instruction can be expressed using
2788 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2789 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2791 These identifiers are shorthands for spanner commands of the types
2792 @internalsref{Sustain}, @internalsref{UnaCorda} and @internalsref{Sostenuto}:
2794 @lilypond[fragment,verbatim]
2795 c''4 \spanrequest \start "Sustain" c''4
2796 c''4 \spanrequest \stop "Sustain"
2799 The symbols that are printed can be modified by setting
2800 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2801 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2802 @rgrob{SustainPedal}, for example, for more information.
2804 Pedals can also be indicated by a sequence of brackets, by setting the
2805 @code{pedal-type} property of SustainPedal objects:
2807 @lilypond[fragment,verbatim]
2808 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2809 c''4 \sustainDown d''4 e''4 a'4
2810 \sustainUp \sustainDown
2811 f'4 g'4 a'4 \sustainUp
2814 A third style of pedal notation is a mixture of text and brackets,
2815 obtained by setting @code{pedal-type} to @code{mixed}:
2817 @lilypond[fragment,verbatim]
2818 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2819 c''4 \sustainDown d''4 e''4 c'4
2820 \sustainUp \sustainDown
2821 f'4 g'4 a'4 \sustainUp
2824 The default '*Ped' style for sustain and damper pedals corresponds to
2825 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2826 for a sostenuto pedal:
2828 @lilypond[fragment,verbatim]
2829 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2832 For fine-tuning of the appearance of a pedal bracket, the properties
2833 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2834 @code{PianoPedalBracket} objects (see the detailed documentation of
2835 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2836 may be extended to the end of the note head.
2838 @lilypond[fragment,verbatim]
2839 \property Staff.PianoPedalBracket \override
2840 #'shorten-pair = #'(0 . -1.0)
2841 c''4 \sostenutoDown d''4 e''4 c'4
2842 f'4 g'4 a'4 \sostenutoUp
2849 @subsection Arpeggio
2852 @cindex broken arpeggio
2853 @cindex @code{\arpeggio}
2855 You can specify an arpeggio sign on a chord by attaching an
2856 @code{\arpeggio} to a note of the chord.
2859 @lilypond[fragment,relative,verbatim]
2860 \context Voice <c\arpeggio e g c>
2863 When an arpeggio crosses staves in piano music, you attach an arpeggio
2864 to the chords in both staves, and set
2865 @code{PianoStaff.connectArpeggios}.
2867 @lilypond[fragment,relative,verbatim]
2868 \context PianoStaff <
2869 \property PianoStaff.connectArpeggios = ##t
2870 \context Voice = one { <c'\arpeggio e g c> }
2871 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2875 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2876 are @code{PianoStaff.Arpeggio}.
2878 To add an arrow head to explicitly specify the direction of the
2879 arpeggio, you should set the arpeggio object property
2880 @code{arpeggio-direction}.
2882 @lilypond[fragment,relative,verbatim]
2884 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2886 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2891 A square bracket on the left indicates that the player should not
2892 arpeggiate the chord. To draw these brackets, set the
2893 @code{molecule-callback} property of @code{Arpeggio} or
2894 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2895 @code{\arpeggio} statements within the chords as before.
2897 @lilypond[fragment,relative,verbatim]
2898 \context PianoStaff <
2899 \property PianoStaff.connectArpeggios = ##t
2900 \property PianoStaff.Arpeggio \override
2901 #'molecule-callback = \arpeggioBracket
2902 \context Voice = one { <c'\arpeggio e g c> }
2903 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2910 It is not possible to mix connected arpeggios and unconnected
2911 arpeggios in one PianoStaff at the same time.
2915 @node Voice follower lines
2916 @subsection Voice follower lines
2918 @cindex follow voice
2919 @cindex staff switching
2922 @cindex @code{followVoice}
2924 Whenever a voice switches to another staff a line connecting the notes
2925 can be printed automatically. This is enabled if the property
2926 @code{PianoStaff.followVoice} is set to true:
2928 @lilypond[fragment,relative,verbatim]
2929 \context PianoStaff <
2930 \property PianoStaff.followVoice = ##t
2931 \context Staff \context Voice {
2933 \translator Staff=two
2936 \context Staff=two {\clef bass \skip 1*2 }
2940 The associated object is @internalsref{VoiceFollower}.
2946 Tablature notation is used for notating music for plucked string
2947 instruments. It notates pitches not by using note heads, but by
2948 indicating on which string and fret a note must be played. LilyPond
2949 offers limited support for tablature.
2952 * Tablatures basic::
2953 * Non-guitar tablatures::
2954 * Tablature in addition to normal staff::
2957 @node Tablatures basic
2958 @subsection Tablatures basic
2959 @cindex Tablatures basic
2961 Tablature can be typeset with Lilypond by using the
2962 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
2963 tablature is a recent feature in Lilypond, most of the guitar special
2964 effects such as bend are not yet supported.
2966 With the @internalsref{TabStaff}, the string number associated to a note
2967 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
2968 quarter on the third string. By default, string 1 is the highest one, and the
2969 tuning defaults to the standard guitar tuning (with 6 strings).
2971 @lilypond[fragment,verbatim]
2980 If you do not specify a string number then lilypond automatically selects one.
2981 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
2982 simply selects the first string that does not give a fret number less than
2983 @code{minimumFret}. Default is 0.
2985 Notice that LilyPond does not handle chords in any special way, and hence
2986 the automatic string selector may easily select the same string to two notes in a chord.
2989 e8 fis gis a b cis' dis' e'
2990 \property TabStaff.minimumFret = #8
2991 e8 fis gis a b cis' dis' e'
2996 e8 fis gis a b cis' dis' e'
2997 \property TabStaff.minimumFret = #8
2998 e8 fis gis a b cis' dis' e'
3001 \context StaffGroup <
3002 \context Staff { \clef "G_8" \frag }
3003 \context TabStaff { \frag }
3008 @node Non-guitar tablatures
3009 @subsection Non-guitar tablatures
3010 @cindex Non-guitar tablatures
3012 There are many ways to customize Lilypond tablatures.
3014 First you can change the number of strings, by setting the number of
3015 lines in the @internalsref{TabStaff} (the @code{line-count} property
3016 of TabStaff can only be changed using @code{\outputproperty}, for more
3017 information, see @ref{Tuning per object}. You can change the strings
3018 tuning. A string tuning is given as a Scheme list with one integer
3019 number for each string, the number being the pitch of an open string.
3021 (The numbers specified for stringTuning are the numbers of semitons
3022 to subtract --- or add --- starting the specified pitch by default
3023 middle C, in string order: thus the notes are e, a, d & g)
3025 @lilypond[fragment,verbatim]
3028 \outputproperty #(make-type-checker 'staff-symbol-interface)
3030 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3033 a,4 c' a e' e c' a e'
3039 Finally, it is possible to change the Scheme function to format the
3040 tablature note text. The default is @var{fret-number-tablature-format},
3041 which uses the fret number, but for some instruments that may not use
3042 this notation, just create your own tablature-format function. This
3043 function takes three argument: the string number, the string tuning and
3047 @node Tablature in addition to normal staff
3048 @subsection Tablature in addition to normal staff
3049 @cindex Tablature in addition to normal staff
3051 It is possible to typeset both tablature and a "normal" staff, as
3052 commonly done in many parts.
3054 A common trick for that is to put the notes in a variables, and to hide
3055 the fingering information (which correspond to the string number) for
3059 @c @lily pond[verbatim]
3066 \context StaffGroup <
3068 % Hide fingering number
3069 \property Staff.Fingering \override #'transparent = ##t
3074 \property Staff.Stem \override #'direction = #1
3088 LilyPond has support for both entering and printing chords.
3089 @lilypond[verbatim,singleline]
3090 twoWays = \notes \transpose c'' {
3100 < \context ChordNames \twoWays
3101 \context Voice \twoWays > }
3104 This example also shows that the chord printing routines do not try to
3105 be intelligent. If you enter @code{f bes d}, it does not interpret
3106 this as an inversion.
3108 As you can see chords really are a set of pitches. They are internally
3109 stored as simultaneous music expressions. This means you can enter
3110 chords by name and print them as notes, enter them as notes and print
3111 them as chord names, or (the most common case) enter them by name, and
3116 * Printing named chords::
3121 @subsection Chords mode
3124 Chord mode is a mode where you can input sets of pitches using common
3125 names. It is introduced by the keyword @code{\chords}. It is similar
3126 to note mode, but words are also looked up in a chord modifier table
3127 (containing @code{maj}, @code{dim}, etc). Dashes and carets are used
3128 to indicate chord additions and subtractions, so articulation scripts
3129 can not be entered in Chord mode.
3131 Throughout these examples, chords have been shifted around the staff
3132 using @code{\transpose}.
3134 @lilypond[fragment,verbatim]
3138 c:9 c:9-.5+.7+ c:3-.5-
3148 The second type of modifier that may appear after the @code{:} is a
3149 named modifier. Named modifiers are listed in the file
3150 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
3151 @code{min} which lower the 3rd half a step, `@code{aug}' which
3152 raises the 5th, `@code{dim}' which lowers the 5th,
3153 `@code{maj}' which adds a raised 7th, and `@code{sus}'
3154 which replaces the 5th with a 4th.
3156 @lilypond[fragment,verbatim]
3159 c1:m c:min7 c:maj c:aug c:dim c:sus
3165 Chord subtractions are used to eliminate notes from a chord. The
3166 notes to be subtracted are listed after a @code{^} character,
3169 @lilypond[fragment,verbatim,center]
3178 Chord inversions can be specified by appending `@code{/}' and the name
3179 of a single note to a chord. In a chord inversion, the inverted note is
3180 transposed down until it is the lowest note in the chord. If the note
3181 is not in the chord, a warning will be printed.
3183 @lilypond[fragment,verbatim,center]
3193 Bass notes can be added by `@code{/+}' and
3194 the name of a single note to a chord. This has the effect of
3195 adding the specified note to the chord, lowered by an octave,
3196 so it becomes the lowest note in the chord.
3198 @lilypond[fragment,verbatim,center]
3207 The formal syntax for named chords is as follows:
3209 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
3212 @var{tonic} should be the tonic note of the chord, and @var{duration} is
3213 the chord duration in the usual notation. There are two kinds of
3214 modifiers. One type is formed by @emph{chord additions}. Additions are
3215 obtained by listing intervals separated by dots. An interval is written
3216 by its number with an optional @code{+} or @code{-} to indicate raising
3217 or lowering by half a step. Chord additions have two effects: they adds
3218 the specified interval and all lower odd numbered intervals to the
3219 chord, and they may lower or raise the specified interval.
3224 Implementation details are gory. For example @code{c:4} not only adds
3225 a fourth, but also removes the third.
3228 @c . {Printing named chords}
3229 @node Printing named chords
3230 @subsection Printing named chords
3232 @cindex printing chord names
3236 For displaying printed chord names, use the @internalsref{ChordNames} context.
3237 The chords may be entered either using the notation described above, or
3238 directly using simultaneous music.
3240 @lilypond[verbatim,singleline]
3242 \chords {a1 b c} <d f g> <e g b>
3246 \context ChordNames \scheme
3247 \context Staff \transpose c'' \scheme
3252 You can make the chord changes stand out by setting
3253 @code{ChordNames.chordChanges} to true. This will only display chord
3254 names when there's a change in the chords scheme and at the start of a
3259 c1:m c:m \break c:m c:m d
3263 \context ChordNames {
3264 \property ChordNames.chordChanges = ##t
3266 \context Staff \transpose c'' \scheme
3268 \paper{linewidth= 9.\cm}
3272 LilyPond examines chords specified as lists of notes to determine a name
3273 to give the chord. LilyPond will not try to identify chord inversions or
3274 an added bass note, which may result in strange chord names when chords
3275 are entered as a list of pitches:
3277 @lilypond[verbatim,center,singleline]
3286 \context ChordNames \scheme
3287 \context Staff \scheme
3293 By default, a chord name system proposed by Harald Banter (See
3294 @ref{Literature}) is used. The system is very regular and predictable.
3295 Typical American style chord names may be selected by setting the
3296 @code{style} property of the @code{ChordNames.ChordName} object to
3297 @code{'american}. Similarly @code{'jazz} selects Jazz chordnames.
3299 Routines that determine the names to be printed are written in Scheme,
3300 and may be customized by the user. The code can be found in
3301 @file{scm/chord-name.scm}. Here's an example showing the differences in
3305 @c maybe just junk verbatim option?
3306 @lilypond[verbatim,singleline]
3316 \context ChordNames = banter \scheme
3317 \context ChordNames = american {
3318 \property ChordNames.ChordName \override
3319 #'style = #'american \scheme }
3320 \context ChordNames = jazz {
3321 \property ChordNames.ChordName \override
3322 #'style = #'jazz \scheme }
3323 \context Staff \transpose c'' \scheme
3330 @section Writing parts
3332 Orchestral music involves some special notation, both in the full score,
3333 as in the individual parts. This section explains how to tackle common
3334 problems in orchestral music.
3341 * Instrument names::
3343 * Multi measure rests::
3344 * Automatic part combining::
3345 * Hara kiri staves::
3346 * Sound output for transposing instruments::
3349 @c . {Rehearsal marks}
3350 @node Rehearsal marks
3351 @subsection Rehearsal marks
3352 @cindex Rehearsal marks
3354 @cindex @code{\mark}
3356 To print a rehearsal mark, use the @code{\mark} command.
3357 @lilypond[fragment,verbatim]
3368 As you can see, the mark is incremented automatically if you use
3369 @code{\mark \default}. The value to use is stored in the property
3370 @code{rehearsalMark} is used and automatically incremented. The object
3371 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3372 @code{input/test/boxed-molecule.ly} if you need boxes around the
3375 The @code{\mark} command can also be used to put signs like coda,
3376 segno and fermatas on a barline. The trick is to use the text markup
3377 mechanism to access the fermata symbol.
3378 @lilypond[fragment,verbatim,relative=1]
3379 c1 \mark #'(music "scripts-ufermata")
3383 The problem is that marks that occur at a line break are typeset only
3384 at the beginning of the next line, opposite to what you want for the
3385 fermata. This can be corrected by the following property setting
3387 \property Score.RehearsalMark \override
3388 #'visibility-lambda = #begin-of-line-invisible
3394 @cindex barlines, putting symbols on
3398 @subsection Bar numbers
3402 @cindex measure numbers
3403 @cindex currentBarNumber
3405 Bar numbers are printed by default at the start of the line. The
3406 number itself is a property that can be set by modifying the
3407 @code{currentBarNumber} property, i.e.
3409 \property Score.currentBarNumber = #217
3412 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3413 you need to change the grob property @code{break-visibility} as well as the translator
3414 property @code{barNumberVisibility}, as illustrated in the following example which also
3415 adds a box around the bar numbers:
3417 \property Score.BarNumber \override #'break-visibility =
3418 #end-of-line-invisible
3419 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3420 \property Score.BarNumber \override #'molecule-callback =
3421 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3422 \property Score.BarNumber \override #'font-relative-size = #0
3426 \context Staff \notes \transpose c''' {
3427 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3428 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3429 \property Score.BarNumber \override #'molecule-callback =
3430 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3431 \property Score.BarNumber \override #'font-relative-size = #0
3433 \repeat unfold 16 c1 \bar "|."
3438 See also @seeinternals{BarNumber}.
3442 Barnumbers can collide with the StaffGroup, if there is one at the
3443 top. To solve this, You have to twiddle with the
3444 @internalsref{padding} property of @internalsref{BarNumber} if your
3445 score starts with a @internalsref{StaffGroup}.
3447 @node Instrument names
3448 @subsection Instrument names
3450 In scores, the instrument name is printed before the staff. This can
3451 be done by setting @code{Staff.instrument} and
3452 @code{Staff.instr}. This will print a string before the start of the
3453 staff. For the first start, @code{instrument} is used, for the next
3454 ones @code{instr} is used.
3456 @lilypond[verbatim,singleline]
3457 \property Staff.instrument = "ploink " { c''4 }
3460 You can also use markup texts to construct more complicated instrument
3464 @lilypond[verbatim,singleline]
3466 '((font-relative-size . -2 ) (music "accidentals--1")))
3469 \property Staff.instrument = #`((kern . 0.5) (lines
3470 "2 Clarinetti" (columns " (B" ,text-flat ")")))
3478 When you put a name on a grand staff or piano staff the width of the
3479 brace is not taken into account. You must add extra spaces to the end of
3480 the name to avoid a collision.
3483 @subsection Transpose
3485 @cindex transposition of pitches
3486 @cindex @code{\transpose}
3488 A music expression can be transposed with @code{\transpose}. The syntax
3491 \transpose @var{pitch} @var{musicexpr}
3494 This means that middle C in @var{musicexpr} is transposed to
3497 @code{\transpose} distinguishes between enharmonic pitches: both
3498 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
3499 a tone. The first version will print sharps and the second version
3502 @lilypond[singleline, verbatim]
3503 mus =\notes { \key d \major cis d fis g }
3504 \score { \notes \context Staff {
3512 If you want to use both @code{\transpose} and @code{\relative}, then
3513 you must use @code{\transpose} first. @code{\relative} will have no
3514 effect music that appears inside a @code{\transpose}.
3516 @c . {Multi measure rests}
3517 @node Multi measure rests
3518 @subsection Multi measure rests
3519 @cindex Multi measure rests
3523 Multi measure rests are entered using `@code{R}'. It is specifically
3524 meant for full bar rests and for entering parts: the rest can expand to
3526 rests, or it can be printed as a single multimeasure rest This expansion
3527 is controlled by the property @code{Score.skipBars}. If this is set to true,
3528 Lily will not expand empty measures, and the appropriate number is added
3531 @lilypond[fragment,verbatim]
3532 \time 3/4 r2. | R2. | R2.*2
3533 \property Score.skipBars = ##t R2.*17 R2.*4
3536 Notice that the @code{R2.} is printed as a whole rest, centered in the
3539 @cindex whole rests for a full measure
3541 The object for this object is @internalsref{MultiMeasureRest}.
3545 Currently, there is no way to automatically condense multiple rests
3546 into a single multimeasure rest. Multi measure rests do not take part
3549 @cindex condensing rests
3551 @node Automatic part combining
3552 @subsection Automatic part combining
3553 @cindex automatic part combining
3554 @cindex part combiner
3557 Automatic part combining is used to merge two parts of music onto a
3558 staff in an intelligent way. It is aimed primarily at typesetting
3559 orchestral scores. When the two parts are identical for a period of
3560 time, only one is shown. In places where the two parts differ, they
3561 are typeset as separate voices, and stem directions are set
3562 automatically. Also, solo and @emph{a due} parts can be identified
3565 The syntax for part combining is
3568 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3570 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3571 combined into one context of type @var{context}. The music expressions
3572 must be interpreted by contexts whose names should start with @code{one}
3575 The most useful function of the part combiner is to combine parts into
3576 one voice, as common for wind parts in orchestral scores:
3578 @lilypond[verbatim,singleline,fragment]
3580 \context Voice=one \partcombine Voice
3581 \context Thread=one \relative c'' {
3584 \context Thread=two \relative c'' {
3590 Notice that the first @code{g} appears only once, although it was
3591 specified twice (once in each part). Stem, slur and tie directions are
3592 set automatically, depending whether there is a solo or unisono. The
3593 first part (with context called @code{one}) always gets up stems, and
3594 `solo', while the second (called @code{two}) always gets down stems and
3597 If you just want the merging parts, and not the textual markings, you
3598 may set the property @var{soloADue} to false.
3600 @lilypond[verbatim,singleline,fragment]
3602 \property Staff.soloADue = ##f
3603 \context Voice=one \partcombine Voice
3604 \context Thread=one \relative c'' {
3607 \context Thread=two \relative c'' {
3613 There are a number of other properties that you can use to tweak the
3614 behavior of part combining, refer to the automatically generated
3615 documentation of @reng{Thread_devnull_engraver} and
3616 @reng{Voice_devnull_engraver}. Look at the documentation of the
3617 responsible engravers, @code{Thread_devnull_engraver},
3618 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3622 In @code{soloADue} mode, when the two voices play the same notes on and
3623 off, the part combiner may typeset @code{a2} more than once in a
3626 @lilypond[fragment,singleline]
3628 \context Voice=one \partcombine Voice
3629 \context Thread=one \relative c'' {
3632 \context Thread=two \relative c'' {
3638 @cindex @code{Thread_devnull_engraver}
3639 @cindex @code{Voice_engraver}
3640 @cindex @code{A2_engraver}
3642 @node Hara kiri staves
3643 @subsection Hara kiri staves
3645 In orchestral scores, staff lines that only have rests are usually removed.
3646 This saves some space. LilyPond also supports this through the hara
3647 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
3648 the Japanese Samourai warriors.} staff. This staff commits suicide when
3649 it finds itself to be empty after the line-breaking process. It will
3650 not disappear when it contains normal rests, you must use multi measure
3653 The hara kiri staff is specialized version of the @internalsref{Staff}
3654 context. It is available as the context identifier
3655 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3656 example disappears in the second line.
3660 \notes \relative c' <
3661 \context Staff = SA { e4 f g a \break c1 }
3662 \context Staff = SB { c4 d e f \break R1 }
3666 \translator { \HaraKiriStaffContext }
3672 @node Sound output for transposing instruments
3673 @subsection Sound output for transposing instruments
3675 When you want to make a MIDI file from a score containing transposed
3676 and untransposed instruments, you have to instruct LilyPond the pitch
3677 offset (in semitones) for the transposed instruments. This is done
3678 using the @code{transposing} property. It does not affect printed
3681 @cindex @code{transposing}
3684 \property Staff.instrument = #"Cl. in B-flat"
3685 \property Staff.transposing = #-2
3691 @node Ancient notation
3692 @section Ancient notation
3694 @cindex Vaticana, Editio
3695 @cindex Medicaea, Editio
3701 * Ancient note heads::
3709 @node Ancient note heads
3710 @subsection Ancient note heads
3712 To get a longa note head, you have to use mensural note heads. This
3713 is accomplished by setting the @code{style} property of the
3714 NoteHead object to @code{mensural}. There is also a note head style
3715 @code{baroque} which gives mensural note heads for @code{\longa} and
3716 @code{\breve} but standard note heads for shorter notes.
3718 @lilypond[fragment,singleline,verbatim]
3719 \property Voice.NoteHead \set #'style = #'mensural
3724 @subsection Ancient clefs
3726 LilyPond supports a variety of clefs, many of them ancient.
3728 For modern clefs, see section @ref{Clef}. For the percussion clef, see
3729 section @ref{Percussion staves}. For the @code{TAB} clef, see section
3732 The following table shows all ancient clefs that are supported via the
3733 @code{\clef} command. Some of the clefs use the same glyph, but differ
3734 only with respect to the line they are printed on. In such cases, a
3735 trailing number in the name is used to enumerate these clefs. Still,
3736 you can manually force a clef glyph to be typeset on an arbitrary line,
3737 as described in section @ref{Clef}. The note printed to the right side
3738 of each clef denotes the @code{c'} with respect to the clef.
3742 @c --- This should go somewhere else: ---
3743 @c @item modern style G clef (glyph: @code{clefs-G})
3746 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
3748 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
3750 @c @item modern style F clef (glyph: @code{clefs-F})
3753 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
3755 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
3757 @c @item modern style C clef (glyph: @code{clefs-C})
3760 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
3761 @c @code{tenor}, @code{baritone}
3763 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
3765 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
3768 @code{neo_mensural_c1}, @code{neo_mensural_c2},
3769 @code{neo_mensural_c3}, @code{neo_mensural_c4}
3771 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
3773 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
3779 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
3781 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
3787 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
3789 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
3795 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
3797 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
3803 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
3805 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
3811 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
3813 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
3818 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
3820 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
3825 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
3827 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
3830 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
3833 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
3835 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
3840 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
3842 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
3847 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
3849 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
3852 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
3854 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
3856 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
3859 @code{vaticana_fa1}, @code{vaticana_fa2}
3861 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
3863 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
3866 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
3868 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
3870 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
3873 @code{medicaea_fa1}, @code{medicaea_fa2}
3875 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
3877 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
3880 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
3882 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
3884 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
3887 @code{hufnagel_fa1}, @code{hufnagel_fa2}
3889 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
3891 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
3894 @code{hufnagel_do_fa}
3896 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
3898 @c --- This should go somewhere else: ---
3899 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
3902 @c @code{percussion}
3904 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
3906 @c @item modern style tab clef (glyph: @code{clefs-tab})
3911 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
3915 @emph{Modern style} means ``as is typeset in current editions of
3916 transcribed mensural music''.
3918 @emph{Petrucci style} means ``inspired by printings published by the
3919 famous engraver Petrucci (1466-1539)''.
3921 @emph{Historic style} means ``as was typeset or written in contemporary
3922 historic editions (other than those of Petrucci)''.
3924 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
3926 Petrucci used C clefs with differently balanced left-side vertical
3927 beams, depending on which staffline it was printed.
3930 @subsection Custodes
3935 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
3936 staff context symbol that appears at the end of a staff line. It
3937 anticipates the pitch of the first note(s) of the following line and
3938 thus helps the player or singer to manage line breaks during
3939 performance, thus enhancing readability of a score.
3944 \property Staff.Custos \set #'style = #'mensural
3949 \consists Custos_engraver
3955 Custodes were frequently used in music notation until the 17th century.
3956 There were different appearances for different notation styles.
3957 Nowadays, they have survived only in special forms of musical notation
3958 such as via the @emph{editio vaticana} dating back to the beginning of
3961 For typesetting custodes, just put a @code{Custos_engraver} into the
3962 @internalsref{Staff} context when declaring the @code{\paper} block. In this
3963 block, you can also globally control the appearance of the custos symbol
3964 by setting the custos @code{style} property. Currently supported styles
3965 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
3972 \consists Custos_engraver
3973 Custos \override #'style = #'mensural
3978 The property can also be set locally, for example in a @code{\notes}
3983 \property Staff.Custos \override #'style = #'vaticana
3984 c'1 d' e' d' \break c' d' e' d'
3989 @subsection Ligatures
3993 @c TODO: Should double check if I recalled things correctly when I wrote
3994 @c down the following paragraph by heart.
3995 In musical terminology, a ligature is a coherent graphical symbol that
3996 represents at least two different notes. Ligatures originally appeared
3997 in the manuscripts of Gregorian chant notation roughly since the 9th
3998 century as an allusion to the accent symbols of greek lyric poetry to
3999 denote ascending or descending sequences of notes. Both, the shape and
4000 the exact meaning of ligatures changed tremendously during the following
4001 centuries: In early notation, ligatures where used for monophonic tunes
4002 (Gregorian chant) and very soon denoted also the way of performance in
4003 the sense of articulation. With upcoming multiphony, the need for a
4004 metric system arised, since multiple voices of a piece have to be
4005 synchronized some way. New notation systems were invented, that used
4006 the manifold shapes of ligatures to now denote rhythmical patterns
4007 (e.g. black mensural notation, mannered notation, ars nova). With the
4008 invention of the metric system of the white mensural notation, the need
4009 for ligatures to denote such patterns disappeared. Nevertheless,
4010 ligatures were still in use in the mensural system for a couple of
4011 decades until they finally disappeared during the late 16th / early 17th
4012 century. Still, ligatures have survived in contemporary editions of
4013 Gregorian chant such as the Editio Vaticana from 1905/08.
4015 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4016 Some ligature styles (such as Editio Vaticana) may need additional input
4017 syntax specific for this particular type of ligature. By default, the
4018 @internalsref{LigatureBracket} engraver just marks the start and end of
4019 a ligature by small square angles:
4021 @lilypond[singleline,verbatim]
4023 \notes \transpose c'' {
4031 To select a specific style of ligatures, a proper ligature engraver has
4032 to be added to the @internalsref{Voice} context, as explained in the
4033 following subsections. Currently, Lilypond only supports white mensural
4034 ligatures with certain limitations. Support for Editio Vaticana will be
4035 added in the future.
4038 * White mensural ligatures::
4041 @node White mensural ligatures
4042 @subsubsection White mensural ligatures
4044 @cindex Mensural ligatures
4045 @cindex White mensural ligatures
4047 Lilypond has limited support for white mensural ligatures. The
4048 implementation is still experimental; it currently may output strange
4049 warnings or even crash in some cases or produce weird results on more
4050 complex ligatures. To engrave white mensural ligatures, in the paper
4051 block the @internalsref{MensuralLigature} engraver has to be put into
4052 the @internalsref{Voice} context (and you probably want to remove the
4053 @internalsref{LigatureBracket} engraver). There is no additional input
4054 language to describe the shape of a white mensural ligature. The shape
4055 is rather determined solely from the pitch and duration of the enclosed
4056 notes. While this approach may take a new user quite a while to get
4057 accustomed, it has a great advantage: this way, lily has full musical
4058 information about the ligature. This is not only required for correct
4059 MIDI output, but also allows for automatic transcription of the
4064 @lilypond[singleline,verbatim]
4066 \notes \transpose c'' {
4067 \property Score.timing = ##f
4068 \property Score.defaultBarType = "empty"
4069 \property Voice.NoteHead \set #'style = #'neo_mensural
4070 \property Staff.TimeSignature \set #'style = #'neo_mensural
4072 \[ g\longa c\breve a\breve f\breve d'\longa \]
4074 \[ e1 f1 a\breve g\longa \]
4079 \remove Ligature_bracket_engraver
4080 \consists Mensural_ligature_engraver
4086 Without replacing @code{Ligature_bracket_engraver} with
4087 @code{Mensural_ligature_engraver}, the same music transcribes to the
4090 @lilypond[singleline,verbatim]
4092 \notes \transpose c'' {
4093 \property Score.timing = ##f
4094 \property Score.defaultBarType = "empty"
4095 \property Voice.NoteHead \set #'style = #'neo_mensural
4096 \property Staff.TimeSignature \set #'style = #'neo_mensural
4098 \[ g\longa c\breve a\breve f\breve d'\longa \]
4100 \[ e1 f1 a\breve g\longa \]
4106 @subsection Figured bass
4108 @cindex Basso continuo
4110 LilyPond has limited support for figured bass:
4112 @lilypond[verbatim,fragment]
4114 \context FiguredBass
4119 \context Voice { c4 g8 }
4123 The support for figured bass consists of two parts: there is an input
4124 mode, introduced by @code{\figures}, where you can enter bass figures
4125 as numbers, and there is a context called @internalsref{FiguredBass}
4126 that takes care of making @internalsref{BassFigure} objects.
4128 In figures input mode, a group of bass figures is delimited by
4129 @code{<} and @code{>}. The duration is entered after the @code{>}.
4134 \context FiguredBass
4138 Accidentals are added to the numbers if you alterate them by
4139 appending @code{-}, @code{!} and @code{+}.
4145 \context FiguredBass
4146 \figures { <4- 6+ 7!> }
4149 Spaces or dashes may be inserted by using @code{_}. Brackets are
4150 introduced with @code{[} and @code{]}.
4156 \context FiguredBass
4157 \figures { < [4 6] 8 [_ 12]> }
4160 Although the support for figured bass may superficially resemble chord
4161 support, it works much simpler: in figured bass simply stores the
4162 numbers, and then prints the numbers you entered. There is no
4163 conversion to pitches, and no realizations of the bass are played in
4167 @c . {Tuning output}
4169 @section Tuning output
4171 LilyPond tries to take as much formatting as possible out of your
4172 hands. Nevertheless, there are situations where it needs some help, or
4173 where you want to override its decisions. In this section we discuss
4174 ways to do just that.
4176 Formatting is internally done by manipulating so called objects (graphic
4177 objects). Each object carries with it a set of properties (object
4178 properties) specific to that object. For example, a stem object has
4179 properties that specify its direction, length and thickness.
4181 The most direct way of tuning the output is by altering the values of
4182 these properties. There are two ways of doing that: first, you can
4183 temporarily change the definition of a certain type of object, thus
4184 affecting a whole set of objects. Second, you can select one specific
4185 object, and set a object property in that object.
4188 * Tuning groups of objects ::
4189 * Tuning per object ::
4194 @node Tuning groups of objects
4195 @subsection Tuning groups of objects
4197 @cindex object description
4201 A object definition is a Scheme association list, that is stored in a
4202 context property. By assigning to that property (using plain
4203 @code{\property}), you can change the resulting objects.
4205 @lilypond[verbatim, fragment]
4206 c'4 \property Voice.Stem = #'()
4209 The @code{\property} assignment effectively empties the definition of
4210 the Stem object. One of the effects is that the recipe of how it should be
4211 printed is erased, with the effect of rendering it invisible. The above
4212 assignment is available as a standard identifier, for the case that you
4216 \property Voice.Stem = \turnOff
4223 This mechanism is fairly crude, since you can only set, but not modify,
4224 the definition of a object. For this reason, there is a more advanced
4227 The definition of a object is actually a list of default object
4228 properties. For example, the definition of the Stem object (available in
4229 @file{scm/grob-description.scm}), defines the following values for
4234 (beamed-lengths . (0.0 2.5 2.0 1.5))
4235 (Y-extent-callback . ,Stem::height)
4239 You can add a property on top of the existing definition, or remove a
4240 property, thus overriding the system defaults:
4242 c'4 \property Voice.Stem \override #'thickness = #4.0
4243 c'4 \property Voice.Stem \revert #'thickness
4246 You should balance @code{\override} and @code{\revert}. If that's too
4247 much work, you can use the @code{\set} shorthand. It performs a revert
4248 followed by an override. The following example gives exactly the same
4249 result as the previous one.
4251 c'4 \property Voice.Stem \set #'thickness = #4.0
4252 c'4 \property Voice.Stem \set #'thickness = #0.8
4255 If you use @code{\set}, you must explicitly restore the default.
4258 Formally the syntax for these constructions is
4260 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4261 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4262 \property @var{context}.@var{grobname} \revert @var{symbol}
4264 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4265 and @var{grobname} are strings and @var{value} is a Scheme expression.
4268 If you revert a setting which was not set in the first place, then it
4269 has no effect. However, if the setting was set as a system default, it
4270 may remove the default value, and this may give surprising results,
4271 including crashes. In other words, @code{\override} and @code{\revert},
4272 must be carefully balanced.
4274 These are examples of correct nesting of @code{\override}, @code{\set},
4277 A clumsy but correct form:
4279 \override \revert \override \revert \override \revert
4282 Shorter version of the same:
4284 \override \set \set \revert
4287 A short form, using only @code{\set}. This requires you to know the
4290 \set \set \set \set @var{to default value}
4293 If there is no default (i.e. by default, the object property is unset),
4296 \set \set \set \revert
4299 For the digirati, the object description is an Scheme association
4300 list. Since a Scheme list is a singly linked list, we can treat it as a
4301 stack, and @code{\override} and @code{\revert} are just push and pop
4302 operations. This pushing and popping is also used for overriding
4303 automatic beaming settings.
4307 LilyPond will hang or crash if @var{value} contains cyclic references.
4308 The backend is not very strict in type-checking object properties. If you
4309 @code{\revert} properties that are expected to be set by default,
4315 @node Tuning per object
4316 @subsection Tuning per object
4319 Tuning a single object is most often done with @code{\property}. The
4322 \once \property @dots{}
4325 applies a setting only during one moment in the score: notice how the
4326 original setting for stem thickness is restored automatically in the
4329 @lilypond[verbatim, fragment, relative=1]
4331 \once \property Voice.Stem \set #'thickness = #4
4337 @cindex \outputproperty
4339 A second way of tuning objects is the more arcane @code{\outputproperty}
4340 feature. The syntax is as follows:
4342 \outputproperty @var{predicate} @var{symbol} = @var{value}
4344 Here @code{predicate} is a Scheme function taking a object argument, and
4345 returning a boolean. This statement is processed by the
4346 @code{Output_property_engraver}. It instructs the engraver to feed all
4347 objects that it sees to @var{predicate}. Whenever the predicate returns
4348 true, the object property @var{symbol} will be set to @var{value}.
4350 This command is only single shot, in contrast to @code{\override} and
4353 You will need to combine this statement with @code{\context} to select
4354 the appropriate context to apply this to.
4356 In the following example, all note heads occurring at current staff
4357 level, are shifted up and right by setting their @code{extra-offset}
4360 @lilypond[fragment,verbatim,singleline]
4362 \context Staff \outputproperty
4363 #(make-type-checker 'note-head-interface)
4364 #'extra-offset = #'(0.5 . 0.75)
4368 @cindex @code{extra-offset}
4370 In this example, the predicate checks the @code{text} object property, to
4371 shift only the `m.d.' text, but not the fingering instruction "2".
4372 @lilypond[verbatim,singleline]
4373 #(define (make-text-checker text)
4374 (lambda (grob) (equal? text (ly-get-grob-property grob 'text))))
4377 \notes\relative c''' {
4378 \property Voice.Stem \set #'direction = #1
4379 \outputproperty #(make-text-checker "m.d.")
4380 #'extra-offset = #'(-3.5 . -4.5)
4388 If possible, avoid this feature: the semantics are not very clean, and
4389 the syntax and semantics are up for rewrite.
4394 @node Font selection
4395 @subsection Font selection
4397 The most common thing to change about the appearance of fonts is
4398 their size. The font size of a @internalsref{Voice},
4399 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4400 changed by setting the @code{fontSize} property for that context:
4401 @lilypond[fragment,relative=1]
4402 c4 c4 \property Voice.fontSize = #-1
4405 This command will not change the size of variable symbols, such as
4406 beams or slurs. You can use this command to get smaller symbol for
4407 cue notes, but that involves some more subtleties. An elaborate
4408 example of those is in @file{input/test/cue-notes.ly}.
4414 The font used for printing a object can be selected by setting
4415 @code{font-name}, e.g.
4417 \property Staff.TimeSignature
4418 \set #'font-name = #"cmr17"
4420 You may use any font which is available to @TeX{}, such as foreign
4421 fonts or fonts that do not belong to the Computer Modern font family.
4422 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4423 can also be adjusted with a more fine-grained mechanism. By setting
4424 the object properties described below, you can select a different font.
4425 All three mechanisms work for every object that supports
4426 @code{font-interface}.
4430 A symbol indicating the general class of the typeface. Supported are
4431 @code{roman} (Computer Modern), @code{braces} (for piano staff
4432 braces), @code{music} (the standard music font), @code{ancient} (the
4433 ancient notation font) @code{dynamic} (font for dynamic signs) and
4437 A symbol indicating the shape of the font, there are typically several
4438 font shapes available for each font family. Choices are @code{italic},
4439 @code{caps} and @code{upright}
4442 A symbol indicating the series of the font. There are typically several
4443 font series for each font family and shape. Choices are @code{medium}
4446 @item font-relative-size
4447 A number indicating the size relative the standard size. For example,
4448 with 20pt staff height, relative size -1 corresponds to 16pt staff
4449 height, and relative size +1 corresponds to 23 pt staff height.
4451 @item font-design-size
4452 A number indicating the design size of the font.
4454 This is a feature of the Computer Modern Font: each point size has a
4455 slightly different design. Smaller design sizes are relatively wider,
4456 which enhances readability.
4459 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4460 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4461 to override default setting, which are always present. For example:
4463 \property Lyrics.LyricText \override #'font-series = #'bold
4464 \property Lyrics.LyricText \override #'font-family = #'typewriter
4465 \property Lyrics.LyricText \override #'font-shape = #'*
4468 @cindex @code{font-style}
4470 There are also pre-cooked font selection qualifiers. These are
4471 selected through the object property @code{font-style}. For example,
4472 the style @code{finger} selects family @code{number} and relative size
4473 @code{-3}. Styles available include @code{volta}, @code{finger},
4474 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4475 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4476 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4477 to this file for more information.
4479 @cindex magnification
4481 The size of the font may be scaled with the object property
4482 @code{font-magnification}. For example, @code{2.0} blows up all
4483 letters by a factor 2 in both directions.
4487 Relative size is not linked to any real size.
4489 There is no style sheet provided for other fonts besides the @TeX{}
4490 family, and the style sheet can not be modified easiyl.
4492 @cindex font selection
4493 @cindex font magnification
4494 @cindex @code{font-interface}
4498 @subsection Text markup
4502 LilyPond has an internal mechanism to typeset texts. You can
4503 form text markup expressions by composing scheme expressions
4504 in the following way.
4506 @lilypond[verbatim, singleline]
4511 c^#'(italic "italic")
4512 d_#'((bold italic) "ff")
4514 f_#'(lines "one" (bold "two"))
4515 g^#'(music "noteheads-2" ((raise . 2.4) "flags-u3"))
4519 Normally, the Scheme markup text is stored in the @code{text} property
4520 of a object. Formally, it is defined as follows:
4523 text: string | (head? text+)
4524 head: markup | (markup+)
4525 markup-item: property | abbrev
4526 property: (@var{key} . @var{value})
4527 abbrev: @code{columns lines roman music bold italic named super sub}
4528 @code{overstrike text finger volta timesig mmrest mark script}
4529 @code{large Large dynamic}
4532 The markup is broken down and converted into a list of object properties,
4533 which are prepended to the property list. The @var{key}-@var{value}
4534 pair is a object property. A list of properties available is included in
4535 the generated documentation for @internalsref{text-interface}.
4537 The following abbreviations are defined:
4540 horizontal mode: set all text on one line (default)
4542 vertical mode: set every text on a new line
4546 selects the Feta font (the standard font for music notation glyphs),
4547 and uses named lookup
4554 lookup by character name
4556 plain text lookup (by character value)
4562 the next text or character overstrikes this one
4564 select fingering number fontstyle
4566 select volta number fontstyle
4568 select time signature number fontstyle
4570 select multi measure rest number fontstyle
4572 select mark number fontstyle
4574 select scriptsize roman fontstyle
4576 select large roman fontstyle
4578 select Large roman fontstyle
4580 select dynamics fontstyle
4584 @cindex metronome mark
4586 One practical application of complicated markup is to fake a metronome
4590 #(define note '(columns
4591 (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
4592 #(define eight-note `(columns ,note ((kern . -0.1)
4593 (music ((raise . 3.5) "flags-u3")))))
4594 #(define dotted-eight-note
4595 `(columns ,eight-note (music "dots-dot")))
4598 \notes\relative c'' {
4599 a1^#`((columns (font-relative-size . -1))
4600 ,dotted-eight-note " = 64")
4606 TextScript \override #'font-shape = #'upright
4614 The syntax and semantics of markup texts are not clean, and both
4615 syntax and semantics are slated for a rewrite.
4617 LilyPond does not do kerning, and there generally spaces texts
4623 @section Global layout
4625 The global layout determined by three factors: the page layout, the
4626 line breaks and the spacing. These all influence each other: The
4627 choice of spacing determines how densely each system of music is set,
4628 where line breaks breaks are chosen, and thus ultimately how many
4629 pages a piece of music takes. In this section we will explain how the
4630 lilypond spacing engine works, and how you can tune its results.
4632 Globally spoken, this procedure happens in three steps: first,
4633 flexible distances (``springs'') are chosen, based on durations. All
4634 possible line breaking combination are tried, and the one with the
4635 best results---a layout that has uniform density and requires as
4636 little stretching or cramping as possible---is chosen. When the score
4637 is processed by @TeX{}, page are filled with systems, and page breaks
4638 are chosen whenever the page gets full.
4641 * Vertical spacing::
4642 * Horizontal spacing::
4649 @node Vertical spacing
4650 @subsection Vertical spacing
4652 @cindex vertical spacing
4653 @cindex distance between staves
4654 @cindex staff distance
4655 @cindex between staves, distance
4657 The height of each system is determined automatically by lilypond, to
4658 keep systems from bumping into each other, some minimum distances are
4659 set. By changing these, you can put staves closer together, and thus
4660 put more systems onto one page.
4662 Normally staves are stacked vertically. To make
4663 staves maintain a distance, their vertical size is padded. This is
4664 done with the property @code{minimumVerticalExtent}. It takes a pair
4665 of numbers, so if you want to make it smaller from its, then you could
4668 \property Staff.minimumVerticalExtent = #'(-4 . 4)
4670 This sets the vertical size of the current staff to 4 staff-space on
4671 either side of the center staff line. The argument of
4672 @code{minimumVerticalExtent} is interpreted as an interval, where the
4673 center line is the 0, so the first number is generally negative. you
4674 could also make the staff larger at the bottom by setting it to
4675 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
4677 Vertical aligment of staves is handled by the
4678 @internalsref{VerticalAlignment} object, which lives at
4679 @internalsref{Score} level.
4681 The piano staves are handled a little differently: to make cross-staff
4682 beaming work correctly, it necessary that the distance between staves
4683 is fixed. This is also done with a @internalsref{VerticalAlignment}
4684 object, created in @internalsref{PianoStaff}, but a forced distance is
4685 set. This is done with the object property #'forced-distance. If you
4686 want to override this, use a @code{\translator} block as follows:
4690 VerticalAlignment \override #'forced-distance = #9
4693 This would bring the staves together at a distance of 9 staff spaces,
4694 and again this is measured from the center line of each staff.
4698 @node Horizontal spacing
4699 @subsection Horizontal Spacing
4701 The spacing engine translates differences in durations into
4702 stretchable distances (``springs'') of differing lengths. Longer
4703 durations get more space, shorter durations get less. The basis for
4704 assigning spaces to durations, is that the shortest durations get a
4705 fixed amount of space, and the longer durations get more: doubling a
4706 duration adds a fixed amount of space to the note.
4708 For example, the following piece contains lots of half, quarter and
4709 8th notes, the eighth note is followed by 1 note head width. The The
4710 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
4711 @lilypond[fragment, verbatim, relative=1]
4712 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
4715 These two amounts of space are @code{shortest-duration-space}
4716 @code{spacing-increment}, object properties of
4717 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
4718 set to 1.2, which is the width of a note head, and
4719 @code{shortest-duration-space} is set to 2.0, meaning that the
4720 shortest note gets 2 noteheads of space. For normal notes, this space
4721 is always counted from the left edge of the symbol, so the short notes
4722 in a score is generally followed by one note head width of space.
4724 If one would follow the above procedure exactly, then adding a single
4725 32th note to a score that uses 8th and 16th notes, would widen up the
4726 entire score a lot. The shortest note is no longer a 16th, but a 64th,
4727 thus adding 2 noteheads of space to every note. To prevent this, the
4728 shortest duration for spacing is not the shortest note in the score,
4729 but the most commonly found shortest note. Notes that are even
4730 shorter this are followed by a space that is proportonial to their
4731 duration relative to the common shortest note. So if we were to add
4732 only a few 16th notes to the example above, they would be followed by
4735 @lilypond[fragment, verbatim, relative=1]
4736 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
4739 The most common shortest duration is determined as follows: in every
4740 measure, the shortest duration is determined. The most common short
4741 duration, is taken as the basis for the spacing, with the stipulation
4742 that this shortest duration should always be equal to or shorter than
4743 1/8th note. The shortest duration is printed when you run lilypond
4744 with @code{--verbose}. These durations may also be customized. If you
4745 set the @code{common-shortest-duration} in
4746 @internalsref{SpacingSpanner}, then this sets the base duration for
4747 spacing. The maximum duration for this base (normally 1/8th), is set
4748 through @code{base-shortest-duration}.
4750 @cindex @code{common-shortest-duration}
4751 @cindex @code{base-shortest-duration}
4752 @cindex @code{stem-spacing-correction}
4753 @cindex @code{spacing}
4755 In the introduction it was explained that stem directions influence
4756 spacing. This is controlled with @code{stem-spacing-correction} in
4757 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
4758 same property for controlling the stem/barline spacing. In the
4759 following example shows these corrections, once with default settings,
4760 and once with exaggerated corrections.
4766 \property Staff.NoteSpacing \override #'stem-spacing-correction
4768 \property Staff.StaffSpacing \override #'stem-spacing-correction
4773 \paper { linewidth = -1. } }
4780 Spacing is determined on a score wide basis. If you have a score that
4781 changes its character (measured in durations) half way during the
4782 score, the part containing the longer durations will be spaced too
4785 Generating optically pleasing spacing is black magic. LilyPond tries
4786 to deal with a number of frequent cases. Here is an example that is
4787 not handled correctly, due to the combination of chord collisions and
4792 \context PianoStaff \notes \transpose c''' <
4793 \context Staff = up { s1 }
4794 \context Staff = down { [c8 c \translator Staff=up <c d> c
4795 \translator Staff=down c c c] }
4797 \paper { linewidth = -1 }
4804 @subsection Font size
4805 @cindex font size, setting
4806 @cindex staff size, setting
4807 @cindex @code{paper} file
4809 The Feta font provides musical symbols at seven different sizes.
4810 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
4811 point, and 26 point. The point size of a font is the height of the
4812 five lines in a staff when displayed in the font.
4814 Definitions for these sizes are the files @file{paperSZ.ly}, where
4815 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
4816 of these files, the identifiers @code{paperEleven},
4817 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
4818 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
4819 are defined respectively. The default @code{\paper} block is also
4820 set. These files should be imported at toplevel, i.e.
4822 \include "paper26.ly"
4826 The font definitions are generated using a Scheme function. For more
4827 details, see the file @file{scm/font.scm}.
4832 @subsection Line breaking
4835 @cindex breaking lines
4837 Line breaks are normally computed automatically. They are chosen such
4838 that it looks neither cramped nor loose, and that consecutive lines have
4841 Occasionally you might want to override the automatic breaks; you can
4842 do this by specifying @code{\break}. This will force a line break at
4843 this point. Line breaks can only occur at places where there are bar
4844 lines. If you want to have a line break where there is no bar line,
4845 you can force an invisible bar line by entering @code{\bar
4846 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
4850 @cindex regular line breaks
4851 @cindex four bar music.
4853 If you want linebreaks at regular intervals, you can use the following:
4855 < \repeat 7 unfold @{ s1 * 4 \break @}
4859 This makes the following 28 measures (assuming 4/4 time) be broken every
4863 @subsection Page layout
4866 @cindex breaking pages
4868 @cindex @code{indent}
4869 @cindex @code{linewidth}
4871 The most basic settings influencing the spacing are @code{linewidth}
4872 and @code{indent}, both set in the @code{\paper} block. They control
4873 the indentation of the first line of music, and the lengths of the
4874 lines. If @code{linewidth} set to a negative value, a single
4875 unjustified line is produced. A similar effect for scores that are
4876 longer than one line, can be produced by setting @code{raggedright} to
4877 true in the @code{\paper} block.
4881 The page layout process happens outside lilypond. Ly2dvi sets page
4882 layout instructions. Ly2dvi responds to the following variables in the
4883 @code{\paper} block. The variable @code{textheight} sets the total
4884 height of the music on each page. The spacing between systems is
4885 controlled with @code{interscoreline}, its default is 16pt.
4886 The distance between the score lines will stretch in order to fill the
4887 full page @code{interscorelinefill} is set to a positive number. In
4888 that case @code{interscoreline} specifies the minimum spacing.
4890 @cindex @code{textheight}
4891 @cindex @code{interscoreline}
4892 @cindex @code{interscorelinefill}
4894 If the variable @code{lastpagefill} is defined (that is, it gets any
4895 value assigned in the @code{\paper} block), systems are evenly
4896 distributed vertically on the last page. This might produce ugly
4897 results in case there are not enough systems on the last page. Note
4898 that @command{lilypond-book} ignores @code{lastpagefill}. See
4899 @ref{Integrating text and music with lilypond-book} for
4902 @cindex @code{lastpagefill}
4904 Page breaks are normally computed by @TeX{}, so they are not under
4905 direct control of LilyPond. However, you can insert a commands into
4906 the @file{.tex} output to instruct @TeX{} where to break pages. You
4907 can insert a @code{\newpage} from within lilypond. This is done by
4908 setting the @code{between-systems-strings} on the
4909 @internalsref{NonMusicalPaperColumn} where the system is broken.
4913 @cindex @code{papersize}
4915 To change the paper size, you must first set the
4916 @code{papersize} paper variable variable. Set it to
4917 the strings @code{a4}, @code{letter}, or @code{legal}. After this
4918 specification, you must set the font as described above. If you want
4919 the default font, then use the 20 point font.
4922 \paper@{ papersize = "a4" @}
4923 \include "paper16.ly"
4926 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
4927 will set the paper variables @code{hsize} and @code{vsize} (used by
4928 Lilypond and @code{ly2dvi})
4938 LilyPond can produce MIDI output. The performance lacks lots of
4939 interesting effects, such as swing, articulation, slurring, etc., but it
4940 is good enough for proof-hearing the music you have entered. Ties,
4941 dynamics and tempo changes are interpreted.
4943 Dynamic marks, crescendi and decrescendi translate into MIDI volume
4944 levels. Dynamic marks translate to a fixed fraction of the available
4945 MIDI volume range, crescendi and decrescendi make the the volume vary
4946 linearly between their two extremities. The fractions be adjusted by
4947 overriding the @code{absolute-volume-alist} defined in
4948 @file{scm/midi.scm}.
4950 For each type of musical instrument (that MIDI supports), a volume range
4951 can be defined. This gives you basic equalizer control, which can
4952 enhance the quality of the MIDI output remarkably. You can add
4953 instruments and ranges or change the default settings by overriding the
4954 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
4956 Both loudness controls are combined to produce the final MIDI volume.
4962 * MIDI instrument names::
4967 @subsection MIDI block
4971 The MIDI block is analogous to the paper block, but it is somewhat
4972 simpler. The @code{\midi} block can contain:
4976 @item a @code{\tempo} definition
4977 @item context definitions
4980 Assignments in the @code{\midi} block are not allowed.
4984 @cindex context definition
4986 Context definitions follow precisely the same syntax as within the
4987 \paper block. Translation modules for sound are called performers.
4988 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
4991 @node MIDI instrument names
4992 @subsection MIDI instrument names
4994 @cindex instrument names
4995 @cindex @code{Staff.midiInstrument}
4996 @cindex @code{Staff.instrument}
4998 The MIDI instrument name is set by the @code{Staff.midiInstrument}
4999 property or, if that property is not set, the @code{Staff.instrument}
5000 property. The instrument name should be chosen from the list in
5001 @ref{MIDI instruments}.
5005 If the selected string does not exactly match, then LilyPond uses the
5006 default (Grand Piano). It is not possible to select an instrument by