## 'bout unit conversions

DSP, Plug-in and Host development discussion.
juha_p
KVRist
480 posts since 21 Feb, 2006 from FI
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

by using values

Code: Select all

``````G = 1.26
fc = 0.1
``````

Max M.
KVRist
266 posts since 20 Apr, 2005 from Moscow, Russian Federation
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
OK. Thanks for the wink. Found the answers.
G = 10^(2/20);
fc = 2*pi*700/44100;

BertKoor
KVRAF
10644 posts since 8 Mar, 2005 from Utrecht, Holland
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.
My MusicCalc is back online!!

juha_p
KVRist
480 posts since 21 Feb, 2006 from FI
Yes, though, it is matlab code which I made look like a Basic function ...