Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to change the filter coefficients according to the sampling rate? (Read 3125 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to change the filter coefficients according to the sampling rate?

Hello everyone,

I have a set of direct form 2 filter coefficients, which is for 48kHz(given ITU R for loudness calculation).

Now I want to modify these coefficients according to 44.1 kHz sampling rate. Could anyone please help me in this?


I know there is discussion which talks about this, but i couldn't understand that.

Many Thanks

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

Reply #1
Hello everyone,
I have a set of direct form 2 filter coefficients, which is for 48kHz(given ITU R for loudness calculation).
Now I want to modify these coefficients according to 44.1 kHz sampling rate. Could anyone please help me in this?
I know there is discussion which talks about this, but i couldn't understand that.
Many Thanks

IIRC, it's quite difficult task to re-calculate samplerate specific coefficients suitable for other samplerates (not accurate process).
Also, why not just solve the filter types/parameters used for the curve ... ?

Any link to the discussion and paper/source you got those coefficients from?

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

Reply #2
As an addendum for previous post;
If you have EqualizerAPO installed then it's quite easy to find the filter parameters by using Configuration Editor. Enter your filter coefficients for Filter: commands and then use those pre-defined filters as inverted (change the Hz, Q and Gain values to make the graphics show flat response).

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


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 :

Code: [Select]
% 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


 

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

Reply #5
Is this the discussion you didn't understand?

https://hydrogenaud.io/index.php/topic,76394.0.html

If so, better to ask questions about what you didn't understand. 

I posted this update to that old thread:

By MathWorks: ( https://www.mathworks.com/help/audio/ref/weightingfilter-class.html?s_tid=gn_loc_drop )

"These coefficients are recomputed for nonstandard sample rates using the algorithm
described in Mansbridge, Stuart, Saoirse Finn, and Joshua D. Reiss. "Implementation
and Evaluation of Autonomous Multi-track Fader Control
." Paper presented at the
132nd Audio Engineering Society Convention, Budapest, Hungary, 2012.
"
(AES Convention Paper 8588)