|
01-10-2017, 06:53 AM
|
#1
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Stepped Frequency or Gain
Now i'm build my first plugin.(Actually bundle)Vintage German EQs.There are three EQs.
EQs use stepped freq. and gain control.How can do that?
For example low band gain 11 steps.(-15,-9,-6,-4,-2,0,2,4,6,9,15)
So i want to do this like this;
I will set min value -6 and max value 6.(Total 11 steps)
mGainL : Low Gain Knob
if (mGainL == -6)
mGainL = -15;
if (mGainL == -5)
mGainL = -12;
if (mGainL == -4)
mGainL = -9;
.
.
.
if (mGainL == 6)
mGainL = 15;
I tried that but it's not working.How can do this in easy way?
Thanks.
|
|
|
01-10-2017, 08:59 AM
|
#2
|
Human being with feelings
Join Date: May 2012
Location: PA, USA
Posts: 356
|
I think your best bet is to setup the parameters as Int, like
Code:
GetParam(kLowGain)->InitInt("Low Freq Gain", 5, 0, 10);
Then you could set the gain in OnParamChange like
Code:
...
case kLowGain:{
int g = GetParam(kLowGain)->Value();
if (g==0) mLowGain = -15.;
else if (g==1) mLowGain = -9.;
...
CalcFilterWithNewGain();
}
break;
...
You could put the gain values on the background GUI.
|
|
|
01-10-2017, 12:46 PM
|
#3
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Thanks "random_id"!
Worked great for gain!
Last edited by Tunca; 01-10-2017 at 02:27 PM.
|
|
|
01-10-2017, 01:30 PM
|
#4
|
Human being with feelings
Join Date: Apr 2012
Posts: 279
|
maybe it's easyer to distribute your gain vals by an array instead of crawling thru if else comparisons.
Code:
case kLowGain:{
int gainvals[11] = {-15,-9,-6,...}
mLowGain = gainvals[(int)GetParam(kLowGain)->Value()];
}
break;
|
|
|
01-10-2017, 01:56 PM
|
#5
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Thank you "stw" for another great example!
|
|
|
01-10-2017, 02:36 PM
|
#6
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
I tried both of them for frequency but no luck.
Just getting defult value.When i turn my knob,frequency not changing.
My default freq is 2kHz as you can see.Can't change freq.
case kFreqM:{
int freqvals[7] = {700,1000,1400,2000,2800,4000,5600};
mFreqM = freqvals[(int)GetParam(kFreqM)->Value()];
}
break;
Last edited by Tunca; 01-10-2017 at 03:34 PM.
|
|
|
01-11-2017, 05:36 AM
|
#7
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Any idea?
|
|
|
01-12-2017, 07:09 AM
|
#8
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Finally fixed it!
Filters were in Reset().I moved them to ProcessDoubleReplacing and now it's working!
Thanks to everyone for help!
Now only trouble with AU versions.AU causes scan everytime for Logic.Any idea?
Last edited by Tunca; 01-12-2017 at 07:17 AM.
|
|
|
01-12-2017, 10:19 AM
|
#9
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
By the way knob generate audiable click hen i turn them.Why?
|
|
|
01-13-2017, 11:38 AM
|
#10
|
Human being with feelings
Join Date: Sep 2016
Posts: 4
|
Quote:
Originally Posted by Tunca
By the way knob generate audiable click hen i turn them.Why?
|
Because the changes you are making are having an instantaneous change on the output samples, causing a jump from one value to the next. Anytime this happens you will hear a click, the magnitude of which depends on how far the sample value happens to jump.
You can get rid of the click simply by applying a low pass filter to the parameter itself (so that, for example, the output is the average of the previous n values). That way even if you do make an instantaneous change to a parameter, you won't get any clicks because your parameter will change gracefully from one value to the next. This will still achieve the step-like effect you are going for if you keep n low, from like 10-25 samples, but you won't hear a click anymore.
|
|
|
01-14-2017, 11:19 AM
|
#11
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Add9
Because the changes you are making are having an instantaneous change on the output samples, causing a jump from one value to the next. Anytime this happens you will hear a click, the magnitude of which depends on how far the sample value happens to jump.
You can get rid of the click simply by applying a low pass filter to the parameter itself (so that, for example, the output is the average of the previous n values). That way even if you do make an instantaneous change to a parameter, you won't get any clicks because your parameter will change gracefully from one value to the next. This will still achieve the step-like effect you are going for if you keep n low, from like 10-25 samples, but you won't hear a click anymore.
|
Thanks for reply! I will try what you say.
|
|
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:46 PM.
|