lilypond-devel
[Top][All Lists]
Advanced

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

Re: workaround for \partcombine limitation, how to add to docs?


From: Mark Polesky
Subject: Re: workaround for \partcombine limitation, how to add to docs?
Date: Wed, 17 Jul 2013 00:46:45 -0700 (PDT)

Dan Eble wrote:
> Thanks for this hack.  I look forward to trying it.
>
> Any feelings on the likelihood that it is going to stop
> working in future versions?

Hi Dan,

I totally rewrote the snippet to address a spacing issue
that I had overlooked.  Will it stop working in the future?
I hope not, but that's a possibility I suppose.  It looks
like it will be included in the docs soon, in which case the
documented version would be auto-updated with `convert-ly'
with every new release.

And if it ever generates an error in some future version,
the developers will have to fix it, so there's some
stability in that respect.  What sometimes happens is that
the output changes, and nobody notices, but I'm not too
worried.  If you ever notice that with any snippet or trick
of your own, be sure to let us know!

- Mark
____________________________________________________________

\version "2.17.6"

\header {
  lsrtags = "simultaneous-notes,vocal-music,workaround"
  texidoc = "
The @code{\partcombine} command is not designed to work with
lyrics; if one of the voices is explicitly named in order to
attach lyrics to it, the partcombiner will stop working.

However, this effect can be achieved by adding a separate staff,
and tweaking it so it is completely hidden and takes up no extra
space.  A named @code{Voice} context within the hidden staff can
contain one of the two combined voices, and the @code{Lyrics}
context can use this to create the lyrics.

When using this method, the spacing above the printed staff may
vary slightly.  In most situations, using the upper voice in the
hidden staff with the @code{\voiceOne} command will provide the
best results.
"
  doctitle = "Using @code{\partcombine} with lyrics"
}

hideTheseGrobs =
#(define-music-function
   (parser location list-of-grob-symbols) (cheap-list?)
   (make-music 'ApplyContext 'procedure
     (lambda (context)
       (for-each
         (lambda (grob-symbol)
           (ly:context-pushpop-property
             context grob-symbol 'transparent #t))
         list-of-grob-symbols))))

hideStaff = \with {
  \override VerticalAxisGroup.staff-staff-spacing =
    #'((basic-distance . 0) (padding . -inf.0))
  \hideTheseGrobs
    #'(BarLine Clef KeyCancellation KeySignature
       OttavaBracket StaffSymbol TimeSignature)
}

hideVoice = \with {
  \hideNotes
  \hideTheseGrobs
    #'(Arpeggio BreathingSign DoublePercentRepeat
       DoublePercentRepeatCounter DoubleRepeatSlash
       DynamicLineSpanner DynamicText DynamicTextSpanner
       Glissando Hairpin LaissezVibrerTie MultiMeasureRest
       MultiMeasureRestNumber MultiMeasureRestText ParenthesesItem
       PercentRepeat PercentRepeatCounter PhrasingSlur RepeatSlash
       RepeatTie Script Slur StemTremolo TextScript TextSpanner
       Tie TrillPitchAccidental TrillPitchGroup TrillPitchHead
       TrillSpanner TupletBracket TupletNumber VoltaBracket
       VoltaBracketSpanner)
}

sopranoNotes = \relative g' {
  g4 fis8( g) a4 g |
  c4 c b2
}

altoNotes = \relative d' {
  d4 d d d |
  c4 d d2
}

words = \lyricmode {
  As with glad -- ness men of old
}

<<
  \new Staff \with { \hideStaff } {
    \new Voice = "soprano" \with { \hideVoice } {
      \voiceOne \sopranoNotes
    }
  }
  \new Staff \with { printPartCombineTexts = ##f } {
    \key g \major
    \partcombine \sopranoNotes \altoNotes
  }
  \new Lyrics \lyricsto "soprano" \words
>>




reply via email to

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