FFT: track loudest frequencies (plural)

Hello i would like to track the frequencies of a signal.
Sure something like Pitch.kr exists, but it will only track the loudest frequency.
I would like to extend this to a the loudest frequencies and also know their amplitudes.
I guess i could do some FFT, but I’m not entirely sure how to post-process the FFT afterwards. What options do i have to get the frequencies and amplitudes of the most audible frequencies of a signal?

I would like to use those frequencies to then use them for a Synth. lets say a Saw.ar() of those. I made an Example of how this would work, but it only creates a Sin of the obtained largest 3 frequencies, because It’s just a inverse FFT PV_MaxMagN:

(
{
	var size = 2048;
	var sig, chain;
	sig = SinOsc.ar([1,1.5,2,3,4]*110,mul:[1,0.5,0.2,0.3,0.7].normalizeSum);
	sig = sig.sum*0.6;
	chain = FFT(LocalBuf(size), sig);
	chain = PV_MaxMagN(chain, 3);
	IFFT(chain)!2;//detects that the frequency in the middle are not as loud
	// sig!2
}.play;
)

i hope my point is clear. thank you very much!!

The best way to do this is to use FluidSineFeature from the FluCoMa library. It will give you the top N frequencies in any signal.

Sam

2 Likes

Thank you for the answer, this actually works quite good!
But I intend to use the supernova architecture later on. So i suppose it cannot be the solution. As far as i know is the problem known that fluid and supernova are not compatible is known for a couple of years. Do you know by any chance if that will ever change?

For documentations, this would be a solution with flucoma, after increasing the windowsize it worked.

(
{
	var sig;
	var freqs, amps;
	sig = SinOsc.ar([1,1.5,2,3,4] * 110,mul:[1,0.5,0.2,0.3,0.7].normalizeSum);
	sig = sig.sum*0.4;
	# freqs, amps = FluidSineFeature.kr(sig,3,order:1,windowSize:4096);
	sig = SinOsc.ar(freqs,mul:amps).sum!2;
}.play;
)

There is also this, which I haven’t used but claims to be a polyphonic Pitch ugen… Although it sounds like that might not be what you’re trying to do