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.

7 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

4 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.

I realize that this is a VERY old threadâ€¦ but still in 2023, there doesnâ€™t seem to be any good reference for how to do this, so I tried this piece of code. And it works!

EXCEPT: You have to divide `f2pi` by the sample rate.

I eventually realized this after looking at the source of `double dsp::IIR::Coefficients< NumericType >::getMagnitudeForFrequency()`

Just for future reference, if there happen to be others who are banging their heads against the wall like I did yesterday nightâ€¦

1 Like