public class BiquadCustomCoeffCalculator
extends java.lang.Object
BiquadFilter
based on frequency and Q. Users can
create their own coefficient calculator classes by extending this class and
passing it to a BiquadFilter instance with BiquadFilter.setType(int)
.
An instance of such a custom class should override
calcCoeffs(float, float, float)
to define the coefficient
calculation algorithm. The floats a0, a1, a2, b0, b1, and b2 should be set
according to the input parameters freq, q, and gain, as well as the useful
class variables sampFreq
and two_pi_over_sf
.
Modifier and Type | Field and Description |
---|---|
float |
a0 |
float |
a1 |
float |
a2 |
float |
b0 |
float |
b1 |
float |
b2 |
protected float |
sampFreq
The sampling frequency.
|
protected float |
two_pi_over_sf
Two * pi / sampling frequency.
|
Modifier and Type | Method and Description |
---|---|
void |
calcCoeffs(float freq,
float q,
float gain)
Override this function with code that sets a0, a1, etc. in terms of
frequency, Q, and sampling frequency.
|
void |
setSamplingFrequency(float sf)
Sets the sampling frequency.
|
public float a0
public float a1
public float a2
public float b0
public float b1
public float b2
protected float sampFreq
protected float two_pi_over_sf
public void setSamplingFrequency(float sf)
sf
- The sampling frequency in Hertz.public void calcCoeffs(float freq, float q, float gain)
freq
- The frequency of the filter in Hertz.q
- The Q-value of the filter.gain
- The gain of the filter.