FFT processing on Audio and Mic

Thank you for this and all of the other useful synthesis recipes you posted on here!

Here’s an approach to achieve this with EQ’s. Have done some real world test by taking them to loud atmospheres and these values are somewhat reasonable for the final audio - tested on MBP2018 mic and speakers. Please tweak them to your preference.
As this is now working I’m now interested to compare with FFT’s and see what’s the trade-off with audio quality.

s.boot;

~music= Buffer.read(s,"LOAD AN AUDIO FILE MONO or STEREO - IF STEREO change channel num to 2");

(
a = ({
	var mic, sig, loFreq = 20, hiFreq = 20000, numBands = 16, threshold = -20, bandFreqs, dB, maxBoost;
	bandFreqs = Array.geom(numBands, loFreq, (hiFreq/loFreq)**(1/numBands));
	mic = SoundIn.ar(0, 1); //Input Mic Signal
	mic = BPF.ar(mic, bandFreqs, 0.34);
	dB = Amplitude.ar(mic, 0.1, 0.5).ampdb.poll; //Convert to dB scale
	maxBoost = 6; //Increase or decrease the value to your preference.
	mic = min(max(dB - threshold, 0), maxBoost);
	sig = PlayBuf.ar(1, ~music.bufnum, BufRateScale.ir(~music.bufnum), loop: 1); //Set for mono audio signal
	numBands.do{ arg i;
		sig = BPeakEQ.ar(sig, bandFreqs[i], 0.34, mic[i]);
	};
	sig = Limiter.ar(sig, 1);
}).play;
)

s.quit;

Massive thanks to @nathan for helping me achieve this.