Score.add_double_bar_lines_before_time_signatures

Score.add_double_bar_lines_before_time_signatures(*, to_each_voice: bool = False)None[source]

Adds double bar lines to all components of abjad.Score before every time signature changes. Note that Auxjad adds this function as an extension method to abjad.Score (see usage below).

Basic usage:
>>> staff = abjad.Staff(
...     r"\time 3/4 c'2. \time 4/4 d'1 e'1 \time 6/4 f'2. g'2."
... )
>>> score = abjad.Score([staff])
>>> abjad.show(score)
../_images/Score-65l45tLipK.png
>>> score.add_double_bar_lines_before_time_signatures()
>>> abjad.show(score)
../_images/Score-cjmOgHxSJH.png
Multiple staves:

Works with multiple staves:

>>> staff_1 = abjad.Staff(
...     r"\time 3/4 c''2. \time 4/4 d''1 e''1 "
...     "\time 6/4 f''2. g''2."
... )
>>> staff_2 = abjad.Staff(
...     r"\time 3/4 c'2. \time 4/4 d'1 e'1 \time 6/4 f'2. g'2."
... )
>>> score = abjad.Score([staff_1, staff_2])
>>> score.add_double_bar_lines_before_time_signatures()
>>> abjad.show(score)
../_images/Score-cnkUgFuYmI.png

Each stave will receive their own double bar lines, which can be useful when part extracting:

>>> abjad.show(staff_1)
../_images/Score-TZaC5C12yA.png
>>> abjad.show(staff_2)
../_images/Score-wZgCbZi8JD.png
to_each_voice

When multiple voices are present in a staff, double bar lines will be added to the last voice only:

>>> voice_1 = abjad.Voice(
...     r"\time 3/4 c''2. \time 4/4 d''1 e''1 "
...     "\time 6/4 f''2. g''2."
... )
>>> voice_2 = abjad.Voice(
...     r"\time 3/4 c'2. \time 4/4 d'1 e'1 \time 6/4 f'2. g'2."
... )
>>> staff = abjad.Staff([voice_1, voice_2], simultaneous=True)
>>> abjad.attach(abjad.LilyPondLiteral(r'\voiceOne'), voice_1)
>>> abjad.attach(abjad.LilyPondLiteral(r'\voiceTwo'), voice_2)
>>> score = auxjad.Score([staff])
>>> score.add_double_bar_lines_before_time_signatures()
>>> abjad.show(score)
../_images/Score-F6f5a6z3ly.png
>>> abjad.show(voice_1)
../_images/Score-FEAvA2mn1t.png
>>> abjad.show(voice_2)
../_images/Score-QKhtZj82cG.png

Setting to_each_voice to True will add a bar line to each voice in a staff:

>>> voice_1 = abjad.Voice(
...     r"\time 3/4 c''2. \time 4/4 d''1 e''1 "
...     "\time 6/4 f''2. g''2."
... )
>>> voice_2 = abjad.Voice(
...     r"\time 3/4 c'2. \time 4/4 d'1 e'1 \time 6/4 f'2. g'2."
... )
>>> staff = abjad.Staff([voice_1, voice_2], simultaneous=True)
>>> abjad.attach(abjad.LilyPondLiteral(r'\voiceOne'), voice_1)
>>> abjad.attach(abjad.LilyPondLiteral(r'\voiceTwo'), voice_2)
>>> score = auxjad.Score([staff])
>>> score.add_double_bar_lines_before_time_signatures(
...     to_each_voice=True,
... )
>>> abjad.show(voice_1)
../_images/Score-n5x7JhOHy6.png
>>> abjad.show(voice_2)
../_images/Score-tAXRWLGxMp.png
Multi-measure rests:

This method can handle multi-measure rests.

>>> staff = abjad.Staff(
...     r"\time 3/4 R1 * 3/4 "
...     r"\time 4/4 R1 * 2 "
...     r"\time 6/4 R1 * 6/4 "
...     r"\time 4/4 R1"
... )
>>> score = abjad.Score([staff])
>>> score.add_double_bar_lines_before_time_signatures()
>>> abjad.show(score)
../_images/Score-nwYMM8JAYR.png
Input with bar lines:

If the score already contains non-standard bar lines at points where a time signature changes, only those of types "|" and "" will be replaced, keeping all others as they were.

>>> staff = abjad.Staff(
...     r"R1 "
...     r"\time 3/4 c'2. "
...     r"\time 4/4 d'1 "
...     r"e'1 "
...     r"\time 6/4 f'2. g'2. "
...     r"\time 2/4 a'2"
... )
>>> abjad.attach(abjad.BarLine('.|:'), staff[0])
>>> abjad.attach(abjad.BarLine(':|.'), staff[1])
>>> abjad.attach(abjad.BarLine('|'), staff[3])
>>> abjad.attach(abjad.BarLine('!'), staff[5])
>>> score = abjad.Score([staff])
>>> score.add_double_bar_lines_before_time_signatures()
>>> abjad.show(score)
../_images/Score-XVe9oSR8Gi.png