Human being with feelings
Join Date: Dec 2012
Posts: 5,302

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 (premeter) 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 = 1coeff;
);
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(212xlt));
h=((lr)*r/l);
m=sqrt(sqr(lr)sqr(h));
ylt=35+h;
xlt < 212 ? xlt=xlt+m : xlt=xltm;
//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(xl1,yl,1);
gfx_x = 210;
gfx_y = 236;
gfx_lineto(xl2,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; 01032020 at 03:13 PM.
