lilypond-user
[Top][All Lists]
Advanced

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

Re: variable stave distances in piano-staves


From: Matthias Kilian
Subject: Re: variable stave distances in piano-staves
Date: Thu, 1 Apr 2004 20:31:59 +0200
User-agent: Mutt/1.3.28i

On Tue, Mar 30, 2004 at 10:55:37PM +0200, Matthias Kilian wrote:
> > Under "Piano music" -> BUGS I found it, and it is quite complicated, but
> > it works. :)
[...]
> > Can You tell me, wether it is possible or not to determine more than one
> > line to change the distance?
> 
> With the hack mentioned in the docs (I use that for my chaconna exercise),
> it's not possible. However, the hack may be extended to accept a list
> of line numbers (or, pairs of line numbers and staff distances).
> (I'm talking about that futz-alignment-callback)
> 
> I'll work on this in a few days, so stay tuned.

Here it is. Terrible, ugly, imperformant, nearly unusable, but it works:
replcate the definition of futz-alignment-callback in the documentation
sample by the following: function:

    #(define ((futz-alignment-callback count-dists) grob axis)
      "For all COUNT/DISTANCE pairs in count-dists, check if we're the
      system number COUNT, and if yes, set fixed distance to DISTANCE;
      then call the original callback.  "
      (let*
        ((a (ly:grob-parent grob axis))
         (o (ly:grob-original a))
         (bs (if (ly:grob? o)
                (ly:spanner-broken-into o)
                #f))
        )

        (for-each
          (lambda (count-dist)
            (let ((count (car count-dist))
                  (distance (cdr count-dist)))
              (if (and (list? bs)
                   (< count (length bs))
                   (equal? (list-ref bs count) a)
                 )
                 (ly:grob-set-property! a 'forced-distance distance))))
          count-dists)

        (Align_interface::fixed_distance_alignment_callback grob axis))
    )

And, in the score block:

  \context PianoStaff \with {
    verticalAlignmentChildCallback = #(futz-alignment-callback '(
        (14 . 14.5)
        (15 . 15)
        (17 . 14)
    ))
    %% Every cross staff beam will trigger
    %% alignment unless autokneeing is switched off 
    \override Beam #'auto-knee-gap = #'()
  } {
    ...
  }

Each pair contains the system count (counting from 0) and the staff
distance for that system. In the example above, I force the 15th system
to a distance of 14.5, the 16th to 15, and the 17th to 14 staff spaces.

Since this is rather unstable (one changed linebreak after editing
and you're in the wrong staff) I recommend to do that finetuning after
everything else has been typed in.

Ciao,
        Kili




reply via email to

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