public class TriangularFilter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected double |
centreFrequency
The centre (peak) frequency of the filter
|
protected double |
filterAmplitude
The height of the filter
|
protected double |
highFrequency
The highest frequency of the filter
|
protected double |
highSlope
The slope of the second half of the filter
|
protected double |
lowFrequency
The lowest frequency of the filter
|
protected double |
lowSlope
The slope of first half of the filter.
|
| Constructor and Description |
|---|
TriangularFilter(double low,
double centre,
double high) |
| Modifier and Type | Method and Description |
|---|---|
double |
getCentreFrequency()
Get the centre frequency
|
double |
getFilterAmplitude()
Returns the filter amplitude
|
double |
getHighFrequency()
Gets the high frequency
|
double |
getLowFrequency()
Returns the lowest frequency of the filter
|
double[] |
getResponseCurve(int nSpectrumBins,
double maxFreq)
Returns a set of values that represent the response of this filter
when the linear frequency is split in the given number of bins.
|
double |
getWeightAt(double frequency)
Returns the weighting provided by this filter at the given frequency (Hz).
|
double |
process(float[] frequencySpectrum,
AudioFormat format)
Requires a power spectrum and produces an output the filter
|
void |
setCentreFrequency(double centreFrequency)
Set the new centre frequency
|
void |
setFilterAmplitude(double fa)
Set the filter amplitude
|
void |
setHighFrequency(double highFrequency)
Set the high frequency of the filter
|
void |
setLowFrequency(double lowFrequency)
Sets the low frequency
|
String |
toString() |
protected double lowFrequency
protected double highFrequency
protected double centreFrequency
protected double filterAmplitude
protected double lowSlope
protected double highSlope
public TriangularFilter(double low, double centre, double high)
low - centre - high - public double getLowFrequency()
public void setLowFrequency(double lowFrequency)
lowFrequency - The new low frequencypublic double getHighFrequency()
public void setHighFrequency(double highFrequency)
highFrequency - The new high frequencypublic double getCentreFrequency()
public void setCentreFrequency(double centreFrequency)
centreFrequency - The new centre frequencypublic double process(float[] frequencySpectrum, AudioFormat format)
frequencySpectrum - The power spectrumformat - The format of the samples used to create the spectrumpublic double[] getResponseCurve(int nSpectrumBins, double maxFreq)
nSpectrumBins length.nSpectrumBins - The number of bins in a spectrum.maxFreq - The maximum frequency (sample rate)public double getWeightAt(double frequency)
frequency - The frequency (Hz) to get the weight forpublic double getFilterAmplitude()
public void setFilterAmplitude(double fa)
fa - The filter amplitudepublic String toString()
toString in class ObjectObject.toString()