## What curve does the soft clipping limiter uses?

Using Nyquist scripts in Audacity.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
matheus.moreno
Posts: 2
Joined: Sun Feb 21, 2021 7:33 pm
Operating System: Windows 10

### What curve does the soft clipping limiter uses?

Hi, everyone.

I'm using Audacity for a college class that requires us to apply some distortions on audio files. One of the distortions that I'm using is the soft clipping algorithm contained in the Limiter plugin.

My teacher asked me what's the mapping used in the algorithm and so far I was not able to find an answer. Nothing is specified on the wiki, so I went to the source code, but had a hard time understanding exactly what was happening in the Nyquist script. It looks like a piecewise function, and it uses constants like 2/pi and (1 - 1/pi), but I wasn't able to get past that.

Can someone please shed a light on what the soft clipping algorithm is doing? Was this method developed specifically for Audacity? The code for the plugin can be found here: https://github.com/audacity/audacity/bl ... limiter.ny

Thanks!

steve
Posts: 81244
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

### Re: What curve does the soft clipping limiter uses?

matheus.moreno wrote:
Sun Feb 21, 2021 7:44 pm
My teacher asked me what's the mapping used in the algorithm
It's this:

First Track000.png (11.26 KiB) Viewed 516 times
From -0.5 to +0.5 it is linear.
The curves at the bottom / start and at the top / end are 1/8 cycle sine curves.

The signal shown in the screenshot above is used as a lookup table and applied to each sample in the sound being processed. Before being applied, it is scaled as required to clip at the selected level.