Skip to content

Instantly share code, notes, and snippets.

@skyl skyl/ta.py
Created Apr 30, 2012

Embed
What would you like to do?
Simple Timing arp idea
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()
@skyl

This comment has been minimized.

Copy link
Owner Author

skyl commented Apr 30, 2012

arp.arp.reset(notes)
arp.arp.reset(list(reversed(notes)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.