Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.audio
Class IIRFilter

    java.lang.Object
      toxi.audio.IIRFilter

    public class IIRFilter

extends java.lang.Object

This class provides a simple IIR filter implementation with one of lowpass, highpass or bandpass characteristics. The class can filter individual samples or entire signal buffers. The filter function always has this form:

     y = 1 / a0 * (b0 * x0 + b1 * x1 + b2 * x2 - a1 * q1 - a2 * q2)

http://en.wikipedia.org/wiki/Infinite_impulse_response

Nested Class Summary
`static class` | `IIRFilter.Type`

Constructor Summary
`IIRFilter(IIRFilter.Type type, float sampleRate)`

Method Summary
`float` | `calculateAmplitude(float[] in)` Just calculates the amplitude of the filtered signal, but doesn't actually apply the filter.
`IIRFilter` | `clear()`
`float` | `filter(float in)` Applies filter to a single sample value.
`float` | `filter(float[] in)` Destructively filters a the given signal buffer.
`float` | `getDecay()`
`IIRFilter` | `init(float freq, float q)` Initializes the filter to the given cutoff frequency and Q (resonance) settings.
`IIRFilter` | `setDecay(float decay)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IIRFilter

    public IIRFilter(IIRFilter.Type type,
                     float sampleRate)

Parameters:
  `type` -
  `sampleRate` -

Method Detail

### calculateAmplitude

    public float calculateAmplitude(float[] in)

  Just calculates the amplitude of the filtered signal, but doesn't actually apply the filter.

  Parameters:
    `in` -
  Returns:
    amplitude

### clear

    public IIRFilter clear()

### filter

    public float filter(float in)

  Applies filter to a single sample value.

  Parameters:
    `in` -
  Returns:
    filtered sample

### filter

    public float filter(float[] in)

  Destructively filters a the given signal buffer. The original samples are overwritten.

  Parameters:
    `in` -
  Returns:
    amplitude of filtered signal

### getDecay

    public float getDecay()

  Returns:
    the decay

### init

    public IIRFilter init(float freq,
                          float q)

  Initializes the filter to the given cutoff frequency and Q (resonance) settings. This function needs to be called at least once before the filter can be used.

  Parameters:
    `freq` -
    `q` -
  Returns:
    itself

### setDecay

    public IIRFilter setDecay(float decay)

  Parameters:
    `decay` - the decay to set
  Returns:
    itself

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD