def test_adder(self): arpeggio = [] octaveArp = OctaveArp(AscArp(), [1, 2, 3, 4]) adder = Adder(octaveArp) for i in range(16): arpeggio.append(adder()) self.assertEquals( arpeggio, [1, 2, 3, 4, 13, 14, 15, 16, 25, 26, 27, 28, 37, 38, 39, 40]) adder.amount = 2 arpeggio = [] for i in range(16): arpeggio.append(adder()) self.assertEquals(arpeggio, [ v + 2 for v in [1, 2, 3, 4, 13, 14, 15, 16, 25, 26, 27, 28, 37, 38, 39, 40] ])
# And then rudiments from itertools import cycle import random from bl.arp import OrderedArp, OctaveArp, Adder from bl.orchestra.midi import Player from bl.instrument.fsynth import Layer from bl.scheduler import clock from bl.rudiments import FiveStrokeRoll, RudimentSchedulePlayer from tutor.complib import piano_f, kit_f dtt = clock.meter.dtt 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()
# Yeah, we learn about arpegiators ... from itertools import cycle import random from bl.arp import RandomArp, OrderedArp, Adder from bl.orchestra.midi import Player from bl.instrument.fsynth import Layer from bl.scheduler import clock from tutor.complib import bass_f, kit_f dtt = clock.meter.dtt notes1 = Adder(RandomArp()) notes1.reset([ 60, 60, 62, 60, 60, 60, 60, 61, 48, 50, 60, 60, 60, 60, 60, 71, 60, 60, 60, 60, 60, 60, 60, 50 ]) notes1.amount = -18 velocity1 = Adder(OrderedArp([120, 80, 89, 83, 120, 120, 80, 79])) bass = bass_f() bass_player = Player(bass, notes1, velocity1, release=(lambda: random.randint(12, 60)), interval=dtt(1, 16)) bass_player.resumePlaying() notes2 = Adder(RandomArp()) notes2.reset([60, 60, 62])