I am working on a plugin that has a filter frequency response visualizer in it. The plugin itself is resizable (fixed aspect ratio).
The background, grid, and labels of the frequency visualizer component will be a raster graphic as the rest of the plugin uses raster graphics as well.
I’d like to hear your opinion on how to draw the frequency response itself.
As I see it right now I have two options:
- A lot of very short straight lines
- Fewer bezier curves (probably quadratic ones?)
Which approach would you suggest? Or do you have some different idea?
The only problem I see with the curve approach is - how to select which points define the curve?
I use JUCE’s
Path class for rendering frequency spectrums.
I just create straight lines between each point using
In the past I would use
Path::createPathWithRoundedCorners which obviously smoothes any sharp points however that led to some peaks in the spectrum not displaying as big as they should be.
Now I just use curved joints:
g.strokePath(path, PathStrokeType(1.5f, PathStrokeType::curved, PathStrokeType::rounded);
which I find works fairly well.
Another tip is to reduce the number of points you’re drawing. There’s really no point in displaying 1 point for every pixel on the X-axis and certainly not point in displaying 1 point for every bin in the FFT. I usually use around 256 points and find the largest peak around the range of each point to plot.
sounds good! I’ll give it a shot.
I will experiment with the number of points. Also my filter(s) are quite simple so I can go with fixed N number of points plus all the peaks and valleys in the response as there are not that many.
Thank you for sharing your knowledge!