com.tagtraum.jipes.math

## Class Filters.IIRFilter

• All Implemented Interfaces:
MapFunction<float[]>, StatefulMapFunction<float[]>
Enclosing class:
Filters

```public static class Filters.IIRFilter
extends Object
implements StatefulMapFunction<float[]>```
IIR (infinite impulse response) filter.

To compute the coefficients you might want to use Matlab or the free package Octave (with additional Octave-Forge packages needed for signals). E.g. for a low pass filter you could execute:

[a,b] = butter(3, .4, 'low')

This will compute the coefficients for a third order low pass filter where the first argument (3) is the order and the second (.4) the normalized cutoff frequency, which is defined as `fc*2/fs` (fc = cutoff frequency, fs = sample frequency).

Assuming your audio is sampled at 44.1kHz, and you wanted a cutoff frequency of 11.025kHz, the seconds parameters would be `11025*2/44100 = 0.5`.

Date: Jul 20, 2010 Time: 2:13:51 PM

Author:
Hendrik Schreiber
Wikipedia on IIR, `Filters.FIRFilter`
• ### Constructor Summary

Constructors
Constructor and Description
```IIRFilter(double[] inputCoefficients, double[] outputCoefficients)```
• ### Method Summary

All Methods
Modifier and Type Method and Description
`boolean` `equals(Object o)`
`double` `filter(double currentInputValue)`
`int` `hashCode()`
`float[]` `map(float[] data)`
Maps an object (usually an array, an `RealAudioBuffer` or a `List`) to another one of the same size.
`void` `reset()`
Resets the function's state.
`void` `setInputCoefficients(double[] inputCoefficients)`
`void` `setOutputCoefficients(double[] outputCoefficients)`
First b coefficient must always be 1.
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### IIRFilter

```public IIRFilter(double[] inputCoefficients,
double[] outputCoefficients)```
• ### Method Detail

• #### reset

`public void reset()`
Description copied from interface: `StatefulMapFunction`
Resets the function's state.
Specified by:
`reset` in interface `StatefulMapFunction<float[]>`
• #### setInputCoefficients

`public void setInputCoefficients(double[] inputCoefficients)`
Parameters:
`inputCoefficients` - a (input) coefficients
• #### setOutputCoefficients

`public void setOutputCoefficients(double[] outputCoefficients)`
First b coefficient must always be 1.
Parameters:
`outputCoefficients` - b (output) coefficients
• #### map

`public float[] map(float[] data)`
Description copied from interface: `MapFunction`
Maps an object (usually an array, an `RealAudioBuffer` or a `List`) to another one of the same size.
Specified by:
`map` in interface `MapFunction<float[]>`
Parameters:
`data` - data
Returns:
mapped data
• #### filter

`public double filter(double currentInputValue)`
• #### equals

`public boolean equals(Object o)`
Overrides:
`equals` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`