| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Phase Vocoder buffer and playback with transposition" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
This module pre-analyses the input sound and keeps the |
| 8 |
phase vocoder frames in a buffer for the playback. User |
| 9 |
has control on playback position and transposition. |
| 10 |
|
| 11 |
Sliders |
| 12 |
|
| 13 |
# Position : |
| 14 |
Normalized position (0 -> 1) inside the recorded PV buffer. |
| 15 |
Buffer length is the same as the sound duration. |
| 16 |
# Transposition : |
| 17 |
Pitch of the playback sound. |
| 18 |
|
| 19 |
Graph Only |
| 20 |
|
| 21 |
# Overall Amplitude : |
| 22 |
The amplitude curve applied on the total duration of the performance |
| 23 |
|
| 24 |
Popups & Toggles |
| 25 |
|
| 26 |
# FFT Size : |
| 27 |
Size, in samples, of the FFT |
| 28 |
# FFT Envelope : |
| 29 |
Windowing shape of the FFT |
| 30 |
# FFT Overlaps : |
| 31 |
Number of FFT overlaping analysis |
| 32 |
# Polyphony Voices : |
| 33 |
Number of voices played simultaneously (polyphony), |
| 34 |
only available at initialization time |
| 35 |
# Polyphony Spread : |
| 36 |
Pitch variation between voices (chorus), |
| 37 |
only available at initialization time |
| 38 |
|
| 39 |
""" |
| 40 |
def __init__(self): |
| 41 |
BaseModule.__init__(self) |
| 42 |
self.snd = self.addSampler("snd") |
| 43 |
snddur = self.getSamplerDur("snd") |
| 44 |
|
| 45 |
size = int(self.fftsize_value) |
| 46 |
olaps = int(self.overlaps_value) |
| 47 |
wintype = self.wtype_index |
| 48 |
|
| 49 |
self.fin = PVAnal(self.snd, size=size, overlaps=olaps, wintype=wintype) |
| 50 |
self.buf = PVBuffer(self.fin, self.pos, CentsToTranspo(self.pitch), length=snddur) |
| 51 |
self.fout = PVSynth(self.buf, wintype=wintype, mul=self.env) |
| 52 |
|
| 53 |
self.fade = SigTo(value=1, time=.05, init=1) |
| 54 |
self.out = Sig(self.fout, mul=self.fade) |
| 55 |
|
| 56 |
def wtype(self, index, value): |
| 57 |
self.fin.wintype = index |
| 58 |
self.fout.wintype = index |
| 59 |
|
| 60 |
Interface = [ csampler(name="snd"), |
| 61 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"), |
| 62 |
cslider(name="pos", label="Position", min=0, max=1, init=0, func=[(0,0), (1,1)], rel="lin", unit="x", col="green"), |
| 63 |
cslider(name="pitch", label="Transposition", min=-2400, max=2400, init=0, rel="lin", unit="cts", col="blue"), |
| 64 |
cpopup(name="fftsize", label="FFT Size", init="1024", rate="i", value=["16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"], col="red"), |
| 65 |
cpopup(name="wtype", label="FFT Envelope", init="Hanning", col="red", value=["Rectangular", "Hamming", "Hanning", "Bartlett", |
| 66 |
"Blackman 3", "Blackman 4", "Blackman 7", "Tuckey", "Sine"]), |
| 67 |
cpopup(name="overlaps", label="FFT Overlaps", rate="i", init="4", col="red", value=["1", "2", "4", "8", "16"]), |
| 68 |
cpoly() |
| 69 |
] |
| 70 |
|