Jump to content

Unmetered music: An alternative to \cadenzaOn

From LilyPond wiki
Revision as of 13:58, 12 February 2026 by Gabriel Ellsworth (talk | contribs) (I changed the music example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If your music is unmetered, you might use \cadenzaOn. But \cadenzaOn will disable automatic measure demarcation, and when it is applied, the \bar command will not start a new measure.

If you want the features that come with measure demarcation (e.g., resetting accidentals, automatic bar numbering, automatic beaming), the following approach may be useful. It combines \omit TimeSignature with a Devnull context containing a timing (measure demarcation) variable.

If you use Frescobaldi, you may find its built-in duration counter helpful for computing values to enter into your measure-demarcation variable. Look below your code window for “Length: #/#” to the right of the Line and Col counters. Highlight a measure of music input in your code to see Frescobaldi’s automatic counting of its length.

See also “Unmetered music” in the Notation Reference and the snippet Free meter – increasing the bar number wherever you want.

This approach is useful for opera recitative, as demonstrated in the following example from Patience by Gilbert & Sullivan.

\version "2.24"

\header {
  title = "Example from a recitative"
  subtitle = \markup \concat {
    "“Still brooding on their mad infatuation”"
    " from " \italic Patience
  }
  subsubtitle = "Source: IMSLP #251595"
  poet = Gilbert
  composer = Sullivan
}

\layout {
  \context {
    \Staff
    % If you enable the following line,
    % you will see that \measures works
    % to create measure boundaries
    % for automatic accidentals:
    % \accidentalStyle dodecaphonic-first
  }
  \context {
    \Score
    forbidBreakBetweenBarLines = ##f
    \override BarNumber.break-visibility = ##(#f #t #t)
  }
}

%% Define a variable that will go in a Devnull context:
measures = {
  % The source has a common time signature. To reproduce it:
  % Have LilyPond print a text grob instead of a usual time signature:
  \once \override Score.TimeSignature.stencil = #ly:text-interface::print 
  % Specify that the text grob should be the symbol for common time:
  \once \override Score.TimeSignature.text = \markup \musicglyph "timesig.C44" 
  \time 17/8 s8*17
  
  % measure 2: 
  \omit Score.TimeSignature
  \time 13/8 s8*13
  
  % measure 3: 
  \time 4/4 s4*4
  
  % measure 4:
  \time 8/4 s4*8
  
  % measures 5 and 6:
  \time 4/4
  
  % Continue adding time signatures, spacer rests,
  % and (if desired) custom bar lines
  % for each subsequent “measure” of your music:
  % \time XX/4 s4*XX
}

global = {
  \key f \major
  % Notice that if you enable \cadenzaOn,
  % you will lose the features of
  % automatic measure demarcation:
  % \cadenzaOn
}

soprano = \relative c'' {
  \global
  \autoBeamOff
  r4 c bes8 a r a bes c c d e g4 f |
  % Barchecks with | are helpful
  % to confirm that your \measures variable
  % has correct durations in it
  r4 f8 f8. f,16 f4 r8 f
  ees' ees d8. c16 |
  d8 r r4 r2 |
  d4 d8 d f4 d8 d16 d
  c8 d c bes r bes c d |
  d8. g,16 g8 g f'4. e8 |
  c4 r r2 |
}

text = \lyricmode {
  Still brood -- ing on their
  mad in -- fat -- u -- a -- tion!
  I thank thee, Love, thou
  com -- est not to me;
  Far hap -- pier I, free from
  thy min -- is -- tra -- tion,
  Than dukes or duch -- es -- ses
  who love, can be!
}

pianoRH = \relative c' {
  \global
  <f a,>8 r r4 s4 r1 s4. |
  <f c>2 s4. r2 s4 |
  r4 <d bes> r2 |
  r2 s2 r2 s2 |
  <f d>2 r2 |
  r4 <e c> r2 |
}

pianoLH = \relative {
  \global
  \clef bass
  <f f,>8 r r4 s4 r1 s4. |
  <f a,>2 s4. r2 s4 |
  r4 <f bes,> r2 |
  r2 s2 r2 s2 |
  <g b,>2 r2 |
  r4 <g c,>4 r2 |
}

\score {
  <<
    %% Add your variable to a Devnull context:
    \new Devnull \measures
    \new Staff <<
      \new Voice = "soprano" \soprano
      \new Lyrics \lyricsto "soprano" \text
    >>
    \new PianoStaff <<
      \new Staff = "right" \pianoRH
      \new Staff = "left" { \clef bass \pianoLH }
    >>
  >>
}