|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.Storage.StorageManager marf.Preprocessing.Preprocessing
public abstract class Preprocessing
Abstract Preprocessing Module.
$Id: Preprocessing.java,v 1.50 2007/12/16 06:41:22 mokhov Exp $
Field Summary | |
---|---|
protected boolean |
bRemoveNoise
By default we do not remove noise. |
protected boolean |
bRemoveSilence
By default we do not remove silence. |
static double |
DEFAULT_SILENCE_THRESHOLD
Default amplitude value and below to what consider as a silence. |
protected double |
dSilenceThreshold
Current silence removal threshold. |
protected Sample |
oSample
Sample reference. |
Fields inherited from class marf.Storage.StorageManager |
---|
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename |
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 | |
---|---|
protected |
Preprocessing()
Default constructor for reflective creation of Preprocessing clones. |
protected |
Preprocessing(IPreprocessing poPreprocessing)
Allows chaining of preprocessing modules. |
protected |
Preprocessing(Sample poSample)
Main Preprocessing constructor that performs normalization as a part of construction process. |
Method Summary | |
---|---|
void |
backSynchronizeObject()
Implementation of back-synchronization of Sample loaded object. |
java.lang.Object |
clone()
Implements Cloneable interface for the Preprocessing object. |
boolean |
compress()
Compresses the instance of the stored sample by removing duplicates. |
static double[] |
compress(double[] padDataVector)
Compresses input data by removing duplicate values. |
boolean |
cropAudio(double pdStartingFrequency,
double pdEndFrequency)
Derivatives implement this method to crop arbitrary part of the audio sample. |
protected void |
extractParameters()
Performs general preprocessing module parameters extraction. |
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
Sample |
getSample()
Returns enclosed sample. |
boolean |
normalize()
Normalization of entire incoming samples by amplitude. |
boolean |
normalize(int piIndexFrom)
Normalization of incoming samples by amplitude starting from certain index. |
boolean |
normalize(int piIndexFrom,
int piIndexTo)
Normalization of incoming samples by amplitude between specified indexes. |
boolean |
preprocess()
Default implementation of preprocess() includes
normalization of the sample, and optionally removal of noise and
silence. |
boolean |
removeNoise()
Implements the noise in a relatively general default way by invoking the low-pass FFT filter with the default settings. |
boolean |
removeSilence()
Remove silence (amplitudes below certain threshold) from the sample thereby making it smaller and more unique compared to other samples. |
static double[] |
removeSilence(double[] padDataVector,
double pdSilenceThreshold)
Compresses input data by removing values below silence threshold. |
void |
setSample(Sample poSample)
Allows setting a sample object reference. |
Methods inherited from class marf.Storage.StorageManager |
---|
dump, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restore, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_SILENCE_THRESHOLD
protected Sample oSample
protected double dSilenceThreshold
DEFAULT_SILENCE_THRESHOLD
protected boolean bRemoveNoise
protected boolean bRemoveSilence
Constructor Detail |
---|
protected Preprocessing()
protected Preprocessing(Sample poSample) throws PreprocessingException
poSample
- loaded sample by a concrete implementation of SampleLoader
PreprocessingException
- if normalize()
failsnormalize()
protected Preprocessing(IPreprocessing poPreprocessing) throws PreprocessingException
new FooBarBaz(new HighFrequencyBoost(new HighPassFilter(poSample)))
.
Notice, it calls preprocess()
for all inner preprocessing,
but not the outer. The outer is supposed to be called by either MARF
or an application as a part of defined API.
poPreprocessing
- follow up preprocessing module
PreprocessingException
- if underlying preprocess()
fails or
the parameter is null.preprocess()
,
MARF
,
HighFrequencyBoost
,
HighPassFilter
Method Detail |
---|
public boolean preprocess() throws PreprocessingException
preprocess()
includes
normalization of the sample, and optionally removal of noise and
silence.
preprocess
in interface IPreprocessing
true
if there are any changes made
PreprocessingException
- in case of any errorIPreprocessing.removeNoise()
,
IPreprocessing.removeSilence()
public boolean removeNoise() throws PreprocessingException
removeNoise
in interface IPreprocessing
PreprocessingException
- declared but never thrownLowPassFilter
public boolean removeSilence() throws PreprocessingException
removeSilence
in interface IPreprocessing
PreprocessingException
- in case of any errorremoveSilence(double[], double)
,
dSilenceThreshold
public final boolean normalize() throws PreprocessingException
normalize(0)
.
normalize
in interface IPreprocessing
true
if the sample has been successfully normalized;
false
otherwise
PreprocessingException
- if internal sample reference is nullnormalize(int)
public final boolean normalize(int piIndexFrom) throws PreprocessingException
HighFrequencyBoost
.
Equivalent to normalize(piIndexFrom, sample array length - 1)
.
normalize
in interface IPreprocessing
piIndexFrom
- sample array index to start normalization from
true
if the sample has been successfully normalized;
false
otherwise
PreprocessingException
- if internal sample reference is nullnormalize(int, int)
,
HighFrequencyBoost
public final boolean normalize(int piIndexFrom, int piIndexTo) throws PreprocessingException
normalize
in interface IPreprocessing
piIndexFrom
- sample array index to start normalization frompiIndexTo
- sample array index to end normalization at
true
if the sample has been successfully normalized;
false
otherwise
PreprocessingException
- if internal sample reference is null or one or
both indexes are out of rangepublic static double[] compress(double[] padDataVector)
padDataVector
- source data vector to apply compression to
public static double[] removeSilence(double[] padDataVector, double pdSilenceThreshold)
padDataVector
- source data vector to apply compression topdSilenceThreshold
- the silence threshold below or equal to which amplitude values are ignored
public boolean compress()
true
, if the compression was successful.compress(double[])
public boolean cropAudio(double pdStartingFrequency, double pdEndFrequency) throws PreprocessingException
cropAudio
in interface IPreprocessing
pdStartingFrequency
- double Frequency to start to crop frompdEndFrequency
- double Frequency to crop the sample to
true
- cropped, false
- not
NotImplementedException
PreprocessingException
- declared, but is never thrownpublic final Sample getSample()
getSample
in interface IPreprocessing
public void setSample(Sample poSample)
setSample
in interface IPreprocessing
poSample
- new sample objectpublic void backSynchronizeObject()
backSynchronizeObject
in class StorageManager
StorageManager.restore()
public java.lang.Object clone()
clone
in interface IPreprocessing
clone
in class StorageManager
Object.clone()
protected void extractParameters()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |