I can't speak to whether the code is sound, but if it is, this should be added to the LSR. Quite frankly, I'm surprised something similar isn't there already.
DR -----Original Message----- From: Thomas Morley [mailto:[email protected]] Sent: Sunday, November 11, 2012 5:32 PM To: David Nalesnik Cc: Daniel Rosen; David Kastrup; [email protected] Subject: Re: TupletNumber direction 2012/11/11 David Nalesnik <[email protected]>: > On Sun, Nov 11, 2012 at 3:36 PM, Daniel Rosen <[email protected]> wrote: >> Fantastic. I had a feeling that it would be a relatively simple function (it >> certainly appears to be), but I know absolutely nothing about Scheme. I'll >> have to read the Extending manual one of these days. >> > > Yes--Scheme certainly opens up a lot of possibilities, and it's great > fun if you like solving puzzles. Hi David, Big surprise: I _do_ like solving puzzles. :D On topic: Your function doesn't cover the case, where a rest is first in a tuplet. Try it with: \relative c'' { \times 2/3 { r8 c, c } } Here my approach, covering the rest-case and emitting a warning if kneed beam is occurring: \version "2.16.0" \relative c' { \override TupletBracket #'after-line-breaking = #(lambda (grob) (let* ((tuplet-dir (ly:grob-property grob 'direction)) (note-columns (ly:grob-array->list (ly:grob-object grob 'note-columns))) (note-heads-array-list (flatten-list (map (lambda (x) (ly:grob-object x 'note-heads)) note-columns))) (note-heads (flatten-list (map (lambda (x) (ly:grob-array->list x)) note-heads-array-list))) (stems (map (lambda (x) (ly:grob-object x 'stem)) note-heads)) (stem-dirs (map (lambda (x) (ly:grob-property x 'direction)) stems)) (sorted-stems-dirs-list (sort-list stem-dirs (lambda (a b) (< a b)))) (equal-stems-dir? (= (car sorted-stems-dirs-list) (car (reverse sorted-stems-dirs-list))))) (if (and equal-stems-dir? (= (car sorted-stems-dirs-list) tuplet-dir)) (ly:grob-set-property! grob 'direction (* -1 (car sorted-stems-dirs-list))) (ly:warning "Kneed beam detected - if desired, adjust TupletBracket manually.")))) \times 2/3 { c'8 c c } \times 2/3 { r8 c c } \times 2/3 { r8 r c } \times 2/3 { c c'' r } \break \times 2/3 { c,,,8 c c } \times 2/3 { r8 c c } \times 2/3 { r8 r c } \times 2/3 { c c'' r } } Best, Harm _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
