lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Half-note stem length Function help


From: Carl Williams
Subject: Re: Half-note stem length Function help
Date: Sun, 18 Dec 2016 18:20:07 +1300
User-agent: Mailbird/2.3.36.0

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 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)
        )
      )
    )
  )

%%%%%%%%%%%%%%%%
%% 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, 
Carl

On 16/12/2016 22:14:12, Carl Williams <address@hidden> wrote:

Ok thanks Simon, 
I like that suggestion, I might do that. Haven't started on includes yet, but it's good to know. 
Thanks for spotting the reply-all. Didn't cross my mind. 
Carl

On 16/12/2016 20:00:20, Simon Albrecht <address@hidden> wrote:

On 16.12.2016 07:12, Carl Williams wrote:
> One more question, What is the significance of using:?
> %%%%
> \layout {

The setting will apply to all TabVoice contexts – well, I guess that’s
not so relevant. Still, it keeps a ‘presentation’ issue separate from
the ‘content’. Actually, you can then just put the definition as well as
the \layout{} block in a separate file and turn on the functionality
simply by \including the file, without any need to change the music, or
to type the function each time you need it. But of course you can just
do whatever fits your need best :-)

It is standard to keep conversation always on-list: others may be
interested in the information or have more skills and/or time to help
out than I. So always ‘Reply All’, unless there is a compelling reason
to keep any information private.

Best, Simon

Attachment: test4.2.pdf
Description: Adobe PDF document

Attachment: test4.2.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]