X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/ee24fce216592a13d95977d7d4e3374692fd6924..46f3ffd7fdde386f41020171b5733e55a8e64a85:/src/app/synth.py?ds=sidebyside diff --git a/src/app/synth.py b/src/app/synth.py deleted file mode 100755 index 9fb4a3e..0000000 --- a/src/app/synth.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -""" -module de wrapping du synthétiseur - -$Id$ -$URL$ -""" -from os.path import realpath, sep, exists -from fluidsynth import Synth as FSynth -from log import console - -class Synth(FSynth) : - """ - Interface fluidsynth avec les adaptations suivantes : - - la soundfont FluidR3_GM.sf2 est chargée par défaut - - le constructeur démarre le synthé - - octaviation - """ - - def __init__(self, gain=0.2, samplerate=44100, sfPath='') : - FSynth.__init__(self, gain=gain, samplerate=samplerate) - - if not sfPath : - sfPath = realpath(__file__).split(sep) - sfPath = sfPath[:-1] - sfPath.append('soundfonts') - - sfPath.append('FluidR3_GM.sf2') - sfPath = sep.join(sfPath) - - assert exists(sfPath) - - self.start() - self.fsid = self.sfload(sfPath) - self._octaveAjusts = {} - console.info('démarrage du synthétiseur\nsoundfont : %s', sfPath) - - def __del__(self) : - console.info('arrêt du synthétiseur.') - self.delete() - - 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) - - def program_select(self, chan, bank, preset): - FSynth.program_select(self, chan, self.fsid, bank, preset) - - 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)