public class MelFilterBank extends Object
Constructor and Description |
---|
MelFilterBank()
Construct a default MelFilterBank.
|
MelFilterBank(int nFilters,
double lowFreq,
double highFreq)
Default constructor to create a filter bank with the given number
of filters between the two given frequencies.
|
Modifier and Type | Method and Description |
---|---|
Jama.Matrix |
asMatrix(int specSize,
double minFreq,
double maxFreq)
Returns the filters weights as a Matrix, where the rows are the
filters and the columns are the frequencies.
|
void |
createFilterBank()
Instantiate the filter bank, if it's not already instantiated.
|
List<TriangularFilter> |
getFilters()
Returns a list of filters in this filter bank
|
float[] |
getResponseCurve(int nSpectrumBins,
double maxFreq)
Returns a set of values that represent the response of this filter bank
when the linear frequency is split in the given number of bins.
|
float[][] |
process(float[][] spectrum,
AudioFormat format)
Process the input power spectrum with this filter bank.
|
void |
setFilterAmplitude(double fa)
Set the filter amplitude for all the generated filters.
|
public MelFilterBank()
public MelFilterBank(int nFilters, double lowFreq, double highFreq)
nFilters
- The number of filterslowFreq
- The lowest frequency covered by the bankhighFreq
- The highest frequency covered by the bankpublic void createFilterBank()
public List<TriangularFilter> getFilters()
public float[][] process(float[][] spectrum, AudioFormat format)
spectrum
- The power spectrumformat
- The format of the original audio used to produce the
spectrumpublic float[] getResponseCurve(int nSpectrumBins, double maxFreq)
nSpectrumBins
length.nSpectrumBins
- The number of bins in a spectrum.maxFreq
- The maximum frequency (sample rate)public void setFilterAmplitude(double fa)
fa
- The new filter amplitudepublic Jama.Matrix asMatrix(int specSize, double minFreq, double maxFreq)
specSize
- The size of the spectrum (number of cols in the matrix)minFreq
- The minimum frequency represented in the spectrummaxFreq
- The maximum frequency represented in the spectrum