ddf.minim.analysis
Class DFT

java.lang.Object
  extended by ddf.minim.analysis.FourierTransform
      extended by ddf.minim.analysis.DFT

public class DFT
extends FourierTransform

DFT stands for Discrete Fourier Transform and is the most widely used Fourier Transform. You will never want to use this class due to the fact that it is a brute force implementation of the DFT and as such is quite slow. Use an FFT instead. This exists primarily as a way to ensure that other implementations of the DFT are working properly. This implementation expects an even timeSize and will throw and IllegalArgumentException if this is not the case.

Author:
Damien Di Fede
See Also:
FourierTransform, FFT, The Discrete Fourier Transform

Field Summary
 
Fields inherited from class ddf.minim.analysis.FourierTransform
averages, avgPerOctave, bandWidth, BARTLETT, BARTLETTHANN, COSINE, HAMMING, HANN, imag, LANCZOS, LINAVG, LOGAVG, NOAVG, NONE, octaves, real, sampleRate, spectrum, timeSize, TRIANGULAR, TWO_PI, whichAverage, windowFunction
 
Constructor Summary
DFT(int timeSize, float sampleRate)
          Constructs a DFT that expects audio buffers of length timeSize that have been recorded with a sample rate of sampleRate.
 
Method Summary
protected  void allocateArrays()
           
 void forward(float[] samples)
          Performs a forward transform on buffer.
 void inverse(float[] buffer)
          Performs an inverse transform of the frequency spectrum and places the result in buffer.
 void scaleBand(int i, float s)
          Not currently implemented.
 void setBand(int i, float a)
          Not currently implemented.
 
Methods inherited from class ddf.minim.analysis.FourierTransform
avgSize, calcAvg, doWindow, fillSpectrum, forward, forward, forward, freqToIndex, getAverageCenterFrequency, getAvg, getBand, getBandWidth, getFreq, indexToFreq, inverse, inverse, linAverages, logAverages, noAverages, scaleFreq, setComplex, setFreq, specSize, timeSize, window
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DFT

public DFT(int timeSize,
           float sampleRate)
Constructs a DFT that expects audio buffers of length timeSize that have been recorded with a sample rate of sampleRate. Will throw an IllegalArgumentException if timeSize is not even.

Parameters:
timeSize - the length of the audio buffers you plan to analyze
sampleRate - the sample rate of the audio samples you plan to analyze
Method Detail

allocateArrays

protected void allocateArrays()
Specified by:
allocateArrays in class FourierTransform

scaleBand

public void scaleBand(int i,
                      float s)
Not currently implemented.

Specified by:
scaleBand in class FourierTransform
Parameters:
i - the frequency band to modify
s - the scaling factor

setBand

public void setBand(int i,
                    float a)
Not currently implemented.

Specified by:
setBand in class FourierTransform
Parameters:
i - the frequency band to modify
a - the new amplitude

forward

public void forward(float[] samples)
Description copied from class: FourierTransform
Performs a forward transform on buffer.

Specified by:
forward in class FourierTransform
Parameters:
samples - the buffer to analyze

inverse

public void inverse(float[] buffer)
Description copied from class: FourierTransform
Performs an inverse transform of the frequency spectrum and places the result in buffer.

Specified by:
inverse in class FourierTransform
Parameters:
buffer - the buffer to place the result of the inverse transform in