Forum Rule: Always post complete source code & details to reproduce any issue!

Howto Filter with low steepness?
Hi,
at the Moment I use:
biquad1.setHighpass(0, p_value[1], 0.707); // Butterworth filter, 12 db/octave
Is there a way to get less than 12 db/octave? I would be grateful for some link with additional Information about "biquad filters".
Many thanks, Christof

Moderator
Biquads are 12dB/oct or 40dB/decade. Same for the state variable filters based on the Chamberlin algorithm. Both are the preferred filters for musical applications since these are second order filters which allow not only to set a corner frequency, but also a Qfactor, sometimes also called damping or resonance.
Simpler filters are the recursive 1st order filters with 6dB/oct which correspond to the simple "classic" RC filters in analog circuits. Since these can often simply be realized in code by just one multiplication and one subtraction on the current and the previous sample, you won't probably find not much literature about that rather trivial thing.
Some design guidance can be found in the following article : http://freeverb3vst.osdn.jp/iir_filter.shtml

Originally Posted by
Theremingenieur
Since these can often simply be realized in code by just one multiplication and one subtraction on the current and the previous sample, you won't probably find not much literature about that rather trivial thing.
@cebersp A 'trivial' 6dB/octave highpass filter is the difference of two consecutive samples y[n]=x[n]x[n1]; equivalently a 'trivial' 6dB/octave lowpass filter is the integral over consecutive samples y[n]=x[n]+y[n1];
for other slopes, best is to use IIR/FIR filters

Thank you for the inputs!
Sometimes one only needs to know the right words to google. "Recursive 1st order filter" was helpful! I found: http://www.analog.com/media/en/techn..._book_Ch19.pdf and http://www.spinsemi.com/knowledge_ba...ow_pass_filter
In your link http://freeverb3vst.osdn.jp/iir_filter.shtml there is information how to calculate filter coefficients.
"Highpass 1st order
H(S) = S/(S + 1)
W = tan (PI*Fc/Fs)
N = 1/(1+W)
B0 = N
B1 = B0
A1 = N*(W1) "
Fc is the cutoff frequency, Fs is the sampling frequency.
As far as I have understood I can use the biquad filter object setting the coefficients B2=A2=0.
The coefficients can be transferred to the biquad object by "setCoefficients()".
Thank you very much! Best regards Christof
yep, seems to work :)
Code:
void set6dbHp(float fc) // set coefficients for biquad filter highpass with 6db/octave
{
float w = tan(PI*fc/44100.0); // see: http://freeverb3vst.osdn.jp/iir_filter.shtml
float n = 1.0/(1.0+w);
float b0 = n;
float b1 = b0;
float a1 = n*(w1);
float a2=0, b2=0;
double array1[5] = {b0, b1, b2, a1, a2};
biquad1.setCoefficients(0, array1);
}
Last edited by cebersp; 12212017 at 12:19 PM.

Moderator
You could do that, basically. But there are technologies to rewrite it for more efficient and less cpu cycle consuming code. See WMXZ's equations which are just missing the coefficients.

Originally Posted by
Theremingenieur
But there are technologies to rewrite it for more efficient and less cpu cycle consuming code.
Sorry, better to do it quick and dirty instead of not doing it at all....
I am not familiar with the dspinstructions of this CPU M4 so I cannot do it better quickly.
:) Christof

Senior Member
Salut Christof,
there is no need to use dspinstructions or something similar. And it is not at all complicated, try to understand what is behind the IIR, it is really quite simple, WMXZ has already given you the clue.
For your specific problem:
Try to understand "exponential averaging" for the lowpass version
http://blog.prosig.com/2003/04/28/da...ialaveraging/
You will also find a formula for the time constant there.
For your highpass filter desires, try this
http://peabody.sapp.org/class/dmp2/lab/dcblock/
https://github.com/simonyiszk/csdr/b...ster/libcsdr.c > search for dcblock_ff
DC elimination is basically the same as a very simple highpass filter.
Have fun with the Teensy!
Frank DD4WH
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules