def test_pattern_arp(self): pattern = [0, 1, 2, 0, 0, 3, 2] notes = [1, 2, 3, 4] arp = PatternArp(notes, pattern) played = [arp() for i in range(14)] self.assertEqual(played, [1, 2, 3, 1, 1, 4, 3] * 2) arp.resetPattern([0, 0, 1, 1]) played = [arp() for i in range(4)] self.assertEqual(played, [1, 1, 2, 2]) arp.resetPattern(cycle([0, 1, 2, 3]).next) played = [arp() for i in range(8)] self.assertEqual(played, [1, 2, 3, 4, 1, 2, 3, 4])
def test_chord_pattern_arp(self): pattern = [0, 1, 2, [1, 2, 3], 3, 2, 1] notes = [1, 2, 3, 4] arp = ChordPatternArp(notes, pattern) played = [arp() for i in range(14)] self.assertEqual(played, [(1,), (2,), (3,), [2, 3, 4], (4,), (3,), (2,)] * 2)
def test_chord_pattern_arp(self): pattern = [0, 1, 2, [1, 2, 3], 3, 2, 1] notes = [1, 2, 3, 4] arp = ChordPatternArp(notes, pattern) played = [arp() for i in range(14)] self.assertEqual(played, [(1, ), (2, ), (3, ), [2, 3, 4], (4, ), (3, ), (2, )] * 2)