Code: Select all
a = 1.0 - exp(-2.0*pi*frequency/sampleRate);
Check the comments for optimisations.
Code: Select all
a = 1.0 - exp(-2.0*pi*frequency/sampleRate);
Nice, this was the formula I was asking! Sorry for the confusion (english is not my native language eheh). Thank you very much man!matt42 wrote:Also from musicdsp.org. The same as your example on the first post, but with the coefficient formula: http://www.musicdsp.org/showArchiveComm ... hiveID=237Code: Select all
a = 1.0 - exp(-2.0*pi*frequency/sampleRate);
Check the comments for optimisations.
Code: Select all
lf = 2 * sin(M_PI * ((double)lowfreq / (double)mixfreq));
Code: Select all
p = (2-cos(x)) - sqrt((2-cos(x))^2 - 1) with x = 2*pi*cutoff/samplerate
This is just because the filter is not a strict lowpass. It's actually a sort of leaking lowpass turning into more like a high-shelf when F is approaching Fn. Hence different formulae may exist depending on how we'll prefer to see it when F goes high enough.Nowhk wrote:So there isnt a unique way of settings the coefficients on a fixed filter.
I see! Thanks guys!!!!Max M. wrote:This is just because the filter is not a strict lowpass. It's actually a sort of leaking lowpass turning into more like a high-shelf when F is approaching Fn. Hence different formulae may exist depending on how we'll prefer to see it when F goes high enough.Nowhk wrote:So there isnt a unique way of settings the coefficients on a fixed filter.
From above three variants the third one is looking the most fair for higher freqs (don't miss that for your implementation it will be k = 1 - p of it).
Not really. There it also depends on what curve we need and we often need quite different things.Nowhk wrote:I think that on biquad filters, coefficients calc follow strictly rules
I see. So even calculate the coefficents is a sort of "filter" design. Not only the based-formula behind it. DSP makes mind crazy...Max M. wrote:Not really. There it also depends on what curve we need and we often need quite different things.Nowhk wrote:I think that on biquad filters, coefficients calc follow strictly rules
Maybe http://demonstrations.wolfram.com/Digit ... sAndZeros/Nowhk wrote: ...
Not sure if there are only visual representation of it. This is nice for DFT: https://jackschaedler.github.io/circles ... ction.html
Somethings like this for understand Filters would be amazing.
Code: Select all
// FM emphasis filter
double Fs = 44100; // higher sample rate results better filter accuracy
double Fc = 2122.0;
double T1 = 1/(2*pi*Fc); // Hz to time constant
double p1 = -exp(-1.0/(Fs*T1));
double z1 = 1 + z1;
a0 = 1.0;
a1 = p1;
a2 = 0;
b0 = 1.0;
b1 = z1;
b2 = 0;
// swap between a1, b1 to select pre- or de-emphasis
Code: Select all
% FM emphasis filter
% PACKAGES
pkg load control
pkg load signal
clear all;
clc;
fs = 44100;
samplingtime = 1/fs;
% analog prototype
A2 = [1];
B2 = [0.000075 1];
Ds = tf(B2, A2); % swap between A2 and B2 to select pre- or de-emphasis
Ds = Ds/dcgain(Ds);
% MZT
T1 = 0.000075; % 75us
z1 = -exp(-1.0/(fs*T1));
p1 = 1+z1;
a0 = 1.0;
a1 = p1;
a2 = 0;
b0 = 1.0;
b1 = z1;
b2 = 0;
% swap between a1, b1 to select pre- or de-emphasis
Bmzt = [b0 a1 b2]
Amzt = [a0 b1 a2]
DzMZT = tf(Amzt, Bmzt, samplingtime);
DzMZT = DzMZT/dcgain(DzMZT);
%% Plot
wmin = 2 * pi * 20.0; % 20Hz
wmax = 2 * pi * ((fs/2.0) - (fs/2 - 20000)); 20kHz
figure(1);
bode(Ds, 'b', DzMZT, 'c', {wmin, wmax});
legend('Analog prototype', 'MZT 2nd order','location', 'northwest');
grid on;
to look like the topic has been knowledgeably and comprehensively answered while bewildering the correspondent.Miles1981 wrote:What's the point of using a "second" order filter when the second order coefficients are null?
I don't have those null (and don't want to share what's there) ... you sure know why not.Miles1981 wrote:What's the point of using a "second" order filter when the second order coefficients are null?
© KVR Audio, Inc. 2000-2024
Submit: News, Plugins, Hosts & Apps | Advertise @ KVR | Developer Account | About KVR / Contact Us | Privacy Statement