com.oregondsp.signalProcessing.filter.iir
Class Allpass

java.lang.Object
  extended by com.oregondsp.signalProcessing.filter.iir.Allpass
Direct Known Subclasses:
ThiranAllpass

public class Allpass
extends java.lang.Object

Allpass filter class.

Implements a digital allpass filter, using a lattice structure implementation. Allpass filters have unit gain by construction, and are used to alter the phase of signals with altering their magnitude responses.

An allpass filter has the form: z-N AN(z-1) / AN(z), where N is the order of the filter and AN(z) is a polynomial. The numerator polynomial is a "reflection" of the denominator polynomial. If

AN(z) = a0 + a1*z-1 + a2*z-2 + ... + aN*z-N

then the numerator has the following form:

z-N AN(z-1) = aN + aN-1*z-1) + ... + a0*z-N

The allpass filter is represented internally as a set of reflection coefficients. These are numbers k in the open interval (-1, 1) and define AN(z) by the recursion:

Ai(z) = Ai-1(z) + z-i*k(i)*Ai-1(z-1) i = 1, ..., N

A0(z) = 1

Author:
David B. Harris, Deschutes Signal Processing LLC

Constructor Summary
Allpass(double[] k)
          Instantiates a new allpass filter object from a double[] containing the reflection coefficients.
Allpass(int order)
          Instantiates a new allpass filter of a given order with zero reflection coefficients.
Allpass(Polynomial A)
          Instantiates a new allpass filter object from a Polynomial representing the allpass denominator.
 
Method Summary
 Complex evaluate(double omega)
          Evaluate the filters response at digital frequency omega, element of [0, pi].
 float filter(float x)
          Filters a single sample of a sequence.
 void filter(float[] x)
          Filters a sequence or a segment of a sequence contained in a float array.
 double groupDelay(double Omega)
          Evaluates the group delay of the allpass filter at digital frequency Omega, element of [0, pi].
 void initialize()
          Initializes the states of the filter to zero.
 void print(java.io.PrintStream ps)
          Prints the reflection coefficients defining this allpass filter and the state vector.
 Rational rationalRepresentation()
          Accessor for the Rational representation of this allpass filter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Allpass

public Allpass(int order)
Instantiates a new allpass filter of a given order with zero reflection coefficients.

Parameters:
order - int containing the order of the filter.

Allpass

public Allpass(Polynomial A)
Instantiates a new allpass filter object from a Polynomial representing the allpass denominator.

Parameters:
A - Polynomial object containing the polynomial coefficient representation for the allpass filter.

Allpass

public Allpass(double[] k)
Instantiates a new allpass filter object from a double[] containing the reflection coefficients.

Parameters:
k - double[] containing the reflection coefficients.
Method Detail

initialize

public void initialize()
Initializes the states of the filter to zero.


filter

public float filter(float x)
Filters a single sample of a sequence. Because the filter maintains state between calls to filter(x), a sequence (signal) can be filtered by repeated calls to this method using successive continguous samples of the sequence as the argument.

Parameters:
x - float containing the single sample of a sequence.
Returns:
float containing the corresponding single output sample of the filter.

filter

public void filter(float[] x)
Filters a sequence or a segment of a sequence contained in a float array. Because the filter maintains state between successive calls to this method, it is possible to filter a continuous stream in finite consecutive, contiguous blocks with this method with no startup transients between successive calls. This feature permits filtering in real time as blocks of data become available, or filtering very long sequences incrementally from large files.

Parameters:
x - float[] containing the sequence or segment of a sequence upon call. Contains the filtered array following the call.

evaluate

public Complex evaluate(double omega)
Evaluate the filters response at digital frequency omega, element of [0, pi]. Calculates A_N( e^(-j*omega) )

Parameters:
omega - double specifying the discrete frequency for evaluation.
Returns:
Complex object containing the value of the filter transfer function at omega.

groupDelay

public double groupDelay(double Omega)
Evaluates the group delay of the allpass filter at digital frequency Omega, element of [0, pi].

Parameters:
Omega - double containing the discrete frequency for evaluation of the group delay.
Returns:
double containing the group delay in samples.

rationalRepresentation

public Rational rationalRepresentation()
Accessor for the Rational representation of this allpass filter.

Returns:
Rational object containing the rational transfer function for this filter.

print

public void print(java.io.PrintStream ps)
Prints the reflection coefficients defining this allpass filter and the state vector.

Parameters:
ps - PrintStream to which the allpass filter description is printed.