Filter library for the teensy.

frankzappa

Well-known member
Hello!

I've been trying to install this library into my project for 2 days without luck. I'm not very familiar with installing c++ libraries and it seems like a nightmare.

Can anyone tell me if this would even work for Arduino and how do I use it in my project? I've tried importing the .h and cpp files directly into my project but that didn't work, I've also tried using cmake to build the .lib files but I get errors. To be honest I've never done this before as I'm not a c++ programmer, more of a hobbyist.

Here is the library:
https://github.com/berndporr/iir1

It would be amazing if it worked. It's a library with DSP filters which seems to be some kind of hidden witchcraft and impossible to find anywhere for c++.

If someone knows of any similar DSP libraries with multiple order chebyshev/Butterworth filters that you can modify parameters in your project directly I'm all ears.
 
You could use the built-in Teensy Audio Library
Look for examples in Arduino IDE, maybe try this IIR example:

https://github.com/PaulStoffregen/Audio/blob/master/examples/Effects/Filter/Filter.ino

Is there any documentation how to use these filters? Example is not that great.
I can understand that the last coefficient "0.707" makes a butterworth response but how do I filter incoming samples in realtime? Also how do I set order, etc?

Code:
biquad1.setLowpass(0, 800, 0.707;

I'm guessing the 800 is cutoff frequency but how do I set sample rate?
 
Is there any documentation how to use these filters? Example is not that great.
I can understand that the last coefficient "0.707" makes a butterworth response but how do I filter incoming samples in realtime? Also how do I set order, etc?

Code:
biquad1.setLowpass(0, 800, 0.707;

I'm guessing the 800 is cutoff frequency but how do I set sample rate?

The Audio library assumes the sample rate to be defined by macro AUDIO_SAMPLE_RATE_EXACT. Filter coefficients are a function of the ratio of critical frequency to sample frequency, so you could compute the ratio you want, then pass in a frequency that provides the correct ratio, given the value of AUDIO_SAMPLE_RATE_EXACT for your platform (T3 or T4). You could also copy the biquad source code from the Audio library into your project and change it. My recommendation would be to use the Arduino Filters library, since it's probably documented and will have quite a range of examples.
 
Back
Top