Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-08-2017, 02:22 AM   #1
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default how do i add (specific) asymmetry to JS_Waveshaping_Distortion ?

i'm trying to add a specific type of asymmetry to the JS Waveshaping Distortion to get a similar harmonic series as the following picture...
the green trace is the JSWD...the odd harmonics line up perfectly with the red trace.
but i cant seem to figure out how to add the even harmonics in the proportion shown.


i have tried adding DC to the input but it does not give this harmonic series.
the closest i can come is by adding a certain amount of the square to the input, but the #2 level is too high. the rest of the evens seems about right.
anyway, it must be something simple i just dont understand yet, so any help would be greatly appreciated.
thanks.
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 05-08-2017, 12:52 PM   #2
sonicowl
Human being with feelings
 
sonicowl's Avatar
 
Join Date: Oct 2015
Posts: 739
Default

Use another JSFX. One that has asymetric waveshaping.
sonicowl is offline   Reply With Quote
Old 05-08-2017, 12:58 PM   #3
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

I didn't find anything that gives me what I need.
I can code my own (different) asymmetrical waveshaper, but I would like to know how to alter this one accordingly.
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 05-08-2017, 02:10 PM   #4
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

What are you trying to clone here? Where does that red trace come from?
ashcat_lt is offline   Reply With Quote
Old 05-08-2017, 02:18 PM   #5
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

Quote:
Originally Posted by ashcat_lt View Post
What are you trying to clone here? Where does that red trace come from?
Some Waves crap...(pooptec eq I think)...pretty generic...I'm making a JS "clone". Not because I want one, more as a learning experience and to share with others if there aren't enough clones out there already...
It seems pretty simple/basic/common, and I've actually done it before by accident, I just don't remember how. I've seen a version of the code by Bram which does add asymmetry, but the harmonic structure is nothing like what I was looking for. Tried to modify it with no success.
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 05-08-2017, 02:59 PM   #6
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Have tried my diode clipper? I'm not promising anything, but it does assymetrical by scaling the curve differently for each half of the waveform. I'm not completely convinced it's any different from DC offset, but...maybe?

If you want to look at it, search the stash for lt_diode, but it's a bit weird since it uses real voltage values, but you can really just try what I said - process positive values differently from the negative - and see if it works for you.
ashcat_lt is offline   Reply With Quote
Old 05-08-2017, 05:12 PM   #7
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

i'll check out the diode clipper again, it's a little confusing but i think i can figure it out.
i like the tanh function, i think that's where i got the basic code for it. that's about as far as i got "ripping it apart".

by adding this this piece of code (basically squaring before the waveshaping) to the JSWD it does almost exactly what i want, except the #2 harmonic is +20 dB or so too loud. all of the other harmonics seem to match pretty close. i'm using -18 dBFS as a calibration level, it gets a little off approaching 0 dBFS but still close enough.

Code:
spl0 = spl0-(spl0*spl0*0.2);
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 05-08-2017, 10:58 PM   #8
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 876
Default

There's a very good chance that they did it parallel saturation. I can get a fairly rough approximation of that curve if I blend in just a little bit of a signal that's been boosted, DC biased, then sent through a tanh(x) function.
SaulT is offline   Reply With Quote
Old 05-22-2017, 03:29 AM   #9
Aesis
Human being with feelings
 
Join Date: Jan 2011
Posts: 445
Default

Quote:
Originally Posted by bezusheist View Post
i'm trying to add a specific type of asymmetry to the JS Waveshaping Distortion to get a similar harmonic series as the following picture...
the green trace is the JSWD...the odd harmonics line up perfectly with the red trace.
but i cant seem to figure out how to add the even harmonics in the proportion shown.


i have tried adding DC to the input but it does not give this harmonic series.
the closest i can come is by adding a certain amount of the square to the input, but the #2 level is too high. the rest of the evens seems about right.
anyway, it must be something simple i just dont understand yet, so any help would be greatly appreciated.
thanks.
Well we know f(input) = output

Which means that by simply mapping the input in the X axis and output on the Y axis you get the waveshaper function. Or even more simply, simply feed a saw wave to the shaper (one that ascends the values one by one) - now the output is the waveshaper function.

Then just use the wavetable of that function as the waveshaper. Or if you want, try estimating the curve with some simple functions. The only problem is that what you have may not be a pure waveshaper, in which case it's possible it can't be modelled with a pure waveshaper.

Last edited by Aesis; 05-22-2017 at 03:36 AM.
Aesis is offline   Reply With Quote
Old 05-22-2017, 03:42 AM   #10
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

Thanks for the replies. I have kind of lost interest in trying to duplicate this distortion and moved on to making a better one (imo)
I assumed it was something simple because it's an old plug in and it looks very linear/stale if that makes sense. Almost like blending the (filtered?) rectified signal with the distorted one.
Anyway, I just thought it would be cool/funny to duplicate this plug ins saturation with a JSFX. But every time I start playing with code, I "stumble" upon a cool idea or learn something new to try and get distracted from my original project, so i guess I'd rather be inventing than imitating at this point.
__________________
I like turtles
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 04:52 AM.


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