Soft Clip (tanh) Distortion
  • This is a good technique for getting analog(ish) tube distortion in digital audio. It will eventually get to a hard clip if you push it hard enough but the journey there sounds more pleasant.. Adjust the offsets A and B for some flavour (these are also interesting when the gain is set to 0).

    The design was taken from here:

    Edit: Updated patch to also include the basic tanh distortion which is less intensive on the CPU.
  • Really cool man!
  • I've been just using the tanh(X) in the expression node. Is there an advantage to your more elaborate expression?
  • @MacroMachines, nearly fell of my chair when I read that.. I doesn't mention tanh in the math node reference so I figured it wasn't supported!!

    If you don't use the A and B dials then there is no difference between the tanh() function. The link in my post explains it a bit more as it refers to this as a 'modified' tanh distortion
  • @afta8 that is funny, yeah I saw the tan function in the help file and must have just assumed it had tanh since it's such a useful function for audio. I think I may have even misread the help tan as tanh hahaha, I have been using it even though it isn't specificaly listed.

    I just checked out your version and it is awesome, I love that it can do these sort of exponential shapes as well as the log standard type tanh soft squaring.

    I made a really nifty chebychev patch, I am about to do a serious forum drop in the next week and will be posting loads of patches and modules I've been working on.
  • @MacroMachines, seems like the Maths node might have a few easter eggs in it!

    Yeah the modified tanh adds a certain grit compared to the vanilla tanh, credit to the website where I got it, another example of Googling for stuff, sticking it in the maths node and boom..

    I never quite got my head around chebyshev stuff so interested to see what you have..

    Anyway I've updated my first post to now include both tanh variants, the basic tanh uses about half the cpu of the modified version so worth having.
  • afta8,
    I'm always interested in your patches, but I'm not on Audulus 3.0 yet (awaiting new iPad) and it seems new patches won't download to 2.xx, so I can't see what you're doing.
    I've been using the tanh (exponential form, (e^x-e^-x)/(e^x+e^-x) ) as a softclipper myself for quite some time in two different forms (direct equation and in block form, summing/subtracting e^x and e^-x math blocks, which is more CPU efficient), but both forms have identical sound, as expected.

    What 2 equations are you using? of which gives more "grit"?
  • @BTL, the modified tanh is just a variation on the exponential form you are using:


    Where 'a' and 'b' are offset values, the most useful range I found for these is 0-10. This simply makes the waveshaping asymetric.

    The actual formula in my patch is:

    Where G is the gain on the incoming signal.

    Hope that helps
  • afta8,
    Thanks...Got it.......also took a look at your source site in the mean time....l hadn't considered asymmetric distortion...I'll give it a try.....I use this tanh soft clip/distortion a you mentioned, it can give a nice "tube-ish" sound to a lot of source signals.
    For some signals that are already harsh (heavy harmonic content) or those with hard, heavy attacks, this thing will clip and distort (alias) too those cases, I have simply run our standard low pass filter in front of the device with heavy gain compensation on both sides of the device (i.e....LP Filter---->Drive Gain----tanh Sotclipper----->Output Gain Compensation).....give it a try....I think you'll like it.......When I'm back up and running, I'll post what I have.
  • Made a little demo of this with guitar - sounds awesome!

  • Wow!......sounds guitars have been in storage for several years...this is the firs time I'm getting to hear this thing with guitar input....very "tube-ish", as I suspected!

    I can see from biminiroads video that you gave the device a non- linear input gain control (spline node)...I assume that was helpful in achieving better gain sensitivity in the lower range where you may wish to adjust for soft clipping as opposed to a harder clipping... is that the reason?
  • @biminiroad, that sounds great, wish I could play guitar :)

    @BTL, yes that's exactly right, it is just for that extra sensitivity at low settings.. btw I tried your suggestion with the low pass before the distortion, sounds very nice, it really does tame those extra harmonics
  • I am curious to check out your original version @afta8