Hey everyone!
So I sat up all night looking through the FFT helpfiles to figure out how to analyze sound and resynthesize it using Sinewaves. This is where I am at the moment:
(
SynthDef.new("FFT", {
var in, chain, sig;
in = PlayBuf.ar(1, 0, doneAction:2);
~b = LocalBuf(2048, 1);
chain = FFT(~b, in);
chain = PV_MaxMagN(chain, 3);
chain = chain.pvcollect(2048, {
arg mag, phase, bin, index;
mag.postln;
});
sig = IFFT(chain);
Out.ar(0, sig!2);
}).add;
)
As you can see, I at least figured out how to narrow it down to the 3 strongest bins with PV_MaxMagN, but couldn’t for the life of me figure out how to convert the Unpack1FFT’s stored in the arguments mag and phase under the .pvcollect-iteration into freq and amp information to use in the SinOsc.
Anyone know what to do?
Martin