Jump to content

Creating arbitrary lines following notes across staves: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m Remove LSR link
 
Line 2: Line 2:


<lilypond version="2.24.0">
<lilypond version="2.24.0">
%% http://lsr.di.unimi.it/LSR/Item?id=729
\score {
\score {
   \new StaffGroup {
   \new StaffGroup {

Latest revision as of 21:16, 2 November 2025

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"

\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
      }
    >>
  }
}