def top_level_eighths(): r'''Top-level eighths. 444 eighths structure rotated in time between four voices, like fleurs downbeat avoidance: tupletted structures start coincident with eighth tupletted structures may frequently start with rest grouping durations between 2 and 8 eighths beaming follows top-level eighth-note grouping top-level eighths may be prolated smart secondary beams show essentially thirty-seconds secondary prolation possible only at beginning or end of top-level figure, in thirds primary beam extends across tupletted figures primary beam encompasses essentially all 444 eighths deletions may happen, again by thirds ''' first_numerators, second_numerators = make_numerators() eighths = first_numerators assert eighths == [ [5, 2, 1, 6, 3, 6, 2, 5, 5, 5, 2, 2, 5], [8, 2, 4, 3, 4, 4, 4, 3, 1, 3, 2, 4, 7], [8, 2, 2, 3, 2, 3, 7, 7, 1, 6, 7], [7, 2, 2, 8, 2, 5, 7, 8, 2, 3, 1, 4], [3, 4, 3, 6, 6, 6, 6, 6, 6, 6], [6, 6, 6, 6, 6, 2, 2, 7, 6]] eighths = sequencetools.permute_sequence(eighths, [1, 4, 5, 0, 2, 3]) eighths = sequencetools.flatten_sequence(eighths) eighths = list(eighths) eighths += second_numerators assert eighths == [8, 2, 4, 3, 4, 4, 4, 3, 1, 3, 2, 4, 7, 3, 4, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 7, 6, 5, 2, 1, 6, 3, 6, 2, 5, 5, 5, 2, 2, 5, 8, 2, 2, 3, 2, 3, 7, 7, 1, 6, 7, 7, 2, 2, 8, 2, 5, 7, 8, 2, 3, 1, 4, 2, 5, 7, 7, 7, 7, 7, 2, 1, 2, 4, 7, 1, 7, 3, 5, 6, 1, 7, 7, 7, 7, 7, 2, 4, 3, 4, 4, 1, 2, 5, 2, 5] assert sum(eighths) == 444 assert len(eighths) == 101 eighths = sequencetools.partition_by_weights_ratio(eighths, [1, 1, 1, 1, 1]) top_level_eighths = [] for n in range(4): top_level = sequencetools.rotate(eighths, -n) top_level = sequencetools.flatten_sequence(top_level) assert sum(top_level) == 444 assert len(top_level) == 101 top_level = merge_top_level(top_level) top_level = sequencetools.flatten_sequence(top_level) assert sum(top_level) == 444 assert len(top_level) == 88 top_level_eighths.append(top_level) top_level_eighths = cast_top_level_eighths(top_level_eighths) return top_level_eighths
def harmonic_rhythms(): # 3 * 148 = 444 eighth notes total in fleurs first_numerators, second_numerators = make_numerators() assert second_numerators == [2, 5, 7, 7, 7, 7, 7, 2, 1, 2, 4, 7, 1, 7, 3, 5, 6, 1, 7, 7, 7, 7, 7, 2, 4, 3, 4, 4, 1, 2, 5, 2, 5] assert sum(second_numerators) == 148 assert len(second_numerators) == 33 second_numerators *= 3 assert sum(second_numerators) == 444 assert len(second_numerators) == 99 #core_partition_lengths = (6, 6, 3, 3, 1, 1, 1, 1, 6, 3, 1, 1) #assert sum(core_partition_lengths) == 33 #assert len(core_partition_lengths) == 12 first = [12] * 2 + [6] * 3 + [3] * 6 + [1] * 18 second = [12] * 0 + [6] * 1 + [3] * 2 + [1] * 9 core_partition_lengths = first + second assert sum(core_partition_lengths) == 99 assert len(core_partition_lengths) == 41 harmonic_rhythms = [] for n in range(4): #partition_lengths = sequencetools.rotate(core_partition_lengths, -n) #partition = sequencetools.partition_by_lengths(second_numerators, # partition_lengths, cyclic = False, overhang = False) instrument_numerators = sequencetools.rotate(second_numerators, -n) partition = sequencetools.partition_by_lengths(instrument_numerators, core_partition_lengths, cyclic = False, overhang = False) harmonic_rhythm = [sum(part) for part in partition] assert sum(harmonic_rhythm) == 444 assert len(harmonic_rhythm) == 41 harmonic_rhythms.append(harmonic_rhythm) return harmonic_rhythms