Bar checks

Though not strictly necessary, bar checks should be used in the input code to show where bar lines are expected to fall. They are entered using the bar symbol, ‘|’. With bar checks, the program can verify that you have input durations where each measure adds up to the correct length. Bar checks also make your input code easier to read, since they help keep things organized.

\relative {
  g'1 | e1 | c2. c' | g4 c g e | c4 r r2 |

[image of music]

If you compile the code in the example above, you should see a warning in the console output:

warning: bar check failed at: 1/2
 g'1 | e1 | c2. c'
                   | g4 c g e | c4 r r2 |

Although the missing duration is clear in the musical output in this simple example, the warning in the console output is far more effective in drawing attention to the missing ‘4’ in bar 3.

See also

Notation Reference: Bar and bar number checks.

LilyPond Learning Manual v2.25.18 (development-branch).