[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to change the stem-length?
From: |
address@hidden |
Subject: |
Re: How to change the stem-length? |
Date: |
Mon, 7 Nov 2011 06:52:44 -0800 |
On Nov 6, 2011, at 4:56 AM, harm6 wrote:
>
> Hi,
>
> using a beam-stencil-override, I'd wish to adjust the stem-length within the
> beam-stencil-override. The following (boiled down) function works fine in
> most cases, even with kneed-beams. But when using it in a cross-staff
> example with kneed-beams, I've noticed a problem: Some stems are affected
> some not. Oddly enough, when changing the global-staff-size, I retrieve
> different results.
>
>
I love how that looks!!
I need to find a way to work it into a piece...
The function will be consistent if you hijack a different property. To wit,
quantized-positions. By the time you call ly:beam::print, the stencil values
for the stem may have already been cached, in which case they will not be
recalculated for length.
Cheers,
MS
\version "2.15.16"
#(set-global-staff-size 20)
#(define ((stem-change y) grob)
(let ((pos (ly:beam::set-stem-lengths grob)))
(begin
(ly:grob-set-property! grob 'color red)
(map
(lambda (n)
(ly:grob-set-property! n 'length y))
(ly:grob-array->list (ly:grob-object grob 'stems))))
pos))
%---- Test
top = \change Staff = "1"
bottom = \change Staff = "2"
music = \relative c {
\override Beam #'auto-knee-gap = #0
\override Beam #'quantized-positions = #(stem-change 20)
\bottom c32[ g' \top eis'']
c[ b \bottom g,]
\top e''[ \bottom c,, \top g'']
\bottom c,,64[ \top g'' e' \bottom c,, \top c'']
f,,32 [f''' f,,, f''']
}
\score {
\new PianoStaff <<
\new Staff = "1" {
s4 s8 s16
}
\new Staff = "2" {
\clef bass
\music
}
>>
}