AutoCloseable
FFT
, PureJavaFFT
public abstract class AbstractFFT extends Object implements AutoCloseable
Modifier and Type | Field | Description |
---|---|---|
static int |
FREQUENCY |
Index to be used on the result of
transform(float[]) and the like. |
static int |
IMAGINARY |
Index to be used on the result of
transform(float[]) and the like. |
static int |
REAL |
Index to be used on the result of
transform(float[]) and the like. |
Constructor | Description |
---|---|
AbstractFFT(int numberOfSamples) |
Constructor for a given number of samples.
|
Modifier and Type | Method | Description |
---|---|---|
float[] |
getFrequencies() |
Array describing the frequency for the different FFT bins.
|
float |
getFrequencyForBin(int bin) |
Frequency for a given fourier transform bin.
|
int |
getNumberOfSamples() |
Number of samples.
|
abstract float[][] |
inverseTransform(float[] real,
float[] imaginary) |
Perform inverse transform.
|
String |
toString() |
|
abstract float[][] |
transform(float[] real) |
Transform for real numbers.
|
abstract float[][] |
transform(float[] real,
float[] imaginary) |
Transform for complex numbers.
|
close
public static final int REAL
transform(float[])
and the like.public static final int IMAGINARY
transform(float[])
and the like.public static final int FREQUENCY
transform(float[])
and the like.public AbstractFFT(int numberOfSamples)
numberOfSamples
- number of samples you intend to transformIllegalArgumentException
- if the number of samples is negative or not a power of 2public int getNumberOfSamples()
public float[] getFrequencies()
N/2
(Nyquist
frequency) are typically not useful.
The returned array is a clone, you may do with it whatever you want.
public float getFrequencyForBin(int bin)
N/2
(Nyquist
frequency) are typically not useful.bin
- binIllegalArgumentException
- if the given bin number is invalid for this FFT instancepublic abstract float[][] inverseTransform(float[] real, float[] imaginary) throws UnsupportedOperationException
real
- real partimaginary
- imaginary partUnsupportedOperationException
public abstract float[][] transform(float[] real) throws UnsupportedOperationException
real
- samplesUnsupportedOperationException
public abstract float[][] transform(float[] real, float[] imaginary) throws UnsupportedOperationException
real
- real partimaginary
- imaginary partUnsupportedOperationException