scamp_extensions.rhythm.metric_structure.flatten_beat_groups

scamp_extensions.rhythm.metric_structure.flatten_beat_groups(beat_groups: list[list], upbeats_before_group_length: bool = True) list[source]

Returns a flattened version of beat_groups, unraveling the outer layer according to rules of indispensability. Repeated application of this function to nested beat groups leads to a 1-d ordered list of beat priorities

Parameters:
  • beat_groups – list of nested beat group

  • upbeats_before_group_length – This is best explained with an example. Consider a 5 = 2 + 3 beat pattern. The Barlow approach to indispensability would give indispensabilities [4, 0, 3, 1, 2]. The idea would be downbeat first, then start of the group of 3, then upbeat to downbeat, and then the fourth eighth note because it’s the upbeat to that upbeat, and because he would say the eighth note right after the downbeat should be the most dispensable. However, another way of looking at it would be to say that once we get to [4, _, 3, _, 2], the next most indispensable beat should be the second eighth note, since it is the pickup to the second most indispensable beat! This would yield indispensabilities [4, 1, 3, 0, 2], which also makes sense. I’ve chosen to make this latter approach the default; I think it generally sounds more correct.

Returns:

a (perhaps still nested) list of beat groups with the outer layer unraveled so that it’s a layer less deep