|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable com.softsynth.jsyn.SynthObject com.softsynth.jsyn.SynthSound com.softsynth.jsyn.SynthUnit com.softsynth.jsyn.SynthFilter com.softsynth.jsyn.Filter_2o2p2z
public class Filter_2o2p2z
Filter_2o2p2z unit. Second Order, Two Pole, Two Zero filter using the following formula:
y(n) = 2.0 * (A0*x(n) + A1*x(n-1) + A2*x(n-2) - B1*y(n-1) - B2*y(n-2))
where y(n) is Output, x(n) is Input, x(n-1) is a delayed copy of the input, and y(n-1) is a delayed copy of the output.
This filter is a recursive IIR or Infinite Impulse Response filter. It can be unstable depending on the values of the coefficients.
A thorough description of the digital filter theory needed to fully describe this filter is beyond the scope of this document. Calculating coefficients is non-intuitive; the interested user is referred to one of the standard texts on filter theory (e.g., Moore, "Elements of Computer Music", section 2.4).
Special thanks to Robert Bristow-Johnson for contributing his filter equations to the music-dsp list. They were used for calculating the coefficients for the lowPass, highPass, and other parametric filter calculations.
Synth
,
SynthUnit
,
Filter_1o1z
,
Filter_1o1p
,
Filter_2o2p
,
Filter_1o1p1z
,
Filter_LowPass
,
Filter_HighPass
,
Filter_BandPass
,
Filter_PeakingEQ
,
Filter_BandStop
,
Filter_LowShelf
,
Filter_HighShelf
,
Filter_StateVariable
Field Summary | |
---|---|
SynthVariable |
A0
Filter coefficient. |
SynthVariable |
A1
Filter coefficient. |
SynthVariable |
A2
Filter coefficient. |
SynthVariable |
B1
Filter coefficient. |
SynthVariable |
B2
Filter coefficient. |
Fields inherited from class com.softsynth.jsyn.SynthFilter |
---|
input, output |
Constructor Summary | |
---|---|
Filter_2o2p2z()
|
|
Filter_2o2p2z(SynthContext synthContext)
Create a SynthUnit that runs at Synth.RATE_AUDIO. |
|
Filter_2o2p2z(SynthContext synthContext,
int calculationRate)
|
Method Summary | |
---|---|
void |
bandPass(double frequency,
double bandwidth)
|
void |
bandPass(int time,
double frequency,
double bandwidth)
Set coefficients of filter for Band Pass operation. |
void |
highPass(double frequency,
double bandwidth)
|
void |
highPass(int time,
double frequency,
double bandwidth)
Set coefficients of filter for High Pass operation. |
void |
highShelf(double frequency,
double dBGain,
double slope)
|
void |
highShelf(double frequency,
double bandwidth,
double dBGain,
double slope)
|
void |
highShelf(int time,
double frequency,
double dBGain,
double slope)
Set coefficients of filter for High Shelf operation. |
void |
highShelf(int time,
double frequency,
double bandwidth,
double dBGain,
double slope)
|
void |
lowPass(double frequency,
double bandwidth)
|
void |
lowPass(int time,
double frequency,
double bandwidth)
Set coefficients of filter for Low Pass operation. |
void |
lowShelf(double frequency,
double dBGain,
double slope)
|
void |
lowShelf(double frequency,
double bandwidth,
double dBGain,
double slope)
|
void |
lowShelf(int time,
double frequency,
double dBGain,
double slope)
Set coefficients of filter for Low Shelf operation. |
void |
lowShelf(int time,
double frequency,
double bandwidth,
double dBGain,
double slope)
|
void |
notch(double frequency,
double bandwidth)
|
void |
notch(int time,
double frequency,
double bandwidth)
Set coefficients of filter for Notch operation. |
void |
peakingEQ(double frequency,
double bandwidth,
double dBGain)
|
void |
peakingEQ(int time,
double frequency,
double bandwidth,
double dBGain)
Set coefficients of filter for Peaking EQ operation. |
Methods inherited from class com.softsynth.jsyn.SynthSound |
---|
addPort, addPort, findNamedPort, getName, getNumPorts, getPortAt, getPriority, setPriority, setStage, setStage, start, start, stop, stop |
Methods inherited from class com.softsynth.jsyn.SynthObject |
---|
delete, deleteAll, enableDeletionByGarbageCollector, enableTracking, getPeer, getSynthContext, isTrackingEnabled, toString, track |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public SynthVariable A0
public SynthVariable A1
public SynthVariable A2
public SynthVariable B1
public SynthVariable B2
Constructor Detail |
---|
public Filter_2o2p2z(SynthContext synthContext, int calculationRate) throws SynthException
SynthException
public Filter_2o2p2z(SynthContext synthContext) throws SynthException
SynthException
- If resource allocation fails.public Filter_2o2p2z() throws SynthException
SynthException
Method Detail |
---|
public void lowPass(int time, double frequency, double bandwidth) throws SynthException
time
- Time at which to set ports..frequency
- Cutoff frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies
for peaking
or between -3 dB frequencies for BPF and notch).
SynthException
- If port setting fails.public void lowPass(double frequency, double bandwidth) throws SynthException
SynthException
public void highPass(int time, double frequency, double bandwidth) throws SynthException
time
- Time at which to set ports..frequency
- Cutoff frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).
SynthException
- If port setting fails.public void highPass(double frequency, double bandwidth) throws SynthException
SynthException
public void bandPass(int time, double frequency, double bandwidth) throws SynthException
time
- Time at which to set ports..frequency
- Center frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).
SynthException
- If port setting fails.public void bandPass(double frequency, double bandwidth) throws SynthException
SynthException
public void notch(int time, double frequency, double bandwidth) throws SynthException
time
- Time at which to set ports..frequency
- Center frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).
SynthException
- If port setting fails.public void notch(double frequency, double bandwidth) throws SynthException
SynthException
public void peakingEQ(int time, double frequency, double bandwidth, double dBGain) throws SynthException
time
- Time at which to set ports..frequency
- Center frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).dBGain
- Gain in decibels at the center frequency. If dBGain is
zero then the signal is unmodified.
SynthException
- If port setting fails.public void peakingEQ(double frequency, double bandwidth, double dBGain) throws SynthException
SynthException
public void lowShelf(int time, double frequency, double dBGain, double slope) throws SynthException
time
- Time at which to set ports..frequency
- Center frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).dBGain
- Gain in decibels past the edge of the shelf. If dBGain is
zero then the signal is unmodified.slope
- Slope of the edge of the shelf. Should be < 1.0 to prevent
irregularities in the frequency response curve.
SynthException
- If port setting fails.public void lowShelf(double frequency, double dBGain, double slope) throws SynthException
SynthException
public void lowShelf(double frequency, double bandwidth, double dBGain, double slope) throws SynthException
SynthException
public void lowShelf(int time, double frequency, double bandwidth, double dBGain, double slope) throws SynthException
SynthException
public void highShelf(int time, double frequency, double dBGain, double slope) throws SynthException
time
- Time at which to set ports..frequency
- Center frequency in Hertz.bandwidth
- Bandwidth in octaves (between midpoint (dBgain/2) gain frequencies for peaking
or between -3 dB frequencies for BPF and notch).dBGain
- Gain in decibels past the edge of the shelf. If dBGain is
zero then the signal is supposed to be unmodified but isn't.slope
- Slope of the edge of the shelf. Should be < 1.0 to prevent
irregularities in the frequency response curve.
SynthException
- If port setting fails.public void highShelf(double frequency, double dBGain, double slope) throws SynthException
SynthException
public void highShelf(double frequency, double bandwidth, double dBGain, double slope) throws SynthException
SynthException
public void highShelf(int time, double frequency, double bandwidth, double dBGain, double slope) throws SynthException
SynthException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |