public abstract class FilterBiquad extends TunableFilter
FilterBandStop,
FilterBandPass,
FilterLowPass,
FilterHighPass,
FilterTwoPolesTwoZeros| Modifier and Type | Field and Description |
|---|---|
protected double |
a0 |
protected double |
a1 |
protected double |
a2 |
UnitInputPort |
amplitude |
protected double |
b1 |
protected double |
b2 |
protected double |
cos_omega |
protected static double |
MINIMUM_FREQUENCY |
protected static double |
MINIMUM_GAIN |
protected double |
omega |
protected double |
previousFrequency |
protected static double |
RATIO_MINIMUM |
protected double |
sin_omega |
frequencyinput, outputFALSE, PORT_NAME_AMPLITUDE, PORT_NAME_CUTOFF, PORT_NAME_FREQUENCY, PORT_NAME_FREQUENCY_SCALER, PORT_NAME_INPUT, PORT_NAME_OUTPUT, PORT_NAME_PAN, PORT_NAME_PHASE, PORT_NAME_PRESSURE, PORT_NAME_TIMBRE, PORT_NAME_TIME, synthesisEngine, TRUE, VERY_SMALL_FLOAT| Constructor and Description |
|---|
FilterBiquad() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
calculateOmega(double ratio) |
void |
generate(int start,
int limit)
Generic generate(int start, int limit) method calls this filter's recalculate() and
performBiquadFilter(int, int) methods.
|
void |
performBiquadFilter(int start,
int limit)
Each filter calls performBiquadFilter() through the generate(int, int) method.
|
protected abstract void |
recalculate() |
getInput, getOutputaddPort, addPort, autoStop, convertHalfLifeToMultiplier, convertTimeToRate, flattenOutputs, generate, getCircuit, getFramePeriod, getFrameRate, getId, getPortByName, getPorts, getSynthesisEngine, getSynthesizer, getTopUnit, getUnitGenerator, incrementWrapPhase, isEnabled, isStartRequired, printConnections, printConnections, printConnections, pullData, setCircuit, setEnabled, setFrameRate, setPort, setSynthesisEngine, start, start, start, stop, stop, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetUnitGenerator, start, start, stop, stopgetUnitGeneratorpublic UnitInputPort amplitude
protected static final double MINIMUM_FREQUENCY
protected static final double MINIMUM_GAIN
protected static final double RATIO_MINIMUM
protected double a0
protected double a1
protected double a2
protected double b1
protected double b2
protected double previousFrequency
protected double omega
protected double sin_omega
protected double cos_omega
public void generate(int start,
int limit)
generate in class UnitGeneratorstart - offset into port bufferslimit - limit offset into port buffers for loopprotected abstract void recalculate()
public void performBiquadFilter(int start,
int limit)
y(n) = A0*x(n) + A1*x(n-1) + A2*x(n-2) -vB1*y(n-1) - B2*y(n-2)Here is the equation that Robert Bristow-Johnson uses:
y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2]So to translate between JSyn coefficients and RBJ coefficients:
JSyn => RBJ A0 => b0/a0 A1 => b1/a0 A2 => b2/a0 B1 => a1/a0 B2 => a2/a0
start - limit - protected void calculateOmega(double ratio)