time_signature_list¶
- auxjad.get.time_signature_list(container: abjad.score.Container, *, do_not_use_none: bool = False, implicit_common_time: bool = True, omit_repeated: bool = False) → list[source]¶
Returns a
list
with theabjad.TimeSignature
’s for all measures of an inputabjad.Container
.- Basic usage:
This function returns a
list
with oneabjad.TimeSignature
per measure.>>> container = abjad.Container(r"\time 3/4 c'2. \time 4/4 e'1") >>> time_signatures = auxjad.get.time_signature_list(container) >>> time_signatures [TimeSignature((3, 4)), TimeSignature((4, 4))]
Note
Auxjad automatically adds this function as an extension function to
abjad.get
. It can thus be used from eitherauxjad.get
orabjad.get
namespaces. Therefore, the two lines below are equivalent:>>> container = abjad.Container(r"\time 3/4 c'2. \time 4/4 e'1") >>> auxjad.get.time_signature_list(container) [TimeSignature((3, 4)), TimeSignature((4, 4))] >>> abjad.get.time_signature_list(container) [TimeSignature((3, 4)), TimeSignature((4, 4))]
do_not_use_none
:By default, the
list
will contain aNone
if a measure does not have an explicit time signature.>>> container = abjad.Container( ... r"\time 5/8 c'4 ~ c'16 \time 3/8 d'4. e'4." ... ) >>> time_signatures = auxjad.get.time_signature_list(container) >>> time_signatures [TimeSignature((5, 8)), TimeSignature((3, 8)), None]
Set the keyword argument
do_not_use_none
toTrue
to change this behaviour.>>> time_signatures = auxjad.get.time_signature_list( ... container, ... do_not_use_none=True, ... ) >>> time_signatures [TimeSignature((5, 8)), TimeSignature((3, 8)), TimeSignature((3, 8))]
omit_repeated
:By default, time signatures are output according to the container, even if there are multiple instances of a same time signature.
>>> container = abjad.Container( ... r"\time 3/4 c'2. d'2. \time 3/4 e'2. f'2." ... ) >>> time_signatures = auxjad.get.time_signature_list(container) >>> time_signatures [abjad.TimeSignature((3, 4)), None, abjad.TimeSignature((3, 4)), None]
Set the keyword argument
omit_repeated
toTrue
to replace repeated time signatures withNone
.>>> time_signatures = auxjad.get.time_signature_list( ... container, ... omit_repeated=True, ... ) >>> time_signatures [abjad.TimeSignature((3, 4)), None, None, None]
Error
Setting both
do_not_use_none
andomit_repeated
toTrue
will raise aValueError
exception:>>> container = abjad.Container( ... r"\time 3/4 c'2. d'2. \time 3/4 e'2. f'2." ... ) >>> time_signatures = auxjad.get.time_signature_list( ... container, ... do_not_use_none=True, ... omit_repeated=True, ... ) ValueError: 'omit_repeated' and 'do_not_use_none' cannot be both set to 'True'
implicit_common_time
:LilyPond uses an implicit time signature of 4/4 whenever a time signature is not found. This function behaves the same way.
>>> container = abjad.Container(r"c'1 d'1 e'1 f'1") >>> time_signatures = auxjad.get.time_signature_list(container) >>> time_signatures [TimeSignature((4, 4)), None, None, None]
To disable this behaviour, set
implicit_common_time
toFalse
.>>> time_signatures = auxjad.get.time_signature_list( ... container, ... implicit_common_time=False, ... ) >>> time_signatures [None, None, None, None]
Error
Setting
do_not_use_none
toTrue
andimplicit_common_time
toFalse
on a container that starts with no time signature will raise aValueError
exception:>>> container = abjad.Container(r"c'1 d'1 e'1 f'1") >>> time_signatures = auxjad.get.time_signature_list( ... container, ... do_not_use_none=True, ... implicit_common_time=False, ... ) ValueError: container does not have a time signature attached to its first leaf, with 'implicit_common_time' set to 'False' and 'omit_repeated' set to 'True'