def run(self): """ generate notes """ m = self.midi c = random.choice s = time.sleep q = self.q while not self.interrupt: note = c(self.notes)+12*c(self.octaves) vel = c(self.velocities) on = m.note_on_msg(note, self.channel, vel) off = m.note_off_msg(note, self.channel) print "PADGEN {0}: NOTE ON note: {1} channel: {2} velocity: {3}".format(self.instrname, a_name(note), self.channel, vel) m.send_message(on) q.put(off) s(c(self.durations)*c(self.stretto)) size = random.randint(0, q.qsize()) for i in xrange(size): if not q.empty(): off = q.get() print "PADGEN {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) m.send_message(off) self.cleanup()
def cleanup(self): """ turn off all notes that were still running """ while not self.q.empty(): off = self.q.get() print "PADGEN {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) self.midi.send_message(off)
def cleanup(self): """ turn off all activated notes that weren't off yet """ while not self.q.empty(): off = self.q.get() print "NOTEWALK {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) self.midi.send_message(off)
def cleanup(self): while not self.q.empty(): off = self.q.get() print "CIRCLEWALK {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) self.midi.send_message(off)
def run(self): """ generate notes """ m = self.midi c = random.choice s = time.sleep q = self.q # a queue to remember which notes have been started; needed to switch them off at some random time later on while not self.interrupt: note_dur = self.next_note(self.notes) note = note_dur[0]+ 12*c(self.octaves) dur = note_dur[1]*c(self.strettos) vel = c(self.velocities) on = m.note_on_msg(note, self.channel, vel) off = m.note_off_msg(note, self.channel) print "NOTEINTERPOLATOR {0}: NOTE ON note: {1} channel: {2} velocity: {3}".format(self.instrname, a_name(note), self.channel, vel) m.send_message(on) q.put(off) s(dur) size = random.randint(0, q.qsize()) for i in xrange(size): if not q.empty(): off = q.get() print "NOTEINTERPOLATOR {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) m.send_message(off) self.cleanup()
def cleanup(self): """ send note off msgs to all notes that were still running """ while not self.q.empty(): off = self.q.get() print "NOTEINTERPOLATOR {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) self.midi.send_message(off)
def run(self): m = self.midi c = random.choice s = time.sleep q = self.q while not self.interrupt: note_dur = self.next_note(self.notes) note = note_dur[0]+ 12*c(self.octaves) dur = note_dur[1]*c(self.strettos) vel = c(self.velocities) on = m.note_on_msg(note, self.channel, vel) off = m.note_off_msg(note, self.channel) print "CLUSTRIFICATOR {0}: NOTE ON note: {1} channel: {2} velocity: {3}".format(self.instrname, a_name(note), self.channel, vel) m.send_message(on) q.put(off) s(dur) size = random.randint(0, q.qsize()) for i in xrange(size): if not q.empty(): off = q.get() print "CLUSTRIFICATOR {0}: NOTE OFF note: {1} channel: {2}".format(self.instrname, a_name(off[1]), self.channel) m.send_message(off) self.cleanup()