[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Banjo tablature stem length for beamed stems?
From: |
Thomas Morley |
Subject: |
Re: Banjo tablature stem length for beamed stems? |
Date: |
Sat, 21 Mar 2015 11:30:28 +0100 |
2015-03-21 0:24 GMT+01:00 Thomas Morley <address@hidden>:
> 2015-03-20 17:21 GMT+01:00 address@hidden
> <address@hidden>:
>> I’m working on some banjo tablature and I’d like to change the stem length
>> for beamed stems when 2 non-adjacent strings are played together. I can use
>> \override-s to lengthen and shift the stems of unbeamed notes. How can I
>> change the length of beamed stems? It seems like beamed-lengths might hold
>> the answer, but I haven’t figured out how to apply it or what the numbers
>> mean. See the minimal example below.
>> Thanks,
>> Holland
>>
>> ************
>>
>> \version "2.18.0"
>>
>> \new TabStaff {
>> \set TabStaff.instrumentName = "Banjo"
>> \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
>> \set TabStaff.stringTunings = #banjo-open-g-tuning %gDGBD
>> \tabFullNotation
>> \numericTimeSignature
>> \clef moderntab
>> \relative c' {
>> \time 4/4
>>
>> g8 < g'\5 d >8
>> %how can I make this stem longer, like the unbeamed stem after it?
>> r2. |
>>
>> g,8
>>
>> \once \override Stem.length = #12 % make the stem longer
>> \once \override Stem.Y-offset = #7 % moves the stem up
>> \once \override Stem.Y-extent = #'(-7.0 . 0.0)
>> %moves the flag to the end of the moved stem
>>
>> < g'\5 d >8
>>
>>
>> } % end of banjo notes
>> } % end of banjo voice
>>
>>
>> _______________________________________________
>> lilypond-user mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> How about my coding here:
> http://lilypond.1069038.n5.nabble.com/Stem-length-at-a-fixed-height-td172661.html#a172677
>
> Cheers,
> Harm
More elaborated:
\version "2.19.16"
equal-tab-staff-stems =
#(define-music-function (parser location avoid-intermediate-stems? val)
((boolean? #f) number?)
"
Prints all Stems ending at the same height.
\\tabFullNotation has to be set.
Printing intermediate stems, connecting TabNoteHeads in chords, is optional,
default is to print them.
"
#{
%% We set 'stem-attachment to '(0 . 0), but widen the extent of the
%% TabNoteHead in Y-direction
%% Otherwise the gap between TabNoteHead and Stem is inconsistent
\override TabNoteHead.stem-attachment = #'(0 . 0)
\override TabNoteHead.stencil =
#(lambda (grob)
(let ((default-stil (tab-note-head::print grob)))
(ly:make-stencil
(ly:stencil-expr default-stil)
(ly:stencil-extent default-stil X)
(interval-widen (ly:stencil-extent default-stil Y) 0.2))))
%% Printing intermediate Stems is made optional, default is to print them
\override Stem.avoid-note-head = #avoid-intermediate-stems?
%% Lowering Stem.layer to let the TabNoteHead whiteout them
\override Stem.layer = -100
\override Stem.direction =
#(lambda (grob)
(if (negative? val)
DOWN
UP))
%% Calculate unbeamed Stem.length to let them end according to
%% @var{val}
\override Stem.after-line-breaking =
#(lambda (grob)
(let* ((stem-begin-pos (ly:grob-property grob 'stem-begin-position)))
;; the override for Beam.positions counts from staff-position 0
;; thus we need to go there for the (unbeamed) stem-length as well
;; beam-thickness is taken from engraver-init.ly:
(ly:grob-set-property! grob
'length
(+ (if (negative? val)
stem-begin-pos
(- stem-begin-pos))
(* (abs val) 2)
;; beam-thickness:
0.32))))
%% Set Beam.positions to @var{val}, resulting in new stem-lengths
\override Beam.positions = #(cons val val)
#})
my-banjo-tab-settings =
\with {
instrumentName = "Banjo"
tablatureFormat = #fret-number-tablature-format-banjo
stringTunings = #banjo-open-g-tuning %gDGBD
\tabFullNotation
\equal-tab-staff-stems #5
}
\new TabStaff \my-banjo-tab-settings
\relative c' {
\numericTimeSignature
\clef moderntab
g8 < g'\5 d >8 r2. |
g,8 <g'\5 d, b' d > g\5 d, g \noBeam b d4 |
} % end of banjo notes
HTH,
Harm