public class LPRezFilter extends IIRFilter implements DataBeadReceiver
y(n) = b0 * x(n) + a1 * y(n-1) + a2 * y(n-2)
so it doesn't compute unnecessary parts of the biquad formula.
Takes two parameters: cut-off frequency and resonance (0 for no resonance, 1
for maximum resonance). These parameters can be set using
setFreq()
and setRes()
,
or by passing a DataBead with "frequency" and "resonance" properties to
setParams(DataBead)
. (Messaging this object with a DataBead achieves
the same.)
IIRFilter.IIRFilterAnalysis
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
Modifier and Type | Field and Description |
---|---|
protected float |
_2pi_over_sr |
protected float |
a1 |
protected float |
a2 |
protected float |
b0 |
protected float |
cosw |
protected float |
freq |
protected UGen |
freqUGen |
protected boolean |
isFreqStatic |
protected boolean |
isResStatic |
protected float |
res |
protected UGen |
resUGen |
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
LPRezFilter(AudioContext con)
Constructor for a single-channel LPRezFilter with default values for
frequency and resonance.
|
LPRezFilter(AudioContext con,
float freq,
float res)
Constructor for a single-channel LPRezFilter with frequency and resonance
specified by floats.
|
LPRezFilter(AudioContext con,
float freq,
UGen res)
Constructor for a single-channel LPRezFilter with frequency specified by
a float and resonance specified by a UGen.
|
LPRezFilter(AudioContext con,
int channels)
Constructor for a multi-channel LPRezFilter with default values for
frequency and resonance.
|
LPRezFilter(AudioContext con,
int channels,
float freq,
float res)
Constructor for a multi-channel LPRezFilter with frequency and resonance
specified by floats.
|
LPRezFilter(AudioContext con,
int channels,
float freq,
UGen res)
Constructor for a multi-channel LPRezFilter with frequency specified by a
float and resonance specified by a UGen.
|
LPRezFilter(AudioContext con,
int channels,
UGen freq,
float res)
Constructor for a multi-channel LPRezFilter with frequency specified by a
UGen and resonance specified by a float.
|
LPRezFilter(AudioContext con,
int channels,
UGen freq,
UGen res)
Constructor for a multi-channel LPRezFilter with frequency and resonance
specified by UGens.
|
LPRezFilter(AudioContext con,
UGen freq,
float res)
Constructor for a single-channel LPRezFilter with frequency specified by
a UGen and resonance specified by a float.
|
LPRezFilter(AudioContext con,
UGen freq,
UGen res)
Constructor for a single-channel LPRezFilter with frequency and resonance
specified by UGens.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
protected void |
calcVals() |
IIRFilter.IIRFilterAnalysis |
getFilterResponse(float freq) |
float |
getFreq()
Deprecated.
Use
getFrequency() . |
float |
getFrequency()
Gets the current cut-off frequency.
|
UGen |
getFrequencyUGen()
Gets the frequency UGen, if it exists.
|
UGen |
getFreqUGen()
Deprecated.
Use
getFrequencyUGen() . |
DataBead |
getParams()
Gets a DataBead with properties "frequency" and "resonance" set to the
corresponding filter parameters.
|
float |
getRes()
Gets the current resonance value.
|
UGen |
getResUGen()
Gets the resonance UGen, if it exists.
|
DataBead |
getStaticParams()
Gets a DataBead with properties "frequency" and "resonance" set to static
float values corresponding to the current filter parameters.
|
void |
messageReceived(Bead message)
Responds to an incoming message.
|
void |
reset()
Resets the filter in case it "explodes".
|
DataBeadReceiver |
sendData(DataBead db)
Sets the filter's parameters with properties from a DataBead.
|
LPRezFilter |
setFreq(float freq)
Deprecated.
Use
setFrequency(float) . |
LPRezFilter |
setFreq(UGen freqUGen)
Deprecated.
Use
setFrequency(UGen) . |
LPRezFilter |
setFrequency(float freq)
Sets the cut-off frequency to a float.
|
LPRezFilter |
setFrequency(UGen freqUGen)
Sets a UGen to specify the cut-off frequency.
|
LPRezFilter |
setParams(DataBead paramBead)
Sets the filter parameters with a DataBead.
|
LPRezFilter |
setRes(float r)
Sets the filter resonance to a float value.
|
LPRezFilter |
setRes(UGen r)
Sets a UGen to specify the filter resonance.
|
analyzeFilter, calculateFilterResponse, calculateGroupDelay, getAmplitudeResponse, getGroupDelay, getPhaseDelay, getPhaseResponse
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
protected float freq
protected float res
protected float _2pi_over_sr
protected float cosw
protected UGen freqUGen
protected UGen resUGen
protected float a1
protected float a2
protected float b0
protected boolean isFreqStatic
protected boolean isResStatic
public LPRezFilter(AudioContext con)
con
- The audio context.public LPRezFilter(AudioContext con, int channels)
con
- The audio context.channels
- The number of channels.public LPRezFilter(AudioContext con, float freq, float res)
con
- The audio context.freq
- The filter cut-off frequency.res
- The resonance.public LPRezFilter(AudioContext con, UGen freq, float res)
con
- The audio context.freq
- The filter cut-off frequency UGen.res
- The resonance.public LPRezFilter(AudioContext con, float freq, UGen res)
con
- The audio context.freq
- The filter cut-off frequency.res
- The resonance UGen.public LPRezFilter(AudioContext con, UGen freq, UGen res)
con
- The audio context.freq
- The filter cut-off frequency UGen.res
- The resonance UGen.public LPRezFilter(AudioContext con, int channels, float freq, float res)
con
- The audio context.channels
- The number of channels.freq
- The filter cut-off frequency.res
- The resonance.public LPRezFilter(AudioContext con, int channels, UGen freq, float res)
con
- The audio context.channels
- The number of channels.freq
- The filter cut-off frequency UGen.res
- The resonance.public LPRezFilter(AudioContext con, int channels, float freq, UGen res)
con
- The audio context.channels
- The number of channels.freq
- The filter cut-off frequency.res
- The resonance UGen.public LPRezFilter(AudioContext con, int channels, UGen freq, UGen res)
con
- The audio context.channels
- The number of channels.freq
- The filter cut-off frequency UGen.res
- The resonance UGen.protected void calcVals()
public void calculateBuffer()
UGen
UGen.bufIn
and putting data
into UGen.bufOut
in some way. UGen.bufIn
and UGen.bufOut
are 2D arrays of floats of the form float[numChannels][bufferSize]. The length of the buffers is given by
UGen.bufferSize
, and the number of channels of the input and output buffers are given by UGen.ins
and UGen.outs
respectively.calculateBuffer
in class UGen
public void reset()
public float getFrequency()
public LPRezFilter setFrequency(float freq)
freq
- The cut-off frequency.public LPRezFilter setFrequency(UGen freqUGen)
freqUGen
- The frequency UGen.public UGen getFrequencyUGen()
@Deprecated public float getFreq()
getFrequency()
.@Deprecated public LPRezFilter setFreq(float freq)
setFrequency(float)
.freq
- The cut-off frequency.@Deprecated public LPRezFilter setFreq(UGen freqUGen)
setFrequency(UGen)
.freqUGen
- The frequency UGen.@Deprecated public UGen getFreqUGen()
getFrequencyUGen()
.public float getRes()
public LPRezFilter setRes(float r)
r
- The resonance.public LPRezFilter setRes(UGen r)
r
- The resonance UGen.public UGen getResUGen()
public LPRezFilter setParams(DataBead paramBead)
Use the following properties to specify filter parameters:
paramBead
- The DataBead specifying parameters.public void messageReceived(Bead message)
Bead
messageReceived
in class Bead
message
- the messagepublic DataBead getParams()
public DataBead getStaticParams()
public DataBeadReceiver sendData(DataBead db)
sendData
in interface DataBeadReceiver
db
- The DataBead message.this
.setParams(DataBead)
public IIRFilter.IIRFilterAnalysis getFilterResponse(float freq)
getFilterResponse
in class IIRFilter