[PD] better tabread4~

Mathieu Bouchard matju at artengine.ca
Wed Jul 2 11:43:55 CEST 2008


On Fri, 27 Jun 2008, Charles Henry wrote:

> I get what you're saying now.  I had to read it a couple times through
> to see :)  You're referring to piecewise cubic polynomials, right?

Yes, I'm always assuming that piecewise-cubics is all that we'll need.

> We would wind up with an overdetermined system of equations if we didn't 
> float the 1st *and* 2nd derivatives, which would come out as a linear 
> algebra problem of the size of the table.

Yes, which is why we don't want to do that.

> but I think it gets even worse.  There could be a non-zero null space to 
> the problem.  There are infinite solutions to interpolate a table full 
> of zeros, with these conditions.  What a mess :)

In that case (which is when the algebra problem has the size of the 
table), there are two missing conditions, and then when you set them to 
x''[0]=0 and x''[last]=0, it is called «natural cubic spline».

> By expanding it out to more points, we could use a more accurate
> calculation of the derivative.

Yes, but we don't want to get into that for this particular application, 
because the point is to be fast, and 4-point is the first N-point that 
makes sense (enough interpolation). Well, there is also 3-point, as used 
in Tk's Bézier splines (-smooth 1), but... hmm... what is possible with 
3-point ?

> There's always a frequency dependent effect on the accuracy of 1st 
> derivative approximations.

And on the accuracy of all Nth derivative approximations.

> So there might be some value in expanding the number of points to 
> include better approximations.

Perhaps, but there is still a need for something fairly expedient to be 
used as the main interpolation method in pd.

> Yeah, a cubic polynomial makes the most sense for small changes.  I
> haven't ever heard of people interpolating 4 points with a 5th degree
> polynomial.... but I think I could make it work....

It could work, but I don't know how much it's worth it. Higher derivatives 
of anything quite discrete will be rather jumpy. The Nth derivative of a
white noise sample doubles its RMS at every derivation, for example, but 
when looking just at the near-Nyquist hiss, it's much worse than that. The 
more you use derivatives, the trickier it gets.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec


More information about the Pd-list mailing list