[Top][All Lists]
[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 14:00:26 +0100 |
2008/12/18 Kieren MacMillan <address@hidden>:
> Nicely done! Definitely LSR-worthy…
Will do.
Here's a better version, that also demonstrates a slight bug (the
cross-staff slur doesn't work well)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.->
\ottava #1 << c' \\ c >> \ottava #0 \change Staff = down c'8(
\change Staff = up 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
(music-map remove event))
(if (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
>> }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Anyway, I've compiled my opera with it and it works like a charm.
Cheers,
Valentin
- workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Valentin Villenave, 2008/12/17
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Kieren MacMillan, 2008/12/17
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Valentin Villenave, 2008/12/17
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Jonathan Kulp, 2008/12/17
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Valentin Villenave, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Kieren MacMillan, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext,
Valentin Villenave <=
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Neil Puttock, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Valentin Villenave, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Neil Puttock, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Valentin Villenave, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Andrew Hawryluk, 2008/12/18
- Re: workaround: keeping piano staves alive together in a RemoveEmptyStaffContext, Neil Puttock, 2008/12/19