lilypond-user
[Top][All Lists]
Advanced

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

Re: Default length of laissezvibrer ties


From: Thomas Morley
Subject: Re: Default length of laissezvibrer ties
Date: Tue, 13 Mar 2012 00:21:50 +0100

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
> manner.
>
> --
> 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)
                          1
                          (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))))
  (ly:stencil-translate-axis
     new-stil
     x-corr
     X)))

#(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) }
    \music

 \new Staff
     \music

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


Thanks,
  Harm



reply via email to

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