[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Half-note stem length Function help
From: |
Thomas Morley |
Subject: |
Re: Half-note stem length Function help |
Date: |
Sun, 18 Dec 2016 12:34:26 +0100 |
Hi Carl,
2016-12-18 6:20 GMT+01:00 Carl Williams <address@hidden>:
> For those interested,
>
> I made some improvements to the solution for this. It now accounts for
> whether the stems are up or down, so as to match what is commonly done in
> modern tablature.
I really doubt about "commonly" ;)
I've seen so many different styles...
>
> I intend to make a tablature template incorporating this solution here also,
> http://lists.gnu.org/archive/html/bug-lilypond/2016-12/msg00022.html.
>
> %%%%%%%%%%%%%%%%
> \version "2.18.2"
>
> halve-half-stems =
> \override Stem.before-line-breaking =
> #(lambda (grob)
> (if (= 1 (ly:grob-property grob 'duration-log))
> (if (= DOWN (ly:grob-property grob 'direction))
> (and
> (ly:grob-set-property! grob 'stem-begin-position
> (- (ly:grob-property grob 'stem-begin-position)
> (/ (ly:grob-property grob 'length) 2)
> )
> )
> (ly:grob-set-property! grob 'length
> (/ (ly:grob-property grob 'length) 2)
> )
> )
> (ly:grob-set-property! grob 'length
> (/ (ly:grob-property grob 'length) 2)
> )
> )
> )
> )
No point in calling the same over and over again. How about:
halve-half-stems =
\override Stem.before-line-breaking =
#(lambda (grob)
(if (= 1 (ly:grob-property grob 'duration-log))
(let ((half-orig-lngth (/ (ly:grob-property grob 'length) 2)))
(if (= DOWN (ly:grob-property grob 'direction))
(ly:grob-set-property! grob 'stem-begin-position
(- (ly:grob-property grob 'stem-begin-position)
half-orig-lngth)))
(ly:grob-set-property! grob 'length half-orig-lngth))))
>
> %%%%%%%%%%%%%%%%
> %% EXAMPLES
> %%%%%%%%%%%%%%%%
>
> \new TabStaff \with {
> stringTunings = #ukulele-tuning
> \tabFullNotation
> \stemUp
> \halve-half-stems
> }
> \relative c' {
> \partial 2.. a'8 a4 a2 |
> a1 |
> \stemDown
> \partial 2.. g8\4 g4\4 g2\4 |
> g1\4 |
> }
> \new TabStaff \with {
> stringTunings = #ukulele-tuning
> \tabFullNotation
> \revert Stem.stencil
> \revert Stem.X-extent
> \stemUp
> \halve-half-stems
> }
> \relative c' {
> \partial 2.. a'8 a4 a2 |
> a1 |
> \stemDown
> \partial 2.. g8\4 g4\4 g2\4 |
> g1\4 |
> }
> %%%%%%%%%%%%%%%%
Cheers,
Harm