 # Is there a Graphic Eq graph plot component available?

I am making an editor for a digital Graphic Eq and would like to have the standard frequency graph as a visual display. I would like to input centre frequency, Q and Gain (+/- dB) of up to 12 filters and have a component draw the graph for me.
I would like so when I changed a value (Freq/Q/gain) the graph would redraw/update in real-time.

Is this a component that already exists?
thanks

1 Like

i think you will need to roll your own : )

You need to get the transfer function for the filter/eq. Once you’ve got that glorious graphs await… This was drawn using this:

``````double getMagnitudeAtFrequency(double freq)
{
auto f2pi = 2.0 * M_PI * freq;
std::complex<double> z(cos(f2pi), sin(f2pi));
std::complex<double> z2 = z * z;

std::complex<double> h =
(b0a0 * z2 + b1a0 * z + b2a0)
/
(1.0 * z2 + a1a0 * z + a2a0);

return std::abs(h);
}
``````

I’ll try and remember how I arrived at that But hopefully it works out from the transfer function for the biquad here: https://ccrma.stanford.edu/~jos/fp/BiQuad_Section.html

Where the b0a0, b1a0 etc. are the filter coefficients.

6 Likes

I think, this would be a nice addition for Fabians DSP class, when it arrives. Its Xmas soon, so let me add another wish:
I would also wish for a basic GUI for reverb!

There is a component floating around in the interweb which draws a frequency plot from
IIR coefficients. Search for Sean Enderby’s FilterGraph (I am using a adaption of it myself)

Yeah, the SAFE module has an updated version of that.

4 Likes

Thanks for the suggestions. I did the the “graphpaper” - had a quick look, found an equation to use and thought “am I re-inventing something that already exists?” and then got divereted. Anyway thanks to the sugestions I know the correct way forward. The bi-quad makes sense to me I can use that. I like Sean’s suggestion too.

Excuse me but, how I can use that code?
I need a graph for my biquad filters, I have coefficients calculators in my app and the equations for the various types of filters…

(Don LaFontain voice:) Meanwhile in JUCE-land, a new dsp module has landed…

Now you can use coefficients of your filters to get the magnitudes for each frequency using dsp::IIR::getMagnitudeForFrequencyArray() and dsp::FIR::getMagnitudeForFrequencyArray(), that you easily can plot.
If you chain filters, that means usually multiplying the frequency response (in gains) or adding in dB…

I did a project for my own upskilling on the dsp module, you can get inspiration of the code here:

HTH

3 Likes

Thank you very much @daniel.
But I have used the stk from CCRMA Stanford for the filter and I’ve found a module written by senderby called JUCE Filter Graph Component and I have edited it for my needs. It is a bit confusing, but at least it works.
But for my next projects I will use your DSP module.