Esempio n. 1
0
def make_union_chords():

    aggregates = manifolds.etc.pitch.aggregates

    union_chords = sequencetools.pairwise(aggregates, 'wrap')
    union_chords = [set(x[0]) | set(x[1]) for x in union_chords]
    union_chords = [tuple(sorted(list(x))) for x in union_chords]

    return union_chords
def make_intersection_chords():

    aggregates = manifolds.etc.pitch.aggregates

    intersection_chords = sequencetools.pairwise(aggregates, 'wrap')
    intersection_chords = [set(x[0]) & set(x[1]) for x in intersection_chords]
    intersection_chords = [tuple(sorted(list(x))) for x in intersection_chords]

    return intersection_chords
def make_disjunction_chords():

    aggregates = manifolds.etc.pitch.aggregates

    disjunction_chords = sequencetools.pairwise(aggregates, 'wrap')
    disjunction_chords = [set(x[0]) ^ set(x[1]) for x in disjunction_chords]
    disjunction_chords = [tuple(sorted(list(x))) for x in disjunction_chords]

    return disjunction_chords
Esempio n. 4
0
assert len(source) == 12

#intercalations = [1, 2, 2, 3, 1, 2, 3, 3, 1, 1, 2, 3]
#intercalations = [1, 2, 5, 6]
intercalations = [1, 5, 2, 6]

indices = range(len(source))
counts = sequencetools.repeat_to_length(intercalations, len(source))
counts = [[count] for count in counts]
specification = zip(indices, counts)

assert specification == [(0, [1]), (1, [5]), (2, [2]), (3, [6]), (4, [1]), (5, [5]), (6, [2]), (7, [6]), (8, [1]), (9, [5]), (10, [2]), (11, [6])]

pitchtools.insert_transposed_pc_subruns(source, specification)

for i, j in sequencetools.pairwise(source):
    if isinstance(j, list):
        assert isinstance(i, scoretools.Note)
        for note in j:
            note.history['tag'] = i.history['tag'] + '1'

source = sequencetools.flatten_sequence(source)

assert len(source) == 54

source = truncate_note_subruns(source)

assert len(source) == 53

indices = range(len(source))
counts = sequencetools.repeat_to_length(intercalations, len(source))
def make_sequence_with_prominences():

    harmonic_walk_lengths = manifolds.etc.pitch.harmonic_walk_lengths
    harmonic_walk_lengths *= 2

    field_center_cell_triples = manifolds.etc.pitch.field_center_cell_triples

    assert sum(harmonic_walk_lengths) == len(field_center_cell_triples)

    partitioned_triples = sequencetools.partition_by_lengths(
        field_center_cell_triples, harmonic_walk_lengths)

    prominent_sections = manifolds.etc.pitch.prominent_sections

    assert len(prominent_sections) == len(partitioned_triples) == 46

    prominent_section_numbers = manifolds.etc.pitch.prominent_section_numbers

    pairwise_parts = sequencetools.pairwise(partitioned_triples, mode = 'wrap')

    from manifolds.etc.pitch._helpers import field_number_to_field

    prominent_counts = manifolds.etc.pitch.prominent_counts

    modified_parts = []

    for part_index, pair in enumerate(pairwise_parts):

        first_part, second_part = pair
        part_number = part_index + 1

        if part_number in prominent_section_numbers:

            start_triple = first_part[-1]
            stop_triple = second_part[0]

            start_field, start_direction, start_pitch = _unpack(start_triple)
            stop_field, stop_direction, stop_pitch = _unpack(stop_triple)

            count = prominent_counts[part_index]

            if 0 < count:

                prominence = make_prominence_between(
                    start_field, start_direction, start_pitch,
                    stop_field, stop_direction, stop_pitch,
                    count)

                print len(prominence)

                modified_first_part = list(first_part[:-1]) + prominence

            else:
                modified_first_part = list(first_part)

        else:
            modified_first_part = list(first_part)

        modified_parts.append(modified_first_part)

    assert len(modified_parts) == 46

    return modified_parts