def test_rudiment_schedule_player(self): rudiment = FiveStrokeRoll() player = RudimentSchedulePlayer(self.instr, rudiment, 60, 63, clock=self.clock) player.resumePlaying() self.runTicks(96 * 2 - 1) expected = [ ('note', 0, 60, 90), ('note', 6, 60, 70), ('note', 12, 63, 80), ('note', 18, 63, 67), ('note', 24, 60, 120), ('note', 48, 63, 90), ('note', 54, 63, 76), ('note', 60, 60, 89), ('note', 66, 60, 70), ('note', 72, 63, 127), ('note', 96, 60, 90), ('note', 102, 60, 70), ('note', 108, 63, 80), ('note', 114, 63, 67), ('note', 120, 60, 120), ('note', 144, 63, 90), ('note', 150, 63, 76), ('note', 156, 60, 89), ('note', 162, 60, 70), ('note', 168, 63, 127)] self.assertEquals(self.instr.plays, expected)
def test_changeStrokes(self): rudiment = FiveStrokeRoll() player = RudimentSchedulePlayer(self.instr, rudiment, 60, 63, clock=self.clock) player.changeStrokes(45, 49) player.resumePlaying() self.runTicks(96 * 2 - 1) expected = [ ("note", 0, 45, 90), ("note", 6, 45, 70), ("note", 12, 49, 80), ("note", 18, 49, 67), ("note", 24, 45, 120), ("note", 48, 49, 90), ("note", 54, 49, 76), ("note", 60, 45, 89), ("note", 66, 45, 70), ("note", 72, 49, 127), ("note", 96, 45, 90), ("note", 102, 45, 70), ("note", 108, 49, 80), ("note", 114, 49, 67), ("note", 120, 45, 120), ("note", 144, 49, 90), ("note", 150, 49, 76), ("note", 156, 45, 89), ("note", 162, 45, 70), ("note", 168, 49, 127), ] self.assertEquals(self.instr.plays, expected)
notes = Adder(OctaveArp(OrderedArp([60, 48, 62, 64, 69, 71, 46]))) notes.arp.octaves = 2 notes.arp.oscillate = True notes.amount = 12 velocity = Adder(OrderedArp([120,80,89,83,120,120,80,79])) piano = piano_f() pianoPlayer = Player(piano, notes, velocity, release=lambda: random.randint(12,60), interval=dtt(1,16)) pianoPlayer.resumePlaying() kit = kit_f() drumRudiment = FiveStrokeRoll() drumPlayer = RudimentSchedulePlayer(kit, drumRudiment, 51, 48) drumPlayer.resumePlaying() # Now we see how we can set up a simple "process" to change the key periodically keys = cycle([-18] * 8 + [-18,-37,-18,-37] * 4 + [-18,-26,-18,-26,-37,-26,-18]) def change_key(): notes.amount = keys.next() change_key_event = clock.schedule(change_key) change_key_event.startAfter((1,1), (1,1)) # TODO say some things with some enthusiasm ... late
notes.arp.oscillate = True notes.amount = 12 velocity = Adder(OrderedArp([120, 80, 89, 83, 120, 120, 80, 79])) piano = piano_f() pianoPlayer = Player(piano, notes, velocity, release=lambda: random.randint(12, 60), interval=dtt(1, 16)) pianoPlayer.resumePlaying() kit = kit_f() drumRudiment = FiveStrokeRoll() drumPlayer = RudimentSchedulePlayer(kit, drumRudiment, 51, 48) drumPlayer.resumePlaying() # Now we see how we can set up a simple "process" to change the key periodically keys = cycle([-18] * 8 + [-18, -37, -18, -37] * 4 + [-18, -26, -18, -26, -37, -26, -18]) def change_key(): notes.amount = keys.next() change_key_event = clock.schedule(change_key) change_key_event.startAfter((1, 1), (1, 1))