scamp_extensions.rhythm.indispensability.indispensability_array_from_expression
- scamp_extensions.rhythm.indispensability.indispensability_array_from_expression(meter_arithmetic_expression: str, normalize: bool = False, break_up_large_numbers: bool = False, upbeats_before_group_length: bool = True) List[INT_OR_FLOAT] [source]
Generates an array of indispensability values for a meter and subdivision, as expressed by a meter arithmetic expression. Such expressions allow great flexibility in describing metric structure, making possible additive, multiplicative, and hybrid metrical structures.
- Parameters:
meter_arithmetic_expression – An string expression representing a metric hierarchy (meter and subdivision structure). For instance, “2 * 3” would create the eighth-note subdivisions of 6/8, and “2 + 3 + 2” would create an additive meter (2+3+2)/8. “(2 + 3 + 2) * 3” would create a kind of hybrid of these: seven main beats in a 2 + 3 + 2 pattern, each of which is subdivided in 3. This might be notated as 6/8+9/8+6/8.
normalize – if True, indispensabilities range from 0 to 1. If false, they count up from 0.
break_up_large_numbers – if True, numbers greater than 3 are broken up into a sum of 2’s followed by one 3 if odd. This is the Barlow approach.
upbeats_before_group_length – see description in
metric_structure.flatten_beat_groups()
. Affects the result when there are groups of uneven length at some level of metric structure. To achieve the standard Barlowian result, set this to False. I think it works better as True, though.
- Returns:
a list of indispensabilities for the pulses of the given meter.