Jump to content

Creating arbitrary lines following notes across staves

From LilyPond wiki

In the snippet, you'll see that "s2" was used instead of "r2" as a placeholder to space it out a little bit. VoiceFollower ignores this -- when r2 was used it would try to draw a line from the rest to the note head, while philosophically interesting would be wrong.

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=729

\score {
  \new StaffGroup {
    \set StaffGroup.followVoice = ##t
    <<
      \new Staff=one {
        \override VoiceFollower.style = #'dashed-line
          <<
            {c'1}
            {s2 \change Staff = "three" b2} 
          >>
        a1
        }
      \new Staff=two {
        \override VoiceFollower.style = #'dashed-line
        g'2 f' \change Staff = "one" e'1
      }
      \new Staff=three {
        \set followVoice = ##f
        r2 s \change Staff = "two" r1
      }
    >>
  }
}