Re: difficulty implementing grob-suicide! for spanned bendAfter
2009/7/10 Mike Solomon mike...@ufl.edu: \relative c'' { \override Voice . BendAfter #'after-line-break = #(lambda This override doesn't work because the property's called after-line-breaking. You don't get any warning since LilyPond (deliberately) does no type checks for grob properties which are set to procedures or closures. Regards, Neil ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: difficulty implementing grob-suicide! for spanned bendAfter
That does the trick - works like a charm now. Thank you! ~Mike On 7/10/09 6:43 PM, Neil Puttock n.putt...@gmail.com wrote: 2009/7/10 Mike Solomon mike...@ufl.edu: \relative c'' { \override Voice . BendAfter #'after-line-break = #(lambda This override doesn't work because the property's called after-line-breaking. You don't get any warning since LilyPond (deliberately) does no type checks for grob properties which are set to procedures or closures. Regards, Neil ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
difficulty implementing grob-suicide! for spanned bendAfter
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? Thank you! ~Mike \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 = #(lambda (grob) (bendcallback grob)) r4 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAf \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 \bendAfter #-3 c1 } }}} \layout { \context { \Voice \remove Forbid_line_break_engraver } } ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: difficulty implementing grob-suicide! for spanned bendAfter
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 ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: difficulty implementing grob-suicide! for spanned bendAfter
On 10.07.2009, at 06:47, Mark Polesky wrote: 5) The \layout block goes *inside* the \score block. Not necessarily, one is global for every \score in a \book, and one only applies to a single \score in a \book. James E. Bailey ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: difficulty implementing grob-suicide! for spanned bendAfter
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 markpole...@yahoo.com 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