lilypond-user
[Top][All Lists]
Advanced

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

Re: workaround: keeping piano staves alive together in a RemoveEmptyStaf


From: Valentin Villenave
Subject: Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext
Date: Thu, 18 Dec 2008 12:49:28 +0100

2008/12/17 Valentin Villenave <address@hidden>:
> Hmm... No, this doesn't help. I have a 450-pages score with a somewhat
> complex piano part (cross-staff voices, internal polyphony etc) and I
> can't check every system one by one. The very reason why I have given
> up using your trick is because i need something automatic.

ok, now it works:


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

one = {
 \repeat unfold 4 { a4 b c' d'} \break
 \repeat unfold 4 { a4 b c' d'} \break
 \repeat unfold 4 { a4 b c' d'} \break
 a1
}
two = { \clef bass
 \repeat unfold 4 { a4 b  c' d'} \break
 \repeat unfold 4 { a4. << c' \\ c  >> c'8 d'} \break
 R1*4 \break
 a1
}
three = { \clef bass
 \repeat unfold 4 { a,4 b, c d} \break
 R1*4 \break
 R1*4 \break
 a1
}

\layout {
 \context {
   \RemoveEmptyStaffContext
 }
 \context {
   \name PseudoVoice
   \type Engraver_group
   \consists Note_heads_engraver
   \consists Pitch_squash_engraver
   squashedPosition = #0
   \override NoteHead #'stencil = #empty-stencil
 }
 \context {
   \Staff
   \accepts PseudoVoice
 }
}

#(define (remove music)
"Sends the whole thing to Devnull whenever possible"
 (context-spec-music music 'Devnull))

#(define (event-filter event)
 (let ((n (ly:music-property event 'name)))
  (if (or
    (eq? n 'ContextSpeccedMusic) ; to avoid clefs and ottavas
    (eq? n 'ContextChange) ; cross-staff voices are supported
    (eq? n 'SimultaneousMusic)) ; we don't want a new Voice to be created
  (ly:music-set-property! event 'name 'NoteEvent))))

makeGhost =
#(define-music-function (parser location music) (ly:music?)
 (context-spec-music (music-filter event-filter music) 'PseudoVoice))

LetsTryThis=
#(define-music-function (parser location up down) (ly:music? ly:music?)
#{<<
   \new Staff = "up" \with { \remove Accidental_engraver }
   <<
      \new Voice \with { \consists Accidental_engraver }
         { \clef treble $up }
      \new Voice { \makeGhost $down }
   >>
   \new Staff = "down" \with { \remove Accidental_engraver }
   <<
      \new Voice \with { \consists Accidental_engraver }
         { \clef bass $down }
      \new Voice { \makeGhost $up }
   >>
 >>
#})

{ <<
   \new Staff \one
   \new PianoStaff \LetsTryThis \two \three
>> }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%รน

Note to myself: who's your daddy?

:-)

Cheers,
Valentin

reply via email to

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