Excellent, Aaron! Thanks!
On Wed, Nov 3, 2021 at 8:26 PM Aaron Hill <[email protected]> wrote:
> On 2021-11-03 11:27 am, Paolo Prete wrote:
> > Hello,
> >
> > is there a way to *automatically* have a growing beam on 32th notes
> > with a
> > horizontal middle line?
> >
> > Currently I do that by tweaking Beam.positions (see below), but I
> > wonder if
> > is there a way to avoid this trial-and-error procedure:
> >
> > Thanks!
> > P
> >
> > %%%
> > \version "2.22.0"
> > {
> > \override Beam.grow-direction = #RIGHT
> > \override Beam.positions = #'(0 . 0.8)
> > { c32[ d e f] }
> > }
> > %%%
>
> I think this is right:
>
> %%%%
> {
> \override Beam.positions =
> #(grob-transformer 'positions
> (lambda (grob orig)
> (let* ((dir (ly:grob-property grob 'direction))
> (grow (ly:grob-property grob 'grow-direction))
> (cnt (length (ly:grob-property grob 'beam-segments)))
> (th (ly:grob-property grob 'beam-thickness))
> (iv (if (interval-sane? orig) orig
> (reverse-interval orig)))
> (pos1 (interval-index iv dir))
> (pos2 (- pos1 (* 0.5 dir (- cnt 1 th)))))
> (if (> 0 grow) (cons pos1 pos2) (cons pos2 pos1)))))
>
> \override Beam.grow-direction = #RIGHT
> e'32[ f' g' a']
> c''64[ d'' e'' f'']
> \override Beam.grow-direction = #LEFT
> b'128[ a' g' f']
> }
> %%%%
>
> -- Aaron Hill
>