Login / Register 0 items | $0.00 New @ KVR
juha_p
KVRist
 
444 posts since 21 Feb, 2006, from FI

Postby juha_p; Fri Jun 01, 2018 4:46 am 'bout unit conversions

There's this 1st order HS implementation

Code: Select all
function hs1(fc, G)
    a(0) = tan(pi/2-fc/2) + sqrt(G);
    a(1) = (-tan(pi/2-fc/2) + sqrt(G));
    b(0) = (G*tan(pi/2-fc/2) + sqrt(G));
    b(1) = (-G*tan(pi/2-fc/2) + sqrt(G));
   
    return a, b;
end function


where,
G = linear gain
fc = cutoff frequency (dunno the unit type)

I would like to use dB and Hz as input units ... how to make the conversions?

ATM, I get these magnitude and phase responses

Image

by using values

Code: Select all
G = 1.26
fc = 0.1
User avatar
Max M.
KVRist
 
241 posts since 20 Apr, 2005, from Moscow, Russian Federation

Postby Max M.; Fri Jun 01, 2018 4:59 am Re: 'bout unit conversions

Search for "Decibel" and "Angular frequency" (aka "Radial frequency"). Wikipedia articles should be enough to know the conversion formulas you need.
juha_p
KVRist
 
444 posts since 21 Feb, 2006, from FI

Postby juha_p; Fri Jun 01, 2018 7:11 am Re: 'bout unit conversions

OK. Thanks for the wink. Found the answers.
G = 10^(2/20);
fc = 2*pi*700/44100;
User avatar
BertKoor
KVRAF
 
10376 posts since 8 Mar, 2005, from Utrecht, Holland

Postby BertKoor; Fri Jun 01, 2018 7:18 am Re: 'bout unit conversions

juha_p wrote:
Code: Select all
function hs1(fc, G)
    a(0) = tan(pi/2-fc/2) + sqrt(G);
    a(1) = (-tan(pi/2-fc/2) + sqrt(G));
    b(0) = (G*tan(pi/2-fc/2) + sqrt(G));
    b(1) = (-G*tan(pi/2-fc/2) + sqrt(G));
   
    return a, b;
end function

Kidz these days get lazy with all the compiler optimizations, they don't even TRY themselves!
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is back online!!
juha_p
KVRist
 
444 posts since 21 Feb, 2006, from FI

Postby juha_p; Fri Jun 01, 2018 8:56 am Re: 'bout unit conversions

Yes, though, it is matlab code which I made look like a Basic function ...

Moderator: Moderators (Main)

Return to DSP and Plug-in Development