|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.ugens.UGen ddf.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
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen |
---|
UGen.InputType, UGen.UGenInput |
Field Summary | |
---|---|
protected float[] |
a
The a coefficients. |
UGen.UGenInput |
audio
|
protected float[] |
b
The b coefficients. |
UGen.UGenInput |
cutoff
|
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). |
protected void |
initArrays(int numChannels)
Initializes the in and out arrays based on the number of coefficients being used. |
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. |
void |
setFreq(float f)
Sets the cutoff/center frequency of the filter. |
void |
uGenerate(float[] channels)
Implement this method when you extend UGen. |
boolean |
validFreq(float f)
Returns true if the frequency is valid for this filter. |
Methods inherited from class ddf.minim.ugens.UGen |
---|
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setSampleRate, tick, unpatch, unpatch |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final UGen.UGenInput audio
public final UGen.UGenInput cutoff
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 |
---|
protected final void initArrays(int numChannels)
public final void uGenerate(float[] channels)
UGen
getLastValues
method of your audio UGenInput to retrieve the audio you want to modify,
which you will then modify however
you need to, assigning the result to the values in channels
.
uGenerate
in class UGen
channels
- an array representing one sample frame.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()
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 |