version that you are working on. See TRANSLATION for details.
@end ignore
-@c \version "2.11.38"
+@c \version "2.11.51"
@node Tweaking output
@chapter Tweaking output
@ref{Contexts and engravers}. Here for reference is a list
of the most common object and property types together with
the conventions for naming them and a couple of examples of
-some real names. We have used A to stand for any capitalized
-alphabetic character and aaa to stand for any number of
+some real names. We have used @q{A} to stand for any capitalized
+alphabetic character and @q{aaa} to stand for any number of
lower-case alphabetic characters. Other characters are used
verbatim.
@multitable @columnfractions .33 .33 .33
@headitem Object/property type
@tab Naming convention
- @tab Example
+ @tab Examples
@item Contexts
@tab Aaaa or AaaaAaaaAaaa
@tab Staff, GrandStaff
We have already met the commands @code{\set} and @code{\with},
used to change the properties of @strong{contexts} and to remove
and add @strong{engravers}, in
-@ref{Modifying context properties} and @ref{Adding
+@ref{Modifying context properties}, and @ref{Adding
and removing engravers}. We now must meet some more important
commands.
The general syntax of this command is:
@example
-\override @emph{context}.@emph{layout_object}
- #'@emph{layout_property} = #@emph{value}
+\override @var{Context}.@var{LayoutObject} #'@var{layout-property} = #@var{value}
@end example
@noindent
-This will set the property with the name @emph{layout_property}
+This will set the property with the name @var{layout-property}
of the layout object with the name
-@emph{layout_object}, which is a member of the @emph{context}
-context, to the value @emph{value}.
+@var{LayoutObject}, which is a member of the @var{Context}
+context, to the value @var{value}.
-The @emph{context} can be omitted (and usually is) when the
+The @var{Context} can be omitted (and usually is) when the
required context is unambiguously implied and is one of lowest
level contexts, i.e., @code{Voice}, @code{ChordNames} or
@code{Lyrics}, and we shall omit it in many of the following
commands have been issued.
@example
-\revert @emph{context}.@emph{layout_object} #'@emph{layout_property}
+\revert @var{Context}.@var{LayoutObject} #'@var{layout-property}
@end example
-Again, just like @emph{context} in the @code{\override} command,
-@emph{context} is often not needed. It will be omitted
+Again, just like @var{Context} in the @code{\override} command,
+@var{Context} is often not needed. It will be omitted
in many of the following examples. Here we revert the color
of the note head to the default value for the final two notes:
item in the input stream.
Here's an example. Suppose we wish to change the size of the
-middle note (the E) in a C major chord. Let's first see what
+middle note head (the E) in a C major chord. Let's first see what
@code{\once \override} would do:
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
<c e g>
@end lilypond
-We see the override affects @emph{all} the notes in the chord.
+We see the override affects @emph{all} the note heads in the chord.
This is because all the notes of a chord occur at the same
@emph{musical moment}, and the action of @code{\once} is to
apply the override to all layout objects of the type specified
The @code{\tweak} command operates in a different way. It acts
on the immediately following item in the input stream. However,
it is effective only on objects which are created directly from
-the input stream, essentially note heads and articulations.
-(Objects such as stems and accidentals are created later and
-cannot be tweaked in this way). Furthermore, when it is applied
+the input stream, essentially note heads and articulations;
+objects such as stems and accidentals are created later and
+cannot be tweaked in this way. Furthermore, when it is applied
to note heads these @emph{must} be within a chord, i.e., within
single angle brackets, so to tweak a single note the @code{\tweak}
command must be placed inside single angle brackets with the
layout object should be specified; in fact, it would generate
an error to do so. These are both implied by the following
item in the input stream. So the general syntax of the
-@code{\tweak} command is simply:
+@code{\tweak} command is simply
@example
-\tweak #'@emph{layout_property} = #@emph{value}
+\tweak #'@var{layout-property} = #@var{value}
@end example
A @code{\tweak} command can also be used to modify just one in
-\tweak #'color #green _Green
@end lilypond
+@noindent
Note that the @code{\tweak} command must be preceded by an
articulation mark as if it were an articulation itself.
}
@end lilypond
-You can find more details of the @code{\tweak} command in
-@ruser{Objects connected to the input}.
-
-If nested tuplets do not begin at the same moment their
+If nested tuplets do not begin at the same moment, their
appearance may be modified in the usual way with
@code{\override} commands:
}
@end lilypond
+@seealso
+
+Notation Reference:
+@ruser{The tweak command}.
+
@node The Internals Reference manual
@section The Internals Reference manual
Let's use a concrete example with a simple fragment of real
music:
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
+@lilypond[quote,verbatim,relative=2]
{
\time 6/8
{
The IR for the version of LilyPond you are using may be found
on the LilyPond website at @uref{http://lilypond.org}. Go to the
documentation page and click on the Internals Reference link.
-For learning purposes you should use the standard html version,
+For learning purposes you should use the standard HTML version,
not the @q{one big page} or the PDF. For the next few
paragraphs to make sense you will need to actually do this
as you read.
version of LilyPond, in alphabetic order. Select the link to
Slur, and the properties of Slurs are listed.
-(An alternative way of finding this page is from the Notation
-Reference. On one of the pages that deals with slurs you may
-find a link to the Internals Reference. This link will
-take you directly to this page, but often it is easier to go
-straight to the IR and search there.)
+An alternative way of finding this page is from the Notation
+Reference. On one of the pages that deals with slurs you may find a
+link to the Internals Reference. This link will take you directly to
+this page, but if you have an idea about the name of the layout object
+to be tweaked, it is easier to go straight to the IR and search there.
-This Slur page in the IR tells us first that Slur objects are
-created by the
-Slur_engraver. Then it lists the standard settings. Note
-these are @strong{not} in alphabetic order. Browse down
-them looking for a property that might control the heaviness
-of slurs, and you should find
+This Slur page in the IR tells us first that Slur objects are created
+by the Slur_engraver. Then it lists the standard settings. Note
+these are @strong{not} in alphabetic order. Browse down them looking
+for a property that might control the heaviness of slurs, and you
+should find
@example
@code{thickness} (number)
answer is, @q{Within the music, before the first slur and
close to it.} Let's do that:
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
+@lilypond[quote,verbatim,relative=2]
{
\time 6/8
{
@code{\once} must be
repositioned as follows:
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
+@lilypond[quote,verbatim,relative=2]
{
\time 6/8
{
@code{\once} placed immediately before each of the notes where
the slurs begin:
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
+@lilypond[quote,verbatim,relative=2]
{
\time 6/8
{
to return the @code{thickness} property to its default value
after the second slur:
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
+@lilypond[quote,verbatim,relative=2]
{
\time 6/8
{
practice in extracting information from it. These examples will
contain progressively fewer words of guidance and explanation.
+
@node Properties found in interfaces
@subsection Properties found in interfaces
@tab @code{2.5}, @code{0.34}
@item Direction
@tab A valid direction constant or its numerical equivalent
- @tab @code{#LEFT}, @code{#CENTER}, @code{#UP},
+ @tab @code{LEFT}, @code{CENTER}, @code{UP},
@code{1}, @code{-1}
@item Integer
@tab A positive whole number
@code{#f}
@item Vector
@tab A list of three items enclosed in brackets and preceded
-by a hash sign, @code{#}.
- @tab @code{#(#t #t #f)}
+by apostrophe-hash, @code{'#}.
+ @tab @code{'#(#t #t #f)}
@end multitable
@node Appearance of objects
These control respectively whether bar lines are printed at
the end of a line, in the middle of lines, and at the beginning
of lines. For our example we want all bar lines to be suppressed,
-so the value we need is @code{#(#f #f #f)}.
+so the value we need is @code{'#(#f #f #f)}.
Let's try that, remembering
to include the @code{Staff} context. Note also that in writing
-this value we have two hash signs before the opening bracket.
-One is required as part of the value to introduce a vector,
-and one is required, as always, to precede the value itself in
-the @code{\override} command.
+this value we have @code{#'#} before the opening bracket.
+The @code{'#} is required as part of the value to introduce a
+vector, and the first @code{#} is required, as always, to precede
+the value itself in the @code{\override} command.
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
- \override Staff.BarLine #'break-visibility = ##(#f #f #f)
+ \override Staff.BarLine #'break-visibility = #'#(#f #f #f)
c4 b8 c d16 c d8 |
g, a16 b8 c d4 e16 |
e8
page in the IR that the @code{transparent} property is a boolean.
This
should be set to @code{#t} to make the grob transparent.
-In this next example let us make the time signature invisible
-rather than the bar lines.
+In this next example let us make the time signature invisible
+rather than the bar lines.
To do this we need to find the grob name for the time signature.
Back to
the @q{All layout objects} page in the IR to find the properties
@end lilypond
@noindent
-The time signature is gone, but this command leaves a gap where
+The time signature is gone, but this command leaves a gap where
the time signature should be. Maybe this is what is wanted for
-an exercise for the student to fill it in, but in other
-circumstances a gap might be undesirable. To remove it, the
+an exercise for the student to fill it in, but in other
+circumstances a gap might be undesirable. To remove it, the
stencil for the time signature should be set to @code{#f}
instead:
@subheading color
@cindex color property
-Finally we could make the bar lines invisible by coloring
-them white. The @code{grob-interface} specifies that the
+Finally let us try making the bar lines invisible by coloring
+them white. (There is a difficulty with this in that the
+white bar line may or may not blank out the staff lines where
+they cross. You may see in some of the examples below that this
+happens unpredictably. The details of why this is so and how to
+control it are covered in @ruser{Painting objects white}. But at
+the moment we are learning about color, so please just accept this
+limitation for now.)
+
+The @code{grob-interface} specifies that the
color property value is a list, but there is no
explanation of what that list should be. The list it
requires is actually a list of values in internal units,
a symbol, but a @emph{function}. When called, it provides
the list of internal values required to set the color to
white. The other colors in the normal list are functions
-too. To convince yourself this is working you might like
+too. To convince yourself this is working you might like
to change the color to one of the other functions in the
list.
There is yet a third function, one which converts RGB values into
internal colors -- the @code{rgb-color} function. This takes
-three arguments giving the intensities of the red, green and
+three arguments giving the intensities of the red, green and
blue colors. These take values in the range 0 to 1. So to
set the color to red the value should be @code{(rgb-color 1 0 0)}
and to white it should be @code{(rgb-color 1 1 1)}:
@tab Up/Right
@tab Revert
@tab Effect
-@item @code{\arpeggioDown}
- @tab @code{\arpeggioUp}
- @tab @code{\arpeggioNeutral}
+@item @code{\arpeggioArrowDown}
+ @tab @code{\arpeggioArrowUp}
+ @tab @code{\arpeggioNormal}
@tab Arrow is at bottom, at top, or no arrow
@item @code{\dotsDown}
@tab @code{\dotsUp}
% Place dynamics above staff
\dynamicUp
% Start Ottava Bracket
-#(set-octavation 1)
+\ottava #1
c' \startTextSpan
% Add Dynamic Text
c\pp
% Add Dynamic Text
c\ff c \stopTextSpan
% Stop Ottava Bracket
-#(set-octavation 0)
+\ottava #0
c, c c c
@end lilypond
%Place following Ottava Bracket below Text Spanners
\once \override Staff.OttavaBracket #'outside-staff-priority = #340
% Start Ottava Bracket
-#(set-octavation 1)
+\ottava #1
c' \startTextSpan
% Add Dynamic Text
c\pp
% Add Dynamic Text
c\ff c \stopTextSpan
% Stop Ottava Bracket
-#(set-octavation 0)
+\ottava #0
c, c c c
@end lilypond
@node Real music example
@subsection Real music example
-We end this section on Tweaks by showing the steps to be taken to
-deal with a tricky example which needs several tweaks to produce
-the desired output. The example has been deliberately chosen to
-illustrate the use of the Notation Reference to resolve unusual
-problems with notation. It is not representative of more usual
-engraving process, so please do not let these difficulties put
+We end this section on Tweaks by showing the steps to be taken to
+deal with a tricky example which needs several tweaks to produce
+the desired output. The example has been deliberately chosen to
+illustrate the use of the Notation Reference to resolve unusual
+problems with notation. It is not representative of more usual
+engraving process, so please do not let these difficulties put
you off! Fortunately, difficulties like these are not very common!
The example is from Chopin's Première Ballade, Op. 23, bars 6 to
bes1~ |
\bar "||"
\time 6/4
- \override Staff.NoteCollision #'merge-differently-headed = ##t
- \override Staff.NoteCollision #'merge-differently-dotted = ##t
+ \mergeDifferentlyHeadedOn
+ \mergeDifferentlyDottedOn
bes2.^\markup {\bold "Moderato"} r8
<<
{c,8[ d fis bes a] | }
\\
{s4 fis4.}
>>
- \revert Staff.NoteCollision #'merge-differently-headed
- \revert Staff.NoteCollision #'merge-differently-dotted
+ \mergeDifferentlyHeadedOff
+ \mergeDifferentlyDottedOff
g2.\)
}
All the notes are right, but the appearance is far from
satisfactory. The tie clashes with the change in time signature,
the beaming in the third bar is wrong, the notes are not
-merged together, and several notation elements are missing.
+merged together, and several notation elements are missing.
Let's first deal with the easier things.
We can correct the beaming by inserting a beam
-manually, and we can easily add the left hand slur and the right
+manually, and we can easily add the left hand slur and the right
hand phrasing slur, since these were all covered in the Tutorial.
Doing this gives:
@end lilypond
On to bar three and the start of the Moderato section. The
-tutorial showed how to add embolded text with the
-@code{\markup} command, so adding @q{Moderato} in bold is easy.
-But how do we merge notes in different voices together? The
-index in the Notation Reference does not mention merging,
-but a search of the text for @q{merge} quickly leads us to
-the overrides for merging differently headed and differently
+tutorial showed how to add embolded text with the @code{\markup}
+command, so adding @q{Moderato} in bold is easy.
+But how do we merge notes in different voices together? This is
+where we need to turn to the Notation Reference for help. A search
+for @qq{merge} in the Notation Reference index quickly leads us to
+the commands for merging differently headed and differently
dotted notes in @ruser{Collision resolution}. In our
example we need to merge both types of note for the duration
of the polyphonic section in bar 3, so using the information
-in the Notation Reference we add
+we find in the Notation Reference we add
@example
-\override Staff.NoteCollision #'merge-differently-headed = ##t
-\override Staff.NoteCollision #'merge-differently-dotted = ##t
+\mergeDifferentlyHeadedOn
+\mergeDifferentlyDottedOn
@end example
@noindent
to the start of that section and
@example
-\revert Staff.NoteCollision #'merge-differently-headed
-\revert Staff.NoteCollision #'merge-differently-dotted
+\mergeDifferentlyHeadedOff
+\mergeDifferentlyDottedOff
@end example
@noindent
\bar "||"
\time 6/4
bes2.^\markup {\bold "Moderato"} r8
- \override Staff.NoteCollision #'merge-differently-headed = ##t
- \override Staff.NoteCollision #'merge-differently-dotted = ##t
+ \mergeDifferentlyHeadedOn
+ \mergeDifferentlyDottedOn
% Start polyphonic section of four voices
<<
{c,8[ d fis bes a] | }
\\
{s4 fis4. | }
>>
- \revert Staff.NoteCollision #'merge-differently-headed
- \revert Staff.NoteCollision #'merge-differently-dotted
+ \mergeDifferentlyHeadedOff
+ \mergeDifferentlyDottedOff
g2.\)
}
}
@end lilypond
-These overrides have merged the two F-sharp notes, but not the two
+These overrides have merged the two F-sharp notes, but not the two
on D. Why not? The answer is there in the same section in the
-Notation Reference -- notes being merged must have stems in
-opposite directions and two notes cannot be merged successfully if
-there is a third note in the same note column. Here the two D's
+Notation Reference -- notes being merged must have stems in
+opposite directions and two notes cannot be merged successfully if
+there is a third note in the same note column. Here the two D's
both have upward stems and there is a third note -- the C. We know
how to change the stem direction using @code{\stemDown}, and
the Notation Reference also says how to move the C -- apply a shift
The C is in voice two which has shift off, and the two D's are in
voices one and three, which have shift off and shift on,
respectively. So we have to shift the C a further level still
-using @code{\shiftOnn} to avoid it interfering with the two D's.
+using @code{\shiftOnn} to avoid it interfering with the two D's.
Applying these changes gives:
@lilypond[quote,verbatim,ragged-right]
\bar "||"
\time 6/4
bes2.^\markup {\bold "Moderato"} r8
- \override Staff.NoteCollision #'merge-differently-headed = ##t
- \override Staff.NoteCollision #'merge-differently-dotted = ##t
+ \mergeDifferentlyHeadedOn
+ \mergeDifferentlyDottedOn
% Start polyphonic section of four voices
<<
{c,8[ d fis bes a] | }
\\
{s4 fis4. | }
>>
- \revert Staff.NoteCollision #'merge-differently-headed
- \revert Staff.NoteCollision #'merge-differently-dotted
+ \mergeDifferentlyHeadedOff
+ \mergeDifferentlyDottedOff
g2.\)
}
\bar "||"
\time 6/4
bes2.^\markup {\bold "Moderato"} r8
- \override Staff.NoteCollision #'merge-differently-headed = ##t
- \override Staff.NoteCollision #'merge-differently-dotted = ##t
+ \mergeDifferentlyHeadedOn
+ \mergeDifferentlyDottedOn
<<
{c,8[ d fis bes a] | }
\\
\\
{s4 fis4.}
>>
- \revert Staff.NoteCollision #'merge-differently-headed
- \revert Staff.NoteCollision #'merge-differently-dotted
+ \mergeDifferentlyHeadedOff
+ \mergeDifferentlyDottedOff
g2.\)
}
@section Further tweaking
@menu
-* Other uses for tweaks::
-* Using variables for tweaks::
-* Other sources of information::
-* Avoiding tweaks with slower processing::
+* Other uses for tweaks::
+* Using variables for tweaks::
+* Other sources of information::
+* Avoiding tweaks with slower processing::
* Advanced tweaks with Scheme::
@end menu
>>
@end lilypond
-@subheading Simulating a fermata
+@subheading Simulating a fermata in MIDI
@cindex stencil property, use of
@cindex fermata, implementing in MIDI
to simulate a fermata in the MIDI output we would not want the
metronome markings to appear in the printed output, and we would
not want it to influence the spacing between the two systems or
-the spacing of the notes on the staff. So setting its
-@code{stencil} property to @code{#f} would be the best way.
+the positions of adjacent annotations on the staff. So setting
+its @code{stencil} property to @code{#f} would be the best way.
We show here the effect of the two methods:
@lilypond[quote,verbatim,ragged-right]
\tempo 4=120
a4 a a
\once \override Score.MetronomeMark #'transparent = ##t
- % Invisible tempo marking to lengthen fermata note in MIDI
+ % Invisible tempo marking to lengthen fermata in MIDI
\tempo 4=80
a\fermata
- \once \override Score.MetronomeMark #'stencil = ##f
- % Invisible tempo marking to restore tempo in MIDI
+ % New tempo for next section
+ \tempo 4=100
+ a a a a
+ }
+ \layout { }
+ \midi { }
+}
+@end lilypond
+
+@lilypond[quote,verbatim,ragged-right]
+\score {
+ \relative c'' {
+ % Visible tempo marking
\tempo 4=120
+ a4 a a
+ \once \override Score.MetronomeMark #'stencil = ##f
+ % Invisible tempo marking to lengthen fermata in MIDI
+ \tempo 4=80
+ a\fermata
+ % New tempo for next section
+ \tempo 4=100
a a a a
}
\layout { }
@end lilypond
@noindent
-Both methods remove the metronome mark from the printed output,
-and both affect the MIDI timing as required, but the first
-(transparent) metronome mark still influences the note spacing
-while the second (with no stencil) does not.
+Both methods remove the metronome mark which lengthens the fermata
+from the printed output, and both affect the MIDI timing as
+required, but the transparent metronome mark in the first line
+forces the following tempo indication too high while the
+second (with the stencil removed) does not.
@node Using variables for tweaks
@subsection Using variables for tweaks
used many times it may be worth defining variables to hold them.
Suppose we wish to emphasize certain words in lyrics by printing
them in bold italics. The @code{\italic} and @code{\bold}
-commands do not work within lyrics so we must instead use the
-following @code{\override} and @code{\revert} commands:
+commands only work within lyrics if they are also embedded in
+@code{\markup}, which makes them tedious to enter, so as an
+alternative can we instead use the @code{\override} and
+@code{\revert} commands?
@example
@code{\override Lyrics . LyricText #'font-shape = #'italic}
@code{\revert Lyrics . LyricText #'font-series}
@end example
-These would be extremely tedious to enter if there were many words
-requiring emphasis. So instead we define these as two variables,
-and use them as follows:
+These would also be extremely tedious to enter if there were many
+words requiring emphasis. So instead we define these as two
+variables, and use them as follows, although normally we would
+perhaps choose shorter names for the variables to make them
+quicker to type:
@lilypond[quote,verbatim]
-emph = {
+emphasize = {
\override Lyrics . LyricText #'font-shape = #'italic
\override Lyrics . LyricText #'font-series = #'bold
}
-norm = {
+normal = {
\revert Lyrics . LyricText #'font-shape
\revert Lyrics . LyricText #'font-series
}
global = { \time 4/4 \partial 4 \key c \major}
-SopMusic = \relative c' { c4 | e4. e8 g4 g | a a g }
+SopranoMusic = \relative c' { c4 | e4. e8 g4 g | a a g }
AltoMusic = \relative c' { c4 | c4. c8 e4 e | f f e }
TenorMusic = \relative c { e4 | g4. g8 c4. b8 | a8 b c d e4 }
BassMusic = \relative c { c4 | c4. c8 c4 c | f8 g a b c4 }
-VerseOne = \lyrics { E -- | ter -- nal \emph Fa -- ther, \norm | strong to save, }
-VerseTwo = \lyricmode { O | \emph Christ, \norm whose voice the | wa -- ters heard, }
-VerseThree = \lyricmode { O | \emph Ho -- ly Spi -- rit, \norm | who didst brood }
-VerseFour = \lyricmode { O | \emph Tri -- ni -- ty \norm of | love and pow'r }
+VerseOne = \lyrics { E -- | ter -- nal \emphasize Fa -- ther, \normal | strong to save, }
+VerseTwo = \lyricmode { O | \emphasize Christ, \normal whose voice the | wa -- ters heard, }
+VerseThree = \lyricmode { O | \emphasize Ho -- ly Spi -- rit, \normal | who didst brood }
+VerseFour = \lyricmode { O | \emphasize Tri -- ni -- ty \normal of | love and pow'r }
\score {
\new ChoirStaff <<
\new Staff <<
\clef "treble"
- \new Voice = "Sop" { \voiceOne \global \SopMusic }
+ \new Voice = "Soprano" { \voiceOne \global \SopranoMusic }
\new Voice = "Alto" { \voiceTwo \AltoMusic }
- \new Lyrics \lyricsto "Sop" { \VerseOne }
- \new Lyrics \lyricsto "Sop" { \VerseTwo }
- \new Lyrics \lyricsto "Sop" { \VerseThree }
- \new Lyrics \lyricsto "Sop" { \VerseFour }
+ \new Lyrics \lyricsto "Soprano" { \VerseOne }
+ \new Lyrics \lyricsto "Soprano" { \VerseTwo }
+ \new Lyrics \lyricsto "Soprano" { \VerseThree }
+ \new Lyrics \lyricsto "Soprano" { \VerseFour }
>>
\new Staff <<
\clef "bass"