lilypond-learning: Tying notes across voices

 
 Tying notes across voices
 .........................
 
 The following example demonstrates how to connect notes in different
 voices using ties.  Normally, only two notes in the same voice can be
 connected with ties.  By using two voices, with the tied notes in one of
 them
 
      [image src="" alt="[image of music]" text="image of music"]
 
 and blanking the first up-stem in that voice, the tie appears to cross
 voices:
 
      <<
        {
          \tweak Stem.transparent ##t
          b8~ b\noBeam
        }
      \\
        { b8[ g] }
      >>
      [image src="" alt="[image of music]" text="image of music"]
 
    To make sure that the just-blanked stem doesn’t squeeze the tie too
 much, we can lengthen the stem by setting the ‘length’ to ‘8’,
 
      <<
        {
          \tweak Stem.transparent ##t
          \tweak Stem.length #8
          b8~ b\noBeam
        }
      \\
        { b8[ g] }
      >>
      [image src="" alt="[image of music]" text="image of music"]
 
    Now for _overriding_ the transparency of a graphical object, we could
 have used the shorthand ‘\hide’ as explained above.  Tweaking is a
 different operation, affecting only properties generated from a single
 music expression.  It turns out that we can convert overrides into
 tweaks using ‘\single’, making it possible to rewrite the above example
 as
 
      <<
        {
          \single \hide Stem
          \single \hide Flag
          \tweak Stem.length #8
          b8~ b\noBeam
        }
      \\
        { b8[ g] }
      >>
      [image src="" alt="[image of music]" text="image of music"]
 
    In this particular case, the difference to ‘\once \hide’ is not
 apparent.  It is important when there are several objects at the same
 point in musical time (like noteheads in a chord).  In that case,
 ‘\once’ will affect all of those objects while ‘\single’ will only
 affect a single one, the one generated by the immediately following
 music expression.