Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Compatibility

Reply
 
Thread Tools Display Modes
Old 01-20-2017, 03:30 AM   #1
schallgeber
Human being with feelings
 
Join Date: Mar 2016
Location: London, UK
Posts: 4
Default Make JS Plugins Multichannel Compatible

Hi!

Is there any easy way to re-program the JS Plugins from stereo to multichannel?
Not a very good programmer here. I tried to up the count of in pins and out pins in the script,
but the additional channels won't be effected by the plugin. (Still just processing on ch. 1&2)
Do I need to assign further parameters?

If someone could point me in the right direction than I could rework these plugins to my multichannel needs

Thank you!
Cheers
schallgeber is offline   Reply With Quote
Old 02-12-2018, 01:30 AM   #2
mlprod
Human being with feelings
 
Join Date: Jul 2015
Location: Stockholm, Sweden
Posts: 1,343
Default

I have the same question! Anyone?
__________________
Magnus Lindberg Productions - VRTKL Audio - Redmount Studios
magnuslindberg.com
mlprod is offline   Reply With Quote
Old 02-12-2018, 08:26 AM   #3
skippertag
Human being with feelings
 
Join Date: Jun 2015
Posts: 474
Default

Quote:
Originally Posted by schallgeber View Post
Hi!

Is there any easy way to re-program the JS Plugins from stereo to multichannel?
Not a very good programmer here. I tried to up the count of in pins and out pins in the script,
but the additional channels won't be effected by the plugin. (Still just processing on ch. 1&2)
Do I need to assign further parameters?

If someone could point me in the right direction than I could rework these plugins to my multichannel needs

Thank you!
Cheers
I don't know it either by now, but you may want to have a look at the free 5.1 Buss Compressor by SonicAnomaly (the JS version). There you may get a clue.

Please let us know..
skippertag is offline   Reply With Quote
Old 02-12-2018, 10:02 AM   #4
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

This thread probably best to post at JSFX/ReaScript subforum.

There is no easy way. You should know a bit or more about math and (DSP) programming. Yes, you should.

Here's an example for 4 channel. For more channel, just add more

after plugin description, define the I/O pin

Code:
in_pin:Input 1
in_pin:Input 2
in_pin:Input 3
in_pin:Input 4

out_pin:Output 1
out_pin:Output 2
out_pin:Output 3
out_pin:Output 4
Code above is only define how many I/O should be available by default, and name it.

The code in the @sample section is executed for every PCM audio sample. To enable processing more than 1/2 channel. You need to provide calculation for Input/Output samples from which Input channel(s) and output the result to which output channel(s).

In most JSFX plugins you will see spl0 and spl1 calculation below the @sample section. Means, audio samples are calculated for I/O 1 and 2.

Code:
spl0 is for I/O 1
spl1 is for I/O 2
spl2 is for I/O 3
spl3 is for I/O 4
...
and so on until
spl63 is for I/O 64
perhaps the simplest explanation of sample processing in JSFX would be,
  • the first line of splX on the RIGHT side of " = " would be audio samples coming from input X
  • the last line of splX on the LEFT side of " = " would be audio samples results to output X

Here is an example of a simple 4-channel volume control.

Code:
desc:a very simple 4-channel volume control

in_pin:Input 1
in_pin:Input 2
in_pin:Input 3
in_pin:Input 4

out_pin:Output 1
out_pin:Output 2
out_pin:Output 3
out_pin:Output 4

slider1:vol_dB_1=0.0<-144,18,0.1>Ch 1 Volume (dB)
slider2:vol_dB_2=0.0<-144,18,0.1>Ch 2 Volume (dB)
slider3:vol_dB_3=0.0<-144,18,0.1>Ch 3 Volume (dB)
slider4:vol_dB_4=0.0<-144,18,0.1>Ch 4 Volume (dB)

@slider
vol1 = 10^(vol_dB_1/20); // convert slider1 value from dB to amp
vol2 = 10^(vol_dB_2/20); // convert slider2 value from dB to amp
vol3 = 10^(vol_dB_3/20); // convert slider3 value from dB to amp
vol4 = 10^(vol_dB_4/20); // convert slider4 value from dB to amp

@sample
spl0 = spl0 * vol1; // input 1 multiplied by vol1 result to output 1
spl1 = spl1 * vol2; // input 2 multiplied by vol2 result to output 2
spl2 = spl2 * vol3; // input 3 multiplied by vol3 result to output 3
spl3 = spl3 * vol4; // input 4 multiplied by vol4 result to output 4
Calculation of audio samples could be complicated. In order to modify 1/2 channel JSFX you should know where are your samples would be calculated as input and output. The most brutal way to do it is probably by copying/duplicating the formula, and assign it to a different variable (like the example above).

For complex calculation with a lot of parameters and variables, it would be wise to create user defined function and multiply the function as many as I/O channel as you need.

The formula for sample calculation in above example are
Code:
vol = 10^(vol_dB/20);  
//convert the slider (parameter) value from decibel (dB) to amplitude ratio (amp).
//copy the result to variable vol
and

Code:
splX = splX * vol; 
//multiply the input samples X with vol, and output the result to output X.
Here is the above example with user defined function.

Code:
desc:a very simple 4-channel volume control

in_pin:Input 1
in_pin:Input 2
in_pin:Input 3
in_pin:Input 4

out_pin:Output 1
out_pin:Output 2
out_pin:Output 3
out_pin:Output 4

slider1:vol_dB_1=0.0<-144,18,0.1>Ch 1 Volume (dB)
slider2:vol_dB_2=0.0<-144,18,0.1>Ch 2 Volume (dB)
slider3:vol_dB_3=0.0<-144,18,0.1>Ch 3 Volume (dB)
slider4:vol_dB_4=0.0<-144,18,0.1>Ch 4 Volume (dB)

@init
function amp (vol_dB, in)
 local (vol)
 instance (out)
(
 vol = 10^(vol_dB/20); // convert dB to amp
 out = in * vol; // multiply sample in by amp, result to out
);

@sample
vol1.amp(vol_dB_1, spl0); // calculate value from slider1 and samples from input 1
vol2.amp(vol_dB_2, spl1); // calculate value from slider2 and samples from input 2
vol3.amp(vol_dB_3, spl2); // calculate value from slider3 and samples from input 3
vol4.amp(vol_dB_4, spl3); // calculate value from slider4 and samples from input 4

spl0 = vol1.out; // result to output 1
spl1 = vol2.out; // result to output 2
spl2 = vol3.out; // result to output 3
spl3 = vol4.out; // result to output 4
__________________
JRENG! | M E T R I C

Last edited by jrengmusic; 02-14-2018 at 10:00 AM. Reason: edit examples with comments
jrengmusic is offline   Reply With Quote
Old 02-12-2018, 12:14 PM   #5
skippertag
Human being with feelings
 
Join Date: Jun 2015
Posts: 474
Default

thanks a lot jreng!
skippertag 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 08:19 AM.


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