Exemplo n.º 1
0
def normal_form(notes):
    oset = order_set(notes)
    rotations = rotate_set(oset)
    min_size = min(set_sizes(oset))
    smallest_sets = [x for x in rotations if set_size(x) == min_size]

    if len(smallest_sets) == 1:
        return smallest_sets[0]
    else:
        min_pack_size = min([interval_tie(x) for x in smallest_sets])
        packed_sets = [x for x in smallest_sets if interval_tie(x) == min_pack_size]

        return packed_sets[0]
Exemplo n.º 2
0
def normal_form(notes):
    oset = order_set(notes)
    rotations = rotate_set(oset)
    min_size = min(set_sizes(oset))
    smallest_sets = [x for x in rotations if set_size(x) == min_size]

    if len(smallest_sets) == 1:
        return smallest_sets[0]
    else:
        min_pack_size = min([interval_tie(x) for x in smallest_sets])
        packed_sets = [
            x for x in smallest_sets if interval_tie(x) == min_pack_size
        ]

        return packed_sets[0]
Exemplo n.º 3
0
 def test_rotate_set(self):
     all_rotations = [[1,2,3], [2,3,1], [3,1,2]]
     self.assertEqual(music.rotate_set([1,2,3]), all_rotations)
Exemplo n.º 4
0
 def test_rotate_set(self):
     all_rotations = [[1, 2, 3], [2, 3, 1], [3, 1, 2]]
     self.assertEqual(music.rotate_set([1, 2, 3]), all_rotations)