Old 12-31-2019, 08:06 AM   #1
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default Gain Staging and JS VU FX with embedded UI

;TLDR - looking for an FX or FX chain that facilitates gain staging for a set DB level that has an embedded MCP UI

So, much to my embarrassment I've only now realized that gain staging has changed to accommodate the new realities of digital processing, and my "hot without clipping" tactic from the analog days IS WRONG!!! Sorry, I'm late to the party.

I decided that I would stage with an average -18dbFS on the strip input. I dug up an old Gain JS I created and put it as a default FX chain for new tracks.

But it doesn't show an embedded UI in the mixer strip, so I can't see the gain output levels at a glance, and that would be handy because I've got a lot of old tracks songs to re-mix with this newfound knowledge. So, I inserted the JS summing VU which DOES show an embedded MCP UI.

That's nice, but in other tutorials I've seen for other VU plugins, you can set the 0 for the VU meter to be a specific db level, and I see no way to calibrate the JS VU so that zero is -18db.

Anyone have any thoughts on how to achieve what I want, to create a gain-staging FX chain that lets me quickly confirm input gain levels are hovering around the sweet spot visually in the mixer?
CrashAlpha is offline   Reply With Quote
Old 12-31-2019, 10:21 AM   #2
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

Sorry I can’t help with your specific request, but why not just use one of the loudness normalize actions and be done with?
ashcat_lt is online now   Reply With Quote
Old 12-31-2019, 11:29 AM   #3
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default

Quote:
Originally Posted by ashcat_lt View Post
Sorry I can’t help with your specific request, but why not just use one of the loudness normalize actions and be done with?
Different workflow approaches, I suppose. I consider normalizing a first step, gain-staging a second, as does this fellow I follow: https://youtu.be/qZ4nwz6f1Pg?t=174
CrashAlpha is offline   Reply With Quote
Old 12-31-2019, 12:00 PM   #4
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 29,260
Default

John's not saying anything different really than ashcat, the rule is still don't clip (when clipping applies), gain staging is a misused term in digital where it is more about organization and not running out of headroom as you mix (just like the video said). Of course we can get in the weeds about non-linear plugins that like ~n amount of gain but they have input knobs usually if non-linear and we need to use our ears anyway.

That said, if you recorded these tracks, and you observed nominal levels in preamps etc. they are already going to be at something in the -18 dBFS range unless you ran them hot on purpose. At the end of the day you can just loudness normalize them to something sensible and you are good to go.

I find it a waste of time to do all this metering/gain staging/VU duties when in reality if you just don't clip and reasonably organize levels (either during or after the fact) you will save a lot of time and everything will just work out fine.

TBH: If I have a bunch of tracks that when summed are a little hot, I just select all the items and bring their item volume down some, it really is that easy if we don't purposely try to over-complicate things.
__________________
Music is what feelings sound like.
karbomusic is offline   Reply With Quote
Old 12-31-2019, 12:05 PM   #5
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

Well anyway, hit the Edit button on the VU plugin. Scroll down to where it says @sample. Add the following lines right after that:


spl0 *= 8;
spl1 *= 8;


(semicolons are necessary. If you want more technically accurate, you'd use 10^(-18/20), but I think this thing uses the 6db = 2x approximation anyway, so...)

Then hit Ctl+S to save.
ashcat_lt is online now   Reply With Quote
Old 12-31-2019, 01:50 PM   #6
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default

Quote:
Originally Posted by ashcat_lt View Post
Well anyway, hit the Edit button on the VU plugin. Scroll down to where it says @sample. Add the following lines right after that:


spl0 *= 8;
spl1 *= 8;


(semicolons are necessary. If you want more technically accurate, you'd use 10^(-18/20), but I think this thing uses the 6db = 2x approximation anyway, so...)

Then hit Ctl+S to save.
Very much appreciated.
CrashAlpha is offline   Reply With Quote
Old 12-31-2019, 02:21 PM   #7
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default

Quote:
Originally Posted by ashcat_lt View Post
If you want more technically accurate, you'd use 10^(-18/20)
Sorry, can I ask for some clarification? I expected that this formula would produce approx 8 as per your previous code sample, but it produces 0.125893.
CrashAlpha is offline   Reply With Quote
Old 01-01-2020, 09:13 PM   #8
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default

Quote:
Originally Posted by ashcat_lt View Post
Well anyway, hit the Edit button on the VU plugin. Scroll down to where it says @sample. Add the following lines right after that:


spl0 *= 8;
spl1 *= 8;
.
Been looking for documentation on this. If this is done under @sample,would changing spl0 and spl1 actually change the output value? I. E. Would the VU meter now change the audio?
CrashAlpha is offline   Reply With Quote
Old 12-31-2019, 08:12 PM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

sidenote: Incidently I've posted a quite similar request recently, so I'm following with interest.
https://forum.cockos.com/showthread.php?t=229138
nofish is offline   Reply With Quote
Old 12-31-2019, 08:38 PM   #10
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

Quote:
Originally Posted by nofish View Post
so I'm following with interest.
Well I posted the simple answer.

You could add a slider if you wanted. Then you really would need to do the dB to ratio calculation.
ashcat_lt is online now   Reply With Quote
Old 01-01-2020, 08:27 PM   #11
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by ashcat_lt View Post
Well I posted the simple answer.

You could add a slider if you wanted. Then you really would need to do the dB to ratio calculation.
That was one part of my request, yes, thanks.
The other was the ballistics of that meter which I have a feeling are somehow off compared to other VU's I've used (or I haven't found the right settings).

E.g. with a 1 kHz sine test tone I get this:
nofish is offline   Reply With Quote
Old 01-01-2020, 09:06 PM   #12
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 95
Default

Quote:
Originally Posted by ashcat_lt View Post
Well I posted the simple answer.

You could add a slider if you wanted. Then you really would need to do the dB to ratio calculation.
That was the goal, to have a calibration slider.
CrashAlpha is offline   Reply With Quote
Old 01-02-2020, 10:20 AM   #13
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 643
Default

Quote:
Originally Posted by nofish View Post
sidenote: Incidently I've posted a quite similar request recently, so I'm following with interest.
https://forum.cockos.com/showthread.php?t=229138
VU Meter from Liteon misses proper VU meter ballistics: https://en.wikipedia.org/wiki/VU_meter
__________________
www.tbproaudio.de
TBProAudio is offline   Reply With Quote
Old 01-02-2020, 11:55 AM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by TBProAudio View Post
VU Meter from Liteon misses proper VU meter ballistics: https://en.wikipedia.org/wiki/VU_meter
That was my hunch too, thanks for confirming.
So my request still stands.
Embedable VU with proper ballistics.
nofish is offline   Reply With Quote
Old 01-02-2020, 12:49 PM   #15
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

The gfx stuff is over my head. I know it’s really just code, but I have mental block on that stuff. I could probably make a slider wiggle the way you want, but the embedable GUI part is something I couldn’t promise. I’ll maybe take another look one of these days if nobody comes along sooner.

Edit -
Actually wasn't that tough. This is a first attempt, and really kind of mess because it's hacked together from a couple different plugins, but it seems to work quite well. IDK if it really matches proper VU specs or whatever. Right now it's a nice smooth readout of the RMS based on an adjustable window. Has calibration slider. It also has actual audio output with (pre-meter) gain.

Haven't had a lot of times to test it. Hope it helps.

Code:
desc: LT VU Meter (Summed)
//tags: analysis visualization metering
//author: Liteon hacked by ashcat_lt 

slider1:300<0,1000,1>RMS size (ms)
slider2:0<0,2,1{Left,Sum,Maximum}>Channel 
slider3:-18<-24,-9,0.1>Calibrate (0VU = xdbFS)
slider4:0<-24,24,0.1>Gain (db)


in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output


@init
//st - sample time, sc - db scale, rp - right channel y pading, r - radius
rp = 261;
r = 200;
yl = yr = ylt = yrt = 74;
xl = xr = 66;
ms  = slider1;
cs = 0;
calibrate = 8;

function ratiotodb (x)
( x = 20 * log10 (x););

function dbtoratio (x)
( x = 10 ^(x/20););


function RMS_set(rms_ms)
  instance(coeff, icoeff)
(
  coeff = exp(-1/(rms_ms / 1000 * srate));
  icoeff = 1-coeff;
);

function RMS(input)
  instance(rms_s, coeff, icoeff)
(
  rms_s = (rms_s * coeff) + (icoeff * input * input);
  sqrt(rms_s);
);




@slider
rms_ms = slider1;
rms0.RMS_set(rms_ms);
calibrate = dbtoratio (-1 * slider3);
gain = dbtoratio (slider4);


@block


  rmsl_gfx = ratiotodb(rms_in);
  ool = min (6, max (-60, (rmsl_gfx  - slider3)));
  
  //get x from exp scale
  xlt = floor(exp(log(1.055)*2.1*ool)*285);
  
  //get y from x and radius - r     
  l=sqrt(sqr(r)+sqr(212-xlt));
  h=((l-r)*r/l);
  m=sqrt(sqr(l-r)-sqr(h));
  ylt=35+h;
  xlt < 212 ? xlt=xlt+m : xlt=xlt-m;
  
  //update x,y,out
  old_xl < xlt ? (xl = min(max(xlt,66),375); yl = ylt; );
  bscnt = pvl = pvr = 0;
;
//limit x
xl = min(max(xl,66),375);

olt = ratiotodb(peaksample);

@sample
spl0 *= gain;
spl1 *= gain;

slider2 == 0 ?
  (rms_in_0 = spl0;);
slider2 == 1 ?
  (rms_in_0 = (spl0 + spl1)/2) ;
slider2 == 2 ?
  (rms_in_0 = max(spl0, spl1)) ;


rms_in = rms0.RMS(rms_in_0);



peaksample = max (peaksample, rms_in_0);

@gfx 425 191
//**************************************************************** left
//red scale
gfx_r =  gfx_a = 1;
gfx_g = gfx_b =0;
gfx_x = 283;
gfx_y = 28;
gfx_drawnumber(0,0);
gfx_x = 370;
gfx_y = 55;
gfx_drawnumber(3,0);
gfx_x = 405;
gfx_y = 57;
gfx_drawchar($'+');
gfx_x = 283;
gfx_y = 38;
gfx_lineto(269,76,0.5);
gfx_x = 311;
gfx_y = 43;
gfx_lineto(293,80,1);
gfx_x = 342;
gfx_y = 51;
gfx_lineto(318,85,1);
gfx_x = 370;
gfx_y = 65;
gfx_lineto(344,93,0.5);

//white scale
gfx_r = gfx_g = gfx_b = 1;
gfx_a = 1;
gfx_x = 12;
gfx_y = 60;
gfx_drawchar($'-');
gfx_x = 41;
gfx_y = 53;
gfx_drawnumber(20,0);
gfx_x = 80;
gfx_y = 37;
gfx_drawnumber(10,0);
gfx_x = 125;
gfx_y = 29;
gfx_drawnumber(7,0);
gfx_x = 157;
gfx_y = 25;
gfx_drawnumber(5,0);
gfx_x = 198;
gfx_y = 24;
gfx_drawnumber(3,0);
gfx_x = 56;
gfx_y = 63;
gfx_lineto(82,92,0.5);
gfx_x = 95;
gfx_y = 47;
gfx_lineto(119,82,0.5);
gfx_x = 130;
gfx_y = 39;
gfx_lineto(146,77,0.5);
gfx_x = 145;
gfx_y = 37;
gfx_lineto(158,75,1);
gfx_x = 162;
gfx_y = 35;
gfx_lineto(171,74,0.5);
gfx_x = 180;
gfx_y = 34;
gfx_lineto(187,74,1);
gfx_x = 202;
gfx_y = 34;
gfx_lineto(204,72,0.5);
gfx_x = 227;
gfx_y = 34;
gfx_lineto(223,73,1);
gfx_x = 253;
gfx_y = 35;
gfx_lineto(245,73,1);

//vu box border
gfx_r = gfx_g = gfx_b = 0.75;
gfx_a = 1;
gfx_x = 198;
gfx_y = 108;
gfx_rectto(241,139);
//vu box
gfx_a = 1;
gfx_r = 0.5;
gfx_g = gfx_b = 0.1;
gfx_x = 200;
gfx_y = 110;
gfx_rectto(239,137);
//vu text
gfx_r = gfx_g = gfx_b = 0.85;
gfx_a = 1;
gfx_x = 212;
gfx_y = 120;
gfx_drawchar($'V');
gfx_drawchar($'U');

//meter
olt > 0 ? (
  gfx_r = 1; 
  gfx_g = gfx_b = 0;
) : (
  gfx_r = gfx_g = gfx_b = 1;
);
gfx_a = 1;
gfx_x = 212;
gfx_y = 236;
gfx_lineto(xl,yl,1);
gfx_x = 211;
gfx_y = 236;
gfx_lineto(xl-1,yl,1);
gfx_x = 210;
gfx_y = 236;
gfx_lineto(xl-2,yl,1);

//big border
gfx_r = gfx_g = gfx_b = 0.55;
gfx_a = 1;
gfx_x = 0;
gfx_y = 179;
gfx_rectto(425,180);
//big box 1
gfx_r = 0.1;
gfx_g = 0.2; 
gfx_b = 0.39;
gfx_a = 1;
gfx_x = 0;
gfx_y = 180;
gfx_rectto(425,261);
//big box 2 
gfx_r = gfx_g = gfx_b = 1;
gfx_a = 0.1;
gfx_x = 0;
gfx_y = 180;
gfx_rectto(425,190);
//big box 3
gfx_r = gfx_g = gfx_b = 0;
gfx_a = 0.3;
gfx_x = 0;
gfx_y = 245;
gfx_rectto(425,261);
//ch textbox1
gfx_r = gfx_g = gfx_b = 0;
gfx_a = 1;
gfx_x = 350;
gfx_y = 210;
gfx_rectto(415,227);
//ch textbox2
gfx_r = gfx_g = gfx_b = 0;
gfx_a = 1;
gfx_x = 250;
gfx_y = 210;
gfx_rectto(315,227);
//ch text
gfx_r = gfx_g = gfx_b = 1;
gfx_a = 1;
gfx_x = 20;
gfx_y = 215;
gfx_drawchar($'L');
gfx_drawchar($'+');
gfx_drawchar($'R');
gfx_x = 215;
gfx_drawchar($'R');
gfx_drawchar($'M');
gfx_drawchar($'S');
gfx_x = 333;
gfx_drawchar($'P');
gfx_x = 255;
rmsl_gfx > -300 ? (
  rmsl_gfx > 0.0 ? (
    gfx_r = 1;
    gfx_g = gfx_b = 0;
    gfx_drawchar($'+');
  );
  gfx_drawnumber(rmsl_gfx,2);
) : (
  gfx_drawchar($'-');
  gfx_drawchar($'I');
  gfx_drawchar($'N');
  gfx_drawchar($'F');
);
gfx_r = 1;
gfx_g = gfx_b = 1;
gfx_x = 355;
olt > -300 ? (
  olt >= 0.0 ? (
    gfx_drawchar($'+');
    gfx_r = 1;
    gfx_g = gfx_b = 0;  
  );
  gfx_drawnumber(olt,2);
) : (
  gfx_drawchar($'-');
  gfx_drawchar($'I');
  gfx_drawchar($'N');
  gfx_drawchar($'F');
);

Last edited by ashcat_lt; 01-03-2020 at 03:13 PM.
ashcat_lt is online now   Reply With Quote
Old 01-03-2020, 12:53 PM   #16
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

Guess i should have made a new post so everybody would get notifications. See my edit above and let me know what you think.

I have ideas for a couple different responses and a sort of automatic gain staging routine, but I’m afk til later tonight.
ashcat_lt is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.