Port of IIRJ library created by Bernd Porr: https://github.com/berndporr/iirj
An IIR filter library written in JAVA.
Highpass, lowpass, bandpass and bandstop as Butterworth, Bessel and Chebyshev Type I/II.
It's based on the IIR1 library [https://github.com/berndporr/iir1] which in turn is based on Vinnie Falco's DSPFilters [https://github.com/vinniefalco/DSPFilters].
import uk.me.berndporr.iirj.*;
Butterworth butterworth = new Butterworth();
-
Bandstop
butterworth.bandStop(order,Samplingfreq,Center freq,Width in frequ);
-
Bandpass
butterworth.bandPass(order,Samplingfreq,Center freq,Width in frequ);
-
Lowpass
butterworth.lowPass(order,Samplingfreq,Cutoff frequ);
-
Highpass
butterworth.highPass(order,Samplingfreq,Cutoff frequ);
Sample by sample for realtime processing:
v = butterworth.filter(v)
See the *Test.java
files for complete examples
for all filter types. Run them with mvn test
. These test programs
write the different impulse responses of the filters to text files.
Just run: mvn install
to add it to your local maven respository or
just point your project to Maven Central:
[http://search.maven.org/#artifactdetails%7Cuk.me.berndporr%7Ciirj%7C1.1%7Cjar]
dependencies {
compile group: 'uk.me.berndporr', name:'iirj', version: '1.1'
}
mvn javadoc:javadoc
generates the JavaDocsmvn site
generates the web pages containing the documentation undertarget/site
describing all commands in detail.
mvn test
creates impulse responses in the subdirectories
for the different filters: target/surefire-reports
.
To see the frequency responses install octave, copy the script 'src/test/resources/filtertest.m' in these subdirectories and run it from there. You should see the different frequency reponses for high/low/stop/bandpass. You can try out different filter parameters by modifiing the test scripts and re-run 'mvn test'.
The script DetectorTest uses a bandpass filter to detect the heartbeats of an ECG recording faking a matched filter which could be also seen as a 1st approximation of a wavelet. The heartrate is stored in hr.txt.
Have fun
/Bernd Porr [http://www.berndporr.me.uk]