Skip to content

Instantly share code, notes, and snippets.

@skyl
Created April 30, 2012 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyl/2555022 to your computer and use it in GitHub Desktop.
Save skyl/2555022 to your computer and use it in GitHub Desktop.
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
Copy link
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