lilypond-user
[Top][All Lists]
Advanced

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

Re: Peculiar issue with something I copied from advanced tweaks


From: Kevin Patrick Barry
Subject: Re: Peculiar issue with something I copied from advanced tweaks
Date: Sat, 27 Apr 2013 14:35:29 +0100

Dear David,

Thank you for the quick response.  Overriding control-points instead of after-line-breaking made it work, although I have no idea why.  I just copied the scheme code from a page in the manual.  The only part of it I understand is the word grob....

I must admit I didn't know that \shape could be used on broken slurs (I love that function and use it all the time - lilypond not-infrequently draws slurs in ways I don't like).  That should save me some time in the future.  Thank you for the 2.16 syntax (I have never used 2.17 so I don't know it anyway).

Oh, and the music is Mendelssohn!

Thanks again,
Kevin


On 27 April 2013 13:37, David Nalesnik <address@hidden> wrote:
Hi Kevin,


On Sat, Apr 27, 2013 at 6:54 AM, Kevin Patrick Barry <address@hidden> wrote:
Dear LilyPond users,

I need help with a strange problem I have encountered.  I wanted to edit the control points of a phrasing slur that has a line break.  I found a page about this in the lilypond manual, from which I adapted the following code:

#(define (my-callback grob)

(let* (

;; have we been split?

(orig (ly:grob-original grob))

;; if yes, get the split pieces (our siblings)

(siblings (if (ly:grob? orig)

(ly:spanner-broken-into orig)

'())))

(if (and (>= (length siblings) 2)

(eq? (car (last-pair siblings)) grob))

(ly:grob-set-property! grob 'control-points '((8.5 . 5) (11 . 7.5) (68 . 7) (70.33 . 2.75))))))


When I added an \override PhrasingSlur #'after-line-breaking = #my-callback everything looked OK in Frescobaldi (2.08, running on Ubuntu 13.04), but when I engrave the file from the command line it engraves it without the override (the phrasing slur appears as it did before). I made sure to save changes. Even if I copy the command line from Frescobaldi it will not engrave correctly. Both Frescobaldi and the command line state that they are using 2.16.2 (which is the only version installed anyway).


I haven't been able to reproduce the issue in a tiny example, but I have noticed that the override I used (I don't understand the scheme code) is very temperamental. For example I can only get it to work when the Bar number engraver is removed. In another test I was able to break it simply by adding the Horizontal bracket engraver to the voice context: I use lots of style files in my work (and the horizontal bracket engraver is included in them) and when preparing a stand-alone version of the file to attach I removed the \include and added the engraver explicity which immediately caused the override to stop working.


If anyone has the patience to look into this I have attached a file which reproduces the problem (I'm sorry I couldn't pare it down; there must be some weird interactions that I don't understand going on). I had to leave the horizontal bracket engraver out.



I can't address the inconsistencies you describe, though...

You can get the function to work by overriding 'control-points instead of 'after-line-breaking.

So, you can keep your function as is and write:

\override PhrasingSlur #'control-points = #my-callback

However, if altering 'control-points with the above line, it would be cleaner to have the callback return control points:

#(define (my-callback grob)
   (let* (
          ;; have we been split?
          (orig (ly:grob-original grob))
          
          ;; if yes, get the split pieces (our siblings)
          (siblings (if (ly:grob? orig)
                        (ly:spanner-broken-into orig)
                        '())))  
     (if (and (>= (length siblings) 2)
              (eq? (car (last-pair siblings)) grob))
         '((8.5 . 5) (11 . 7.5) (68 . 7) (70.33 . 2.75)))))

BTW, are you aware that \shape can be used to alter broken curves as well?  You might consider using it since it will reflect changes in spacing.

The syntax is different for 2.16 versus 2.17.  For 2.16, you'd write:

\shape PhrasingSlur '( () ((0 . 0) (0 . 2) (0 . 2) (0 . 0)) ) 

where () is equivalent to ((0 . 0) (0 . 0) (0 . 0) (0 . 0))
indicating no change.

You'll probably need to move the \shape override closer to the phrasing slur, though.  (Can't remember the situation with 2.16, but in 2.17 it's a \once \override)

HTH,
David



reply via email to

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