Old 12-31-2019, 08:06 AM   #1
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
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: 5,158
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 offline   Reply With Quote
Old 12-31-2019, 11:29 AM   #3
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
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: 26,714
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: 5,158
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 offline   Reply With Quote
Old 12-31-2019, 01:50 PM   #6
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
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: 74
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 12-31-2019, 03:14 PM   #8
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Quote:
Originally Posted by CrashAlpha View Post
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.
Yeah sorry. Should by 18/20 (not negative). Your result is, of course, very close to 1/8.
ashcat_lt 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: 9,911
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: 5,158
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 offline   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: 9,911
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: 74
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-01-2020, 09:13 PM   #13
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
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 01-01-2020, 09:44 PM   #14
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Quote:
Originally Posted by CrashAlpha View Post
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?
This plugin has no audio output. It will only affect the meter.


So you know how to add a slider in there? I would suggest just sticking it at the end of the list and giving it the next ordinal number so that you don't have edit references to existing sliders. Give it some reasonable range in db. Then, in @slider do something like:


calibrate = 10 ^ (sliderx/20); //where x is your calibration slider number


and then in @sample, we'll replace the 8 with calibrate:


spl0 *= calibrate;
spl1 *= calibrate;



And it should be at least really damn close. Like I said, the rest of the plugin seems to use 2^(db/6) which is not technically correct and doesn't even match Reaper's own meters, but it's a **** hair's difference at most.


Edit - I also noticed the jitter in the meter, and had trouble finding a setting to make it stop. I kind of assumed it had something to do with the windowing of the RMS calculation. I honestly didn't look very far at all into how they do that part, but there can be glitches in some of these kinds of calculations depending on how the window relates to the frequency of the test tone, and even though I was using a square wave which really shouldn't do that, like every meter, scope, or display in every JS plugin is weird and glitchy, so... Ultimately, there are things happening at the sample block frequency, at the window time frequency, at individual sample frequency, and at gfx frequency such that I think it would almost a miracle if it actually worked smoothly.

Last edited by ashcat_lt; 01-01-2020 at 09:54 PM.
ashcat_lt is offline   Reply With Quote
Old 01-02-2020, 09:19 AM   #15
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by ashcat_lt View Post
This plugin has no audio output. It will only affect the meter.

So you know how to add a slider in there?
Yes, thanks - that's exactly what I did and got that working. Then I realized that I could just as well add a gain volume in there, and thought a copy-paste from the simple JS volume adjustment FX would work, then I became concerned.

But this all started because the JS Volume adjustment FX doesn't expose an embedded UI for MCP, and I couldn't find anyone who knew how to do that. I thought it would be interesting to have a UI showing summed in vs out would be handy, moving it between input and FX and between them on the MCP strip.
CrashAlpha is offline   Reply With Quote
Old 01-02-2020, 10:20 AM   #16
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 565
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.tb-software.com/TBProAudio
TBProAudio is offline   Reply With Quote
Old 01-02-2020, 11:55 AM   #17
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,911
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   #18
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
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 offline   Reply With Quote
Old 01-03-2020, 12:53 PM   #19
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
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 offline   Reply With Quote
Old 01-03-2020, 02:01 PM   #20
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,000
Default

Quote:
Originally Posted by ashcat_lt View Post
Guess i should have made a new post so everybody would get notifications. See my edit above and let me know what you think.
You should probably paste the code in CODE tags, I get error, @init:31: missing ) or ].
Edgemeal is offline   Reply With Quote
Old 01-03-2020, 03:15 PM   #21
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Quote:
Originally Posted by Edgemeal View Post
You should probably paste the code in CODE tags, I get error, @init:31: missing ) or ].
Poop. Sorry. I changed the tags in my post above. Hopefully that helps???
ashcat_lt is offline   Reply With Quote
Old 01-05-2020, 09:21 AM   #22
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

I tried copying the code above into a new JS and it seemed to compile fine. Is this not what y’all were looking for?

Edit - also it lets you choose how it should handle metering for stereo inputs. It will either just work with the left channel, sum the two channels, or just whichever is louder from sample to to sample. None of that will affect the audio output, but the gain slider affects both the meter and the output.

Last edited by ashcat_lt; 01-05-2020 at 09:32 AM.
ashcat_lt is offline   Reply With Quote
Old 01-05-2020, 11:21 PM   #23
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

The one above doesn't have the code to make it embed properly. I posted one that works on nofish's thread.


https://forum.cockos.com/showpost.ph...49&postcount=9


Includes calibration, 3 detector types, manual gain, and an automatic gain routine
ashcat_lt is offline   Reply With Quote
Old 01-08-2020, 09:28 PM   #24
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by ashcat_lt View Post
I tried copying the code above into a new JS and it seemed to compile fine. Is this not what yíall were looking for?

.
I am so sorry, I need to check my notification settings, I had no idea that you had scripted this. I look forward to trying this out whrn I get to my DAW. Thanks so much!
CrashAlpha is offline   Reply With Quote
Old 01-09-2020, 11:04 AM   #25
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Make sure you follow the link from my last post here. The version that actually works is at the bottom of that thread. It has a lot of weird options, but default should be about right for most people.
ashcat_lt is offline   Reply With Quote
Old 01-11-2020, 10:23 AM   #26
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by ashcat_lt View Post
Make sure you follow the link from my last post here. The version that actually works is at the bottom of that thread. It has a lot of weird options, but default should be about right for most people.
Great stuff. I'd like to change the defaults to have practical general use values.

Meter: The default meter time of 0 of course caused it to jump around wildly (it so happened I just randomly picked a drum track, great way to illustrate that). 175ms seems to work nicely on both drum and vocals.

Channel: I used Channel Sum - I saw your code modified the RMS to make sure it didn't divide by two, can I assume Sum it will work correctly for a mono source?

Caliibrate: As a tool aimed for Gain staging (I know, over-hyped topic and now I see it raging on YouTube I agree), I set it to -18. I wonder if -18 or -12 is a good general use value though. Personal taste, but again as a default, what's useful?

EDIT: after writing all that, now I see defaults for calibration, meter time = 300, channel left calibrate -18, etc. So, when I first opened and compiled it saved the file under Gain Stage Control (just a name I picked) I changed the desc to the same. But it keeps on showing up in my FX list as LT VU Meter (summed), same for the title in the FX listing. So, when I first compiled it didn't have these defaults but had the right name, but subsequently DID have the defaults but the wrong name. Clearing cache and rescanning for VSTs didn't change it (I was hoping it was a JS cache issue). Any ideas?

Detector: RMS for (I think) obvious reasons)

Autogain: Yikes. Took me a few seconds to figure out why the volumes suddenly jumped to deafening and didn't go back when turned off, but later noticed the +24 jump on Gain (you know, drums). Definitely default to zero. Maybe I'll modify the code to have it return to the default gain when turned off.

I'd appreciate any thoughts you have on the settings, and again thank you for this tool.

Last edited by CrashAlpha; 01-11-2020 at 10:46 AM.
CrashAlpha is offline   Reply With Quote
Old 01-11-2020, 10:51 AM   #27
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

EDIT: I created the control via Create new JS, saved and compiled under Gain Stage Control, also edited desc to contain that name. This put it in the default user roaming folder. It didn't open with those defaults but the right name. Since I have opened it again, it appears as the LT VU Meter (summed) control but DOES have useful defaults. So, wrong name, right behaviour. Clearing the VST cache didn't change it (I was hoping this was somethign wrong with the JS cache). I don't see anywhere else to change the FX name. When I edit it, it clearly says:

//tags: analysis visualization metering
//author: Liteon hacked by ashcat_lt

So, I'm opening the right file, and the path in the editor confirms it. Ever seen this before?
CrashAlpha is offline   Reply With Quote
Old 01-11-2020, 01:49 PM   #28
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

So naming JS plugs can be weird, and Iím not sure I completely understand it. All I can do is tell you what I think I know and hope it helps. When you do ďCreate new JSĒ, it pops up a window to name the plugin. Whatever you type there becomes the actual file name for the plugin on your drive. This is also what it will display on the track because at this point it has nothing else. The desc: line is what is actually supposed to display both in the FX Finder and in the FX chain, but just changing that wonít change the displayname of any instances that are already in the project. If you changed that line and saved/recompiled and itís not coming up by the new name in the finder and showing that name for new instances, idk what to tell you.

Somewhat similarly, when you made the new JS, it had a set of sliders already and they were all set to 0. When you paste my code over what was already there and recompile, it doesnít move those sliders. To get that instance to default settings, youíd just have to double-click each of the sliders. Or delete that instance and add a new one.

AutoGain is experimental, might not be the best way to do it, and probably isnít great for drums anyway. You might try setting the Time slider as high as it goes and setting Calibration a bit lower to get something a bit more appropriate, but itíd still be kind of hit or miss. The crest factor of a drum track usually is really big because itís usually a lot of silence (compared to other more sustained instruments) with short sudden bursts of really loud. It averages out to pretty small.

Now it shouldnít really do anything when AutoGain is actually set to 1. It is calculating, but wonít change gain or anything else as long as that is 1. When you switch it back to 0, it moves the Gain slider to whatever value it decided on and leaves it there. You can adjust that as necessary and if you want to get back to default, double click the slider. The idea you had to have it ďundoĒ AutoGain wonít work without a lot of rethinking because the automatically calculated gain isnít actually applied until you set it to 0, so youíd pretty much never actually get the automatic gain at all. In which case, you might as well just leave it or even delete that slider altogether.

I think Iím going to look into adding LUFS as an option and also an ďinfinite timeĒ integrated option. Donít hold your breath on that, but Iíll let you know when/if I get it done.
ashcat_lt is offline   Reply With Quote
Old 01-11-2020, 05:05 PM   #29
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by ashcat_lt View Post
So naming JS plugs can be weird, and Iím not sure I completely understand it.
I'm suspecting there's an issue with using mixed case or spaces as the file name. It asked me to name the effect, I named it "Gain Stager" and it opened with the name "new effect" this time. The original JS instance had the right name (i.e. the one I had inserted) but subsequent copyies caused the "new effect" name to manifest.

So, i think there's an undocumented issue with either spaces or mixed case. I then created it with the name gain_stager and modified the desc with the name Gain Stager, moved it to the utility sub-folder and everything works as expected. And perhaps choking on the name causes it to pull the previously-working name out of a cache.

I had also done some other things that I don't think affected the outcome, but as a developer that bellows at anyone that creates properties with unconventional names because it is just asking for trouble, I am sheepishly admitting that maybe I should take my own advice.
CrashAlpha is offline   Reply With Quote
Old 01-11-2020, 10:32 PM   #30
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by ashcat_lt View Post
I tried copying the code above into a new JS and it seemed to compile fine. Is this not what y’all were looking for?
So, I actually had real world use for this today. I had an out of control guitar solo and having the VU meter in the Mix console with the VU meter showing AND including the Gain parameter control show in the strip allowed me to locate a hot spot between FXs and since they weren't actually clipping, use the gain reduction right there and it tamed the track.
CrashAlpha is offline   Reply With Quote
Old 01-12-2020, 11:22 AM   #31
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

The only useful VU-JSFX with correct ballistics that I know of was written by Chris S. I modified it to look a bit nicer and to make the meter values readable from scripts like LBX Stripper.
But to be honest - I have no idea how to modify @gfx so that the UI in the MCP scales correctly. Maybe someone here is smarter than me.

Zeno is offline   Reply With Quote
Old 01-12-2020, 12:30 PM   #32
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Zeno - that one doesn’t appear to have integrated gain control, which was one of the asks here. Have you tried mine? If you click through to the other thread, there is some discussion of what part of the code does the scaling that might give you some insight. It involves like overriding functions and I’m not sure how that actually works. Like if yours uses other functions that also need overridden, I guess you have to just sort that out cause it wouldn’t be a straight copy/paste.
ashcat_lt is offline   Reply With Quote
Old 01-12-2020, 02:56 PM   #33
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

Quote:
Originally Posted by ashcat_lt View Post
Zeno - that one doesnít appear to have integrated gain control, which was one of the asks here. Have you tried mine? If you click through to the other thread, there is some discussion of what part of the code does the scaling that might give you some insight. It involves like overriding functions and Iím not sure how that actually works. Like if yours uses other functions that also need overridden, I guess you have to just sort that out cause it wouldnít be a straight copy/paste.
If spl0 and spl1 is defined as input for the meter as well as for the gain, then the meter refers to the input, not to the gain.
Basically, the meter must be built around the input gain.
I think this can be done for example by not choosing spl0 and spl1 for the meter readout, but by giving "spl0/spl1 +/- the current gain value" a name and choosing this name as reference for the meter readout.
Zeno is offline   Reply With Quote
Old 01-12-2020, 03:05 PM   #34
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

I'm not sure what you're talking about. Mine applies the gain before everything else so that it affects both the meter and the audio output. I can't imagine why you would want it to be otherwise.
ashcat_lt is offline   Reply With Quote
Old 01-12-2020, 03:57 PM   #35
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

Quote:
Originally Posted by ashcat_lt View Post
I'm not sure what you're talking about. Mine applies the gain before everything else so that it affects both the meter and the audio output. I can't imagine why you would want it to be otherwise.
i've referred your statements about scaling to the gain function, but i just realized that this was related to the embedded ui. oops
and yes, i looked at your version of the LT VU meter, but the ballistics of the meter is not correct.

look here:

Zeno is offline   Reply With Quote
Old 01-12-2020, 04:20 PM   #36
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,158
Default

Ah. Gotcha. That was kinda two different thoughts. One based on the request of the OP here, and the other on your question about how to make it embed properly.



I honestly never promised it would be "correct" to real VU ballistics, but I notice you're in RMS mode. I promise it's accurate for that. I'd be interested to see this compared to maybe the Slew mode, though. The way I read the actual VU definition/spec made me think that would be more "realistic", but IDK.


I actually have no use for this plugin at all. Just trying to help.
ashcat_lt is offline   Reply With Quote
Old 01-12-2020, 06:14 PM   #37
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

Quote:
Originally Posted by ashcat_lt View Post
I'd be interested to see this compared to maybe the Slew mode, though.
yes, this is a bit closer to the real behaviour of the needle, or to the behaviour of other vu meter plugins.

Zeno is offline   Reply With Quote
Old 01-13-2020, 09:08 AM   #38
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

Quote:
Originally Posted by ashcat_lt View Post
that one doesnít appear to have integrated gain control, which was one of the asks here.
Good point. Now it has one. There are also some hidden sliders for the meter response and damping, except for the sliders for the Vu-meter display itself and the peak LEDs that can be used as triggers (the Warn Level slider then acts as a threshold).
In combination with volume-slider parameter modulation (VU Left //Hidden), this even results in a pretty decent compressor. Make the response slider visible and you get a parameter for the compression timing.




Code:
//********************************************************************
// Simple VU Meter - a fine freeware by chris-s
// V1.1; 10-Jan-2017
// Disclaimer: Use of this software is on your own risk

// Modified by Zeno
// V1.3; 13-Jan-2020
   - graphic appearance: color scheme adapted, more modern look
   - added volume slider for gain adjustments
   - added hidden sliders for peak LEDs left/mid and right/side
   - added hidden sliders for vu meter readout left/mid and right/side

   Hidden sliders can be used as triggers for scripts and modulation envelopes !!

//*************************************** END INFO ****************/



desc:VU Meter (ZenoMOD)
//tags: analysis analyze vu meter
//author: chris-s , Zeno

// hidden sliders: remove the "-" in front of the name to activate

slider1:-18<-20,0,0.5>Ref Level
slider2:-6<-20,0,0.1>Warn Level
slider3:50<0,100,1}>-Response  // Hidden
slider4:0<0,2,1{Stereo,Mono,Mid/Side}>Mode
slider5:0.0053<0,.01,0.0001>-Damping  // Hidden
slider6:0<-12,12,0.1>Volume (dB)

slider50: -20<-20,3>-VU Left/Mid  // Hidden     
slider51: -20<-20,0,3>-VU Right/Side  // Hidden
slider52: 0<0,1>-Peak LED L  // Hidden
slider53: 0<0,1>-Peak LED R  // Hidden

  
// Hide side meters
in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output

options:no_meter
 
/***************************************** END DESC *****************/



@init

//========================================= VOLUME ==================/
AMP_dB_i=1/8.68588963806504;

db=slider6; // initialize here but not in @slider for playback start


//======================================== VU METER =================/
errcnt = 0;
tot_nbr_spl = 0;
scnt = 0;

fact_up = 0;

offset = 0.0074;

nd_posL = nd_posR = 0;
nd_speedL = nd_speedR = 0;

dt = 10 / srate;

mom = 0.00042;
damp = 1 - 0.0053 * (48000 / srate);

dbL = dbR = 0;
overL = overR = 0;


print = 10;
print[0] = -20;
print[1] = -10;
print[2] = -7;
print[3] = -5;
print[4] = -3;
print[5] = -2;
print[6] = -1;
print[7] = 0;
print[8] = 1;
print[9] = 2;
print[10] = 3;


pos = 30;
pos[0] = 0;
pos[1] = .1650;
pos[2] = .2641;
pos[3] = .3519;
pos[4] = .4626;
pos[5] = .5284;
pos[6] = .6022;
pos[7]  = .6849;
pos[8]  = .7779;
pos[9] = .8822;
pos[10] = 1;

/**************************************** END @INIT *****************/



@slider

//======================================== VOLUME ===================/
ddb=0.0;


//======================================== VU METER =================/
fact_up = 10 ^ (( -slider1 - 10)/20) * 0.3785 ;

wl   = slider2;
mode = slider4;
lim = 10 ^ (wl / 20);

mom = 0.00010 + 0.00032 *  slider3^3 / 125000;   

damp = 1 - slider5 * (48000 / srate);

/**************************************** END @SLIDER ***************/



@block

//========================================= VOLUME ==================/
cnt=0;
ddb=0.0;

db_chg_splpos=slider_next_chg(1, tgtdb);
db_chg_splpos > 0 ? 
(
  db=slider6;
) : (
  tgtdb = slider6;
  db_chg_splpos = samplesblock;
);

ddb=(tgtdb-db)/db_chg_splpos;

/**************************************** END @BLOCK ****************/



@sample

//========================================= VOLUME ==================/
cnt == db_chg_splpos ? 
(
  ddb=0.0;
  db_chg_splpos=slider_next_chg(1, tgtdb);
  db_chg_splpos > cnt ? 
  (
    ddb=(tgtdb-db)/(db_chg_splpos-cnt);
  );
);


adj=exp(db*AMP_DB_i);

spl0 *= adj;
spl1 *= adj;

db += ddb;
cnt += 1;


//======================================== VU METER =================/
tot_nbr_spl += 1;

smpL = spl0; 
smpR = spl1;

mode == 1 ? ( 
  smpL = (spl0 + spl1) * 0.5;
  smpR = smpL;  
);

mode >= 2 ? ( 
  smpL = (spl0 + spl1) * 0.5;
  smpR = (spl0 - spl1) * 0.5;  
);

smpL = abs(smpL);
smpR = abs(smpR);

 
scnt += 1;

scnt === 10 ? (
    
	// move left needle
  
    force = smpL * fact_up  -  (nd_posL * .1 + offset);
    
    nd_speedL += force * dt / mom;  
    nd_speedL = nd_speedL * damp;
    nd_posL += nd_speedL * dt;
    nd_posL < 0 || nd_posL > 1 ? nd_speedL = 0;
  
    nd_posL = min(max(nd_posL,0),1);
  
    // move right needle

    force = smpR * fact_up  - (nd_posR * .1 + offset);
    
    nd_speedR += force * dt / mom;  
    nd_speedR = nd_speedR * damp;
    nd_posR += nd_speedR * dt;
    nd_posR < 0 || nd_posR > 1 ? nd_speedR = 0;
  
    nd_posR = min(max(nd_posR,0),1);
     
    overL -= 10;
    overR -= 10;

    scnt = 0;
  
);
tot_nbr_spl_g  = tot_nbr_spl;

overL_g = overL;
overR_g = overR;
nd_posL_g = nd_posL;
nd_posR_g = nd_posR;

tot_nbr_spl_g === tot_nbr_spl ? (

  dbL = (nd_posL_g * 23) - 20;
  dbR = (nd_posR_g * 23) - 20;
  
) : (
  errcnt += 1; // thread collision
);


smpL > lim ? overL = srate;
smpR > lim ? overR = srate;


slider50 = dbL;   //LBX ZenoMOD
slider51 = dbR;   //LBX ZenoMOD
slider52 = overL_g;
slider53 = overR_g;

/**************************************** END @SAMPLE ***************/



@gfx 480 200


// paint gfx 

fontinit != 1 ? (
  gfx_setfont(1, "Arial", 14, '');
  gfx_setfont(2, "Arial", 20, 'b');

  fontinit = 1;
);

gfx_a = 1;

w1 = $pi * 16.5 / 180; 
w2 = $pi * 45 / 180;

xw = max(1,floor((gfx_w-30) / 2));
yw = floor(xw / 1.5);

r1 = floor(yw * 0.85);


chan = 0;

while (chan <= 1) (

  xd = 10 + chan*(xw+10);
  mode === 1 ? xd += floor(xw/2);
  
  yd = 10;

  xa = floor(xd + xw / 2);
  ya = floor(yd + yw * 1.1);

  // meter backgr
     
  gfx_r=0;gfx_g=1;gfx_b=.9;  
  gfx_rect(xd,yd,xw,yw);
     
  // scale   
  
  gfx_r=gfx_g=gfx_b = 0; // black 
  gfx_arc(xa, ya, r1, -45 * ($pi / 180), w2, 1);

  gfx_r=.95; gfx_g=0; gfx_b = 0; // red 
  gfx_arc(xa, ya, r1 + 1, w1, w2, 1);
  gfx_arc(xa, ya, r1 + 2, w1, w2, 1);  
  gfx_arc(xa, ya, r1 + 3, w1, w2, 1);  
  gfx_arc(xa, ya, r1 + 4, w1, w2, 1);    
  
   
  gfx_setfont(1);
  
  gfx_r=gfx_g=gfx_b = 0.2; // black 
  
  jj = 0;
  while ( jj <= 10 ) (
  
    ii = print[jj];
    
    ph =  pos[jj];
    ph = (45 + ph*90) * $pi / 180; 
	  
    cosp = cos(ph) * r1;
    sinp = sin(ph) * r1;
    
    x1 = xa - cosp ;
    y1 = ya - sinp ;

    x2 = xa - cosp * 1.1;
    y2 = ya - sinp * 1.1;

    x3 = xa - cosp * 1.12;
    y3 = ya - sinp * 1.12;

    gfx_x = x1;
    gfx_y = y1 ; 
    gfx_lineto(x2, y2);
	
    gfx_x = x3 - 7;   
    gfx_y = y3 - gfx_texth;
   
    gfx_printf("%3d", ii);
   
    jj += 1;
   
    jj == 8 ? ( gfx_r = 1; gfx_g = gfx_b = 0 );  
  ); 
  
  
  // Peak
    
  gfx_r=gfx_g=gfx_b = 0.0; // black 
    
  gfx_x = xd + xw * .9 - 30;
  gfx_y = yd + yw * .9 - 10;
  gfx_drawstr("PEAK");
  
  // VU
  
  gfx_setfont(2); // large
  gfx_r=gfx_g=gfx_b = 0.0; // black 
  
  gfx_x = xa - 10;
  gfx_y = yd + yw * .6;
  gfx_drawstr("VU");
  
  
  // draw LEDs
  
  gfx_r = .95; gfx_g = gfx_b = 0.1; // red 
    
  (chan == 0 && overL_g > 0) || (chan == 1 && overR_g > 0)  ? (   
     gfx_circle(xd + xw*0.9 + 6, yd + yw * 0.9 - 4, 4, 1, 1);
  );
  
  
  // draw needle
  
  chan == 0 ? ph = dbL : ph = dbR;

  ph = 45 + (ph+20)/23*90; 
  ph = ph * ($pi / 180);
	
  cosp = cos(ph);
  sinp = sin(ph);
    
  x1 = xa - cosp * r1 * 0.15;
    y1 = ya - sinp * r1 * 0.15;
  
    x2 = xa - cosp * r1 * 1.1;
    y2 = ya - sinp * r1 * 1.1;
  
    gfx_r=gfx_g=gfx_b = 0; // black                   
  
    gfx_x = x1;
    gfx_y = y1; 
    gfx_lineto(x2, y2);
  
    gfx_x = x1+1;
    gfx_y = y1;
    gfx_lineto(x2+1, y2);
  
    gfx_x = x1+4;
    gfx_y = y1; 
    gfx_lineto(x2+4, y2);
 
    gfx_r=gfx_g=gfx_b = 1; // white 
	
    gfx_x = xd;
    gfx_y = yd+yw+2;
	  
    chan == 0 ?
	 gfx_drawstr("LEFT / MID") :
	 gfx_drawstr("RIGHT / SIDE") ;
	
    chan += 1;
    
    mode === 1 ? chan += 1;
  );
  
  
/******************************************** EOF *******************/

Last edited by Zeno; 01-13-2020 at 05:34 PM.
Zeno is offline   Reply With Quote
Old 01-13-2020, 04:34 PM   #39
CrashAlpha
Human being with feelings
 
CrashAlpha's Avatar
 
Join Date: May 2010
Posts: 74
Default

Quote:
Originally Posted by Zeno View Post
Good point. Now it has one.
Nice! When last I tried this VU, the meter UI created an ugly jumble in the MCP. Is this just a scaling issue?
CrashAlpha is offline   Reply With Quote
Old 01-13-2020, 05:04 PM   #40
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: Germany
Posts: 368
Default

Quote:
Originally Posted by CrashAlpha View Post
Nice! When last I tried this VU, the meter UI created an ugly jumble in the MCP. Is this just a scaling issue?
Yes, this is a scaling problem.
Unfortunately, I have not yet found any useful documentation on the topic of embedded ui and scaling to be able to tackle this specifically.
Zeno is offline   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 01:49 AM.


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