Old 11-19-2021, 07:08 PM   #1
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default Code to add to JS plug to reverse polarity

Is there some code I could add to a JS plugin to have the ability to reverse the polarity of the signal leaving the plugin? I would like it to be a feature I can toggle on & off somehow. Specifically I am looking to add this to a compressor plugin so the polarity can be reversed within the compressor as opposed to doing so with another plugin. I am not a coder, but I have done minor tweaking in JS plugins, so please respond with that in mind. Thanks!
AxeMan2U is offline   Reply With Quote
Old 11-19-2021, 07:41 PM   #2
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

Hi. It's very easy.

Add a slider (change the slider# as needed):

Code:
slider1:0<0,1,1{Normal,Inverted}>Polarity
In the @slider section make a variable called polarity, dependent on the slider you just added:

Code:
polarity = 1-2*slider1;
At the end of the @sample section, add this:

Code:
spl0 *= polarity;
spl1 *= polarity;
And that's it.
The signal leaving the JS plugin will be multiplied by 1 in Normal mode and -1 in Inverted mode.
ErBird is offline   Reply With Quote
Old 11-19-2021, 10:06 PM   #3
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default

Wow! That does seem easy. Thanks!
AxeMan2U is offline   Reply With Quote
Old 11-20-2021, 02:16 AM   #4
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Cool, waiting for your compressor now.

No matter, if you will share your end result here or not, have fun with Reaper and the music lovers here, my friend.
TonE is offline   Reply With Quote
Old 11-20-2021, 01:06 PM   #5
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

Quote:
Originally Posted by AxeMan2U View Post
Wow! That does seem easy. Thanks!
NP. If it pops/clicks when changing polarity we can add a few lines to smoothly transition between states.
ErBird is offline   Reply With Quote
Old 11-20-2021, 10:26 PM   #6
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default

Quote:
Originally Posted by ErBird View Post
NP. If it pops/clicks when changing polarity we can add a few lines to smoothly transition between states.
No pops/clicks at this point. Now I've got two more questions:

Is there a way to change polarity on just the wet signal, leaving the dry signal as is?

Is there a complete list of JS parameters, etc. available somewhere?

Thanks!
AxeMan2U is offline   Reply With Quote
Old 11-21-2021, 08:52 AM   #7
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

At some point in the code you must have the wet signal stored in some variable(s) separate from the dry. Multiply the wet one(s) by -1. At that point, though, you’ve duplicated the functionality of the new Delta Solo function that all plugins now get for free.

Does this help?
https://www.reaper.fm/sdk/js/js.php
ashcat_lt is offline   Reply With Quote
Old 11-24-2021, 10:26 PM   #8
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default

Quote:
Originally Posted by ashcat_lt View Post
At some point in the code you must have the wet signal stored in some variable(s) separate from the dry. Multiply the wet one(s) by -1. At that point, though, you’ve duplicated the functionality of the new Delta Solo function that all plugins now get for free.

Does this help?
https://www.reaper.fm/sdk/js/js.php
I can't figure out how to get this to work. There's something about the way splitting & mixing the wet & dry signals that I am missing. Can someone add this functionality to any existing JS Compressor (if that's allowed) and share the code here so I can see how it should be done and maybe learn something? The Delta Solo does do the same thing, but I would still like to know how to duplicate that functionality within a plugin. Thanks.

Oh, and yes, that resource is helpful!
AxeMan2U is offline   Reply With Quote
Old 11-25-2021, 09:39 AM   #9
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

My LT_Comp does it
https://stash.reaper.fm/v/29185/lt_comp

Edit - not that my code is any great example of anything, but it does have switchable delta mode.
ashcat_lt is offline   Reply With Quote
Old 11-25-2021, 06:46 PM   #10
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default

Quote:
Originally Posted by ashcat_lt View Post
My LT_Comp does it
https://stash.reaper.fm/v/29185/lt_comp

Edit - not that my code is any great example of anything, but it does have switchable delta mode.
Thanks! I downloaded your plugin and managed to figure out how to do what I wanted based on it. I'm learning little by little from this great community!
AxeMan2U is offline   Reply With Quote
Old 11-25-2021, 06:49 PM   #11
AxeMan2U
Human being with feelings
 
Join Date: Apr 2021
Posts: 26
Default

Quote:
Originally Posted by TonE View Post
Cool, waiting for your compressor now.

No matter, if you will share your end result here or not, have fun with Reaper and the music lovers here, my friend.
After receiving lots of help from the community, I managed to cobble my plugin together. Here's the link to it: https://stash.reaper.fm/v/43352/Bleed%20Kill-pressor
AxeMan2U 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 04:41 AM.


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