lilypond-user
[Top][All Lists]
Advanced

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

Re: Callback function and applying to all notes in chord


From: David Nalesnik
Subject: Re: Callback function and applying to all notes in chord
Date: Tue, 13 Mar 2012 16:47:06 -0500

Hi Nick,

I was trying to make a callback function to lengthen LV ties (thanks to David Nalesnik for his help). It works fine when applied to single notes, but on a chord, only one of the two ties is lengthened. Is this due to an error in the code below or some more deep-rooted problem. If I reverse the order of the notes in the chord, the long and short ties swap around:

Instead of overriding the property directly, I set 'control-points within an override of 'before-line-breaking.  Seems to to the trick:

\version "2.15.30"

#(define ((alter-lv-tie-curve offsets) grob)
  (let ((coords (ly:semi-tie::calc-control-points grob)))

    (define (add-offsets coords offsets)
      (if (null? coords)
      '()
      (cons
(cons (+ (caar coords) (car offsets))
     (+ (cdar coords) (cadr offsets)))
(add-offsets (cdr coords) (cddr offsets)))))

    (add-offsets coords offsets)))
    
\relative c'' {
  \override LaissezVibrerTie #'before-line-breaking = #(lambda (grob)
     (set! (ly:grob-property grob 'control-points)
  (if (= UP (ly:grob-property grob 'direction))
      ((alter-lv-tie-curve '(0 0 0.75 0.7 2.25 0.7 3 0)) grob)
               ((alter-lv-tie-curve '(0 0 0.75 -0.7 2.25 -0.7 3 0)) grob))))
               
  <c f,>1\laissezVibrer
  <f, c'>\laissezVibrer
  <c f c' f>\laissezVibrer
}

-David

 


reply via email to

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