Currently I'm working out plotting biquads in a VST/AU plugin and have problems with the graphics part. I posted in several forums but haven't got a really useful answer for this case.

First, tell me if I'm right how to get the magnitude response. For this I use this equation http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf

Am I right that I have to get an array of values, the "points" which are my Y-axis values in my filter plot?

So far, so good. Now, how should I move on to plot this magnitude on screen? I'm really on a point I don't know how to go on.

I'm using the WDL/IPlug framework in which I can use DrawPoints(x,y) and DrawLine (x,y,x1,y1) classes for drawing.

Any help would be appreciated, especially code examples/snippets (I'm learning easier when I can see it...)!

  • 2
    $\begingroup$ as an alternative to Eq. (18) in the pdf referenced in the question, another formula for magnitude response is this answer. it doesn't need to evaluate the $\cos(.)$ twice (once for $\omega$ and again for $2\omega$). instead it's in terms of $\sin^2(\omega/2)$ and its square. $\endgroup$ Jan 26, 2016 at 0:35

1 Answer 1


Equation (18) in the pdf is correct to calculate the magnitude response for biquad filters.

As you might know the magnitude response is plotted over the frequency. So you will need to define your points on your x-axis, which resembles the frequency $f$.

In digital systems your frequency will go up to $f_s/2$, where $f_s$ is the sample rate. The $\omega$ is just $2\pi f$. So you just have to subsitute $\omega=2\pi f$ in Eq.(18) and calculate the magnitude response $|H(e^{j 2\pi f})|$ (y-axis) for desired frequency points (x-axis).

You will end up with two vectors. One is the vector of frequencies $\mathbb{f}$ that you define. And the other vector is your calculated magnitude response $|H(e^{j 2\pi f})|$.

I have not used WDL/IPlug frameworks, but I guess you can then just plot your graph using the DrawPoints(x,y) function, using the calculated value pairs. You may have to look into the documentation of the frameworks for further hints. Depending on the resolution of the plot, you may want to increase the step size of your frequency vector, to increase performance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.