# Multicoloured waveform

**URL:** <https://forum.juce.com/t/multicoloured-waveform/21085>\
**Category:** General JUCE discussion\
**Created:** [February 22, 2017, 11:32pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085 "2017-02-22T23:32:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![samspreadborough](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samspreadborough](https://forum.juce.com/u/samspreadborough)\
**Post date:** [February 22, 2017, 11:32pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/1 "2017-02-22T23:32:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 23, 2017, 9:52am UTC](https://forum.juce.com/t/multicoloured-waveform/21085/2 "2017-02-23T09:52:50Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mayae](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mayae](https://forum.juce.com/u/mayae)\
**Post date:** [February 23, 2017, 2:22pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/3 "2017-02-23T14:22:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samspreadborough](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samspreadborough](https://forum.juce.com/u/samspreadborough)\
**Post date:** [February 23, 2017, 2:41pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/4 "2017-02-23T14:41:16Z")

</div>

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](http://www.drowaudio.co.uk/tools.php)

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [February 23, 2017, 2:49pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/5 "2017-02-23T14:49:50Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![mayae](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mayae](https://forum.juce.com/u/mayae)\
**Post date:** [February 23, 2017, 4:02pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/6 "2017-02-23T16:02:44Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![alatar](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@alatar](https://forum.juce.com/u/alatar)\
**Post date:** [February 23, 2017, 7:33pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/7 "2017-02-23T19:33:21Z")

</div>

Looks super cool 🙂

---

<div class="post-metadata">

**Author:** ![peteblues](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@peteblues](https://forum.juce.com/u/peteblues)\
**Post date:** [February 23, 2017, 9:44pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/8 "2017-02-23T21:44:21Z")

</div>

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:

> **[Peter Thom](https://www.instagram.com/p/BPnZQPrB1h0/)**

---

<div class="post-metadata">

**Author:** ![samspreadborough](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samspreadborough](https://forum.juce.com/u/samspreadborough)\
**Post date:** [February 23, 2017, 9:59pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/9 "2017-02-23T21:59:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peteblues](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@peteblues](https://forum.juce.com/u/peteblues)\
**Post date:** [February 23, 2017, 10:21pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/10 "2017-02-23T22:21:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![samspreadborough](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samspreadborough](https://forum.juce.com/u/samspreadborough)\
**Post date:** [February 23, 2017, 10:24pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/11 "2017-02-23T22:24:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peteblues](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@peteblues](https://forum.juce.com/u/peteblues)\
**Post date:** [February 23, 2017, 10:26pm UTC](https://forum.juce.com/t/multicoloured-waveform/21085/12 "2017-02-23T22:26:30Z")

</div>

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