# [PD] tabread4~ "broken" interpolation algorithm - was Re:, Max Smoother Audio than Pd?

Charles Henry czhenry at gmail.com
Thu Apr 1 17:12:09 CEST 2010

```On Wed, Mar 31, 2010 at 5:12 PM, Matteo Sisti Sette
<matteosistisette at gmail.com> wrote:
>> It occurs to me that there exists one very obvious function for which
>> the squared error is minimized for a 4-point interpolator.  4-point
>> interpolator impulse functions have to be 0 outside the interval
>> [-2,2].
>>
>> So,
>> E=|f(x)-sinc(x)|^2 is minimized when
>>
>> f(x)={sinc(x) -2<x<2  ,    0 elsewhere
>
> I may be missing something but I'm afraid the E in your formula is not the
> error that is supposed to be minimized.

Sorry, I often go kind of fast-and-loose with the math, but I think
you'll see it's true within a certain context, which you may or may
not accept.

> The ideally interpolated signal (which is the one in reference to which the
> error has to be minimized) is not just a sinc: it is the sum of an infinite
> series of sinc's centered at the sampled points and scaled with the sampled
> values.

Let x be the series of samples, each multiplied by Dirac-delta
functions at the sample times.  Let S be the convolution operator
which convolves a function by sinc(t) and let F be our arbitrary
convolution operator which convolves by an interpolation function
f(t).

Then, the quantities we need to compare are Sx and Fx where we want to
minimize the L2 norm, the integral of the squared error (Sx - Fx)^2

|Sx-Fx|^2 = |(S-F)x|^2

The error depends on x the signal.  Here, I want to make the
*convenient* assumption that the spectrum of x is flat, since we want
some kind of generality and we want to minimize average error across
frequencies.  This would make the problem equivalent to using just
*one* dirac-delta in place of x and we would get the problem to reduce
back to just the difference of the impulse responses

|sinc(t)-f(t)|^2

For a little while, I was going in circles on how to minimize operator
norms, but it's not quite the right problem for that and I'd probably
spend all day on it, that way :)

> (I won't try to write it in a latex-like fashon, I would certainly get it
> wrong - not because of latex syntax, I mean I would get it wrong even if I
> tried to write it down manually)

I'm reluctant to try latex because it looks like too much work, but I
think lyx (a wysiwyg latex editor) is more my speed.

```