Hello,
I am working on fft analyser. And actually my analyser works great at the moment, but only when I use juce::Path::cubicTo(). And because as usual I add horizontal coordinates logarithmically calculated from my FFT bins so Paths nodes X coordinates are not spaced equally.
But now I need to draw it as bar chart. So I need points which are spaced equally. To do that I do something which is killing my CPU. The method is that I still create path with cubicTo(), but later for each equally spaced X I use: myPath[i].getClippedLine(Line<float>(x, getHeight(), x, 0.0f), false);
So to improve the efficiency I think I should create my own XY array. But then I need to interpolate Y coordinates for all equal spaced Xs by myself.
But I found out that cubic interpolation is not such simple subject so I would like to ask you if you know any good library to achieve such interpolation. I was looking at Boost Cubic B-Spline but it looks like it works only for functions with already equally spaced points, but as my FFT bins are spaced logarithmically so I think I need to find something else.
Or maybe there is anything which I missed in juce::Path But it looks like juce::Path::iterator iterates only through the nodes but not through any given X coordiates.
For any help great thanks in advance.
Best Regards.
I figured this is worth sharing: the Gin spline implementation is based on this Cubic Spline Interpolation blog post, if there’s interest in rolling your own portable spline algorithm.
The Continuity of Splines is an absolute banger when it comes to a fully fledged video about splines, but the video that actually taught me how to implement a basic spline was this one:
I just want to drop in for people that visited this thread specifically to find a way to make a path for a spectrum analyzer.
It might be easier to just p.lineTo(x, y); linear interpolate between points and then…
auto outputPath = p.juce::Path::createPathWithRoundedCorners(48.f);
…rather than try to figure out p.cubicTo control points. Obviously if you’re trying to draw splines this is great info^ but I found myself here a lot when trying to smooth out my spectrum analyzer
would it perform too bad to just linear phase lowpass the spectral information instead of interpolating them? cause i feel it should be rather cheap if you use an IIR filter going up and down the spectrum whenever it came out of the forward fft