Jump to content

Making slurs with complex dash structure: Difference between revisions

From LilyPond wiki
No edit summary
Revise description
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Slurs can be made with complex dash patterns by defining the <code>dash-definition</code> property. <code>dash-definition</code> is a list of <code>dash-elements</code>. A <code>dash-element</code> is a list of parameters defining the dash behavior for a segment of the slur.
Slurs can be composed of complex dash patterns by setting the <code>dash-definition</code> property, which is a list of slur segments, which in turn are lists of parameters setting up the dash behavior of the given segment.


The slur is defined in terms of the bezier parameter t which ranges from 0 at the left end of the slur to 1 at the right end of the slur. <code>dash-element</code> is a list <code>(start-t stop-t dash-fraction dash-period)</code>. The region of the slur from <code>start-t</code> to <code>stop-t</code> will have a fraction <code>dash-fraction</code> of each <code>dash-period</code> black. <code>dash-period</code> is defined in terms of staff spaces. <code>dash-fraction</code> is set to 1 for a solid slur.
Slur segments are defined in terms of the Bézier parameter&nbsp;<var>t</var>, which ranges from&nbsp;0 at the left end of the slur to&nbsp;1 at the right end of the slur. A slur segment has the form <code>(<var>start-t</var> <var>stop-t</var> <var>dash-fraction</var> <var>dash-period</var>)</code>. In the segment spanning the range <var>start-t</var> to <var>stop-t</var>, the dash pattern is defined by the values of <var>dash-fraction</var> and <var>dash-period</var>. <var>dash-fraction</var> specifies how much of a dash period is black; if set to&nbsp;1 you get a solid slur segment. The unit for <var>dash-period</var> is staff spaces.  


<lilypond version="2.24">
<lilypond version="2.24">
\relative c' {
\relative c' {
   \once \override
   \once \override
     Slur.dash-definition = #'((0 0.3 0.1 0.75)
     Slur.dash-definition = #'(( 0 0.3 0.1 0.75)
                                (0.3 0.6 1 1)
                              (0.3 0.6 1   1   )
                                (0.65 1.0 0.4 0.75))
                              (0.65 1.0 0.4 0.75))
   c4( d e f)
   c4( d e f)
   \once \override
   \once \override
     Slur.dash-definition = #'((0 0.25 1 1)
     Slur.dash-definition = #'((0   0.25 1   1   )
                                (0.3 0.7 0.4 0.75)
                              (0.3 0.7   0.4 0.75)
                                (0.75 1.0 1 1))
                              (0.75 1.0   1   1   ))
   c4( d e f)
   c4( d e f)
}
}
Line 20: Line 20:
[[Category:Rhythms]]
[[Category:Rhythms]]
[[Category:Expressive marks]]
[[Category:Expressive marks]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 11:57, 30 November 2025

Slurs can be composed of complex dash patterns by setting the dash-definition property, which is a list of slur segments, which in turn are lists of parameters setting up the dash behavior of the given segment.

Slur segments are defined in terms of the Bézier parameter t, which ranges from 0 at the left end of the slur to 1 at the right end of the slur. A slur segment has the form (start-t stop-t dash-fraction dash-period). In the segment spanning the range start-t to stop-t, the dash pattern is defined by the values of dash-fraction and dash-period. dash-fraction specifies how much of a dash period is black; if set to 1 you get a solid slur segment. The unit for dash-period is staff spaces.

\version "2.24"

\relative c' {
  \once \override
    Slur.dash-definition = #'((  0  0.3  0.1 0.75)
                              (0.3  0.6  1   1   )
                              (0.65 1.0  0.4 0.75))
  c4( d e f)
  \once \override
    Slur.dash-definition = #'((0    0.25  1   1   )
                              (0.3  0.7   0.4 0.75)
                              (0.75 1.0   1   1   ))
  c4( d e f)
}