On 13.10.2016 14:41, David Sumbler wrote:
On Wed, 2016-10-12 at 14:10 -0400, Kieren MacMillan wrote:
Hi David,

But I realise that often what I need in order to get satisfactory
hairpins is more space between the note heads, and simply moving
ends of the hairpin does not reposition the relevant notes.
Have you tried adjusting the minimum-length?

\version "2.18.2"
\language "english"

after =
#(define-music-function (parser location t e m)
      (ly:duration? ly:music? ly:music?)
          \context Bottom <<
              { \skip $t <> -\tweak extra-spacing-width #empty-
interval $e }

testing = \relative e'' {
   \override Hairpin.minimum-length = #5
   e8 cs ds d \after 4 \> \after 4 \mf cs2\< ~ cs4 d8(\p cs)

\score { \testing }

Hope that helps!
Thanks, that's brilliant.  With this and Hairpin.shorten-pair I should
be able to solve most or all of the problems I often find with

I have read all the material in the list archive relating to this
Which function? \after?

after =
%% create a music function with three arguments and assign it to the variable `after`
#(define-music-function (parser location t e m)
   ;; give the types of the three arguments as predicate procedures
   (ly:duration? ly:music? ly:music?)
   ;; have the expression in #{#} evaluated by the LilyPond parser
     %% Bottom is a kind of alias usually referring to Voice.
     %% In this case, it’s there to prevent creating new Voices,
     %% so the simultaneous music <<>> remains in one Voice.
     \context Bottom <<
%% first expression in the simultaneous music: the last argument passed to the function

       %% second expression:
%% \skip $t creates a skip of the duration given as first argument of the function
       %% <> is an empty chord with no duration
%% the tweak prevents the spacing to be distorted by the inserted item $e %% empty-interval is defined in scm/lily-library.scm as #'(+inf.0 . -inf.0), %% i.e. actually an infinitely small interval. Maybe #'(0 . 0) would work just as well,
       %% but it might also cause errors or unwanted behaviour.
       { \skip $t <> -\tweak extra-spacing-width #empty-interval $e }

HTH, Simon

lilypond-user mailing list

Reply via email to