Hi Matt
Thanks for the detailed explanation. I still have troubles getting the idea of the Lagrange interpolator in the context of [tabread4~]. You say, that it finds the cubic polynomial which hits all four points. But what is the advantage of that? As I understand [tabread4~], if the index is between 5 and 6, it will use the cubic hitting the points at indizes 4, 5, 6 and 7. If the index is between 6 and 7, it will use the cubic going through the points at 5, 6, 7 and 8. So for the former the fact, that the curve hits also the points 4 and 7 seems irrelevant and so does it for the latter for the points 5 and 8, since always only the segment between floor(n) and ceiling(n) appears in the result. Or is it my misunderstanding and this is completely wrong? It seems logical to me, that discontinuities in the first derivative are avoided in order not to add any partials to the signal. What I don't get is why it is good to hit all four points, if the segments "outside" the middle segment are ignored/not used for the result.
I haven't studied those things in school, so please forgive, if I am asking things with completely wrong assumptions. I am just trying to understand why [tabread4~] is good for what it is.
Roman
On Mon, 2010-03-29 at 16:33 -0400, Matt Barber wrote:
Miller's is a true implementation of the former -- his is a Lagrange interpolator which goes through all points -- it's algebraically identical to the cubic interpolator in csound, and so it should have a similar "sound" as any of the table-reading opcodes in csound that also employ cubic interpolation.
The latter is an Hermite interpolator which uses the outside points to approximate the first derivative -- the resulting curve only passes through the middle two points, but doesn't go through the outside two; this ensures that as it's pieced together the first derivative will be continuous at the junctions. It's algebraically identical to the cubic interpolator in supercollider.
They're two different approaches -- each has its own frequency response, but both are true cubics. If you want to match all four points AND the first derivatives, you have to use a 5th-order polynomial. The formulas are easily derivable using the Gaussian method, and it's easy to implement all these as a library of functions that can be accessed by the relevant objects, where the user can choose which type of interpolation he/she wants to use.
Matt