'bout unit conversions

DSP, Plug-in and Host development discussion.
juha_p
KVRist
480 posts since 21 Feb, 2006 from FI

Post Fri Jun 01, 2018 4:46 am

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
266 posts since 20 Apr, 2005 from Moscow, Russian Federation

Re: 'bout unit conversions

Post Fri Jun 01, 2018 4:59 am

Search for "Decibel" and "Angular frequency" (aka "Radial frequency"). Wikipedia articles should be enough to know the conversion formulas you need.

juha_p
KVRist
480 posts since 21 Feb, 2006 from FI

Re: 'bout unit conversions

Post Fri Jun 01, 2018 7:11 am

OK. Thanks for the wink. Found the answers.
G = 10^(2/20);
fc = 2*pi*700/44100;

User avatar
BertKoor
KVRAF
10644 posts since 8 Mar, 2005 from Utrecht, Holland

Re: 'bout unit conversions

Post Fri Jun 01, 2018 7:18 am

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
480 posts since 21 Feb, 2006 from FI

Re: 'bout unit conversions

Post Fri Jun 01, 2018 8:56 am

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

Return to “DSP and Plug-in Development”