6

How can individual staff lines be hidden in lilypond?

E.g. in

\new DrumStaff \with {
  \override StaffSymbol.line-count = #3
}
<<
  \drummode {
    <<
      {
        r4 hh 
      } \\
      {
        bd4 bd8 bd8 
      }
    >>
  }
>>

enter image description here

I'd like to hide the staff line in the middle.

And e.g. in

\new DrumStaff \with {
  \override StaffSymbol.line-count = #2
}
<<
  \drummode {
    <<
      {
        r4 hh 
      } \\
      {
        bd4 bd8 bd8 
      }
    >>
  }
>>

enter image description here

I'd like to hide the staff line at the very top (only visible when there is a note at the top) and the staff line at the very bottom (only visible when there is a note at the bottom)

I took a look at the documentation, but could only find how to hide all of the staff lines, but not individual ones.

1 Answer 1

8

I don't fully understand what you're looking for in the bottom example. Feel free to clarify, or perhaps this answer will move you in the right direction.

This solution specifies the number of staff lines while also specifying their positions.

\version "2.18.2"

\relative c' {
  \new DrumStaff 
    <<
      \drummode {
        \override Staff.StaffSymbol.line-count = #2
        \override Staff.StaffSymbol.line-positions = #'(-2 2)
        <<
          {
            r4 hh 
          }
          \\
          {
            bd4 bd8 bd8 
          }
        >>
      }
    >>
}

enter image description here

2
  • 2
    I could be wrong, but I'm pretty sure OP just wants to hide the ledger lines at the end of the question, which could be accomplished with a command like \override NoteHead.no-ledgers = ##t.
    – Athanasius
    Commented May 15, 2020 at 15:01
  • Thanks! Yes, that does the trick @Athanasius I wasn't aware that these are called ledger lines
    – nistel
    Commented May 15, 2020 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.