X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/0bb53427dd76e9e9863362dd3c9b2d205b4f8043..6bfe9ce8372febedd68290beef0405405062b17b:/src/app/synth.py diff --git a/src/app/synth.py b/src/app/synth.py index a2a0244..fa65638 100755 --- a/src/app/synth.py +++ b/src/app/synth.py @@ -23,6 +23,13 @@ class Synth(FSynth) : self.start() self.fsid = self.sfload(sfPath) + self._octaveAjusts = {} + + def adjust_octave(self, chan, octave) : + ''' + Abaisse ou élève les notes de n octave + ''' + self._octaveAjusts[chan] = octave def sfunload(self, update_midi_preset=0): FSynth.sfunload(self, self.fsid, update_midi_preset=update_midi_preset) @@ -33,7 +40,13 @@ class Synth(FSynth) : def sfont_select(self, chan): FSynth.sfont_select(self, chan, self.fsid) - + def noteon(self, chan, key, vel): + key = key + self._octaveAjusts.get(chan, 0) * 12 + FSynth.noteon(self, chan, key, vel) + + def noteoff(self, chan, key) : + key = key + self._octaveAjusts.get(chan, 0) * 12 + FSynth.noteoff(self, chan, key) if __name__ == '__main__' :