Decibel colours for a mixer led meter

Hi there,

I’m trying to map green, yellow and red to their respective decibel values for a simple meter and was hoping someone could confirm if I’m doing things correctly, because it looks a little weird to me.

As you can see, the below uses green for dB’s less than -20, yellow for less than -9 and red from -9 and over.

st.x is simply the value of the normalized horizontal pixel value where the left side of the window is 0., right side is 1.

Many thanks for any help.

The below is written in glsl:

    float dcb = log(st.x) * 20.0;
    return dcb < -20. ? green : dcb < -9. ? yellow : red;

The results:

you might want db to scale linearly with pixels? So the x value can be translated to db without the log and the meter will probably be better for it?

Not sure I understand. In my case, the actual data is already linear, which is applied to the st.x variable which is also linear [0, 1] from left side to right side. I’m only then converting to dB to get the green/yellow/red colour positions to follow convention (i.e. green for [-inf, -20dB], yellow for [-20dB, -9dB] and red for [-9dB, …]).

I’m not sure I understand how to move from linear scaling to dB scaling without using logs.