[Top][All Lists]

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

Re: Default length of laissezvibrer ties

From: Nick Payne
Subject: Re: Default length of laissezvibrer ties
Date: Tue, 13 Mar 2012 18:12:03 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 13/03/12 10:21, Thomas Morley wrote:
2012/3/11 David Kastrup<address@hidden>:
Thomas Morley<address@hidden>  writes:

Hi Nick,

2012/3/9 Nick Payne<address@hidden>:

Thanks. I gave it a try. The one shortcoming I've found is that the ends of
LV ties on a chord containing a second no longer align.
That's because "factor" is used in a multiplication. An easy fix would
be to change that to an addition. But now a new problem arises: If you
use customised staff-sizes the length isn't scaled accurate. For
smaller staffs the LaissezVibrerTie should be still smaller and for
greater staffs still greater.
Currently I don't know how to make it better.
You can get the system grob (ly:grob-system) from the tie, and then base
your additional size on some dimension calculated from that in some

David Kastrup
Hi David,

thanks for the hint, it let me rethink the definition.
Now I've done it a little different and currently I see no drawback.

Well, one could argue about the values, but that's another question ...

\version "2.14.2"

#(define adding 1.5)

#(define (enlarged-extent-laissez-vibrer::print grob)
   (let* ((ssymb (ly:grob-object grob 'staff-symbol))
          (staff-space (ly:grob-property ssymb 'staff-space))
          (adding-factor (if (null? staff-space)
                          (expt staff-space 2)))
          (stil (laissez-vibrer::print grob))
          (stil-ext (ly:stencil-extent stil X))
          (stil-length (interval-length stil-ext))
          (new-stil-length (+ stil-length (* adding-factor adding)))
          (scale-factor (/ new-stil-length stil-length))
          (new-stil (ly:stencil-scale stil scale-factor 1))
          (new-stil-ext (ly:stencil-extent new-stil X))
          (x-corr (- (car stil-ext) (car new-stil-ext))))

#(assoc-set! (assoc-ref all-grob-descriptions 'LaissezVibrerTie)
'stencil enlarged-extent-laissez-vibrer::print)

music = \relative c' {
         <c e g c>\laissezVibrer s s s
         <d c f,>\laissezVibrer s s s
\new StaffGroup
\new Staff \with { fontSize = #-3
                   \override StaffSymbol #'staff-space = #(magstep -3)
                   \override StaffSymbol #'thickness = #(magstep -3) }

  \new Staff

    \new Staff \with { fontSize = #3
                    \override StaffSymbol #'staff-space = #(magstep 3)
                    \override StaffSymbol #'thickness = #(magstep 3) }

Thanks. I was playing around with your code, trying to figure out how to stop the tie getting flattened out, but couldn't manage it. If your code is used for an LV tie that is part of a succession of slurs/ties, then the LV tie looks out of place because it is flatter than the others:

\relative c' {
    d8( e) ~ e4 ~ e2\laissezVibrer
I also played around with trying to make a callback function for \override LaissezVibrerTie #'control-points, but although Lilypond gives no error on the console, the LV tie doesn't appear at all when I try to use the callback.

\version "2.15.33"

#(define ((alter-lv-tie-curve offsets) grob)
    (let ((coords (ly:semi-tie::calc-control-points grob))
        (n 0))
    (define loop (lambda (n)
        (set-car! (list-ref coords n)
            (+ (list-ref offsets (* 2 n))
                (car (list-ref coords n))))
        (set-cdr! (list-ref coords n)
            (+ (list-ref offsets (1+ (* 2 n)))
                (cdr (list-ref coords n))))
        (if (< n 3)
            (loop (1+ n)))))
    (loop n)

shapeLVTie = #(define-music-function (parser location offsets) (list?)
\once \override LaissezVibrerTie #'control-points = #(alter-lv-tie-curve offsets)

\relative c' {
d8( e) ~ e4 ~ \shapeLVTie #'(0 0 0.75 -0.7 2.25 -0.7 3 0) e2\laissezVibrer

\relative c' {
    \override LaissezVibrerTie #'control-points = #(lambda (grob)
        (if (= UP (ly:grob-property grob 'direction))
        (alter-lv-tie-curve '(0 0 0.75 0.7 2.25 0.7 3 0))
        (alter-lv-tie-curve '(0 0 0.75 -0.7 2.25 -0.7 3 0))))
    d8( e) ~ e4 ~ e2\laissezVibrer


reply via email to

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