Grouping Multiple FFT Bins

Hi all,

I’m trying to group FFT bins and do individual processing on those groups.
Step1: I’m now trying to figure out bins and its frequency.
Step-2: Once I get those info, I’ll group FFT bins - 1-30 → 20-200Hz, 31-200-> 201Hz-10kHz, etc. and do processing on different bands
Trying to split to 3 bands or something like that (Low, Mid, Hi band) and do different processing on those different band
Could you please help me in this regard?

Thanks

s.boot;


~music = Buffer.read(s,"LOAD AUDIO FILE"); //Mono

(
SynthDef(\test, {
	arg loop=1, da=1;
	var sig, sig1, sig2, chain1, chain2, size=1024;
	sig1 = SoundIn.ar(0, 1);                                                     //Mic - Noise (Mono)
	//sig1 = PlayBuf.ar(1, ~noise.bufnum, BufRateScale.ir(~noise.bufnum), loop: 1);
	sig2 = PlayBuf.ar(1, \buf.kr(0), BufRateScale.ir(\buf.kr(0)), loop: loop, doneAction: da); //Music(Mono)
	chain1 = FFT(LocalBuf(size), sig1, hop: 0.25, wintype: 1);
	chain2 = FFT(LocalBuf(size), sig2, hop: 0.25, wintype: 1);
	chain2= chain2.pvcalc2(chain1, size , {
		arg mag1, phs1, mag2, phs2;
		var mag1Energy, mag2Energy;
		mag1Energy = mag1**2;                                                   
		mag2Energy = mag2**2;                                                  
		mag1 = mag1 * (mag2Energy/mag1Energy).sqrt;                                     
		[mag1, phs1];
	}, 0, 300, 0);
	sig = IFFT(chain2, 1) * 1!2;                                                 //Duplicating to make it play on L and R
	sig = Limiter.ar(sig, 1);                                                    //A limiter - Just to be safe
	Out.ar(0, sig);
}).add;
)

Synth(\test, [\buf, ~music]);

See PV_BinRange and PV_BinGap in miSCellaneous_lib.

Sincerely

Daniel