Multicoloured waveform

Hello all.

I’m wanting to produce a multicoloured waveform that represents frequency information (e.g higher the frequency, brighter the colour).

Is this something that JUCE could theoretically do, or should I be looking for an external library?

Many thanks

You’re very unlikely to find a magic library that does exactly what you want, so juce’s AudioThumbnail class is probably as good a starting point as anything else out there!

Here’s the magic library! Jokes aside, I recently did exactly that for streamed waveforms. The basic idea is to split up the signal in phase-aligned bands (Linkwitz-Riley crossovers, for instance) whose energy corresponds to a colour. When you paint the waveform, you accumulate the colour for each band at each sample, and normalize the colour.

I haven’t really developed the feature fully, but you can see the diff here:

1 Like

DrowAudio does the thing I’d like, but the module is out of date.

The singalizer looks cool. I’m gonna have a look at that now

That’s a super cute solution … I was always thinking I’d need to do an FFT … probably a touch quicker to use a crossover…

It depends on what you want to do… But for mapping spectral energy and density to colours, it works extremely well and gives per-sample results that are easily interpolatable and smoothable:

The FFT approach would be better if you want to colour the highest magnitude frequency in the window, or something…


Looks super cool :slight_smile:

I did some multicolored waveform drawing using 3 bandpass filters (for low, mid, high bands), and use the values of the 3 bands as basis for the RGB values when drawing the waveform.
Looks like this:

1 Like

Thats awesome and exactly what I’m after.

Would you be happy sharing more details on how you did that?
I’d definitely like to replicate that

I actually used the so called ‘Superpowered sdk’, which has functions to analyze an audio file, and spit out three different bandpass filtered waveforms. Those are essentially my RGB values.
I just looked at the DrowAudio link mentioned above, which basically does the same.

So do you use the 3 bands of RGB to set the colour of an AudioThumbnail object?

I take the respective RGB values for each slice I’m displaying (150 slices per second).