Skip to content

Design and use digital filters with multiple programming languages.

License

Notifications You must be signed in to change notification settings

domohuhn/filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filter library for C

Build Desktop codecov

This repostitory contains a C-library that can be used to both design digital filters, as well as use them. The library also provides bindings to various other programming languages, like C++ and Javascript via emscripten.

You can try out the library online on github pages.

The following filter types are supported:

Name Type Characteristics Examples
Moving average FIR lowpass, highpass n/a
exponential FIR lowpass n/a
exponential IIR lowpass n/a
butterworth IIR lowpass, highpass, bandpass, bandstop n/a
chebyshev (type 1) IIR lowpass, highpass, bandpass, bandstop n/a
chebyshev (type 2) IIR lowpass, highpass, bandpass, bandstop n/a
brickwall FIR lowpass, highpass, bandpass, bandstop n/a

The filters are designed using the bilinear z-transform. In broad terms, you start with the frequency response of the analog filter and compute its poles and zeros. These values are transformed via a bilinear z-transform and expanded into a polynomial. The polynomial is normalized for gain 1 at 0 or the middle of the pass band. Here is a Presentation explaining the process.

MIT Signal processing continuous and discrete course

Build and run

Here is a quick start on how to build the code in this repo. On linux systems, you should be able to copy these command into bash.

git clone https://github.com/domohuhn/filter.git
mkdir -p filter/build
cd filter/build
cmake -DCMAKE_BUILD_TYPE='Release' ..
cmake --build .
# run the unit tests
ctest
# use the example program to design a chebyshev bandstop
# -o: order 4
# -c: cutoff 15 hz and 35 Hz
# -s: sampling rate 100 Hz
# -r: ripple 3 dB
# -g: generate graphs
./design-filter -p chebyshev -t bandstop -o 4 -c 15,35 -s 100 -r -3 -g 

Documentation

The API Documentation is generated with doxygen and can read online on github pages.

License

All code in this repository is licensed with the MIT license, see file "LICENSE".

Dependencies

The library itself has no dependencies. However the tests, examples and documentation have the following dependencies:

  • Catch 2 is used for the test cases.
  • cxxopts parses the command line options in the examples.
  • Doxygen Awesome for the css styles of the api documentation.
  • Chart.js to render the graphs in the documentation.

Issues

Please report issues and bugs using the issue tracker.

About

Design and use digital filters with multiple programming languages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published