#pragma once //class FFTDataCpx; //class FFTDataReal; #include "FFTData.h" class ColoredNoiseSpec { public: float slope = 0; float highFreqCorner = 4000; float sampleRate = 44100; bool operator != (const ColoredNoiseSpec& other) const { return (slope != other.slope) || (highFreqCorner != other.highFreqCorner) || (sampleRate != other.sampleRate); } }; class FFT { public: /** Forward FFT will do the 1/N scaling */ static bool forward(FFTDataCpx* out, const FFTDataReal& in); static bool inverse(FFTDataReal* out, const FFTDataCpx& in); // static FFTDataCpx* makeNoiseFormula(float slope, float highFreqCorner, int frameSize); /** * Fills a complex FFT frame with frequency domain data describing noise */ static void makeNoiseSpectrum(FFTDataCpx* output, const ColoredNoiseSpec&); static void normalize(FFTDataReal*, float maxValue); static double bin2Freq(int bin, double sampleRate, int numBins); static int freqToBin(double freq, double sampleRate, int numBins); };