framed
Class FFT

java.lang.Object
  extended by framed.FFT
All Implemented Interfaces:
FrameSource

public class FFT
extends java.lang.Object
implements FrameSource


Constructor Summary
FFT(FrameSource source)
          Construct a new FFT object.
FFT(FrameSource source, boolean pad)
          Construct a new FFT object.
 
Method Summary
 int getFrameSize()
          Return the length of the frames (needed for the read call)
static void main(java.lang.String[] args)
           
 boolean read(double[] buf)
          Read the next frame and apply FFT.
 java.lang.String toString()
          Return a String representation of the FrameSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FFT

public FFT(FrameSource source)
Construct a new FFT object. Depending on the source frame size, the output frame size will be 512 or the next power of 2. Frames will be padded with zeros. This is done to allow for a better frequency resolution.

Parameters:
source - FrameSource to read from

FFT

public FFT(FrameSource source,
           boolean pad)
Construct a new FFT object.

Parameters:
source - FrameSource to read from
Method Detail

getFrameSize

public int getFrameSize()
Description copied from interface: FrameSource
Return the length of the frames (needed for the read call)

Specified by:
getFrameSize in interface FrameSource

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

read

public boolean read(double[] buf)
             throws java.io.IOException
Read the next frame and apply FFT. The output data size is (in/2 + in%2).

Specified by:
read in interface FrameSource
Parameters:
buf - buffer to save the frame; implementing objects may depend on a constant dimensionduring subsequent calls
Returns:
true on success, false if the stream terminated before the window was filled
Throws:
java.io.IOException

toString

public java.lang.String toString()
Description copied from interface: FrameSource
Return a String representation of the FrameSource

Specified by:
toString in interface FrameSource
Overrides:
toString in class java.lang.Object