Hello, I am currently working on developing a plugin for measuring parameters such as RMS, Loudness, PSR, and a history graph for loudness values. I have been facing issues with repainting in JUCE since I have a very large vector that plots PSR values over time, as shown in the following graphs:


I have tried different methods to smooth this graph:
First, I filter some values with a Linkwitz-Riley filter as follows.
void graphicPathPsr::paint(juce::Graphics& g)
{
juce::Rectangle area = getLocalBounds().toFloat();
float pixelsSpace = 20;
float width = area.getWidth();
float height = area.getHeight() - pixelsSpace;
smoother.setarea(area);
g.setColour(juce::Colours::black);
g.fillRoundedRectangle(area,1.5f);
value = valueSupplier();
float valueLp = lowpassLinkwitz_Riley->filter(value);
values[numvaluesFetched] = valueLp;
smoother.extracvalue(values[numvaluesFetched]); // this function adds a
filtered value to an internal smoothing FIFO
{
After this, I also apply Gaussian smoothing to these filtered values and then repaint the JUCE path.
juce::Path applySmoothing()
{
juce::Path SmoothedPath;
float minValue = 0.0f;
float maxValue = 28.0f;
float initialPointY = juce::jmap(y_values[0], minValue, maxValue,
static_cast<float>(height / 2), 0.0f); // y_values are the psr after the
gaussian filtering
SmoothedPath.clear();
SmoothedPath.startNewSubPath(0.0f,initialPointY);
for (int valuePos = 1; valuePos < numvaluesFetched; valuePos++)
{
float xvalue = step * valuePos;
float yvalue = juce::jmap(y_values[valuePos], minValue, maxValue, static_cast<float>(height / 2), 0.0f);
SmoothedPath.lineTo(xvalue, yvalue);
}
for (int valueNeg = numvaluesFetched - 1; valueNeg >= 0; valueNeg = valueNeg - 1)
{
float xvalue = step * valueNeg;
float yvalueReflex = juce::jmap(y_values[valueNeg], minValue,
maxValue, static_cast<float>(height / 2), static_cast<float>(height));
SmoothedPath.lineTo(xvalue, yvalueReflex);
}
if (numvaluesFetched % 2000 == 0)
{
updateSigma(sigma + 5); // Increase sigma after 2000 values have
been added.
}
}
However, as time goes on and with so many samples, the graph becomes too “noisy” and does not smooth out enough, even when increasing the sigma of the Gaussian filter, and the processing becomes increasingly slower. What recommendations can you give me to improve the graphing? I’ve seen that I could save the amplitude values of the PSR (which is a calculation between the True Peak - short-time LUFS) in a file format like Reaper does with .reapeaks and only display in the graph what is repainted in a FIFO structure while also saving all the values in this file. This way, when paused, the file can be loaded, and the values can be viewed over time depending on a window, just like Youlean does (image below).

