com.frinika.contrib.boblang
Class Fourier
java.lang.Object
com.frinika.contrib.boblang.Fourier
public class Fourier
- extends java.lang.Object
Class to perform Fast Fourier transformations - based on fourierd.c
by Don Cross
- Author:
- Bob Lang (Java conversion), Don Cross (Original C/C++ implementation)
Method Summary |
static void |
fftBase(int numSamples,
boolean inverseTransform,
double[] realIn,
double[] imagIn,
double[] realOut,
double[] imagOut)
Base FFT method which performs an FFT on a power of two samples. |
static void |
frequencyFft(int numberOfSamples,
double[] dataIn,
double[] frequencies)
Perform an FFT on a sequence of samples and produce a list
of frequency values as output. |
static void |
frequencyFft(int numberOfSamples,
int[] dataIn,
double[] frequencies)
Integer version of frequencyFft (). |
static double |
frequencyFromBin(int binNumber,
int numberOfSamples,
double samplingFrequency)
Calculate the frequency from a specified index number of the
output real/imag arrays. |
static int |
nextPowerOfTwo(int sampleSize)
Calculate the next power of two from the sample size,
assuming that the sample size isn't already a power of two |
static double[] |
padToPowerOfTwo(int numberOfSamples,
double[] inData)
Produce an array which is a power of two long and is suitably
padded with zeroes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Fourier
public Fourier()
nextPowerOfTwo
public static int nextPowerOfTwo(int sampleSize)
- Calculate the next power of two from the sample size,
assuming that the sample size isn't already a power of two
fftBase
public static void fftBase(int numSamples,
boolean inverseTransform,
double[] realIn,
double[] imagIn,
double[] realOut,
double[] imagOut)
- Base FFT method which performs an FFT on a power of two samples.
Blatantly copied from FOURIERD.C by Don Cross
frequencyFft
public static void frequencyFft(int numberOfSamples,
double[] dataIn,
double[] frequencies)
- Perform an FFT on a sequence of samples and produce a list
of frequency values as output. The method assumes that only the
real data should be supplied, and the output produced is the magnitude
of the frequency components
frequencyFft
public static void frequencyFft(int numberOfSamples,
int[] dataIn,
double[] frequencies)
- Integer version of frequencyFft ().
frequencyFromBin
public static double frequencyFromBin(int binNumber,
int numberOfSamples,
double samplingFrequency)
- Calculate the frequency from a specified index number of the
output real/imag arrays. After an FFT with N samples, the
frequency spectrum from DC to half the sampling frequency
is divided into n/2 frequency bins.
padToPowerOfTwo
public static double[] padToPowerOfTwo(int numberOfSamples,
double[] inData)
- Produce an array which is a power of two long and is suitably
padded with zeroes. If the input array is null then a
suitable zero padded array of the correct size is returned