Audio waveform drawing with background colour?

Hi there,

I am a little new at JUCE so fair warning for any stupid ideas:

I was wondering if anyone could walk me through how they would draw this (these) waveform/s in JUCE.

So in my head coming from a procedural design point of view I would just create a path (spline) based on an optimised subset of some buffered samples.

I would leave the path open and then just add a fill and edge colour with a slightly lower opacity for the fill.

How that translates to this problem I dont know i.e. maybe that method is not performant enough, maybe its not the correct implementation, maybe its too inaccurate for analysis, maybe the library doesn’t support it.

Any thoughts, advice or alternative ways to think about it would be really helpful. Thanks in advance.

1 Like

JUCE’s graphics system is more than capable of doing this, but if you want to update the waveform at a constant rate (i.e with a timer callback) you might have performance issues. Some more refined / complex JUCE projects like Vital utilize JUCE’s OpenGL context to handle graphics rendering, and in your case taking a look at one of it’s waveform rendering classes would probably help out.

1 Like

Thank you for the example, I will dig though it after I am done decorating for the day.

Looking at the projects UI, it looks like it does everything I need. That’s a perfect example, thanks again.