Package voltage.processors

# Class BiQuadFilter

java.lang.Object
voltage.processors.BiQuadFilter

public class BiQuadFilter extends Object
A bi-quad filter class This is a second order recursive linear filter, containing two poles and two zeros. "Biquad" is an abbreviation of "biquadratic", which refers to the fact that in the Z domain, its transfer function is the ratio of two quadratic functions

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `BiQuadFilter.FilterType`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final double`
  `M_LN2`
  ln(2)

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BiQuadFilter(BiQuadFilter.FilterType type, double frequency, double gain)`
  Constructor for a BiQuadFilter
  `BiQuadFilter(BiQuadFilter.FilterType type, double frequency, double gain, double bandwidth)`
  Constructor for a BiQuadFilter

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `GetBandwidth()`
  Gets the bandwidth
  `double`
  `GetdBGain()`
  Gets the filter's gain.
  `double`
  `GetFrequency()`
  Gets the filter's frequency.
  `double`
  `ProcessSample(double input)`
  Process a sample.
  `void`
  `Reset()`
  Resets the filter.
  `void`
  `SetBandwidth(double bandwidth)`
  Sets the filter's bandwidth
  `void`
  `SetdBGain(double gain)`
  Sets the gain for the filter.
  `void`
  `SetFrequency(double frequency)`
  Sets the filter's frequency.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### M_LN2

    public static final double M_LN2
    ln(2)
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### BiQuadFilter

    public BiQuadFilter(BiQuadFilter.FilterType type, double frequency, double gain)
    Constructor for a BiQuadFilter
    Parameters:
      `type` - the filter type.
      `frequency` - the filter freqency. Valid ranges are 0 to 24,000.
      `gain` - the amount of gain to add/remove. ( 1.0 is no gain.)

  - ### BiQuadFilter

    public BiQuadFilter(BiQuadFilter.FilterType type, double frequency, double gain, double bandwidth)
    Constructor for a BiQuadFilter
    Parameters:
      `type` - the filter type.
      `frequency` - the filter freqency. Valid ranges are 0 to 24,000.
      `gain` - the amount of gain to add/remove.
      `bandwidth` - . 1.0 = 1 octave. 2.0 = 2 octaves and so on.

- ## Method Details

  - ### ProcessSample

    public double ProcessSample(double input)
    Process a sample. Call this once ever VoltageModule.ProcessSample()
    Parameters:
      `input` - the input value.
    Returns:
      the filtered value.
    See Also:
      - `VoltageModule.ProcessSample()`

  - ### SetFrequency

    public void SetFrequency(double frequency)
    Sets the filter's frequency.
    Parameters:
      `frequency` - the frequency to set. (Valid ranges are 0 to 24,000).

  - ### GetFrequency

    public double GetFrequency()
    Gets the filter's frequency.
    Returns:
      the filter's frequency ( Valid ranges are 0 to 24,000).

  - ### SetdBGain

    public void SetdBGain(double gain)
    Sets the gain for the filter. Filters typically remove some of the energy. This helps to account for that.
    Parameters:
      `gain` - the amount of gain to set. 1.0 would be no change.

  - ### GetdBGain

    public double GetdBGain()
    Gets the filter's gain.
    Returns:
      the gain being used.

  - ### SetBandwidth

    public void SetBandwidth(double bandwidth)
    Sets the filter's bandwidth
    Parameters:
      `bandwidth` - the amount of bandwidth to set. 1.0 = 1 octave. 2.0 = 2 octaves and so on.

  - ### GetBandwidth

    public double GetBandwidth()
    Gets the bandwidth
    Returns:
      the amount of bandwidth to set. 1.0 = 1 octave. 2.0 = 2 octaves and so on.

  - ### Reset

    public void Reset()
    Resets the filter.