lilypond-user
[Top][All Lists]
Advanced

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

Ties across variables


From: James Harkins
Subject: Ties across variables
Date: Sat, 23 Mar 2013 17:30:53 +0800

I've run into this limitation a few times -- enough that it's now
worth asking about.

~~
notesA = \relative c'' { c d e f ~ }
notesB = \relative c'' { f e d c }
\new Staff { \notesA \notesB }
~~

This doesn't render the tie. I'm sure there's a good reason why the
tie can't carry over from one variable into an immediately following
variable, but it's not always easy to work around.

Case in point: I want to use a \cadenzaToMusic function (received from
this list, thanks!) to avoid bar check problems after a cadenza
passage. This requires the cadenza material, and only the cadenza
material, to exist in its own separate variable. But the first note of
the cadenza is tied from the previous bar. If I put that first note in
the cadenza variable, I get no tie. If I put it in the variable with
the preceding music, it complicates synchronizing with other staves.

The best workaround I can imagine is to end the preceding variable
with a hidden note that allows the tie to render, and overlap that
with the cadenza variable. That's somewhat shy of elegance.

Example pasted below.

Is it possible to avoid the multi-voice workaround and still get the tie?

Thanks,
hjh


\version "2.16.1"

cadenzaToMusic =
#(define-music-function (parser location cadenzaMusic music)
                                                  (ly:music? ly:music?)
"Adjust the length of `music and the measureLength, to fit the length of
`cadenzaMusic"
(let* ((clen (ly:music-length cadenzaMusic))
       (mlen (ly:music-length music))
       (factor (ly:moment-div clen mlen))
       (compressed (ly:music-compress music factor)))
  ;; (format #t "factor : ~a\n" factor)
  #{
    \set Timing.measureLength = $clen
    $compressed
    \unset Timing.measureLength
  #}))

preVar = \relative c'' { c4 d e f ~ }
cadenzaVar = \relative c'' { f e d e f g a }
postVar = \relative c'' { c2 e4. d8 c1 }

\markup { "missing tie" }

\score {
  <<
    \new Staff {
      \preVar
      \cadenzaOn
      \cadenzaVar
      \cadenzaOff
      \bar "|"
      \postVar
    }
    \new Staff \relative c {
      \clef bass
      c2 a2
      \cadenzaToMusic \cadenzaVar { g1\fermata }
      r2 g2 c1
    }
  >>
}

\markup { "plausible, but inelegant, workaround" }

preVarWorkaround = \relative c'' { c4 d e f ~ \hideNotes f4 \unHideNotes }

\score {
  <<
    \new Staff {
      <<
        \new Voice { \oneVoice \preVarWorkaround }
        \new Voice {
          s1 \oneVoice
          \cadenzaOn
          \cadenzaVar
          \cadenzaOff
        }
      >>
      \bar "|"
      \postVar
    }
    \new Staff \relative c {
      \clef bass
      c2 a2
      \cadenzaToMusic \cadenzaVar { g1\fermata }
      r2 g2 c1
    }
  >>
}



reply via email to

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