| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Dimensions ] | [ Up : Useful concepts and properties ] | [ Modifying broken spanners > ] |
5.4.4 Spanners
Many objects of musical notation extend over several notes or even several bars. Examples are slurs, beams, tuplet brackets, volta repeat brackets, crescendi, trills, and glissandi. Such objects are collectively called “spanners”, and have special properties to control their appearance and behavior, as well as special tweaking methods related to the fact that they can be broken across systems.
| Modifying broken spanners | ||
| Setting minimum lengths for spanners | ||
| Controlling spanner end points |
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Spanners ] | [ Up : Spanners ] | [ Setting minimum lengths for spanners > ] |
Modifying broken spanners
When a spanner crosses a line break or breaks, each piece
inherits the attributes of the original spanner. Thus, ordinary
tweaking of a broken spanner applies the same modifications to
each of its segments. In the example below, overriding
thickness affects the slur on either side of the line
break.
\relative c'' { r2 \once\override Slur.thickness = 10 c8( d e f \break g8 f e d) r2 }
Independently modifying the appearance of individual pieces
of a broken spanner is possible with the \alterBroken
command. This command can produce either an \override
or a \tweak of a spanner property.
The syntax for \alterBroken is
[-]\alterBroken property values target
The argument values is a list of values, one for each broken
piece. If target is a grob name like Slur or
Staff.PianoPedalBracket, the result is an \override
of the specified grob type. If target is a music expression
such as ‘(’ or ‘[’ the result is the same music
expression with an appropriate tweak applied.
The leading hyphen must be used with the \tweak form. Do
not add it when \alterBroken is used as an
\override.
In its \override usage, \alterBroken may be prefaced
by \once or \temporary and reverted by using
\revert with property (see
substitution functions
Intermediate substitution functions).
The following code applies an independent \override to
each of the slur segments in the previous example:
\relative c'' { r2 \alterBroken thickness #'(10 1) Slur c8( d e f \break g8 f e d) r2 }
The \alterBroken command may be used with any spanner
object, including Tie, PhrasingSlur, Beam
and TextSpanner. For example, an editor preparing a
scholarly edition may wish to indicate the absence of part of a
phrasing slur in a source by dashing only the segment which has
been added. The following example illustrates how this can be
done, in this case using the \tweak form of the command:
% The empty list is conveniently used below, because it is the % default setting of dash-definition, resulting in a solid curve. \relative { c''2-\alterBroken dash-definition #'(() ((0 1.0 0.4 0.75))) \(e \break g2 e\) }
It is important to understand that \alterBroken sets each
piece of a broken spanner to the corresponding value in
values. When there are fewer values than pieces, any
additional piece will be assigned the empty list. This may lead
to undesired results if the layout property is not set to the
empty list by default. In such cases, each segment should be
assigned an appropriate value.
Known issues and warnings
Line breaks may occur in different places following changes in
layout. Settings chosen for \alterBroken may be unsuitable
for a spanner that is no longer broken or is split into more
segments than before. Explicit use of \break can guard
against this situation.
The \alterBroken command is ineffective for spanner
properties accessed before line breaking such as
direction.
See also
Extending LilyPond: Difficult tweaks.
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Modifying broken spanners ] | [ Up : Spanners ] | [ Controlling spanner end points > ] |
Setting minimum lengths for spanners
The spanner-interface interface provides three properties
that apply to several spanners.
The minimum-length property
The minimum length of the spanner is specified by the
minimum-length property. Increasing this usually has the
necessary effect of increasing the spacing of the notes between the
two end points. However, this override has no effect on
many spanners, as their length is determined by other considerations.
A few examples where it is effective are shown below.
a'~ a' a' % increase the length of the tie -\tweak minimum-length #5 ~ a'
\relative \compressMMRests { a'1 R1*23 % increase the length of the rest bar \once \override MultiMeasureRest.minimum-length = #20 R1*23 a1 }
\relative { a' \< a a a \! % increase the length of the hairpin \override Hairpin.minimum-length = #20 a \< a a a \! }
This override can also be used to increase the length of slurs and phrasing slurs:
\relative { a'( g) a -\tweak minimum-length #5 ( g) a\( g\) a -\tweak minimum-length #5 \( g\) }
For some layout objects, the minimum-length property becomes
effective only if the set-spacing-rods procedure is called
explicitly. To do this, the springs-and-rods property should
be set to ly:spanner::set-spacing-rods. For example,
the minimum length of a glissando has no effect unless the
springs-and-rods property is set:
% default e' \glissando c'' % not effective alone \once \override Glissando.minimum-length = #20 e' \glissando c'' % effective only when both overrides are present \once \override Glissando.minimum-length = #20 \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods e' \glissando c''
The same is true of the Beam object:
% not effective alone \once \override Beam.minimum-length = #20 e'8 e' e' e' % effective only when both overrides are present \once \override Beam.minimum-length = #20 \once \override Beam.springs-and-rods = #ly:spanner::set-spacing-rods e'8 e' e' e'
The minimum-length-after-break property
The property minimum-length-after-break can be
used to stretch broken spanners starting after a line break.
As for the minimum-length property, it is often needed to set the
springs-and-rods property to ly:spanner::set-spacing-rods.
{ \once \override Tie.minimum-length-after-break = 20 a1~ \break a1 \once \override Slur.minimum-length-after-break = 20 a1( \break d'1) \once \override TextSpanner.springs-and-rods = #ly:spanner::set-spacing-rods \once \override TextSpanner.minimum-length-after-break = 20 a1\startTextSpan \break a1\stopTextSpan \once \override Hairpin.after-line-breaking = ##t \once \override Hairpin.to-barline = ##f \once \override Hairpin.minimum-length-after-break = 20 a1\< \break a1\! \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \once \override Glissando.breakable = ##t \once \override Glissando.after-line-breaking = ##t \once \override Glissando.minimum-length-after-break = 20 a1\glissando \break d'1 }
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Setting minimum lengths for spanners ] | [ Up : Spanners ] | [ Line styles > ] |
Controlling spanner end points
The to-barline property of the spanner-interface,
usually defaulting to true, causes hairpins and other spanners
that are terminated on the first note of a measure to end instead
on the immediately preceding bar line. If set to false, the
spanner extends beyond the bar line and end on the note itself:
\relative { a' \< a a a a \! a a a \break \override Hairpin.to-barline = ##f a \< a a a a \! a a a }
This property is not effective for all spanners. For example,
setting it to #t has no effect on slurs or phrasing slurs
or on other spanners for which terminating on the bar line would
not be meaningful.
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Setting minimum lengths for spanners ] | [ Up : Spanners ] | [ Line styles > ] |
![[image of music]](../6a/lily-9bc9b1e3.png)
![[image of music]](../4f/lily-edcfc3ee.png)
![[image of music]](../d7/lily-616b522e.png)
![[image of music]](../91/lily-c2287515.png)
![[image of music]](../e9/lily-bbaada09.png)
![[image of music]](../1c/lily-b5eba89e.png)
![[image of music]](../45/lily-0a2bf799.png)
![[image of music]](../09/lily-815e99bd.png)
![[image of music]](../e4/lily-cc27726a.png)
![[image of music]](../66/lily-da9ae651.png)
![[image of music]](../58/lily-3c43c1b5.png)