Old 01-11-2017, 04:58 AM   #1
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default Gain knob, with range and curve

Hi!

I'm looking for a gain-knob, vst or JS,
with custom range and curve.
For using with expression-pedal for eg. Amplitube guitar or vst organ.

A simple JS volume is pretty close,
as I can set range and accuracy.

But, my typical need is -60 to +3db
-60 to -30db steep,
-30db to -3db medium steep and
-3 to +3 very flat.

And then, it's how this is displayed as envelope.
For this reason I've defaulted to -30db to 0db
and been using this one:

Code:
desc: Volume Adjustment
//tags: utility gain
//author: Cockos

slider1:6<-30,0,0.1>Adjustment (dB)
slider2:0<-150,150,1>Max Volume (dB)

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

@slider
  adj1=2 ^ (slider1/6); 
  adj2=2 ^ (slider2/6);
  doseek=1;

@block
doseek ? (
  dadj=(adj1-adj1_s)/samplesblock;
  doseek=0;
):(
  dadj=0;
  adj1_s=adj1;
);

@sample
spl0=min(max(spl0*adj1_s,-adj2),adj2);
spl1=min(max(spl1*adj1_s,-adj2),adj2);
adj1_s+=dadj;
But, would like to ditch the second parameter
(as I don't remember what it's fore )

Any suggestions?
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 06:21 AM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,180
Default

I've put a simple gain JSFX (volume slider only) in ReaPack a couple of days ago (mod of the default v5 gain utility with sample accurate automation).

Doesn't have the curves you want (yet, I won't do, because I don't need it, sorry, but maybe someone else will).
nofish is offline   Reply With Quote
Old 01-11-2017, 07:13 AM   #3
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 364
Default

Would using a midi CC work for you? see screen capture:
https://drive.google.com/open?id=0B2...mxTTExGNjNXa28
ericzang is offline   Reply With Quote
Old 01-11-2017, 07:25 AM   #4
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by nofish View Post
I've put a simple gain JSFX (volume slider only) in ReaPack a couple of days ago (mod of the default v5 gain utility with sample accurate automation).

Doesn't have the curves you want (yet, I won't do, because I don't need it, sorry, but maybe someone else will).
Thanks!
Looking at it now,
but don't quite understand.
What are it's features?
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 07:29 AM   #5
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by ericzang View Post
Would using a midi CC work for you? see screen capture:
https://drive.google.com/open?id=0B2...mxTTExGNjNXa28
That's indeed interesting.
Seems quite perfect except two JSFX and 2 parm.mod needed.
But, saved as a chain
it should work pretty well
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 07:31 AM   #6
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 364
Default

I only used one parameter modulation in the example, is there something in your use that needs two?
ericzang is offline   Reply With Quote
Old 01-11-2017, 08:53 AM   #7
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by ericzang View Post
I only used one parameter modulation in the example, is there something in your use that needs two?
Indeed. My mistake.
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 08:55 AM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,180
Default

Quote:
Originally Posted by G-Sun View Post
Thanks!
Looking at it now,
but don't quite understand.
What are it's features?
Nothing special really.
Compared to the one you posted it just has additional parameters removed (as you wanted) and sample-accurate automation.
Range can be set similar as you do it currently (modifying the slider values).

(I use it for volume automation, thought it could be useful as starting point for your request).
nofish is offline   Reply With Quote
Old 01-11-2017, 09:23 AM   #9
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by ericzang View Post
Would using a midi CC work for you? see screen capture:
https://drive.google.com/open?id=0B2...mxTTExGNjNXa28
Trying out "Midi cc mapper x"
But, it's updated, and I can't seem to understand how to set it correctly.

Trying the older one,
but comes up with missing graphics.

Ok, somewhat got it working,
but, I can't seem to get the curves and mappings right.
__________________
Reaper x64, win 8.1
My music on Bandcamp

Last edited by G-Sun; 01-11-2017 at 09:54 AM.
G-Sun is offline   Reply With Quote
Old 01-11-2017, 09:54 AM   #10
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by nofish View Post
I've put a simple gain JSFX (volume slider only)
I think this is the most practical solution for me.

For -60 to +3 db
cc < 64 is -60db to 0db
and
cc > 64 is 0db to +3 db

So, maybe not best curve,
but far easiest.
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 10:00 AM   #11
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Tried again the midi cc mapper x.

Ok, with Gain -60 to 0db
and mapping right, parm right, and x^2 it seems quite good

I'll save it as an fx chain
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 10:52 AM   #12
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 4,344
Default

Quote:
Originally Posted by G-Sun View Post
But, would like to ditch the second parameter
(as I don't remember what it's fore )
It sets a hard limit on the output. If you don't want it, tear it out:
Code:
desc: Volume Adjustment
//tags: utility gain
//author: Cockos

slider1:6<-30,0,0.1>Adjustment (dB)
slider2:0<-150,150,1>Max Volume (dB)

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

@slider
  adj1=2 ^ (slider1/6); 
  doseek=1;

@block
doseek ? (
  dadj=(adj1-adj1_s)/samplesblock;
  doseek=0;
):(
  dadj=0;
  adj1_s=adj1;
);

@sample
spl0=spl0*adj1_s;
spl1=spl1*adj1_s;
adj1_s+=dadj;
Edit to add - I find myself wondering if you might get close to the curve you want if the slider was for gain factor rather than gain in db. Have that slider go from 0.001 to 1.412* in like 0.001 steps, and then set adj1 = slider1 and then you should get a logarithmic action pretty close to what you said you wanted.

*Thats for the -60 to +3db range you said you wanted. Course, your code shows -30 to 0, which kind of confuses me.

Last edited by ashcat_lt; 01-11-2017 at 11:04 AM.
ashcat_lt is online now   Reply With Quote
Old 01-11-2017, 11:10 AM   #13
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by ashcat_lt View Post
It sets a hard limit on the output. If you don't want it, tear it out:


Edit to add - I find myself wondering if you might get close to the curve you want if the slider was for gain factor rather than gain in db. Have that slider go from 0.001 to 1.412* in like 0.001 steps, and then set adj1 = slider1 and then you should get a logarithmic action pretty close to what you said you wanted.

*Thats for the -60 to +3db range you said you wanted. Course, your code shows -30 to 0, which kind of confuses me.
Thanks!
Yes, a hard edit or a slider for y
where curve is x^y is what I'd like.
1 < y < 2

-60 or -30, just depends on range/ curve / action.

I'll try out you suggestion
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 11:29 AM   #14
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Like this: ?

Code:
desc: Volume slider (G-Sun) v2
//tags: utility gain volume
//author: Cockos

slider1:6<0.001,1.412,0.001>Adjustment (dB)

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

@slider
  adj1= slider1
  doseek=1;

@block
doseek ? (
  dadj=(adj1-adj1_s)/samplesblock;
  doseek=0;
):(
  dadj=0;
  adj1_s=adj1;
);

@sample
spl0=spl0*adj1_s;
spl1=spl1*adj1_s;
adj1_s+=dadj;
Doesn't seem right
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 11:34 AM   #15
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 4,344
Default

Quote:
Originally Posted by G-Sun View Post
Like this: ?
Doesn't seem right
It is what I meant. I know it seems too easy, but it kind of is just that easy. Have you actually tried it?

Edit - Well, I suppose you should take "db" out of the label for the slider.

Edit again - Oh and change the slider default! Even before, it was starting above your slider range, now it's defaulting to +15db. Change that 6 to 1 so it defaults to unity. I did that on the original a long time ago, but it got overwritten at some point....
ashcat_lt is online now   Reply With Quote
Old 01-11-2017, 11:47 AM   #16
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Quote:
Originally Posted by ashcat_lt View Post
It is what I meant. I know it seems too easy, but it kind of is just that easy. Have you actually tried it?

Edit - Well, I suppose you should take "db" out of the label for the slider.

Edit again - Oh and change the slider default! Even before, it was starting above your slider range, now it's defaulting to +15db. Change that 6 to 1 so it defaults to unity. I did that on the original a long time ago, but it got overwritten at some point....
Yes, it's in fact working.
I thought the syntax was wrong because of red text

Now, it's not very good having an arbitrary number displayed.
Slider1 needs to be db
Preferably there should be a slider2 with exp-curve

Like this:
Code:
slider1:0<-60,3,0.1>Volume db
slider2: 1<1,2,0.01> Curve
But maybe then it needs:
Slider1 = volume in
Slideer3 = parameter for midi learn
Slider4 = volume out

or something?
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 12:01 PM   #17
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

LOL
I'll be using ages to find out this by myself.
But, I guess it shouldn't be that hard to do.

These ones are maybe the only nessesary:
Code:
slider2: 127<0,127,1> Parameter for midi learn
slider3: 1<1,2,0.01> Curve
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 01-11-2017, 12:15 PM   #18
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Now,
here's a start:
Code:
slider1: 0<-10,10,0.1>Volume in adjust db
slider2: 127<0,127,1> Parameter for midi learn
slider3: 1<1,2,0.01> Curve
slider4: -128<-128,0,1>Volume min
slider5: 0<-20,12,1>Volume max
slider6: 0<-10,10,0.1>Volume out adjust db

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

@slider
  adj1= 2 ^ (slider1/6); 
  adj2= (slider2/127)
  adj3= (slider3)
  doseek=1;
But I don't know much at all where to put what.

only that
volIn * ((adj2^adj3)*range)
is somewhat what I seek

Anyway,
the other solutions above are reasonably good,
so, it's not really that important.
But, if someone thinks it's fun,
please help a JS toddler out
__________________
Reaper x64, win 8.1
My music on Bandcamp

Last edited by G-Sun; 01-11-2017 at 12:22 PM.
G-Sun is offline   Reply With Quote
Old 01-11-2017, 10:00 PM   #19
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 769
Default

I wrote something like this a little while ago. Tweaked with suggestions from ashcat and Tale. Set the smoothing value very high to get a more exaggerated effect. This follows an exponential curve.

Code:
desc:volume adjustment smooth gain utility function (SaulT wBabaGvaluemods + Tale)

slider1:0<-150,60,0.1>Adjustment (dB) (-150 = -inf)
slider3:200<1,2000,1>Smoothing (ms)

@slider
  adj1=slider1 > -150 ? 10 ^ (slider1/20) : 0; 
  coeff = exp(-5/(slider3/1000*srate));

@sample

adj1_s = adj1_s*coeff + adj1*(1-coeff);

spl0 *= adj1_s;
spl1 *= adj1_s;
SaulT is offline   Reply With Quote
Old 01-12-2017, 01:35 AM   #20
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Thanks!
I'll be looking at it.
Smoothing could be a nice option.

Anyway,
for my concept above, there are some issues:
- It should result in an envelope with db reading.
Now, that seems hard to do with my approach.

Another issue is for vsti midi (eg. organ),
that the controller sends on ch1 cc11 and will be recorded with midi as so.
If applying that to parm/envelope, there's a conflict.
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun is offline   Reply With Quote
Old 03-18-2017, 11:48 AM   #21
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: USA
Posts: 701
Default

Quote:
Originally Posted by SaulT View Post
I wrote something like this a little while ago. Tweaked with suggestions from ashcat and Tale. Set the smoothing value very high to get a more exaggerated effect. This follows an exponential curve.

Code:
desc:volume adjustment smooth gain utility function (SaulT wBabaGvaluemods + Tale)

slider1:0<-150,60,0.1>Adjustment (dB) (-150 = -inf)
slider3:200<1,2000,1>Smoothing (ms)

@slider
  adj1=slider1 > -150 ? 10 ^ (slider1/20) : 0; 
  coeff = exp(-5/(slider3/1000*srate));

@sample

adj1_s = adj1_s*coeff + adj1*(1-coeff);

spl0 *= adj1_s;
spl1 *= adj1_s;
Do you know if there's a way to have the smoothing disabled during render ?
I noticed if you have the smoothing on it effects the start of a render.
Is there a play_state or sliderchange command or something to automatically turn it off or on ?
bezusheist is offline   Reply With Quote
Old 03-18-2017, 09:25 PM   #22
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 769
Default

Well, you can always change the smoothing to a very small value for rendering. The point of the smoothing is to keep it from distorting the signal. Alternatively, if you really want to, here's a manual control. I don't know of any way to tell if it's render vs play.

Code:
desc:volume adjustment smooth gain utility function (SaulT wBabaGvaluemods + Tale)

slider1:0<-150,60,0.1>Adjustment (dB) (-150 = -inf)
slider3:200<1,2000,1>Smoothing (ms)
slider5:1<0,1,1{off,on}>Smoothing

@slider
  adj1=slider1 > -150 ? 10 ^ (slider1/20) : 0; 
  coeff = exp(-5/(slider3*0.001*srate));

@sample

slider5 ? (
  adj1_s = adj1_s*coeff + adj1*(1-coeff);
  );

spl0 *= adj1_s;
spl1 *= adj1_s;
SaulT is offline   Reply With Quote
Old 03-18-2017, 10:31 PM   #23
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,415
Default

Quote:
Originally Posted by bezusheist View Post
Do you know if there's a way to have the smoothing disabled during render ?
I noticed if you have the smoothing on it effects the start of a render.
Is there a play_state or sliderchange command or something to automatically turn it off or on ?
yes

from the JS documentation

Quote:
play_state
Context: @block, @sample
Usage: read-only
The current playback state of REAPER (0=stopped, <0=error, 1=playing, 2=paused, 5=recording, 6=record paused).
note, "paused" is useless here because effects do not run when the transport is in pause. (they do run in record paused though)
James HE is offline   Reply With Quote
Old 03-19-2017, 12:37 AM   #24
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: USA
Posts: 701
Default

Quote:
Originally Posted by SaulT View Post
Well, you can always change the smoothing to a very small value for rendering. The point of the smoothing is to keep it from distorting the signal. Alternatively, if you really want to, here's a manual control. I don't know of any way to tell if it's render vs play.
ok, thanks. i have already implemented a manual on/off, but sometimes i can forget to turn it off for a render. no big deal, i just thought there might be an easy way to automatically do it.
bezusheist is offline   Reply With Quote
Old 03-19-2017, 12:41 AM   #25
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: USA
Posts: 701
Default

Quote:
Originally Posted by SaulT View Post
Well, you can always change the smoothing to a very small value for rendering. The point of the smoothing is to keep it from distorting the signal. Alternatively, if you really want to, here's a manual control. I don't know of any way to tell if it's render vs play.
ok, thanks. i have already implemented a manual on/off, i just thought there might be an easy way to "automatically" do it.

Quote:
Originally Posted by James HE View Post
yes
maybe i'm having an early morning brain fart, but i haven't been able to get that to work for me. i believe rendering is the same as playing ("1"), and that's when i would want the smoothing, while playing.
bezusheist is offline   Reply With Quote
Old 03-25-2017, 09:04 AM   #26
RCJacH
Human being with feelings
 
Join Date: Apr 2016
Location: Beijing, China
Posts: 153
Default

Maybe you can try this one: https://github.com/RCJacH/ReaScripts...RangeGain.jsfx

Not your typical fader. One bit is around 6.0206 dB, which is the doubling of distance.
Doesn't do curve though, can do exponential gain fading.
RCJacH is online now   Reply With Quote
Old 03-25-2017, 12:03 PM   #27
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,255
Default

Personally, I've come down to the following specs:
- Volume (default -60 to 0db)
- Trim (default -10 to +10db)
Optionally x^-2 curve
__________________
Reaper x64, win 8.1
My music on Bandcamp
G-Sun 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 11:46 PM.


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