Next: Bar numbers, Up: Bars
Bar lines delimit measures, and are also used to indicate repeats. Normally, simple bar lines are automatically inserted into the printed output at places based on the current time signature.
The simple bar lines inserted automatically can be changed to
other types with the \bar
command. For example, a closing
double bar line is usually placed at the end of a piece:
e4 d c2 \bar "|."
Note: An incorrect duration can lead to poorly formatted music. |
It is not invalid if the final note in a measure does not end on the automatically entered bar line: the note is assumed to carry over into the next measure. But if a long sequence of such carry-over measures appears the music can appear compressed or even flowing off the page. This is because automatic line breaks happen only at the end of complete measures, i.e., where the end of a note coincides with the end of a measure.
Line breaks are also permitted at manually inserted bar lines even within incomplete measures. To allow a line break without printing a bar line, use
\bar ""
This will insert an invisible bar line and allow (but not force) a line break to occur at this point. The bar number counter is not increased. To force a line break see Line breaking.
This and other special bar lines may be inserted manually at any point. When they coincide with the end of a measure they replace the simple bar line which would have been inserted there automatically. When they do not coincide with the end of a measure the specified bar line is inserted at that point in the printed output. Such insertions do not affect the calculation and placement of subsequent automatic bar lines.
The simple bar line and four types of double bar line are available for manual insertion:
f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d
together with dotted and dashed bar lines:
f1 \bar ":" g \bar "dashed" a
and three types of repeat bar line:
f1 \bar "|:" g \bar ":|:" a \bar ":|" b
Although the bar line types signifying repeats may be inserted manually they do not in themselves cause LilyPond to recognize a repeated section. Such repeated sections are better entered using the various repeat commands (see Repeats), which automatically print the appropriate bar lines.
In addition, you can specify "||:"
, which is equivalent to
"|:"
except at line breaks, where it gives a double bar
line at the end of the line and a start repeat at the beginning of
the next line.
\override Score.RehearsalMark #'padding = #3 c c c c \bar "||:" c c c c \break \bar "||:" c c c c
In scores with many staves, a \bar
command in one staff is
automatically applied to all staves. The resulting bar lines are
connected between different staves of a StaffGroup
,
InnerStaffGroup
, PianoStaff
, or GrandStaff
.
<< \new StaffGroup << \new Staff { e'4 d' \bar "||" f' e' } \new Staff { \clef bass c4 g e g } >> \new Staff { \clef bass c2 c2 } >>
The command \bar
bartype is a shortcut for
\set Timing.whichBar =
bartype. A bar line is
created whenever the whichBar
property is
set.
The default bar type used for automatically inserted bar lines is
"|"
. This may be changed at any time
with \set Timing.defaultBarType =
bartype.
Notation Reference: Line breaking, Repeats,
Snippets: Rhythms.
Internals Reference: BarLine (created at Staff level), SpanBar (across staves), Timing_translator (for Timing properties).
This page is for LilyPond-2.11.58 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.