lilypond-user
[Top][All Lists]
Advanced

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

Re: Specifying bezier curve for tie across line break collideswithclef s


From: Nick Payne
Subject: Re: Specifying bezier curve for tie across line break collideswithclef symbol
Date: Thu, 16 Dec 2010 21:01:08 +1100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

Trevor

Thanks. With that I can generalise it a bit further to be used with any sort of spanner:

#(define ((grob2-extra-offset offset) grob)
    (let* (
        (orig (ly:grob-original grob))
        (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 'extra-offset offset))))

albOffset = #(define-music-function (parser location type move) (string? pair?) #{ \once \override $type #'after-line-breaking = #(grob2-extra-offset $move)
#})

and then pass the name of the spanner as the first parameter - in this case, for example:

\albOffset "Tie" #'(0 . 1)

Nick

On 16/12/10 19:37, Trevor Daniels wrote:
Hi Nick

Yes, it's possible to generalise it, although the way
to do it is not easy to guess (nothing in scheme is
easy to guess, I find).  Try:

#(define ((tie2-extra-offset offset) grob)
  (let* (
         (orig (ly:grob-original grob))
         (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 'extra-offset offset))))

and

 \override Tie #'after-line-breaking = #(tie2-extra-offset '(0 . 1))

Trevor

----- Original Message ----- From: "Nick Payne" <address@hidden>
To: "lilypond-user" <address@hidden>
Sent: Thursday, December 16, 2010 2:41 AM
Subject: Re: Specifying bezier curve for tie across line break collideswithclef symbol


Trevor

Thanks for the explanation and Scheme code. I tried to generalise it a bit by passing in the x and y offset values as parameters, using:

#(define (tie2-extra-offset grob movex movey)
    (let* (
        (orig (ly:grob-original grob))
        (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 'extra-offset cons (movex movey)))))

and then calling it as:

\once \override Tie #'after-line-breaking = #(tie2-extra-offset (0 1))

but this gives console log errors:

/home/nick/lilypond/examples/test.ly:48:61: error: GUILE signaled an error for the expression beginning here
        \once \override Tie #'after-line-breaking = #

(tie2-extra-offset (0 1))
Interpreting music...
warning: type check for `after-line-breaking' failed; value `#<unspecified>' must be of type `boolean'

Not knowing Scheme, I'm a bit flummoxed as to how to fix this error. Is what I'm trying to do actually possible?

Nick

On 15/12/10 21:46, Trevor Daniels wrote:
Nick

When a spanner such as a tie crosses a line break, the grob
is cloned into two grobs, one to be placed at the end of
the first line and one to be placed at the beginning of the
second.  Overrides to properties made in the usual way are
made to both of these cloned grobs, although the precise
effect they have depends on the code used to generate the
grobs, and in general changes to positioning properties
will not be useful.  For details of this see Extending
LilyPond, section 2.6

http://lilypond.org/doc/v2.13/Documentation/extending/difficult-tweaks

We can modify the example there to suit your particular
problem, using 'extra-offset rather than messing with the
Bezier curve parameters, as follows:

#(set-global-staff-size 24)

#(define (tie2-extra-offset grob)
  (let* (
         (orig (ly:grob-original grob))
         (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 'extra-offset '(0 . 1)))))

\relative c'' {
    \time 6/4
<< {
        a'8 g fis e dis e \acciaccatura e d4. c'8 b4 |
        c4 r2 s2. |
        dis8 b c b a g b2\rest <e gis,>4 |
    } \\ {
        fis,,,8 e' dis e fis b, c4. g8 a4 |
        dis2 r4 s2. |
        b2 r4 r2. |
    } \\ {
        fis4 s2 s2. |
        s8 e'' fis e g fis ~ fis4. gis8 a4 ~ |
        a4 c,2\rest s2. |
    } \\ {
        s1. |
        c8\rest b a g a c dis4. e,8
 \override Tie #'after-line-breaking = #tie2-extra-offset
        fis4 ~ |
        fis4 s2 fis'8 e dis cis dis b |
    } >>
}


----- Original Message ----- From: "Nick Payne" <address@hidden>
To: <address@hidden>
Sent: Wednesday, December 15, 2010 1:59 AM
Subject: Re: Specifying bezier curve for tie across line break collides withclef symbol

Here's a small example that demonstrates the problem. The lower of the
two ties between bars 2 and 3 appears to go to the wrong note, and if
you uncomment the override for the tie control points to get it
correctly positioned vertically, the continuation of the tie in bar 3
starts at the left of the clef symbol.

\version "2.13.43"

#(set-global-staff-size 24)

\relative c'' {
    \time 6/4
<< {
        a'8 g fis e dis e \acciaccatura e d4. c'8 b4 |
        c4 r2 s2. |
        dis8 b c b a g b2\rest <e gis,>4 |
    } \\ {
        fis,,,8 e' dis e fis b, c4. g8 a4 |
        dis2 r4 s2. |
        b2 r4 r2. |
    } \\ {
        fis4 s2 s2. |
        s8 e'' fis e g fis ~ fis4. gis8 a4 ~ |
        a4 c,2\rest s2. |
    } \\ {
        s1. |
        c8\rest b a g a c dis4. e,8
% \once \override Tie #'control-points = #'((1 . -2) (2.5 . -2.5)
(3.5 . -2.5) (5 . -2))
        fis4 ~ |
        fis4 s2 fis'8 e dis cis dis b |
    } >>
}


_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user









reply via email to

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