/** * Construct a FourierTransform that will analyze sample buffers that are * <code>ts</code> samples long and contain samples with a <code>sr</code> * sample rate. * * @param ts * the length of the buffers that will be analyzed * @param sr * the sample rate of the samples that will be analyzed */ public FourierTransform(int ts, float sr) { timeSize = ts; sampleRate = (int)sr; bandWidth = (2f / timeSize) * ((float)sampleRate / 2f); NoAverages(); AllocateArrays(); currentWindow = new RectangularWindow(); // a Rectangular window is analogous to using no window. }
/** * Sets the window to use on the samples before taking the forward transform. * If an invalid window is asked for, an error will be reported and the * current window will not be changed. * * @param windowFunction * the new WindowFunction to use, typically one of the statically defined * windows like HAMMING or BLACKMAN * * @related FFT * @related WindowFunction * * @example Analysis/FFT/Windows */ public void Window(WindowFunction windowFunction) { this.currentWindow = windowFunction; }