lilypond-user
[Top][All Lists]
Advanced

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

Re: difficulty implementing grob-suicide! for spanned bendAfter


From: Mike Solomon
Subject: Re: difficulty implementing grob-suicide! for spanned bendAfter
Date: Fri, 10 Jul 2009 01:25:20 -0400
User-agent: Microsoft-Entourage/11.4.0.080122

Mark,
    Thank you - I don't have LilyPondTool, but I will get it.  You and I had
gone back and forth recently about scheme formatting for LSR submissions - I
didn't realize that was a general rule-of-thumb.  Sorry for the
inconvenience, and thank you for the clean-up (the file compiled on my
machine, but I now see that I mis-copied and pasted).  Won't happen again.
    I will say for the would-be answerer that:

>3) An initial quarter rest followed by whole notes doesn't fit the time
>signature. Either remove the "r4" or add "\partial 4".

    ...is the point.  Meaning that my scores, which are rather contemporary,
do things like this all the time.  The whole issue arises because I have
passages that span across barlines. \bendAfter works fine for any piece that
is properly barline delimited.
    Again, thank you for your help, I will get better at this formatting
thing (which I realize more and more is half the battle), and if any of you
can help, please do!

~Mike

On 7/10/09 12:47 AM, "Mark Polesky" <address@hidden> wrote:

> 
> Mike Solomon wrote:
>> Hey lilypond-users,
>>     I am working on a piece with lots of beams/events across
>> staves, many of which have bendAfter attached to them.  The
>> spanned bend after clashes with some other stuff in the work, so
>> I wanted to kill it w/ a callback function, but after having
>> written the bit of code below I came to realize that this didn't
>> exist as I was conceiving it (should have checked the docs
>> first...). Taking a peek at the code below, do any of you have
>> suggestions for how I could make this work?
> 
> Mike, I *do* want to be encouraging, but you really have to format
> the scheme code. It's really hard to read, and the good developers
> are not going to waste their time rewriting it.
> 
> *Please* do something more like this:
> 
> #(define (bendcallback grob)
>    (let* ((orig (ly:grob-original grob))
>           (siblings (if (ly:grob? orig)
>                         (ly:spanner-broken-into orig)
>                         '())))
>      (begin
>        (format #t "I will print if this function is called.\n")
>        (if (>= (length siblings) 2)
>            (if (not (eqv? grob (car siblings)))
>                (ly:grob-suicide! grob))))))
> 
> I can understand this in about 30 seconds. It would take me about
> 2 or 3 minutes to understand it the way you have it formatted. It's
> quicker for me to rewrite it than to try to figure it out the way
> you have it. But ultimately it's not worth my time to rewrite it.
> 
> If you have trouble finding matching parentheses, use an editor
> with bracket matching. Personally I use LilyPondTool (there are
> others as well) - I can put the cursor to the right of a ")", do
> "<ctrl>-]" and it takes me to the matching "(".
> 
> Also, the code didn't compile - there's an error on this line:
> \bendAfter #-3 c1 \bendAf
> 
> Some other comments...
> 1) This:
>    \score {{ \new Staff {
>    \relative c'' { ...
> 
>    can be simplified to this:
>    \score {
>      \new Staff \relative c'' {
>      ...
> 
> 2) This:
>    \override Voice . BendAfter #'after-line-break =
>        #(lambda (grob) (bendcallback grob))
> 
>    can be simplified to this:
>    \override Voice.BendAfter #'after-line-break = #bendcallback
> 
> 3) An initial quarter rest followed by whole notes doesn't fit the
>    time signature. Either remove the "r4" or add "\partial 4".
> 
> 4) You can automate repetitive input this way:
>    \repeat unfold 45 { \bendAfter #-3 c1 }
> 
> 5) The \layout block goes *inside* the \score block.
> 
> 6) Please properly format your LilyPond code too...
> 
> 7) Before you post to the mailing list, always do a final
>    test compile to make sure what you're sending compiles!
> 
> ___________________________________
> 
> So here's my rewrite:
> 
> \version "2.13.0"
> 
> #(define (bendcallback grob)
>    (let* ((orig (ly:grob-original grob))
>           (siblings
>             (if (ly:grob? orig)
>                 (ly:spanner-broken-into orig)
>                 '())))
>      (begin
>        (format #t "I will print if this function is called.\n")
>        (if (>= (length siblings) 2)
>            (if (not (eqv? grob (car siblings)))
>                (ly:grob-suicide! grob))))))
>                
> \score {
>   \new Staff \relative c'' {
>     \override Voice.BendAfter #'after-line-break = bendcallback
>     \repeat unfold 45 { \bendAfter #-3 c1 }
>   }
>   \layout {
>     \context {
>       \Voice
>       \remove "Forbid_line_break_engraver"
>     }
>   }
> }
> 
> I'm only doing this so that you see what it should look like.
> I understand that a lot of the coding stuff is tricky; there
> are a lot of things that are easy for a beginner to forget and
> many useful tricks that a beginner just doesn't know yet. Most
> of us are more than happy to help out with those things.
> 
> But we can't and won't keep rewriting code!
> 
> I know, I've not answered your original question; there are
> still problems with the code. But I think proper formatting is
> more important than you realize. In terms of content, I'm
> actually fairly impressed -- you're tackling some ambitious
> concepts.
> 
> Okay, I'm sure someone can take over where I've left off...
> If not, I'll try to help some more later.
> 
> - Mark
> 
> 
> 
>       
> 






reply via email to

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