# [PD] Avoiding clipping with tabread4

Charles Henry czhenry at gmail.com
Mon Aug 25 20:13:30 CEST 2008

```On Mon, Aug 25, 2008 at 7:48 AM, PSPunch <shima at pspunch.com> wrote:
> i.e., having a table of [-1 1 1 -1], an index of 1.5 will return 1.25

This is correct.  The interpolated values can exceed the values in the
where the maximum actually can occur.

> Are there any common practices to avoid unexpected clipping introduced
> by [tabread4] or [tabosc4~] ?

Common practices, not sure.  But I think we can establish an upper
bound on the peak value, analytically.

g(x)=
f[-1]*x(x-1)(x-2)/-6
+ f*(x+1)(x-1)(x-2)/2
+ f*(x+1)x(x-2)/-2
+ f*(x+1)x(x-1)/6

So, the maximum value must occur as a function of x between 0 and 1.
Taking our input peak value as 1, the maximum output peak is the sum
of the absolute value of the coefficients of f[-1], f, f, f

x(x-1)(x-2)/6 + (x+1)(x-1)(x-2)/2 - (x+1)x(x-2)/2 - (x+1)x(x-1)/6

= -x^2 + x + 1

vertex:  x=1/2, f(1/2) = 1.25

> Further more, under what circumstances (what 4 values referred to) will
> the returned value exceed the range most?

Chuck

>
>
>
> --
> David Shimamoto
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>

```