net.beadsproject.beads.ugens
Class BiquadFilter.CustomCoeffCalculator

java.lang.Object
  extended by net.beadsproject.beads.ugens.BiquadFilter.CustomCoeffCalculator
Enclosing class:
BiquadFilter

public class BiquadFilter.CustomCoeffCalculator
extends java.lang.Object

CustomCoeffCalculator provides a mechanism to define custom filter coefficients for a biquad filter based on frequency and Q. Users can create their own coefficient calculator classes by extending this class and passing it to a BiquadFilterMulti instance with setCustomType.

An instance of such a custom class should override calcCoeffs(float, float, float) to define the coefficient calculation algorithm. The floats a0, a1, a2, b0, b1, and b2 should be set according to the input parameters freq, q, and gain, as well as the useful class variables sampFreq and two_pi_over_sf.

Version:
.9.1
Author:
Benito Crawford

Field Summary
 float a0
           
 float a1
           
 float a2
           
 float b0
           
 float b1
           
 float b2
           
protected  float sampFreq
          The sampling frequency.
protected  float two_pi_over_sf
          Two * pi / sampling frequency.
 
Method Summary
 void calcCoeffs(float freq, float q, float gain)
          Override this function with code that sets a0, a1, etc. in terms of frequency, Q, and sampling frequency.
 void setSamplingFrequency(float sf)
          Sets the sampling frequency.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a0

public float a0

a1

public float a1

a2

public float a2

b0

public float b0

b1

public float b1

b2

public float b2

sampFreq

protected float sampFreq
The sampling frequency.


two_pi_over_sf

protected float two_pi_over_sf
Two * pi / sampling frequency.

Method Detail

setSamplingFrequency

public void setSamplingFrequency(float sf)
Sets the sampling frequency.

Parameters:
sf - The sampling frequency in Hertz.

calcCoeffs

public void calcCoeffs(float freq,
                       float q,
                       float gain)
Override this function with code that sets a0, a1, etc. in terms of frequency, Q, and sampling frequency.

Parameters:
freq - The frequency of the filter in Hertz.
q - The Q-value of the filter.
gain - The gain of the filter.