lilypond-user
[Top][All Lists]
Advanced

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

Re: controlling the tie "gap" [and a possible bug?]


From: Aaron Hill
Subject: Re: controlling the tie "gap" [and a possible bug?]
Date: Fri, 16 Nov 2018 16:54:49 -0800
User-agent: Roundcube Webmail/1.3.6

On 2018-11-16 4:24 pm, Kieren MacMillan wrote:
[ . . . ]

Kieren,

Would something like the following be of any help?

%%%%
\version "2.19.82"

#(define (contract-control-points coords amount)
  (let* ((x-coords (map (lambda (coord) (car coord)) coords))
         (orig-left (apply min x-coords))
         (orig-right (apply max x-coords))
         (new-left (+ (* orig-left (- 1 (car amount)))
                      (* orig-right (car amount))))
         (new-right (+ (* orig-left (cdr amount))
                       (* orig-right (- 1 (cdr amount))))))
    (map (lambda (coord)
      (let ((t (/ (- (car coord) orig-left) (- orig-right orig-left))))
        (cons (+ new-left (* t (- new-right new-left))) (cdr coord))))
      coords)))

contractSlur = #(define-music-function (amount evt) (pair? ly:music?)
  #{ \tweak control-points #(lambda (grob)
      (contract-control-points
        (ly:slur::calc-control-points grob)
        amount)) $evt #})
globalContractSlur = #(define-music-function (amount) (pair?)
  #{ \override Slur.control-points = #(lambda (grob)
      (contract-control-points
        (ly:slur::calc-control-points grob)
        amount))
     \override PhrasingSlur.control-points = #(lambda (grob)
      (contract-control-points
        (ly:slur::calc-control-points grob)
        amount)) #})

csr = -\contractSlur #'(0 . 0.05) \etc
csl = -\contractSlur #'(0.05 . 0) \etc

\relative f' {
  \override Score.RehearsalMark.self-alignment-X = #-1
  \mark \markup \small "Default behavior"
  f8 ( e g ) ( e f2 ) |
  f8 \( e g \) \( e f2 \) |

  \mark \markup \small "Overridden behavior"
  \globalContractSlur #'(0.1 . 0.1)
  f8 ( e g ) ( e f2 ) |
  f8 \( e g \) \( e f2 \) |

  \mark \markup \small "Tweaked behavior"
  f8 -\csr ( e g ) -\csl ( e f2 ) |
  f8 -\csr \( e g \) -\csl \( e f2 \) |
}
%%%%

-- Aaron Hill

Attachment: slurs.cropped.png
Description: PNG image


reply via email to

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