class Module(BaseModule): """ "Phase Vocoder based cross synthesis module" Description Performs cross-synthesis between two phase vocoder streaming objects. The amplitudes from `Source Exciter` and `Spectral Envelope`, scaled by `Crossing Index`, are applied to the frequencies of `Source Exciter`. Sliders # Crossing Index : Morphing index between the two source's magnitudes # Exc Pre Filter Freq : Frequency of the pre-FFT filter # Exc Pre Filter Q : Q of the pre-FFT filter # Dry / Wet : Mix between the original signal and the processed signal Graph Only # Overall Amplitude : The amplitude curve applied on the total duration of the performance Popups & Toggles # Exc Pre Filter Type : Type of the pre-FFT filter # FFT Size : Size, in samples, of the FFT # FFT Envelope : Windowing shape of the FFT # FFT Overlaps : Number of FFT overlaping analysis # Polyphony Voices : Number of voices played simultaneously (polyphony), only available at initialization time # Polyphony Spread : Pitch variation between voices (chorus), only available at initialization time """ def __init__(self): BaseModule.__init__(self) self.snd1 = self.addSampler("snd1") self.snd2 = self.addSampler("snd2") self.snd2_filt = Biquadx(self.snd2, freq=self.prefiltf, q=self.prefiltq, type=self.prefilttype_index, stages=2) size = int(self.fftsize_value) olaps = int(self.overlaps_value) wintype = self.wtype_index self.oneOverSr = 1.0 / self.sr self.delsrc = Delay(self.snd1, delay=size*self.oneOverSr) self.fin1 = PVAnal(self.snd1, size=size, overlaps=olaps, wintype=wintype) self.fin2 = PVAnal(self.snd2_filt, size=size, overlaps=olaps, wintype=wintype) self.cross = PVCross(self.fin2, self.fin1, self.interp) self.fout = PVSynth(self.cross, wintype=wintype, mul=1) self.fade = SigTo(value=1, time=.03, init=1) self.out = Interp(self.delsrc*self.env*0.5, self.fout*self.env, self.mix, mul=self.fade) def prefilttype(self, index, value): self.snd2_filt.type = index def fftsize(self, index, value): newsize = int(value) self.fade.value = 0 time.sleep(.05) self.delsrc.delay = newsize*self.oneOverSr self.fin1.size = newsize self.fin2.size = newsize time.sleep(.05) self.fade.value = 1 def overlaps(self, index, value): olaps = int(value) self.fade.value = 0 time.sleep(.05) self.fin1.overlaps = olaps self.fin2.overlaps = olaps time.sleep(.05) self.fade.value = 1 def wtype(self, index, value): self.fin1.wintype = index self.fin2.wintype = index self.fout.wintype = index Interface = [ csampler(name="snd1", label="Spectral Envelope"), csampler(name="snd2", label="Source Exciter"), cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"), cslider(name="interp", label="Crossing Index", min=0, max=1, init=1, rel="lin", unit="x", col="red"), cslider(name="prefiltf", label="Exc Pre Filter Freq", min=40, max=18000, init=150, rel="log", unit="Hz", col="green"), cslider(name="prefiltq", label="Exc Pre Filter Q", min=.5, max=10, init=0.707, rel="log", col="green"), cslider(name="mix", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue"), cpopup(name="prefilttype", label="Exc Pre Filter Type", init="Highpass", col="green", value=["Lowpass","Highpass","Bandpass","Bandstop"]), cpopup(name="fftsize", label="FFT Size", init="1024", value=["16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"], col="red"), cpopup(name="wtype", label="FFT Envelope", init="Hanning", col="red", value=["Rectangular", "Hamming", "Hanning", "Bartlett", "Blackman 3", "Blackman 4", "Blackman 7", "Tuckey", "Sine"]), cpopup(name="overlaps", label="FFT Overlaps", init="4", col="red", value=["1", "2", "4", "8", "16"]), cpoly() ]