Skip to main content
12 of 21
added 545 characters in body

Okay, so to satisfy requirements 5, 6, 7, and 8, the soft-clipping function will have the form:

$$ f(x) = K \int\limits_{0}^{x} \big(1 - u^2 \big)^N \ du \quad \text{ for } |x|\le 1 $$

$K$ is a constant chosen to satisfy requirement 4.

The 1st derivative of $f(x)$ is

$$ f'(x) = K \big(1 - x^2 \big)^N $$

The 2nd derivative of $f(x)$ is

$$ f''(x) = K N \big(1 - x^2 \big)^{N-1} (-2x)$$

The 3rd derivative of $f(x)$ is

$$\begin{align} f'''(x) &= K N(N-1) \big(1 - x^2 \big)^{N-2} (-2x) \ + \ K N \big(1 - x^2 \big)^{N-1} (-2) \\ &= K \big(1 - x^2 \big)^{N-2} \bigg( N(N-1)(-2x) - 2N \big(1 - x^2 \big) \bigg) \\ \end{align}$$

and, for $n \ge 1$, the $n$th derivative is

$$ f^{(n)}(x) = K \big(1 - x^2 \big)^{N-n+1} \, g_n(x) $$

where $g_n(x)$ is some ($n$-1)th order polynomial function of $x$ and is finite in value. This can be proven inductively by considering the ($n$+1)th derivative:

$$\begin{align} \\ f^{(n+1)}(x) &= \frac{d}{dx} \Big(K \big(1 - x^2 \big)^{N-n+1} \, g_n(x)\Big) \\ &= K(N-n+1)\big(1 - x^2 \big)^{N-n} g_n(x) \, + \, K \big(1-x^2 \big)^{N-n+1}g'_n(x) \\ &= K\big(1 - x^2 \big)^{N-n} \Big( (N-n+1)g_n(x) \, + \, (1-x^2) g'_n(x) \Big) \\ &= K\big(1 - x^2 \big)^{N-n} \, g_{n+1}(x) \\ \\ \end{align}$$

Because of differentiation, polynomial $g'_n(x)$ is one order less that $g_n(x)$, but polynomial $(1-x^2)g'_n(x)$ is one order greater that $g_n(x)$

When $x = \pm 1$, then the first $N$ derivatives are zero, $$f^{(n)}(x) = 0 \qquad 1 \le n \le N$$ making this polynomial maximally flat at $x = \pm 1$.

The integrand is a binomial and can be expressed as a power series using binomial expansion:

$$\begin{align} \big(1 - u^2 \big)^N & = \sum\limits_{n=0}^{N} \binom{N}{n} \big(-u^2\big)^n (1)^{N-n} \\ & = \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \big(-u^2\big)^n (1)^{N-n} \\ & = \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} (-1)^n u^{2n} \\ \end{align}$$

So the integral can be expressed as an integral of a power series:

$$\begin{align} \int\limits_{0}^{x} \big(1 - u^2 \big)^N \ du & = \int\limits_{0}^{x} \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} (-1)^n u^{2n} \ du \\ & = \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} (-1)^n \int\limits_{0}^{x} u^{2n} \ du \\ & = \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} u^{2n+1} \Bigg|_0^x \\ & = \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} x^{2n+1} \\ & = x \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} \big(x^2 \big)^n \\ \end{align}$$

When $x = \pm 1$, we get

$$ \int\limits_{0}^{\pm 1} \big(1 - u^2 \big)^N \ du = \pm \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} $$

(there is a little improperness in the integral limit.) So the scaler $K$ must be

$$ K = \frac{1}{ \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} }$$

This makes the entire soft-clipping function to be:

$$ f(x) = \begin{cases} -1 & x \le -1 \\ \frac{ x \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} \big(x^2 \big)^n}{ \sum\limits_{n=0}^{N} \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1} } \quad & -1 \le x \le +1 \\ +1 & +1 \le x \\ \end{cases} $$

and it appears that the odd-power (that is the power = $2n+1$) polynomial coefficients are

$$ a_n = \frac{ \frac{N!}{n!(N-n)!} \frac{(-1)^n}{2n+1}}{ \sum\limits_{i=0}^{N} \frac{N!}{i!(N-i)!} \frac{(-1)^i}{2i+1} } $$

The polynomials (without splicing to the $\operatorname{sgn}(x) = \pm 1$ saturated components) look like

enter image description here

I think the order $2N+1$ starts at 1 and goes to 9 (or $0 \le N \le 4$)

With the saturation attached, the curves look like

enter image description here

The soft-clipping function is continuous everywhere and all derivatives, up to the $(2N-1)$th derivative is continuous everywhere and the $2N$th derivative and higher is continuous everywhere except at the splices at $x = \pm 1$.

Here are the same set of curves but with the scaling adjusted so that the slope around $x=0$ (or "gain") remains at 1 (or "0 dB gain").

enter image description here

The point of discontinuity (where the polynomial is spliced to a constant $\pm 1$) is at $x= \pm K$. I really don't think one needs to get over a $7$th-order ($N=3$) softclipper. Oversampling by 4x suffices to deal it this $7$th-order polynomial.