COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 04-20-2017, 02:41 PM   #1
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default Gain Reduction Meter Help

I'm tring to use vu meter as gain reduction meter.Used vu meter from MultiTarget example.

As vu meter,it's working good.But not as gr meter.

My gr meter working like this; "in - out".Just simple idea.It's working but if input signal is low level,meter doesn't work properly.

For example when input level around 0 dB with -6 dB reduction,meter shows reduction properly.But when input level around -6 dB with -6 dB reduction,meter shows 2 dB or less reduction.So when input signal low,gr meter not showing correctly...

What is your method?Are you using simple meter example or another one?

I really need help about that.

Thanks.
Tunca is offline   Reply With Quote
Old 04-28-2017, 09:15 AM   #2
ConnorLRSS
Human being with feelings
 
ConnorLRSS's Avatar
 
Join Date: Mar 2017
Location: Halifax, NS, Canada
Posts: 11
Default

For my GR meter, I input GR values from each frame into an envelope follower to get the correct rise and fall motion. Then I normalize the value of the envelope and use it to position the needle.

I'm not quite sure what you're trying here. It would really help if you could post some code.
ConnorLRSS is offline   Reply With Quote
Old 04-29-2017, 02:50 PM   #3
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

My meter code like this;

const double METER_ATTACK = 0.6, METER_DECAY = 0.05;
double xL = (peakL < prevL ? METER_DECAY : METER_ATTACK);
double xR = (peakR < prevR ? METER_DECAY : METER_ATTACK);


peakL = peakL * xL + prevL * (1 - xL);
peakR = peakR * xR + prevR * (1 - xR);


prevL = peakL;
prevR = peakR;

peakL = std::max(peakL , *in1 ); (unprocessed)
peakR = std::max(peakR , input ); (processed)

But when input level is low,GR meter show half value.
Tunca is offline   Reply With Quote
Old 05-02-2017, 09:56 AM   #4
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Any advice?
Tunca is offline   Reply With Quote
Old 05-02-2017, 11:33 AM   #5
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 313
Default

You are using absolute values for the input, right?
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 05-02-2017, 12:10 PM   #6
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by random_id View Post
You are using absolute values for the input, right?
Absolute value?

I'm not doing anything with input signal.
Tunca is offline   Reply With Quote
Old 05-02-2017, 03:25 PM   #7
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 313
Default

I mean like this;
peakL = std::max(peakL , std::abs(*in1));
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 05-02-2017, 03:30 PM   #8
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by random_id View Post
I mean like this;
peakL = std::max(peakL , std::abs(*in1));
Oh.Now tried that but still same.
Tunca is offline   Reply With Quote
Old 05-03-2017, 09:10 AM   #9
ConnorLRSS
Human being with feelings
 
ConnorLRSS's Avatar
 
Join Date: Mar 2017
Location: Halifax, NS, Canada
Posts: 11
Default

Sorry for the late response.

Is "*in" the input sample and "input" the gain reduction?
If so, are you taking the absolute value of input as well?
Because if your gain reduction is negative, then your peak value will never descend.
For instance:

input = -6 and peak = 2

prev = peak
prev = 2

peak = max(2, -6)
peak = 2

then...

xL = (peak < prev ? METER_DECAY : METER_ATTACK)
xL = METER_ATTACK

peak = peak * METER_ATTACK + prev * (1 - METER_ATTACK)
peak = 2 * 0.6 + 0.4 * 2
peak = 2

Then this will repeat. Peak will always stay at 2 until the gain reduction goes above 2. Do you see what I mean?

This is my code for a VU meter. I'm not sure if this is conventional but it seems to work.
Code:
double VUEnvelopeFollower::Process (double input)
{
    double absInput = fabs(input);
    
    if (absInput > envelope) {
        absInput *= (1.0 + overshoot);
        envelope = attackCoeff * (envelope - absInput) + absInput;
    }
    else {
        absInput *= (1.0 - overshoot);
        envelope = releaseCoeff * (envelope - absInput) + absInput;
    }
    
    return envelope;
}
Where:
Code:
#define LOG_POINT_ZERO_ONE -4.60517018599

attackS = 0.3 // Rise time in seconds
releaseS = 0.3 // Fall time in seconds

attackCoeff = exp(LOG_POINT_ZERO_ONE / (attackS * sampleRate));
releaseCoeff = exp(LOG_POINT_ZERO_ONE / (releaseS * sampleRate));

overshoot = 0.0125;
I hope this helps!

Last edited by ConnorLRSS; 05-03-2017 at 04:32 PM.
ConnorLRSS is offline   Reply With Quote
Old 09-07-2017, 01:12 PM   #10
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Hi,

Still need about GR meter.

When input level is low,meter not showing reduction correctly.
Tunca is offline   Reply With Quote
Old 09-07-2017, 03:27 PM   #11
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 576
Default

Quote:
Originally Posted by Tunca View Post
Hi,

Still need about GR meter.

When input level is low,meter not showing reduction correctly.
It won't show the correct value if you are just subtracting. Gain reduction is a scalar, which means you need to divide, not subtract.

If the gain reduction is 6dB, then the output will be input/2, no matter what the input level is. Of course, this will break when you get to zero.

Why not just use your actual gain reduction value to send to meter instead of trying to recalculate it? I would assume that if you are applying some amount of gain reduction, you have already calculated that gain reduction value. Just convert that value to dB and send it to your meter.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 09-08-2017, 05:25 AM   #12
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by bozmillar View Post
It won't show the correct value if you are just subtracting. Gain reduction is a scalar, which means you need to divide, not subtract.

If the gain reduction is 6dB, then the output will be input/2, no matter what the input level is. Of course, this will break when you get to zero.

Why not just use your actual gain reduction value to send to meter instead of trying to recalculate it? I would assume that if you are applying some amount of gain reduction, you have already calculated that gain reduction value. Just convert that value to dB and send it to your meter.
I can't send gr value to meter.My recfier and gr in .inl file.I can't assign it in my main.cpp.How can i do that?

Can you show the way,please?
Tunca is offline   Reply With Quote
Old 09-08-2017, 01:37 PM   #13
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 576
Default

Quote:
Originally Posted by Tunca View Post
I can't send gr value to meter.My recfier and gr in .inl file.I can't assign it in my main.cpp.How can i do that?

Can you show the way,please?
make your compressor return the gain reduction value so you can apply it to the graphics.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 09-09-2017, 01:14 AM   #14
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by bozmillar View Post
make your compressor return the gain reduction value so you can apply it to the graphics.
How can i do that? Can you tell me,please?
Tunca is offline   Reply With Quote
Old 09-09-2017, 01:28 PM   #15
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 576
Default

Well, it's hard to help without seeing your code. How are you calculating the gain reduction in the compressor algorithm?
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 09-10-2017, 12:50 AM   #16
Anomaly
Human being with feelings
 
Anomaly's Avatar
 
Join Date: Sep 2007
Posts: 636
Default

EDIT: Never mind, read incorrectly what Tunca was asking...
__________________
___________________________
Sonic Anomaly | free JSFX & VST Plugins

Last edited by Anomaly; 09-10-2017 at 12:57 AM.
Anomaly is offline   Reply With Quote
Old 09-10-2017, 02:09 AM   #17
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by bozmillar View Post
Well, it's hard to help without seeing your code. How are you calculating the gain reduction in the compressor algorithm?
It's easy.

Transfer function is this;

gr = maxdB * ( ratio - 1 )

My rectifier and gain reduction calculation in another file.I need to call it in main .cpp.I don't know how to call it..
Tunca is offline   Reply With Quote
Old 09-10-2017, 06:00 AM   #18
Anomaly
Human being with feelings
 
Anomaly's Avatar
 
Join Date: Sep 2007
Posts: 636
Default

Quote:
Originally Posted by Tunca View Post
It's easy.

Transfer function is this;

gr = maxdB * ( ratio - 1 )

My rectifier and gain reduction calculation in another file.I need to call it in main .cpp.I don't know how to call it..
Even if your compressor classes are on different file(s), you still need to call them within your plugin's main class. As soon as you do that, your "external" classes and their public methods/variables are accessible to your main plugin class.

class MyPlugin : public IPlug
{

private:
MyExternalClass *extClass;
}

extClass = new MyExternalClass();

Then: gr = extClass->myGainReductionValue;

But maybe I misunderstood your problem..?
__________________
___________________________
Sonic Anomaly | free JSFX & VST Plugins

Last edited by Anomaly; 09-10-2017 at 06:11 AM.
Anomaly is offline   Reply With Quote
Old 09-10-2017, 01:13 PM   #19
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by Anomaly View Post
Even if your compressor classes are on different file(s), you still need to call them within your plugin's main class. As soon as you do that, your "external" classes and their public methods/variables are accessible to your main plugin class.

class MyPlugin : public IPlug
{

private:
MyExternalClass *extClass;
}

extClass = new MyExternalClass();

Then: gr = extClass->myGainReductionValue;

But maybe I misunderstood your problem..?
I implemented your code to my code...

class OSS : public IPlug
{

private:
__GR_METER_INL__ double gr;
};


double gr = new __GR_METER_INL__


if (GetGUI()) {
GetGUI()->SetControlFromPlug(mMeterIdx_L , gr );
};

But if (GetGUI)) giving me "expected a type" error.
Tunca is offline   Reply With Quote
Old 09-12-2017, 05:02 AM   #20
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

I'm really stucked...
Tunca is offline   Reply With Quote
Old 09-13-2017, 03:07 PM   #21
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 576
Default

Quote:
Originally Posted by Tunca View Post
I implemented your code to my code...

class OSS : public IPlug
{

private:
__GR_METER_INL__ double gr;
};


double gr = new __GR_METER_INL__


if (GetGUI()) {
GetGUI()->SetControlFromPlug(mMeterIdx_L , gr );
};

But if (GetGUI)) giving me "expected a type" error.
Maybe this is letting my programming ignorance show, but is that proper syntax?
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 09-14-2017, 12:39 AM   #22
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 145
Default

Quote:
Originally Posted by bozmillar View Post
Maybe this is letting my programming ignorance show, but is that proper syntax?
Now i can call my gain reduction.I solved that.

But response is really weird...

How do you send your sidechain to meter?
Tunca 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 06:15 PM.


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