diyAudio

diyAudio (http://www.diyaudio.com/forums/)
-   miniDSP (http://www.diyaudio.com/forums/minidsp/)
-   -   advanced biquad programming: how to set gain for each biquad? (http://www.diyaudio.com/forums/minidsp/200363-advanced-biquad-programming-how-set-gain-each-biquad.html)

CharlieLaub 12th November 2011 08:45 PM

advanced biquad programming: how to set gain for each biquad?
 
I am developing some tools for calculating the IIR transfer function coefficients for the biquads in the MiniDSP. So far I have successfully figured out how to calculate the coefficients for first and second order filter functions and a "gain block" (e.g. b0=gain, all other coefficients=0). I developed my calcs using some of the "cookbook" type of documents that are floating around the web.

The one thing I can not seem to figure out, is how to have a filter with a gain of than unity implemented together in the same biquad. I know in analog filter transfer functions I can just multiple the numerator coefficients by the voltage gain that I want to use, and that does the trick. This does not seem to work for an IIR filter.

For example, in a single biquad, I want to describe a 2nd order high pass filter with Q=0.7071, corner frequency 500Hz, and voltage gain of 0.707.

How to I include the over all biquad gain in my coefficient calculations? I'd like to know a general way to do this for any first or second order filter function.

Thanks in advance.

-Charlie

minidsp 14th November 2011 06:59 AM

Charlie,

If you want to combine Gain (GdB) to one of your biquad filter, there is a simple way. Simply "Multiply" your numerators (all b0, b1, b2) to the linear gain value. (Glin)

e.g. H(z) = Glin * (b0 + b1z-1 + b2z-2) / ( 1+a1z-1 + a2z-2)

So Glin = 10^(GdB/20)

Makes sense?

DevTeam

CharlieLaub 18th November 2011 03:35 PM

Thanks for your reply. You are correct.

I discovered my mistake: in the nomenclature I was following, the numerator coefficients of the transfer function are denoted b0, b1, b2 for IIR filters but are denoted a0, a1, a2 for analog filters. I was just multiplying the wrong set of coefficients!

-Charlie


All times are GMT. The time now is 10:29 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio


Content Relevant URLs by vBSEO 3.3.2