## Re: How to change the filter coefficients according to the sampling rate?

#####
Reply #4 –

As an addendum for previous post;

...

https://s3.postimg.org/jpwzma5cx/BS1770.png

After getting the right filter parameters, just find some filter calculation web page to do the job for you or calculate coefficients by yourself using MatLab/Octave :

% Octave packages --------------------------------------

pkg load control

pkg load signal

% --------------------------------------------------------

% --------------------------------------------------------

% Uses RBJ Cookbook formulas

% http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

%

fs = 44100;

% -------------------------------------------------------

% HPF coefficients

% -------------------------------------------------------

f = 38;

Q = 0.5;

w0 = 2*pi*f/fs;

cw0 = cos(w0);

sw0 = sin(w0);

alpha = sw0/(2*Q);

hp_b0 = (1+cw0)/2

hp_b1 = -(1+cw0)

hp_b2 = (1+cw0)/2

hp_a0 = 1+alpha

hp_a1 = -2*cw0

hp_a2 = 1-alpha

% -------------------------------------------------------

% HSF coefficients

% -------------------------------------------------------

db = 4.0;

f = 1500;

Q = 0.707;

w0 = 2*pi*f/fs;

cw0 = cos(w0);

sw0 = sin(w0);

alpha = sw0/(2*Q);

a = 10^(db/40);

tmp = 2*sqrt(a)*alpha;

hs_b0 = a*((a+1)+(a-1)*cw0+tmp)

hs_b1 = -2*a*((a-1)+(a+1)*cw0)

hs_b2 = a*((a+1)+(a-1)*cw0-tmp)

hs_a0 = (a+1)-(a-1)*cw0+tmp

hs_a1 = 2*((a-1)-(a+1)*cw0)

hs_a2 = (a+1)-(a-1)*cw0-tmp