Filter response visualizer class

I just looked at the details and apparently you have to pass it the coefficients of a 2nd order direct form filter. I’m using Faust where I just specify f0 and Q and the library handles the rest. I could:
a) Add a visualizer mode in PGM to calculate the response given f0 and Q instead of coefficients.
b) Calculate the coefficients in parallel given f0 and Q
c) Try to find the coefficients in the Faust generated C++ (I am really unlikely to choose this method)
d) Faust may also be using a state variable structure. In which case a direct form is not available except by conversion. (true? or am I full of it) Regardless, I am not that concerned if the visualization is a little off as it’s mostly for eye candy (my filters move around in real time).

The MagicPlotSource is an interface class that you can inherit to create any kind of visualisations.
They don’t even need to be an Y over X plot, you could also implement a Stereo visualiser or a GonioMeter.

You simply need to override the three pure virtual functions:

  • virtual void pushSamples (const juce::AudioBuffer<float>& buffer)
  • virtual void createPlotPaths (juce::Path& path, juce::Path& filledPath, juce::Rectangle<float> bounds, MagicPlotComponent& component)
  • virtual void prepareToPlay (double sampleRate, int samplesPerBlockExpected)

Your implementation should simply populate the two juce::Path variables. The existing PlotComponent will take care of the colouring etc.

If you find coefficients in your faust filters, that would correspond to the juce::dsp::IIR implementation, then you can use the existing FilterPlot, but the odds are it’s unlikely.

1 Like