lilypond-user
[Top][All Lists]
Advanced

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

Re: Changing vertical staff spacing for PianoStaff?


From: Han-Wen Nienhuys
Subject: Re: Changing vertical staff spacing for PianoStaff?
Date: Tue, 17 Feb 2004 02:48:54 +0100

address@hidden writes:
> > You can use GrandStaff for this purpose. However, in that case, you
> > cannot use cross-staff beams or slurs.
> 
> Unfortunately, I need both: cross-staff beams and varying staff
> distances. I tried to user a translator and set 'forced-distance to 15,
> which helps avoiding collisions at three places, but also is far too
> wide for the overal piece.

Ah, an excercise in Lily Hacking! Tested on lily .24


\header
{

 texidoc = "It is possible to have different staff distances across
piano systems, but it requires some advanced magic. Kids don't try this at home.

"

}

\version "2.1.24"

#(define ((futz-alignment-callback distance count) grob axis)

   "Check if we're the system number COUNT, and if yes, set fixed distance to
DISTANCE; then call the original callback.  "
   (let*
       ((a (ly:get-parent grob axis))
        (o (ly:get-original a))
        (bs (if (ly:grob? o)
                (ly:get-broken-into o)
                #f))
        )


     (if (and (list? bs)
              (< count (length bs))
              (equal? (list-ref bs count) a)
         )
         (ly:set-grob-property! a 'forced-distance distance))
     
     (Align_interface::fixed_distance_alignment_callback grob axis)) )

\score {
    \notes \relative c''  \context PianoStaff
    \with {
        verticalAlignmentChildCallback = #(futz-alignment-callback 20 1)

        %% Every cross staff beam will trigger
        %% alignment unless autokneeing is switched off 
        \override Beam #'auto-knee-gap = #'()
    } <<

        \context Staff  = up {
            
            \time 2/4 
            c8[
                \change Staff = down
                \once \override Stem #'direction = #UP
                c8
                \change Staff = up
                c c ](
            |
            \break
            
            c8[)
                \change Staff = down
                \once \override Stem #'direction = #UP
                c8
                \change Staff = up
                c c ](
        }
        \context Staff = down {
            \skip 1 }

    >>
    \paper { raggedright = ##T } 
}


-- 

 Han-Wen Nienhuys   |   address@hidden   |   http://www.xs4all.nl/~hanwen 





reply via email to

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