- Notifications
You must be signed in to change notification settings - Fork36
An efficient IIR filter library written in JAVA
License
berndporr/iirj
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An IIR filter library written in JAVA.
Highpass, lowpass, bandpass and bandstop asButterworth, Bessel and Chebyshev Type I/II.
You can also calculate the filter coefficients with Python'sscipy and then create your custom IIR filter.See thepython-design
subdirectory.
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 examplesfor all filter types. Run them withmvn test
. These test programswrite the different impulse responses of the filters to text files.
- Clone this repository
- Run
mvn install
to add it to your local maven respository
Atclick on the iirj version number and then choose the appropriate installation option, forexample for Android studio.
dependencies { implementation group: 'uk.me.berndporr', name:'iirj', version: '1.7'}
Android studio will automatically notify you if a new IIR library is available.
- Online:https://berndporr.github.io/iirj/
mvn javadoc:javadoc
generates the JavaDocsmvn site
generates the web pages containing the documentationundertarget/site
describing all commands in detail.
mvn test
creates impulse responses in the subdirectoriesfor the different filters:target/surefire-reports
.
To see the impulse and frequency responses run:
python3 ./plot_impulse_fresponse.py <filter>
where is is butterworth, bessel, chebyshevI or chebyshevII.
The script DetectorTest uses a bandpass filter to detect theheartbeats of an ECG recording faking a matched filter which couldbe also seen as a 1st approximation of a wavelet. The heartrate isstored in hr.txt.
Have fun
/Bernd Porr[http://www.berndporr.me.uk]
About
An efficient IIR filter library written in JAVA