X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/a4026ac6cb2afe5804ca826f7e8fa04254d36d46..c469bfe0b89e42f313651c097ac7bedd5cd0cae6:/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__' :