Hello,
i am trying to manipulate an fft chain, the goal is to check for every bin if the magnitude is a new maximum, and to hold onto all the maximum magnitude values in an array.
I tried this code:
c.free; c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
(
{
var in = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1),
chain = FFT(LocalBuf(1024), in),
maxMag = (0!512);
chain = chain.pvcollect(1024, {|mag, phase, index|
maxMag[index] = if ( (mag > maxMag[index]), mag, maxMag[index]);
[maxMag[index], phase]
}, frombin: 0, tobin: 250, zeroothers: 0);
0.5 * IFFT(chain).dup
}.play
)
Can someone help me out?