remove_repeated_time_signatures¶
- auxjad.mutate.remove_repeated_time_signatures(selection: abjad.select.Selection) → None[source]¶
Mutates an input
abjad.Selection
in place and has no return value; this function removes all consecutive repeated time signatures.- Basic usage:
When two consecutive measures have identical time signatures, the second one is removed:
>>> staff = abjad.Staff(r"c'4 d'8 | c'4 d'8") >>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0]) >>> abjad.attach(abjad.TimeSignature((3, 8)), staff[2]) >>> abjad.show(staff)
>>> auxjad.mutate.remove_repeated_time_signatures(staff[:]) >>> abjad.show(staff)
Note
Auxjad automatically adds this function as an extension function to
abjad.mutate
. It can thus be used from eitherauxjad.mutate
orabjad.mutate
namespaces. Therefore, the two lines below are equivalent:>>> auxjad.mutate.remove_repeated_time_signatures(staff[:]) >>> abjad.mutate.remove_repeated_time_signatures(staff[:])
- Time signature structure:
The function also removes time signatures that are separated by an arbitrary number of measures without one:
>>> staff = abjad.Staff(r"c'4 d'8 e'4. c'4 d'8") >>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0]) >>> abjad.attach(abjad.TimeSignature((3, 8)), staff[3]) >>> abjad.show(staff)
>>> auxjad.mutate.remove_repeated_time_signatures(staff[:]) >>> abjad.show(staff)
- Subcontainers:
The container from which the selection is made can also have subcontainers, including cases in which the time signatures are attached to leaves of subcontainers:
>>> staff = abjad.Staff([abjad.Note("c'2"), ... abjad.Chord("<d' f'>2"), ... abjad.Tuplet((2, 3), "g2 a2 b2"), ... ]) >>> abjad.attach(abjad.TimeSignature((2, 2)), staff[0]) >>> abjad.attach(abjad.TimeSignature((2, 2)), staff[2][0]) >>> abjad.show(staff)
>>> auxjad.mutate.remove_repeated_time_signatures(staff[:]) >>> abjad.show(staff)
Warning
The input selection must be a contiguous logical voice. When dealing with a container with multiple subcontainers (e.g. a score containing multiple staves), the best approach is to cycle through these subcontainers, applying this function to them individually.