lilypond-user
[Top][All Lists]
Advanced

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

Re: Growing beam position


From: Aaron Hill
Subject: Re: Growing beam position
Date: Wed, 03 Nov 2021 12:26:05 -0700
User-agent: Roundcube Webmail/1.4.9

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



reply via email to

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