lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Partially dashed phrasing slurs


From: Aaron Hill
Subject: Re: Partially dashed phrasing slurs
Date: Tue, 22 Sep 2020 19:46:37 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-09-22 6:39 pm, Andrew Bernard wrote:
Using \phrasingSlurHalfDashed is great. But how can I set the dash
pattern to a smaller fraction than half, say the first eighth of the
slur? and indeed, how can you put the dash as the right hand side? I
think the question is clear without an MWE.

Although I am fluent in Postscript, I'd prefer to use the actual lilypond slurs.

The details you need are documented in the Notation Reference [1].

[1]: http://lilypond.org/doc/v2.20/Documentation/notation/expressive-marks-as-curves#index-dash-patterns_002c-slur-1

And from property-init.ly you can find the existing definitions for reference:

%%%%
phrasingSlurHalfDashed =
  \override PhrasingSlur.dash-definition = #'((0 0.5 0.4 0.75)
                                              (0.5 1 1 1))
%%%%

The dash-definition specified may be arbitrarily complex, however here is a helper function assuming you only require a two-pattern curve with a variable midpoint:

%%%%
\version "2.20.0"

dashHelper =
#(define-music-function
  (grob start-pattern midpoint end-pattern)
  (symbol? symbol? (number? 0.5) symbol?)
  (define patterns '((solid . (1 . 1))
                     (dashed . (0.4 . 0.75))
                     (dotted . (0.1 . 0.75))
                     (none . (0 . 0))))
  (define (lookup-pattern symbol)
    (let ((pattern (ly:assoc-get symbol patterns #f)))
      (or (number-pair? pattern)
          (begin
            (ly:input-warning (*location*) "unknown pattern ~s" symbol)
            (set! pattern '(1 . 1))))
      pattern))
  (set! start-pattern (lookup-pattern start-pattern))
  (set! end-pattern (lookup-pattern end-pattern))
  #{ \override #grob . dash-definition =
     #`((0 ,midpoint ,(car start-pattern) ,(cdr start-pattern))
        (,midpoint 1 ,(car end-pattern) ,(cdr end-pattern))) #} )

{ \once \dashHelper PhrasingSlur solid #0.3 dashed g'2\( e''4 d''\)
  \once \dashHelper Slur dotted #0.7 solid b'4_( a'8 e' f'2)
  \once \dashHelper Tie solid none g'2.~ 4 }
%%%%


-- Aaron Hill

Attachment: dash-definition.cropped.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]