Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

marf.Preprocessing.FFTFilter
Class FFTFilter  view FFTFilter download FFTFilter.java

java.lang.Object
  extended bymarf.Storage.StorageManager
      extended bymarf.Preprocessing.Preprocessing
          extended bymarf.Preprocessing.FFTFilter.FFTFilter
All Implemented Interfaces:
marf.Preprocessing.IFilter, marf.Preprocessing.IPreprocessing, marf.Storage.IStorageManager, java.io.Serializable
Direct Known Subclasses:
BandpassFilter, HighFrequencyBoost, HighPassFilter, LowPassFilter

public abstract class FFTFilter
extends marf.Preprocessing.Preprocessing
implements marf.Preprocessing.IFilter

FFTFilter class implements filtering using the FFT algorithm.

Derivatives must set frequency response based on the type of filter they are.

$Id: FFTFilter.java,v 1.23 2005/08/05 22:19:55 mokhov Exp $

Since:
0.0.1
Version:
$Revision: 1.23 $

Field Summary
protected  double[] adFreqResponse
          Frequency repsonse to be multiplied by the incoming value.
static int DEFAULT_FREQUENCY_RESPONSE_SIZE
          Default size of the frequency response vector, 128.
 
Fields inherited from class marf.Preprocessing.Preprocessing
oSample
 
Fields inherited from class marf.Storage.StorageManager
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename
 
Fields inherited from interface marf.Preprocessing.IFilter
MARF_INTERFACE_CODE_REVISION
 
Fields inherited from interface marf.Preprocessing.IPreprocessing
MARF_INTERFACE_CODE_REVISION
 
Fields inherited from interface marf.Storage.IStorageManager
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, MARF_INTERFACE_CODE_REVISION, STORAGE_FILE_EXTENSIONS
 
Constructor Summary
FFTFilter(marf.Preprocessing.IPreprocessing poPreprocessing)
          Pipelined constructor.
FFTFilter(marf.Storage.Sample poSample)
          FFTFilter Constructor.
 
Method Summary
 boolean filter(double[] padSample, double[] padFiltered)
          Perform a filter by the following algorithm: (1) sample -> window -> FFT -> buffer
(2) buffer * frequency response
(3) buffer -> IFFT -> window -> sample.
abstract  void genereateResponseCoefficients()
          Creates frequency response coefficients and sets applies them to the frequency response vector.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 boolean preprocess()
          FFTFilter implementation of preprocess().
 void setFrequencyResponse(double[] padPesponse)
          Sets frequency response.
 
Methods inherited from class marf.Preprocessing.Preprocessing
backSynchronizeObject, cropAudio, getSample, normalize, normalize, normalize, removeNoise, removeSilence, setSample
 
Methods inherited from class marf.Storage.StorageManager
dump, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, restore, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FREQUENCY_RESPONSE_SIZE

public static final transient int DEFAULT_FREQUENCY_RESPONSE_SIZE
Default size of the frequency response vector, 128.

See Also:
Constant Field Values

adFreqResponse

protected transient double[] adFreqResponse
Frequency repsonse to be multiplied by the incoming value.

Constructor Detail

FFTFilter

public FFTFilter(marf.Preprocessing.IPreprocessing poPreprocessing)
          throws marf.Preprocessing.PreprocessingException
Pipelined constructor.

Since:
0.3.0.3

FFTFilter

public FFTFilter(marf.Storage.Sample poSample)
          throws marf.Preprocessing.PreprocessingException
FFTFilter Constructor.

Method Detail

preprocess

public boolean preprocess()
                   throws marf.Preprocessing.PreprocessingException
FFTFilter implementation of preprocess().

It does call removeNoise() and removeSilence() if they were explicitly requested by an app before applying filtering.

NOTE: it alters inner Sample by resetting its data array to the new filtered values.

Specified by:
preprocess in interface marf.Preprocessing.IPreprocessing

setFrequencyResponse

public final void setFrequencyResponse(double[] padPesponse)
Sets frequency response. Derivatives must call this method before any preprocessing occurs.


filter

public final boolean filter(double[] padSample,
                            double[] padFiltered)
                     throws marf.Preprocessing.PreprocessingException
Perform a filter by the following algorithm: (1) sample -> window -> FFT -> buffer
(2) buffer * frequency response
(3) buffer -> IFFT -> window -> sample. Window used is square root of Hamming window, because the sum at half-window overlap is a constant, which avoids amplitude distortion from noise. Also, start sampling at -responseSize/2, in order to avoid amplitude distortion of the first half of the first window.

Specified by:
filter in interface marf.Preprocessing.IFilter

genereateResponseCoefficients

public abstract void genereateResponseCoefficients()
Creates frequency response coefficients and sets applies them to the frequency response vector. Must be overridden by individual filters.

Since:
0.3.0

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Since:
0.3.0.2