net.beadsproject.beads.ugens
Class IIRFilter

java.lang.Object
  extended by net.beadsproject.beads.core.Bead
      extended by net.beadsproject.beads.core.UGen
          extended by net.beadsproject.beads.ugens.IIRFilter
Direct Known Subclasses:
AllpassFilter, BiquadFilter, CombFilter, LPRezFilter, OnePoleFilter

public abstract class IIRFilter
extends UGen

An abstract class that provides methods for analyzing infinite impulse response (IIR) filters. IIR filters built on this class should implement getFilterResponse(float) appropriately.

Version:
0.9.5
Author:
Benito Crawford

Nested Class Summary
static class IIRFilter.IIRFilterAnalysis
          A holder class for the various filter analysis data.
 
Nested classes/interfaces inherited from class net.beadsproject.beads.core.UGen
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
 
Field Summary
 
Fields inherited from class net.beadsproject.beads.core.UGen
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
 
Constructor Summary
IIRFilter(AudioContext context, int ins, int outs)
           
 
Method Summary
protected static IIRFilter.IIRFilterAnalysis analyzeFilter(float[] bs, float[] as, float freq, float samplingFreq)
          Does our analysis at the specified frequency.
static IIRFilter.IIRFilterAnalysis calculateFilterResponse(float[] bs, float[] as, float freq, float samplingFreq)
          Gets an IIRFilterAnalysis object filled with the filter response characteristics for the specified frequency: frequency response (real), frequency response (imaginary), amplitude response, phase response, phase delay, group delay.
protected static double calculateGroupDelay(float[] bs, float[] as, float freq, float samplingFreq)
           
 float getAmplitudeResponse(float freq)
          Gets the filter's amplitude response at the specified frequency.
abstract  IIRFilter.IIRFilterAnalysis getFilterResponse(float freq)
           
 float getGroupDelay(float freq)
          Gets an estimate of the filter's group delay at the specified frequency.
 float getPhaseDelay(float freq)
          Gets the filter's phase delay at the specified frequency.
 float getPhaseResponse(float freq)
          Gets the filter's phase response at the specified frequency.
 
Methods inherited from class net.beadsproject.beads.core.UGen
addDependent, addInput, addInput, calculateBuffer, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
 
Methods inherited from class net.beadsproject.beads.core.Bead
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IIRFilter

public IIRFilter(AudioContext context,
                 int ins,
                 int outs)
Method Detail

getFilterResponse

public abstract IIRFilter.IIRFilterAnalysis getFilterResponse(float freq)

getAmplitudeResponse

public float getAmplitudeResponse(float freq)
Gets the filter's amplitude response at the specified frequency.

Parameters:
freq - The frequency to evaluate.
Returns:
The amplitude response.

getPhaseResponse

public float getPhaseResponse(float freq)
Gets the filter's phase response at the specified frequency.

Parameters:
freq - The frequency to evaluate.
Returns:
The phase response.

getPhaseDelay

public float getPhaseDelay(float freq)
Gets the filter's phase delay at the specified frequency.

Parameters:
freq - The frequency to evaluate.
Returns:
The phase delay.

getGroupDelay

public float getGroupDelay(float freq)
Gets an estimate of the filter's group delay at the specified frequency.

Parameters:
freq - The frequency to evaluate.
Returns:
The group delay.

calculateFilterResponse

public static IIRFilter.IIRFilterAnalysis calculateFilterResponse(float[] bs,
                                                                  float[] as,
                                                                  float freq,
                                                                  float samplingFreq)
Gets an IIRFilterAnalysis object filled with the filter response characteristics for the specified frequency: frequency response (real), frequency response (imaginary), amplitude response, phase response, phase delay, group delay.

Parameters:
bs - The b coefficients (corresponding to the x(n) terms of the filter algorithm.
as - The a coefficients (corresponding to the y(n) terms of the filter algorithm.
freq - The frequency to evaluate.
samplingFreq - The sampling frequency.
Returns:
The IIRFilterAnalysis object.

calculateGroupDelay

protected static double calculateGroupDelay(float[] bs,
                                            float[] as,
                                            float freq,
                                            float samplingFreq)

analyzeFilter

protected static IIRFilter.IIRFilterAnalysis analyzeFilter(float[] bs,
                                                           float[] as,
                                                           float freq,
                                                           float samplingFreq)
Does our analysis at the specified frequency.

Parameters:
freq - The frequency to analyze.