|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectddf.minim.effects.IIRFilter
public abstract class IIRFilter
An Infinite Impulse Response, or IIR, filter is a filter that uses a set of
coefficients and previous filtered values to filter a stream of audio. It is
an efficient way to do digital filtering. IIRFilter is a general IIRFilter
that simply applies the filter designated by the filter coefficients so that
sub-classes only have to dictate what the values of those coefficients are by
defining the calcCoeff()
function. When filling the
coefficient arrays, be aware that b[0]
corresponds to
b1
.
Field Summary | |
---|---|
protected float[] |
a
The a coefficients. |
protected float[] |
b
The b coefficients. |
Constructor Summary | |
---|---|
IIRFilter(float freq,
float sampleRate)
Constructs an IIRFilter with the given cutoff frequency that will be used to filter audio recorded at sampleRate . |
Method Summary | |
---|---|
protected abstract void |
calcCoeff()
Calculates the coefficients of the filter using the current cutoff frequency. |
float |
frequency()
Returns the cutoff frequency (in Hz). |
void |
printCoeff()
Prints the current values of the coefficients to the console. |
void |
process(float[] signal)
Processes signal in some way. |
void |
process(float[] sigLeft,
float[] sigRight)
Processes sigLeft and sigRight in some way. |
float |
sampleRate()
Returns the sample rate of audio that this filter will process. |
void |
setFreq(float f)
Sets the cutoff/center frequency of the filter. |
boolean |
validFreq(float f)
Returns true if the frequency is valid for this filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float[] a
protected float[] b
Constructor Detail |
---|
public IIRFilter(float freq, float sampleRate)
sampleRate
.
freq
- the cutoff frequencysampleRate
- the sample rate of audio to be filteredMethod Detail |
---|
public final void process(float[] signal)
AudioEffect
signal
in some way.
process
in interface AudioEffect
signal
- an array of audio samples, representing a mono sound stream.public final void process(float[] sigLeft, float[] sigRight)
AudioEffect
sigLeft
and sigRight
in some way.
process
in interface AudioEffect
sigLeft
- an array of audio samples, representing the left channel of a
stereo sound streamsigRight
- an array of audio samples, representing the right channel of a
stereo sound streampublic final void setFreq(float f)
f
- the new cutoff/center frequency (in Hz).public boolean validFreq(float f)
f
is positive.
f
- the frequency (in Hz) to validate
f
is a valid frequency for this filterpublic final float frequency()
public final float sampleRate()
protected abstract void calcCoeff()
b[0]
corresponds to the coefficient b1
.
public final void printCoeff()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |