math.fourierTransforms.r2
Class FFT1dDouble

java.lang.Object
  extended by math.fourierTransforms.r2.FFT1dDouble

public class FFT1dDouble
extends java.lang.Object

Works. Automatically scales ouput in ifft. A 1D FFT for integral power of two FFTs


Constructor Summary
FFT1dDouble()
           
 
Method Summary
 void bandPassFilter(int flp, int fhp)
           
 void computeBackwardFFT(double[] in_r, double[] in_i)
           
 void computeForwardFFT(double[] in_r, double[] in_i)
           
static void csvparserTest()
           
 void fft(double[] _realPart, double[] _imaginaryPart)
           
 double[] getImaginaryData()
           
 double[] getLogPSD()
           
static double getMagnitudeSquared(double r, double imag)
          Compute the sum of the squares of a complex number
static int getMaxPSDLocation(double[] realPart, double[] imaginaryPart)
          get the location of the maximum partial
static double[] getNoise(double[] a)
           
static double[] getPsd(double[] audioWaveForm)
           
 double[] getPSDNormalized()
           
 double[] getPSDNotNormalized()
           
static double[] getPsdNotNormalized(double[] in_r, double[] in_i)
          Compute the power spectral density of the input arrays
 double[] getRealData()
           
static OscopePanel getSpectrumPanel(double[] audioWaveForm)
           
 void highPassFilter(int fk)
           
 void lowPassFilter(int fk)
           
static void main(java.lang.String[] args)
           
 void normalize()
          Divide the real and imginary parts by the length of each.
static void print(java.lang.Object[] o)
           
static void showSpectrumAnalyzer()
          A way to visually test the 1D FFT on a small amount of data.
 void squelch(double v)
           
 void swap(int i, int numBits)
           
static void synthesizeRamp(double[] realPart, double[] imaginaryPart)
          Destroy the input data with a linear ramp.
static void testFFT()
          Test the DFT using a small number of samples.
static void testFFT2()
           
static void testGetMaxPSDLocation()
           
 void timeFFT(int n)
           
 void visuallyTest()
           
static void window(double[] r, double[] w)
           
 void zeroCutOff(double psdMin)
          Zero out the partials whose PSD is below the psdMin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FFT1dDouble

public FFT1dDouble()
Method Detail

showSpectrumAnalyzer

public static void showSpectrumAnalyzer()
A way to visually test the 1D FFT on a small amount of data.


getSpectrumPanel

public static OscopePanel getSpectrumPanel(double[] audioWaveForm)

getPsd

public static double[] getPsd(double[] audioWaveForm)

print

public static void print(java.lang.Object[] o)

synthesizeRamp

public static void synthesizeRamp(double[] realPart,
                                  double[] imaginaryPart)
Destroy the input data with a linear ramp.

Parameters:
realPart - input datas real component
imaginaryPart - input datas' imaginary component.

window

public static void window(double[] r,
                          double[] w)

swap

public void swap(int i,
                 int numBits)
Parameters:
i -
numBits -

testGetMaxPSDLocation

public static void testGetMaxPSDLocation()

getMaxPSDLocation

public static int getMaxPSDLocation(double[] realPart,
                                    double[] imaginaryPart)
get the location of the maximum partial

Parameters:
realPart -
imaginaryPart -
Returns:
location of max(realPart[i],imaginaryPart[i])

getMagnitudeSquared

public static double getMagnitudeSquared(double r,
                                         double imag)
Compute the sum of the squares of a complex number

Parameters:
r - real part
imag - imaginary part
Returns:
r*r + imag * imag.

computeForwardFFT

public void computeForwardFFT(double[] in_r,
                              double[] in_i)

computeBackwardFFT

public void computeBackwardFFT(double[] in_r,
                               double[] in_i)

fft

public void fft(double[] _realPart,
                double[] _imaginaryPart)
Parameters:
_realPart -
_imaginaryPart -

getRealData

public double[] getRealData()
Returns:
gets the real component from FFT.

getImaginaryData

public double[] getImaginaryData()
Returns:
gets the imaginary component from FFT.

getPSDNormalized

public double[] getPSDNormalized()
Returns:
Power Spectral Density of the internal data

getPSDNotNormalized

public double[] getPSDNotNormalized()

getLogPSD

public double[] getLogPSD()

getPsdNotNormalized

public static double[] getPsdNotNormalized(double[] in_r,
                                           double[] in_i)
Compute the power spectral density of the input arrays

Parameters:
in_r - real part of an fft
in_i - imaginary part of an fft
Returns:
the psd.

testFFT2

public static void testFFT2()

testFFT

public static void testFFT()
Test the DFT using a small number of samples. This is an O(N**2) algorithm.


normalize

public void normalize()
Divide the real and imginary parts by the length of each. This should be done before the IFFT is computed, for filters to work in a consistent manner.


zeroCutOff

public void zeroCutOff(double psdMin)
Zero out the partials whose PSD is below the psdMin

Parameters:
psdMin - generally a small number (2E-4)

getNoise

public static double[] getNoise(double[] a)

bandPassFilter

public void bandPassFilter(int flp,
                           int fhp)

highPassFilter

public void highPassFilter(int fk)

lowPassFilter

public void lowPassFilter(int fk)

squelch

public void squelch(double v)

visuallyTest

public void visuallyTest()

timeFFT

public void timeFFT(int n)

csvparserTest

public static void csvparserTest()

main

public static void main(java.lang.String[] args)