I’m trying to find a way to synchronize the FFT Ugen, so that I can delay the analysis window by an exact amount.
I’m building a Synthdef that incorporates Paul-stretch style time-stretching, building off of jpdrecourt’s work here: http://sccode.org/1-5d6
The relevant bit of code looks like this:
sig = sig.collect({ |item, i|
chain = FFT(LocalBuf(fftSize), item, hop: 1.0, wintype: -1);
// PV_Diffuser is only active if its trigger is 1
// And it needs to be reset for each grain to get the smooth envelope
chain = PV_Diffuser(chain, 1 - trig);
item = IFFT(chain, wintype: -1);
});
Here we have two signals, and we’re running an FFT on each signal. The windows over the two FFTs are aligned. What I want to do is shift the second FFT window to have the two calculations out of phase. Note I’m not considering enveloping windows here: I’m just interested in the exact moment that the last N samples are used for a FFT calculation and finding a way to have those moments interwoven between the two chains.
The FFT Ugen has an active
parameter, which I’ve tried using to leave it ‘turned off’ for the first half of the window, but unfortunately it doesn’t seem to affect the positioning of the window. What would be ideal is an offset
parameter to FFT
that I could set to i * (fftSize/2)
(assuming sig
holds two items). But perhaps there is another way to do it.
In jpdrecourt’s example, this need is overcome by introducing a delay line after the FFT process. However, this introduces a delay between the input parameters and the output sound which I’m trying to eliminate.
I hope my question is clear - let me know if I need to explain it better!
Thanks,
Tim
PS - This diagram may also help explain the intention behind having the two FFT chains out of phase.