Soft clipper

DSP related issues, mathematics, processing and techniques
Post Reply
Logado
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Soft clipper

Post by Logado »

i need create soft clipper (distortion)
The curve and harmonics are very similar to free plugin Gclip.
I found a formula that gives the right harmonics

Code: Select all

sample / pow(1 + pow(fabs(sample), alpha), 1.0f / alpha)

where alpha 2.5
but 2 power and 2 divisions per sample :cry: :cry:
Can there is another way to get this curve?
i try in desmos
https://www.desmos.com/calculator/ujkvajglhj
I did not succeed, can anyone have more experience in mathematics?
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Soft clipper

Post by TheOm »

That's very close to the good old tanh(x). I'm not familiar with that plugin but I assume that's what it's using since that function is very popular.
Now tanh itself is also expensive to compute, but you can get away with very rough polynomial approximations.
You can find some on google.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Soft clipper

Post by martinvicanek »

There are fast stream functions over at FS Guru which you could use. Alternatively, try

Code: Select all

y = x/sqrt(1 + x^2)


which is even closer to your formula than tanh(x).

Edit: Sorry if this information was cursory. Here is a schematic with optimised transfer curves.
Attachments
CustomTF.fsm
(1.24 MiB) Downloaded 1637 times
Logado
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: Soft clipper

Post by Logado »

thanks for tips, distortion is an interesting area, so much magic happens here :)
BobF
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: Soft clipper

Post by BobF »

Hello Logado,

DO some searches on the forum, but just not for distortion, but clipper, wave shapers, fuzz, square wave (etc), rectifiers, and so on. You will find many examples of magic. Feed them with a sine wave and then out to a windowed FFT display and you can view the harmonics.

Have fun.
Cheers, BobF.....
Logado
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: Soft clipper

Post by Logado »

BobF wrote:Hello Logado,

DO some searches on the forum, but just not for distortion, but clipper, wave shapers, fuzz, square wave (etc), rectifiers, and so on. You will find many examples of magic. Feed them with a sine wave and then out to a windowed FFT display and you can view the harmonics.

Have fun.
Cheers, BobF.....

I think I've seen ~90% of osm files from the forum :) I learned dsp with the help of this forum (thank you). Now I'm using the juce. I want to learn how to emulate different devices. But the smallest difference in the curve no longer gives the harmonics that need. I'm thinking of experimenting with a wave shaper with a table without formulas. I wonder what will come out
Post Reply