Hi,

On Fri, Oct 31, 2014 at 2:39 PM, David Nalesnik <david.nales...@gmail.com>
wrote:

>
> You could scale the stencil.
>

This will break down if you have sub-beams because the entire beam is
stretched.  Thankfully, the coordinates of the various beam segments are
cached, and resetting these does get a response from ly:beam::print.

The attached file is what I come up with.

Enjoy!

--David
\version "2.19.15"

#(define (calc-beam-right segments)
   (fold
    (lambda (elem prev)
      (if (> (cddr (cadr elem)) prev)
          (cddr (cadr elem))
          prev))
    0
    segments))

#(define (myBeamLength extra)
   (lambda (grob)
     (let* ((segments (ly:beam::calc-beam-segments grob))
            (beam-right-edge (calc-beam-right segments)))
       (let loop ((segs segments) (result '()))
         (if (null? segs)
             result
             (let* ((vertical (caar segs))
                    (horizontal (cadar segs))
                    (right-coord (cddr horizontal)))
               (if (= right-coord beam-right-edge)
                   (set-cdr! horizontal
                     (cons (cadr horizontal)
                       (+ extra right-coord))))
               (loop (cdr segs)
                 (append result 
                   (list (list vertical horizontal))))))))))

lengthenBeam =
#(define-music-function (parser location extra-X)
   (number?)
   #{
     \override Beam.beam-segments = #(myBeamLength extra-X)
   #})


\relative c' {
  \lengthenBeam 3.5
  c8[ d e f g a b c]
  \once \offset bar-extent #'(0 . 3) Staff.BarLine
  \stemDown
  \lengthenBeam 3
  c,16[ c c c c c c c c c c c c c c c]
  \once \offset bar-extent #'(-5 . 0) Staff.BarLine 
  \override Staff.BarLine.bar-extent = #'(-7 . 2)
  \stemNeutral
  \lengthenBeam 1.5
  c8[ c16 c c32 c c c c16. c32 c8 c c8.. c32]
  \lengthenBeam 2.5
  c8[ d16 e f32 g a b c16. d32 e8 f g8.. a32]
  \once \offset bar-extent #'(-2 . 0) Staff.BarLine
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to