Jump to content

Creating arbitrary lines following notes across staves: Difference between revisions

From LilyPond wiki
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
No edit summary
Line 31: Line 31:
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Specific notation]]
[[Category:Specific notation]]
[[Category:Expressive marks]]
[[Category:Expressive marks]][[Category:Snippet]]

Revision as of 22:50, 21 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"

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