So I’m wondering if it’s possible, instead of playing the result of an IFFT in real time:
~fftbuf = Buffer.alloc(s, 1024);
(
{
var in = SoundIn.ar(0);
var chain = FFT(~fftbuf, in, 1).pvcalc(1024, { |mags, phases|
[mags, 0!1024]
});
var sig = IFFT(chain);
sig
}.play;
)
to instead instantly write (in this case) the 1024 signal points into a Buffer.
I can basically get what I want using RecordBuf:
~fftbuf = Buffer.alloc(s, 1024);
~resbuf = Buffer.alloc(s, 1024);
(
{
var in = SoundIn.ar(0);
var chain = FFT(~fftbuf, in, 1).pvcalc(1024, { |mags, phases|
[mags, 0!1024]
});
var sig = IFFT(chain);
RecordBuf.ar(sig, ~resbuf, trigger: chain);
nil;
}.play;
)
But this introduces another 1024 samples delay before I can read the whole IFFT from the buffer, and also is constantly writing, so most of the time the buffer contains a discontinuity somewhere.
It would be better if there were something like IFFT
that could write the transform immediately into a buffer… does this exist already?
Relatedly, is there a UGen that will copy the contents of one buffer into another buffer on receiving a trigger?