diff --git a/amy b/amy index 2f48d7e7..638d07b9 160000 --- a/amy +++ b/amy @@ -1 +1 @@ -Subproject commit 2f48d7e79a93f467e2a26e7ba13445e3ce1b73eb +Subproject commit 638d07b9bc948bee7c2a209d8a735a4fba7e5f01 diff --git a/tulip/shared/py/midi.py b/tulip/shared/py/midi.py index 01357be2..4d6a4294 100644 --- a/tulip/shared/py/midi.py +++ b/tulip/shared/py/midi.py @@ -189,6 +189,7 @@ class Synth: Provides methods: synth.note_on(midi_note, velocity, time=None) synth.note_off(midi_note, time=None) + synth.all_notes_off() synth.program_change(patch_num) changes preset for all voices. synth.control_change(control, value) modifies a parameter for all voices. Provides read-back attributes (for voices.py UI): @@ -393,6 +394,10 @@ def note_off(self, note, pcm_patch=0, custom=False, time=None): amy.send(time=time, osc=osc, vel=0) del self.pcm_patch_to_osc[note] + def all_notes_off(self): + for i in self.oscs: + amy.send(osc=osc, vel=0) + # Rest of Synth protocol doesn't do anything for PitchedPCM. def sustain(self, state): pass @@ -410,52 +415,6 @@ def set_patch_state(self, state): pass -class DrumSynth: - """Simplified Synth for Drum channel (10). Plays one patch per note at its default pitch. Not used right now. """ - PCM_PATCHES = 29 - - def __init__(self, num_voices=10): - self.oscs = list(range(amy.AMY_OSCS - num_voices, amy.AMY_OSCS)) - self.next_osc = 0 - self.note_to_osc = {} - # Fields used by UI - self.amy_voices = self.oscs # Actually osc numbers not amy voices. - self.patch_number = None # Patch number is used to detect Juno synths - self.patch_state = None - - def note_on(self, note, velocity, time=None): - osc = self.oscs[self.next_osc] - self.next_osc = (self.next_osc + 1) % len(self.oscs) - amy.send(time=time, osc=osc, wave=amy.PCM, - patch=note % DrumSynth.PCM_PATCHES, vel=velocity, freq=0) - self.note_to_osc[note] = osc - - def note_off(self, note, time=None): - # Drums don't really need note-offs, but handle them anyway. - try: - osc = self.note_to_osc[note] - amy.send(time=time, osc=osc, vel=0) - del self.note_to_osc[note] - except KeyError: - # We didn't recognize the note number; never mind. - pass - - # Rest of Synth protocol doesn't do anything for drums. - def sustain(self, state): - pass - - def program_change(self, patch_number): - pass - - def control_change(self, control, value): - pass - - def get_patch_state(self): - return None - - def set_patch_state(self, state): - pass - arpeggiator = arpegg.ArpeggiatorSynth(synth=None)