lilypond-user
[Top][All Lists]
Advanced

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

Re: Shape of ties


From: Thomas Morley
Subject: Re: Shape of ties
Date: Sat, 20 Apr 2013 01:31:51 +0200

2013/4/19 Andrew Bernard <address@hidden>:
> I want to make ties use a flared horizontal bracket instead of a curved slur
> shape for a contemporary score I am setting. How does one go about this sort
> of transformation?
>
> Andrew

Hi Andrew,

how about the code below (after ideas from Mike Solomon):

\version "2.16.2"

#(define ((flared-tie coords) grob)

 (define (pair-to-list pair)
    (list (car pair) (cdr pair)))

 (define (normalize-coords goods x y dir)
   (map
     (lambda (coord)
       (cons (* x (car coord)) (* y dir (cdr coord))))
     goods))

 (define (my-c-p-s points thick)
   (make-connected-path-stencil
     points
     thick
     1.0
     1.0
     #f
     #f))

; outer let to trigger suicide
 (let ((sten (ly:tie::print grob)))
   (if (grob::is-live? grob)
       (let* ((layout (ly:grob-layout grob))
              (line-thickness (ly:output-def-lookup layout 'line-thickness))
              (thickness (ly:grob-property grob 'thickness 0.1))
              (used-thick (* line-thickness thickness))
              (dir (ly:grob-property grob 'direction))
              (xex (ly:stencil-extent sten X))
              (yex (ly:stencil-extent sten Y))
              (lenx (interval-length xex))
              (leny (interval-length yex))
              (yex (ly:stencil-extent sten Y))
              (xtrans (car xex))
              (ytrans (if (> dir 0)(car yex) (cdr yex)))
              (uplist
                (map pair-to-list
                     (normalize-coords coords lenx (* leny 2) dir))))

  (ly:stencil-translate
      (my-c-p-s uplist used-thick)
    (cons xtrans ytrans)))
  '())))

#(define flare-tie
  (flared-tie '((0 . 0)(0.1 . 0.2) (0.9 . 0.2) (1.0 . 0.0))))

\layout {
        \context {
                \Voice
                \override Tie #'stencil = #flare-tie
        }
}

\relative c' {
        a4~a
        a'4~a
        a'4~a
        <a,, c e a c e a c e>~ q
}


HTH,
  Harm

Attachment: flare-tie.png
Description: PNG image


reply via email to

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