lilypond-user
[Top][All Lists]
Advanced

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

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


From: harm6
Subject: How to read out the number of beams and the space between them?
Date: Sun, 16 Oct 2011 08:27:20 -0700 (PDT)

Hi,

trying to override Beam-stencil I need to read out the number of beams, the
space between the beams and the thickness of the whole beam (shown by the
red bracket). Of course I need only two of this values to detemine the
third, but I only managed to get the thickness of a single Beam.

http://old.nabble.com/file/p32662208/clip.png 

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.

\version "2.14.2"

#(define ((stencil-plus-bracket beam-count between-beam-space) grob)
  (let* ((beam (ly:beam::print grob))
         (beam-positions (ly:grob-property grob 'positions))
         (single-beam-thickness (ly:grob-property grob 'beam-thickness))
         (whole-beam-thickness (+ (* beam-count single-beam-thickness) (* (-
beam-count 1) between-beam-space)))
         (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 3 0.35)
        f'32 [f f f]
        \once\override Beam #'stencil = #(stencil-plus-bracket 2 0.35)
        f16 [f f f]
        \once\override Beam #'stencil = #(stencil-plus-bracket 4 0.35)
        f64 [f f f]
} 

Any hint to improve?

Thanks,
  Harm
-- 
View this message in context: 
http://old.nabble.com/How-to-read-out-the-number-of-beams-and-the-space-between-them--tp32662208p32662208.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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