Jump to content

Spacing notes using an invisible staff

From LilyPond wiki
Revision as of 22:36, 26 October 2025 by Jean Abou Samra (talk | contribs) (Import snippet from LSR)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When entering partially typeset music (i.e. for students to be completed by hand), you may need the spacing that correspond to the timing of notes: all measures have same length, etc. It can be implemented by adding an invisible staff with a lot of fast notes.

\version "2.24.0"

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

%LSR modified by P.P.Schneider on Feb.2014

quickmeasure =  {
  \hideNotes
  \repeat unfold 64 c''16
}

mel =  \relative c' { 
  c16 d16 e8 a4 g2 
  e8 d c2. 
  g'1 
  e4 d c2 
}

\score {
  \context PianoStaff  <<
    \new Staff <<
      \clef G
      \new Voice { \mel }
      \new Voice { \quickmeasure }
    >>
    \new Staff  { 
      \clef F 
      s1*4 
    }
  >>
  \layout {}
}