I’ve been taking a look at the Superpowered library, specifically the OfflineAnalyser:
http://superpowered.com/docs/class_superpowered_offline_analyzer.html
It gives me various EQd sets of waveform data as unsigned char**. The data is 150 points per second.
I’m trying to work out what the best way of turning that into an actual displayable waveform.
Should I try and render that into a juce::Image, or go the route of writing a custom AudioThumbnail class…? Or something else?
I’d be interested in knowing people’s thoughts.
I think the easiest way would be to just draw a path in a component. Something like this:
void SuperpoweredComponent::paint (Graphics& g)
{
Path p;
for (int i = 0; i < waveformLength; i++)
{
float x = float (i) / float (waveformLength - 1);
float y = 1.0 - float (averageWaveform[i]) / 255.0;
i == 0 ? p.startNewSubPath (x, y) : p.lineTo (x, y);
}
p.scaleToFit (0, 0, getWidth(), getHeight(), false);
g.setColour (Colours::white);
g.strokePath (p, PathStrokeType(1.0));
}
edit: forgot scaling…
2 Likes
Oh, nice!
Then I could draw the different layered waveforms on top of each other and blend the colours.
Could maybe even have a little class that could render small portions for a scrolling waveform