com.jsyn.unitgen
Class FilterTwoPolesTwoZeros

java.lang.Object
  extended by com.jsyn.unitgen.UnitGenerator
      extended by com.jsyn.unitgen.UnitFilter
          extended by com.jsyn.unitgen.FilterTwoPolesTwoZeros
All Implemented Interfaces:
UnitSink, UnitSource

public class FilterTwoPolesTwoZeros
extends UnitFilter

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. This filter is basically the same as the FilterBiquad with different ports. 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.


Field Summary
 UnitVariablePort a0
           
 UnitVariablePort a1
           
 UnitVariablePort a2
           
 UnitVariablePort b1
           
 UnitVariablePort b2
           
 
Fields inherited from class com.jsyn.unitgen.UnitFilter
input, output
 
Fields inherited from class com.jsyn.unitgen.UnitGenerator
FALSE, TRUE
 
Constructor Summary
FilterTwoPolesTwoZeros()
           
 
Method Summary
 void generate(int start, int limit)
          Perform essential synthesis function.
 
Methods inherited from class com.jsyn.unitgen.UnitFilter
getInput, getOutput
 
Methods inherited from class com.jsyn.unitgen.UnitGenerator
addPort, convertHalfLifeToMultiplier, flattenOutputs, generate, getFramePeriod, getFrameRate, getPortByName, getPorts, getSynthesisEngine, isEnabled, pullData, setCircuit, setFrameRate, setSynthesisEngine, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a0

public UnitVariablePort a0

a1

public UnitVariablePort a1

a2

public UnitVariablePort a2

b1

public UnitVariablePort b1

b2

public UnitVariablePort b2
Constructor Detail

FilterTwoPolesTwoZeros

public FilterTwoPolesTwoZeros()
Method Detail

generate

public void generate(int start,
                     int limit)
Description copied from class: UnitGenerator
Perform essential synthesis function.

Specified by:
generate in class UnitGenerator
Parameters:
start - offset into port buffers
limit - limit offset into port buffers for loop