public final class FFT
extends java.lang.Object
Constructor and Description |
---|
FFT(int size) |
FFT(int size,
WindowFunction windowFunction)
Create a new fft of the specified size.
|
Modifier and Type | Method and Description |
---|---|
void |
backwardsTransform(float[] data)
Computes inverse DFT.
|
double |
binToHz(int binIndex,
float sampleRate) |
void |
complexForwardTransform(float[] data) |
void |
forwardTransform(float[] data)
Computes forward DFT.
|
void |
modulus(float[] data,
float[] amplitudes)
Calculates the the modulus for each element in data and stores the result
in amplitudes.
|
float |
modulus(float[] data,
int index)
Returns the modulus of the element at index bufferCount.
|
void |
multiply(float[] data,
float[] other)
Multiplies to arrays containing imaginary numbers.
|
void |
powerAndPhaseFromFFT(float[] data,
float[] power,
float[] phase)
Returns magnitude (or power) and phase for the FFT transformed data.
|
void |
powerPhaseFFT(float[] data,
float[] power,
float[] phase)
Computes an FFT and converts the results to polar coordinates (power and
phase).
|
void |
powerPhaseFFTBeatRootOnset(float[] data,
float[] power,
float[] phase) |
int |
size() |
public FFT(int size)
public FFT(int size, WindowFunction windowFunction)
size
- The size of the fft.windowFunction
- Apply the specified window on the samples before a forward transform.
arning: the window is not applied in reverse when a backwards transform is requested.public void forwardTransform(float[] data)
data
- data to transform.public void complexForwardTransform(float[] data)
public void backwardsTransform(float[] data)
data
- data to transformpublic double binToHz(int binIndex, float sampleRate)
public int size()
public float modulus(float[] data, int index)
data
- The FFT transformed data.index
- The index of the element.public void modulus(float[] data, float[] amplitudes)
data
- The input data.amplitudes
- The output modulus info or amplitude.public void powerPhaseFFT(float[] data, float[] power, float[] phase)
data
- The input audio signal.power
- The power (modulus) of the data.phase
- The phase of the datapublic void powerAndPhaseFromFFT(float[] data, float[] power, float[] phase)
data
- The FFT transformed data.power
- The array where the magnitudes or powers are going to be stored. It is half the length of data (FFT size).phase
- The array where the phases are going to be stored. It is half the length of data (FFT size).public void powerPhaseFFTBeatRootOnset(float[] data, float[] power, float[] phase)
public void multiply(float[] data, float[] other)
2*i
, the imaginary part 2*i+i
data
- The array with imaginary numbers that is modified.other
- The array with imaginary numbers that is not modified.
Data and other need to be the same length.