def test3(): echo = effects.Echo() route(echo, midi) midi.setSustain(True) velocity = 100 for x in range(1000): pitch = 60 + x echo.note(pitch, 0.1, velocity) time.sleep(0.15)
def stop_all(): for section in open_sections: sprout(section.stop) events.disable() for pitch in [octave*12+p for p in (0,1,2,3,4,5,6,7,8,9,10,11) for octave in (0,1,2,3,4,5,6,7,8)]: midi.note(pitch, 5., 127, 5) midi.setSustain(False) print 'stopping' midi.silence = True
def stop_all(): for section in open_sections: sprout(section.stop) events.disable() for pitch in [ octave * 12 + p for p in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) for octave in (0, 1, 2, 3, 4, 5, 6, 7, 8) ]: midi.note(pitch, 5., 127, 5) midi.setSustain(False) print 'stopping' midi.silence = True
def _calculate(self): smoothness = Smoothness.retrieve() while self.calculate: lh = smoothness.value('lefthand') rh = smoothness.value('righthand') self.swing = round( scale_constrain(lh, 0, 150, 0.5, 0.7) * 100) * 0.01 self.jaggedness = scale_constrain(rh, 0, 150, 0., 1.) self.snapshots.append((lh + rh) * .5) self.snapshots = self.snapshots[-5:] if self.snapshots[0] <= .5 and self.snapshots[-1] > .5: midi.setSustain(False) elif self.snapshots[0] >= .5 and self.snapshots[-1] < .5: midi.setSustain(True) time.sleep(0.1)
def echos(): print 'echoing' midi.setSustain(True) humanize = Humanize(delay_max = 0.01, velocity_max = 20) echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1) gain = Gain() gain.fade(0,1,10) route(echo, humanize) route(humanize, gain) route(gain, midi) note_choices = [x + octave*12 for x in (4,5,7,11,12) for octave in (1,2,3,4,5,6,7,8)] print note_choices while True: t = time.time() echo.note(random.choice(note_choices), 0.15,60) time.sleep(random.choice((0.4,0.6)) - time.time() + t)
def echos(): print 'echoing' midi.setSustain(True) humanize = Humanize(delay_max=0.01, velocity_max=20) echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1) gain = Gain() gain.fade(0, 1, 10) route(echo, humanize) route(humanize, gain) route(gain, midi) note_choices = [ x + octave * 12 for x in (4, 5, 7, 11, 12) for octave in (1, 2, 3, 4, 5, 6, 7, 8) ] print note_choices while True: t = time.time() echo.note(random.choice(note_choices), 0.15, 60) time.sleep(random.choice((0.4, 0.6)) - time.time() + t)