Multicoloured waveform


#1

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


#2

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!


#3

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:
https://bitbucket.org/Mayae/signalizer/branch/osc/feature-colours?dest=oscilloscope#diff


#4

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

http://www.drowaudio.co.uk/tools.php


#5

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…


#6

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…


#7

Looks super cool :slight_smile:


#8

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:


#9

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


#10

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.


#11

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


#12

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