def set_pitches(self, pitches, velocity): for pitch, rhythm in zip(pitches, self.rhythms): midi.unlockPitch(rhythm.pitch) rhythm.pitch = pitch midi.lockPitch(rhythm.pitch, 'rhythm') rhythm.loud = min(max(velocity+10,20),127) rhythm.quiet = min(max(velocity-20, 10),100)
def set_pitches(self, pitches, velocity): for pitch, rhythm in zip(pitches, self.rhythms): midi.unlockPitch(rhythm.pitch) rhythm.pitch = pitch midi.lockPitch(rhythm.pitch, 'rhythm') rhythm.loud = min(max(velocity + 10, 20), 127) rhythm.quiet = min(max(velocity - 20, 10), 100)
def _stop(self): self.ictus.stop() for r in self.rhythms: r.stop() midi.unlockPitch(r.pitch)