lilypond-user
[Top][All Lists]
Advanced

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

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: Sun, 16 Oct 2011 13:58:19 -0500

Hi, Harm --

On Sun, Oct 16, 2011 at 10:27 AM, harm6 <address@hidden> wrote:

In the little test-function below I have to put in the beam-count manually.
And the value of the between-beam-space is a guess.

Any hint to improve?

You can get the space between the beams from the 'gap property.  (It's measured in half staff-spaces, so this value needs to be halved.)  Also, you can get the number of beams through the 'beaming property.  Here I've gotten the beam-count from the first stem.

I hope this helps!

\version "2.14.2"

#(define ((stencil-plus-bracket beam-count) grob)
 (let* ((beam (ly:beam::print grob))
        (beam-count (length (cdr (ly:grob-property (ly:grob-parent grob X) 'beaming))))
        (beam-positions (ly:grob-property grob 'positions))
        (gap (* 0.5 (ly:grob-property grob 'gap)))
        (single-beam-thickness (ly:grob-property grob 'beam-thickness))
        (whole-beam-thickness 
          (+ (* beam-count single-beam-thickness)(* (- beam-count 1) gap)))
        (bracket (ly:bracket Y (cons (* -0.5 whole-beam-thickness) (* 0.5 whole-beam-thickness)) 0.05 0.4)))

 (ly:stencil-add
   beam
   (ly:stencil-in-color
     (ly:stencil-translate
       bracket
       (cons -1 (- (car beam-positions) (* 0.38 whole-beam-thickness))))
   1 0 0))
     ))

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

Best,

David

reply via email to

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