Created
April 30, 2012 02:34
-
-
Save skyl/2555022 to your computer and use it in GitHub Desktop.
Simple Timing arp idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import cycle | |
from bl.arp import RandomArp, OrderedArp, ArpSwitcher | |
from bl.orchestra.midi import Player, ChordPlayer | |
from bl.utils import getClock | |
from tutor.complib import piano_f | |
piano = piano_f() | |
time = [ | |
(1, 4), | |
(1, 8), | |
(1, 8), | |
(1, 16), | |
(1, 16), | |
(1, 16), | |
(1, 16), | |
(1, 16), | |
(1, 16), | |
(1, 8), | |
] | |
notes = [ | |
60, 62, 64, | |
62, 64, 65, | |
64, 65, 67, | |
65, 67, 69, | |
67, 69, 71, | |
69, 71, 72, | |
71, 72, 74, | |
] | |
oarp = OrderedArp() | |
arp = ArpSwitcher(oarp, notes) | |
class TimingArp(object): | |
def __init__(self, l): | |
self.l = l | |
self.c = cycle(l).next | |
self.clock = getClock(None) | |
def __call__(self): | |
return self.clock.meter.dtt(*self.c()) | |
def reset(self, l): | |
self.l = l | |
self.c = cycle(l).next | |
ta = TimingArp(time) | |
player = Player(piano, arp, | |
velocity=RandomArp([127, 80, 90, 80,]), | |
release=RandomArp([11, 10, 9, 8, 40]), | |
interval=ta | |
) | |
player.resumePlaying() |
Author
skyl
commented
Apr 30, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment