\version "2.18.2" beam-stem-height = #(define-music-function (parser location start-in length-in)(number? number?) "Takes a list containing values for: - the stem-start in Y-direction - the stem-length Values can be positive or negative, depending on direction but may produce a warning if only one value is negative: 'warning: weird stem size, check for narrow beams' " #{ \override Stem.direction = #(if (positive? length-in) UP DOWN) \override Stem.stem-begin-position = #start-in \override Stem.length = #(abs length-in) \override Beam.after-line-breaking = #(lambda (grob) (let ( (stems (ly:grob-array->list (ly:grob-object grob 'stems))) (position (if (positive? length-in) (/ (+ start-in (- (abs length-in) (ly:grob-property grob 'beam-thickness))) 2) (/ (- start-in (- (abs length-in) (ly:grob-property grob 'beam-thickness))) 2) ) ) ) (ly:grob-set-property! grob 'positions (cons position position)) (for-each (lambda (stem) (ly:stem::calc-stem-begin-position stem) (ly:grob-set-property! stem 'length (abs length-in)) (ly:grob-set-property! stem 'stem-begin-position start-in) ) stems ) ) ) #}) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXAMPLES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% { \beam-stem-height #5 #7 c''8[ d''] c''16[ d''] c''32[ d''] \autoBeamOff c''8 d''16 e''32 \beam-stem-height #-7 #-10 c''8[ d''] c''16[ d''] c''32[ d''] \autoBeamOff c''8 d''16 e''32 } \new TabStaff \with { stringTunings = #ukulele-tuning \tabFullNotation \beam-stem-height #-5 #-5 } { \relative c' { r8 g'\4 c,4 e2 | a1 | g8\4 c, e a c,[ c] a'8 a | \beam-stem-height #5 #5 r8 g\4 c,4 e2 a1 g8\4 c, e a c,[ c] a'8 a } }