Old 04-14-2017, 04:54 PM   #1
mainframe
Human being with feelings
 
Join Date: Apr 2009
Posts: 48
Default Simple routing JS question

Howdy,

I often bus all my direct drums into one folder and my room mics into an other. These go into a general drum bus and from there I balance my drums towards the rest of the song. From time to time I like pushing my rooms a bit more but I often have to lower my directs accordingly to not overpower the mix with drums. This got me thinking. It might be nice to have a JS plugin that has the direct bus on 1-2 and the rooms on 3-4 and just a dry/wet slider between the two so you can go from a normal 50/50 mix to fully dry or wet and everything in between.
My JS skills are non existent but I'm willing to learn. Any guidance in the right direction is highly appreciated.

Cheers,

Wouter
mainframe is offline   Reply With Quote
Old 04-14-2017, 09:14 PM   #2
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 876
Default

Well, the basic outline of a JS effect looks like this

Code:
desc:a mix thing

sliderx:default_value<smallest_value,largest_value,tick_value>Text

@init

// anything that needs to be precomputed
// good place to define your functions, too

@slider

// things that are computed when the slider values change

ratio = 10^(decibel/20); // decibel value from slider

@sample

// things that are done to every sample
// spl0 and spl1 are the left and right channels
// spl2 and spl3 are the 2 channels after that

spl0 *= ratio; // this is a volume change
Here are some example pieces that you could plug in to the appropriate places.


slider1:0<-15,15,0.1>Volume adjustment (dB)

volume = 10^(slider1/20);

spl0 *= volume;
spl1 *= volume;


All of the pieces are here to do what you want. Isn't too difficult to add a single-pole smoother in so that the volume shifts aren't jagged. Code here.

http://forum.cockos.com/showthread.php?t=177535
SaulT is offline   Reply With Quote
Old 04-14-2017, 10:40 PM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

While I really do like doing JSFX, is this really something that should be done that way ?

Would it not be more appropriate to use standard Reaper features like "VCA"

-Michael
mschnell is offline   Reply With Quote
Old 04-15-2017, 04:10 AM   #4
mainframe
Human being with feelings
 
Join Date: Apr 2009
Posts: 48
Default

Thanks a lot for the input. I'll have a crack at the JS code and see what I can come up with. It doesn't have to be a plugin per se, I just thought that might be the easiest. I had a look at the VCA option and found a way to do it with the volume and reverse flag. Thanks for that, I didn't think of that way at all!
mainframe is offline   Reply With Quote
Old 04-15-2017, 05:47 AM   #5
mainframe
Human being with feelings
 
Join Date: Apr 2009
Posts: 48
Default

All right, this is what I have now. It's working but I doubt it's correct. Also, there is a volume boost in the middle so I would need to implement a sort of pan law thing.
Code:
desc:direct/room

slider1:0<-1,1,0.01>Balance (Direct/Room)

in_pin: input L Direct
in_pin: input R Direct
in_pin: input L Room
in_pin: input R Room 
out_pin: output 1
out_pin: output 2

@init

// anything that needs to be precomputed
// good place to define your functions, too

@slider

// things that are computed when the slider values change

slider1 < 0 ? (dry = 1; wet = 1+slider1);
slider1 > 0 ? (wet = 1; dry = 1-slider1);

@sample

// things that are done to every sample
// spl0 and spl1 are the left and right channels
// spl2 and spl3 are the 2 channels after that

spl0 = (spl0 * dry) + 
      (spl2 * wet);
spl1 = (spl1 * dry) +
      (spl3 * wet);
mainframe is offline   Reply With Quote
Old 04-15-2017, 06:46 AM   #6
mainframe
Human being with feelings
 
Join Date: Apr 2009
Posts: 48
Default

Cleaned up the code a bit and added an equal power slider.

Code:
desc:dry/wet mixer

slider1:0<-1,1,0.01>dry/wet balance
slider2:3<0,6,1>equal power (0=none, 3=LUFS, 6=+3dB)

in_pin: input L dry
in_pin: input R dry
in_pin: input L wet
in_pin: input R wet 
out_pin: output L
out_pin: output R

@init

// anything that needs to be precomputed
// good place to define your functions, too

@slider

// things that are computed when the slider values change

slider1 <= 0 ? (dry = 10^((-slider1*slider2)/20); wet = 1+slider1);
slider1 > 0 ? (wet = 10^((slider1*slider2)/20); dry = 1-slider1);

@sample

// things that are done to every sample
// spl0 and spl1 are the left and right channels
// spl2 and spl3 are the 2 channels after that

spl0 = (spl0 * dry) + 
      (spl2 * wet);
spl1 = (spl1 * dry) +
      (spl3 * wet);
mainframe is offline   Reply With Quote
Old 04-16-2017, 12:49 AM   #7
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

not bad for your first try, it works, so good job
ii think with a little more tinkering you will figure out how to get the "balance" correct.
you end up with values of "dry = 1" & "wet = 1" when the slider is at 0, that's why you have a volume boost. their values should be = "0.5". you should be able to address this without the "pan law" variable, unless that's something you really wanted to have there.
as an alternative, for a mixer, you could use the "%" method. that way you have values of "0 to 100", keeping all values +. it's simpler/easier.

Last edited by bezusheist; 04-16-2017 at 12:58 AM.
bezusheist 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 09:22 AM.


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