comirva.audio.util
Class FFT

java.lang.Object
  extended by comirva.audio.util.FFT

public class FFT
extends java.lang.Object

Class for computing a windowed fast Fourier transform. Implements some of the window functions for the STFT from Harris (1978), Proc. IEEE, 66, 1, 51-83.


Field Summary
static int FFT_FORWARD
          used in fft(double[], double[], int) to specify a forward Fourier transform
static int FFT_INLINE_POWER_PHASE
          used to specify a inline power phase Fourier transform
static int FFT_MAGNITUDE
          used to specify a magnitude Fourier transform
static int FFT_MAGNITUDE_PHASE
          used to specify a magnitude phase Fourier transform
static int FFT_NORMALIZED_POWER
          used to specify a normalized power Fourier transform
static int FFT_POWER
          used to specify a power Fourier transform
static int FFT_POWER_PHASE
          used to specify a power phase Fourier transform
static int FFT_REVERSE
          used in fft(double[], double[], int) to specify an inverse Fourier transform
static int WND_BH3
          used in FFT#makeWindow(int,int,int) to specify a 61-dB 3-sample Blackman-Harris window function
static int WND_BH3MIN
          used in FFT#makeWindow(int,int,int) to specify a minimum 3-sample Blackman-Harris window function
static int WND_BH4
          used in FFT#makeWindow(int,int,int) to specify a 74-dB 4-sample Blackman-Harris window function
static int WND_BH4MIN
          used in FFT#makeWindow(int,int,int) to specify a minimum 4-sample Blackman-Harris window function
static int WND_GAUSS
          used in FFT#makeWindow(int,int,int) to specify a Gaussian window function
static int WND_HAMMING
          used in FFT#makeWindow(int,int,int) to specify a Hamming window function
static int WND_HANNING
          used in FFT#makeWindow(int,int,int) to specify a Hanning window function
static int WND_NONE
          used in FFT#makeWindow(int,int,int) to specify a rectangular window function
static int WND_RECT
          used in FFT#makeWindow(int,int,int) to specify a rectangular window function
static int WND_USER_DEFINED
          used in FFT#makeWindow(int,int,int) to specify a Hanning window function
 
Constructor Summary
FFT(int transformationType, int windowSize)
           
FFT(int transformationType, int windowSize, double[] windowFunction)
           
FFT(int transformationType, int windowSize, int windowFunctionType)
           
FFT(int transformationType, int windowSize, int windowFunctionType, int support)
           
 
Method Summary
 int getTransformationType()
           
 int getWindowFunctionType()
           
 void setWindowFunction(int windowFunctionType, int support)
          Returns an array of values of a normalised smooth window function, as used for performing a short time Fourier transform (STFT).
 void transform(double[] re, double[] im)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FFT_FORWARD

public static final int FFT_FORWARD
used in fft(double[], double[], int) to specify a forward Fourier transform

See Also:
Constant Field Values

FFT_REVERSE

public static final int FFT_REVERSE
used in fft(double[], double[], int) to specify an inverse Fourier transform

See Also:
Constant Field Values

FFT_MAGNITUDE

public static final int FFT_MAGNITUDE
used to specify a magnitude Fourier transform

See Also:
Constant Field Values

FFT_MAGNITUDE_PHASE

public static final int FFT_MAGNITUDE_PHASE
used to specify a magnitude phase Fourier transform

See Also:
Constant Field Values

FFT_NORMALIZED_POWER

public static final int FFT_NORMALIZED_POWER
used to specify a normalized power Fourier transform

See Also:
Constant Field Values

FFT_POWER

public static final int FFT_POWER
used to specify a power Fourier transform

See Also:
Constant Field Values

FFT_POWER_PHASE

public static final int FFT_POWER_PHASE
used to specify a power phase Fourier transform

See Also:
Constant Field Values

FFT_INLINE_POWER_PHASE

public static final int FFT_INLINE_POWER_PHASE
used to specify a inline power phase Fourier transform

See Also:
Constant Field Values

WND_NONE

public static final int WND_NONE
used in FFT#makeWindow(int,int,int) to specify a rectangular window function

See Also:
Constant Field Values

WND_RECT

public static final int WND_RECT
used in FFT#makeWindow(int,int,int) to specify a rectangular window function

See Also:
Constant Field Values

WND_HAMMING

public static final int WND_HAMMING
used in FFT#makeWindow(int,int,int) to specify a Hamming window function

See Also:
Constant Field Values

WND_BH3

public static final int WND_BH3
used in FFT#makeWindow(int,int,int) to specify a 61-dB 3-sample Blackman-Harris window function

See Also:
Constant Field Values

WND_BH4

public static final int WND_BH4
used in FFT#makeWindow(int,int,int) to specify a 74-dB 4-sample Blackman-Harris window function

See Also:
Constant Field Values

WND_BH3MIN

public static final int WND_BH3MIN
used in FFT#makeWindow(int,int,int) to specify a minimum 3-sample Blackman-Harris window function

See Also:
Constant Field Values

WND_BH4MIN

public static final int WND_BH4MIN
used in FFT#makeWindow(int,int,int) to specify a minimum 4-sample Blackman-Harris window function

See Also:
Constant Field Values

WND_GAUSS

public static final int WND_GAUSS
used in FFT#makeWindow(int,int,int) to specify a Gaussian window function

See Also:
Constant Field Values

WND_HANNING

public static final int WND_HANNING
used in FFT#makeWindow(int,int,int) to specify a Hanning window function

See Also:
Constant Field Values

WND_USER_DEFINED

public static final int WND_USER_DEFINED
used in FFT#makeWindow(int,int,int) to specify a Hanning window function

See Also:
Constant Field Values
Constructor Detail

FFT

public FFT(int transformationType,
           int windowSize)

FFT

public FFT(int transformationType,
           int windowSize,
           int windowFunctionType)

FFT

public FFT(int transformationType,
           int windowSize,
           int windowFunctionType,
           int support)

FFT

public FFT(int transformationType,
           int windowSize,
           double[] windowFunction)
Method Detail

transform

public void transform(double[] re,
                      double[] im)

setWindowFunction

public void setWindowFunction(int windowFunctionType,
                              int support)
Returns an array of values of a normalised smooth window function, as used for performing a short time Fourier transform (STFT). All functions are normalised by length and coherent gain. More information on characteristics of these functions can be found in F.J. Harris (1978), On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform, Proceedings of the IEEE, 66, 1, 51-83.

Parameters:
choice - the choice of window function, one of the constants defined above
support - the number of non-zero values in the array, if the array is larger than this, it is zero-padded symmetrically at both ends

getTransformationType

public int getTransformationType()

getWindowFunctionType

public int getWindowFunctionType()