Previous: Line length, Up: Horizontal spacing
LilyPond supports proportional notation, a type of horizontal spacing in which each note consumes an amount of horizontal space exactly equivalent to its rhythmic duration. This type of proportional spacing is comparable to horizontal spacing on top of graph paper. Some late 20th- and early 21st-century scores use proportional notation to clarify complex rhythmic relationships or to faciliate the placement of timelines or other graphics directly in the score.
LilyPond supports five different settings for proportional notation, which may be used together or alone:
proportionalNotationDuration
uniform-stretching
strict-note-spacing
\remove Separating_line_group_engraver
\override PaperColumn #'used = ##t
In the examples that follow, we explore these five different proportional notation settings and examine how these settings interact.
We start with the following one-measure example, which uses classical spacing with ragged-right turned on.
\new Score << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } >>
Notice that the half note which begins the measure takes up far less than half of the horizontal space of the measure. Likewise, the sixteenth notes and sixteenth-note quintuplets (or twentieth notes) which end the measure together take up far more than half the horizontal space of the measure.
In classical engraving, this spacing may be exactly what we want because we can borrow horizontal space from the half note and conserve horizontal space across the measure as a whole.
On the other hand, if we want to insert a measured timeline or other graphic above or below our score, we need proportional notation. We turn proportional notation on with the proportionalNotationDuration setting.
\new Score \with { proportionalNotationDuration = #(ly:make-moment 1 20) } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } >>
The half note at the beginning of the measure and the faster notes in the second half of the measure now occupy equal amounts of horizontal space. We could place a measured timeline or graphic above or below this example.
The proportionalNotationDuration
setting is a context setting that
lives in Score
. Recall that context settings appear in one of
three locations in our input file – in a \with
block, in a
\context
block, or directly in music entry
preceeded by the \set
command. As with all
context settings, users can pick which of the three different
locations they would like to set proportionalNotationDuration
.
The proportionalNotationDuration
setting takes a single argument,
which is the reference duration against which all music will be
spaced. The LilyPond Scheme function make-moment takes two arguments
– a numerator and denominator which together express some fraction of
a whole note. The call #(ly:make-moment 1 20)
therefore produces a
reference duration of a twentieth note. The values
#(ly:make-moment 1 16)
, #(ly:make-moment 1 8)
, and
#(ly:make-moment 3 97)
are all possible as well.
How do we select the right reference duration to pass to
proportionalNotationDuration
? Usually by a process of trial and error,
beginning with a duration close to the fastest (or smallest) duration
in the piece. Smaller reference durations space music loosely; larger
reference durations space music tightly.
\new Score \with { proportionalNotationDuration = #(ly:make-moment 1 8) } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } >> \new Score \with { proportionalNotationDuration = #(ly:make-moment 1 16) } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } >> \new Score \with { proportionalNotationDuration = #(ly:make-moment 1 32) } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } >>
Note that too large a reference duration – such as the eighth note, above – spaces music too tightly and can cause notehead collisions. Note also that proportional notation in general takes up more horizontal space that does classical spacing. Proportional spacing provides rhythmic clarity at the expense of horizontal space.
Next we examine how to optimally space overlapping tuplets.
We start by examining what happens to our original example, with classical spacing, when we add a second staff with a different type of tuplet.
\new Score << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } \new RhythmicStaff { \times 8/9 { c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 } } >>
The spacing is bad because the evenly notes of the bottom staff do not
stretch uniformly. Classical engraving includes very few complex
triplets and so classical engraving rules can generate this type of
result. Setting proportionalNotationDuration
remedies this
situation considerably.
\new Score \with { proportionalNotationDuration = #(ly:make-moment 1 20) } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } \new RhythmicStaff { \times 8/9 { c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 } } >>
But if we look very carefully we can see that notes of the second half
of the 9-tuplet space ever so slightly more widely than do the notes
of the first half of the 9-tuplet. To ensure uniform stretching, we
turn on uniform-stretching
, which is a property of
SpacingSpanner
.
\new Score \with { proportionalNotationDuration = #(ly:make-moment 1 20) \override SpacingSpanner #'uniform-stretching = ##t } << \new RhythmicStaff { c'2 c'16 c'16 c'16 c'16 \times 4/5 { c'16 c'16 c'16 c'16 c'16 } } \new RhythmicStaff { \times 8/9 { c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 c'8 } } >>
Our two-staff example now spaces exactly, our rhythmic relationships are visually clear, and we can include a measured timeline or graphic if we want.
The SpacingSpanner
is an abstract grob that lives in the
Score
context. As with our settings of
proportionalNotationDuration
,
overrides to the SpacingSpanner
can occur in any of three different
places in our input file – in the Score \with
block, in a
Score \context
block, or in note entry directly.
There is by default only one SpacingSpanner
per Score
. This
means that, by default, uniform-stretching
is either turned on for the
entire score or turned off for the entire score. We can, however,
override this behavior and turn on different spacing features at
different places in the score. We do this with the command
\newSpacingSection
. See New spacing area, for more info.
Next we examine the effects of the Separating_line_group_engraver
and
see why proportional scores frequently remove this engraver. The following
example shows that there is a small amount of “preferatory” space
just before the first note in each system.
\paper { indent = #0 } \new Staff { c'1 \break c'1 }
The amount of this preferatory space is the same whether after a time
signature, a key signature or a clef. Separating_line_group_engraver
is responsible for this space. Removing Separating_line_group_engraver
reduces this space to zero.
\paper { indent = #0 } \new Staff \with { \remove Separating_line_group_engraver } { c'1 \break c'1 }
Nonmusical elements like time signatures, key signatures, clefs and accidentals are problemmatic in proportional notation. None of these elements has rhythmic duration. But all of these elements consume horizontal space. Different proportional scores approach these problems differently.
It may be possible to avoid spacing problems with key signatures simply by not having any. This is a valid option since most proportional scores are contemporary music. The same may be true of time signatures, especially for those scores that include a measured timeline or other graphic. But these scores are exceptional and most proportional scores include at least some time signatures. Clefs and accidentals are even more essential.
So what strategies exist for spacing nonmusical elements in a
proportional context? One good option is the strict-note-spacing
property of SpacingSpanner
. Compare the two scores below:
\new Staff { \set Score.proportionalNotationDuration = #(ly:make-moment 1 16) c''8 c''8 c''8 \clef alto d'8 d'2 } \new Staff { \set Score.proportionalNotationDuration = #(ly:make-moment 1 16) \override Score.SpacingSpanner #'strict-note-spacing = ##t c''8 c''8 c''8 \clef alto d'8 d'2 }
Both scores are proportional, but the spacing in the first score is
too loose because of the clef change. The spacing of the second score
remains strict, however, because strict-note-spacing
is turned
on. Turning on strict-note-spacing
causes the width of time
signatures, key signatures and clefs to play no part in the spacing
algorithm. Accidentals are a different matter, however. By default, all
accidentals consume a little extra space, as the following pair of
scores shows.
\new Staff { \set Score.proportionalNotationDuration = #(ly:make-moment 1 32) c'16 c'16 c'16 c'16 c'16 c'16 c'16 c'16 } \new Staff { \set Score.proportionalNotationDuration = #(ly:make-moment 1 32) c'16 cis'16 c'16 c'16 c'16 c'16 c'16 c'16 }
Both scores are proportional but the second score exhibits spacing
irregularities due to accidentals. Turning on strict-note-spacing
does not work for accidentals. Instead,
we override the X-extent
of all accidentals to zero and then move the
accidentals to the left of the notes they modify.
\new Staff { \set Score.proportionalNotationDuration = #(ly:make-moment 1 32) \override Accidental #'X-extent = #'(0 . 0) \override Accidental #'extra-offset = #'(-1 . 0) c'16 cis'16 c'16 c'16 c'16 c'16 c'16 c'16 }
In addition to the settings given here, there are other settings that frequently appear in proportional scores. These include:
\override SpacingSpanner #'strict-grace-spacing = ##t
tupletFullLength = ##t
\override Beam #'breakable = ##t
\override Glissando #'breakable = ##t
\override TextSpanner #'breakable = ##t
\remove Forbid_line_break_engraver in the Voice context
These settings space grace notes strictly, extend tuplet brackets to
mark both rhythmic start- and stop-points, and allow spanning elements
to break across systems and pages. See the respective parts of the manual
for these related settings.
Previous: Line length, Up: Horizontal spacing
Cette page documente LilyPond-2.11.28 (branche de développement).
Rapporter toute anomalie en français à lilypond-user-fr@gnu.org ou en anglais à http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs
Your suggestions for the documentation are welcome.