Jump to content

Grid lines: emphasizing rhythms and notes synchronization: Difference between revisions

From LilyPond wiki
m New category
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


<lilypond version="2.24">
<lilypond version="2.24">
\score {
\new ChoirStaff {
  \new ChoirStaff {
  \relative c'' <<
    \relative c'' <<
    \new Staff {
      \new Staff {
      \time 12/8
        \time 12/8
      \stemUp
        \stemUp
      c4. d8 e8 f g4 f8 e8. d16 c8
        c4. d8 e8 f g4 f8 e8. d16 c8
    }
      }
    \new Staff {
      \new Staff {
      % hides staff and notes so that only the grid lines are visible
        % hides staff and notes so that only the grid lines are visible
      \hideNotes
        \hideNotes
      \hide Staff.BarLine
        \hide Staff.BarLine
      \override Staff.StaffSymbol.line-count = #0
        \override Staff.StaffSymbol.line-count = #0
      \hide Staff.TimeSignature
        \hide Staff.TimeSignature
      \hide Staff.Clef
        \hide Staff.Clef
          
          
        % dummy notes to force regular note spacing
      % dummy notes to force regular note spacing
        \once  \override Score.GridLine.thickness = #4.0
      \once  \override Score.GridLine.thickness = #4.0
        c8 c c
      c8 c c
        \once  \override Score.GridLine.thickness = #3.0
      \once  \override Score.GridLine.thickness = #3.0
        c8 c c
      c8 c c
        \once  \override Score.GridLine.thickness = #4.0
      \once  \override Score.GridLine.thickness = #4.0
        c8 c c
      c8 c c
        \once  \override Score.GridLine.thickness = #3.0
      \once  \override Score.GridLine.thickness = #3.0
        c8 c c
      c8 c c
      }
    }
    >>
  >>
}
 
\layout {
  \context {
    \Score
    \consists "Grid_line_span_engraver"
    % center grid lines horizontally below note heads
    \override NoteColumn.X-offset = #-0.5
   }
   }
   \layout {
   \context {
    \context {
     \Staff
      \Score
    \consists "Grid_point_engraver"
      \consists "Grid_line_span_engraver"
    gridInterval = #(ly:make-moment 1/8)
      % center grid lines horizontally below note heads
    % set line length and positioning:
      \override NoteColumn.X-offset = #-0.5
    % two staff spaces above center line on hidden staff
    }
    % to four spaces below center line on visible staff
     \context {
    \override GridPoint.Y-extent = #'(2 . -4)
      \Staff
      \consists "Grid_point_engraver"
      gridInterval = #(ly:make-moment 1/8)
      % set line length and positioning:
      % two staff spaces above center line on hidden staff
      % to four spaces below center line on visible staff
      \override GridPoint.Y-extent = #'(2 . -4)
    }
    ragged-right = ##t
   }
   }
}
}
</lilypond>
</lilypond>


[[Category:Contexts and engravers]]
[[Category:Editorial annotations]]
[[Category:Education]]
[[Category:Education]]
[[Category:Editorial annotations]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Latest revision as of 20:36, 16 December 2025

Regular vertical lines can be drawn between staves to show note synchronization; however, in case of monophonic music, you may want to make the second stave invisible, and make the lines shorter like in this snippet.

\version "2.24"

\new ChoirStaff {
  \relative c'' <<
    \new Staff {
      \time 12/8
      \stemUp
      c4. d8 e8 f g4 f8 e8. d16 c8
    }
    \new Staff {
      % hides staff and notes so that only the grid lines are visible
      \hideNotes
      \hide Staff.BarLine
      \override Staff.StaffSymbol.line-count = #0
      \hide Staff.TimeSignature
      \hide Staff.Clef
        
      % dummy notes to force regular note spacing
      \once  \override Score.GridLine.thickness = #4.0
      c8 c c
      \once  \override Score.GridLine.thickness = #3.0
      c8 c c
      \once  \override Score.GridLine.thickness = #4.0
      c8 c c
      \once  \override Score.GridLine.thickness = #3.0
      c8 c c
    }
  >>
}

\layout {
  \context {
    \Score
    \consists "Grid_line_span_engraver"
    % center grid lines horizontally below note heads
    \override NoteColumn.X-offset = #-0.5
  }
  \context {
    \Staff
    \consists "Grid_point_engraver"
    gridInterval = #(ly:make-moment 1/8)
    % set line length and positioning:
    % two staff spaces above center line on hidden staff
    % to four spaces below center line on visible staff
    \override GridPoint.Y-extent = #'(2 . -4)
  }
}