lilypond-user
[Top][All Lists]

Re: How to read out the number of beams and the space between them?

 From: David Nalesnik Subject: Re: How to read out the number of beams and the space between them? Date: Mon, 17 Oct 2011 08:43:24 -0500

Hi again Harm,

I've been thinking about this some more.  Specifically, I've noticed that adding the beam widths and the spaces between the beams doesn't seem to add up precisely to the total extent of the beam.  The result is that the size of the bracket is off -- noticeably so in the first beamed group.

I don't know why this is the case.  (I hope that somebody with more expertise could answer this.)

If you use stencil extents, however, you can avoid the problem entirely and simplify the function:

\version "2.14.2"

#(define (stencil-plus-bracket grob)
(let* ((beam (ly:beam::print grob))
(beam-extent-Y (ly:stencil-extent beam Y))
(bracket (ly:bracket Y
(cons (car beam-extent-Y)
(cdr beam-extent-Y))
0.05 0.4)))

beam
(ly:stencil-in-color
(ly:stencil-translate
bracket
(cons -1 0))
1 0 0))))

\relative c' {
\stemUp
\override Beam #'stencil = #stencil-plus-bracket
f'32 [f f f]
f16 [f f f]
f64 [f f f]
}

-David