[PD] better tabread4~

cyrille henry cyrille.henry at la-kitchen.fr
Wed Jul 2 10:18:40 CEST 2008

a good place to find different kind of audio interpolator : 


Matt Barber a écrit :
>> For polynomial interpolation using four points, if the above is right
>> there are 5 ways to do it, and they are ordered first by degree of
>> polynomial, then from fewest to greatest number of derivatives
>> matched.  I tend to agree with other posters who suggested that this
>> kind of organization might best lend itself to one object with
>> interpolation type specified by an argument or message.
>> The argument could follow one of a couple standards:  1) a numeral or
>> letter in order, as above, or 2) a descriptive argument.  The
>> descriptive argument could work something like this:
>> [tabread4~  array]  -- default to cubic Lagrange
>> [tabread4~ array 3] -- explicit cubic Lagrange
>> [tabread4~ array 3d] -- cubic, C1
>> [tabread4~ array 5dd] -- fifth-degree, C2
>> etc.
>> [tabread4~ array 3dd] -- cubic, C2 -- doesn't exist, object doesn't
>> create -- might post a list of available options.
>> The d or dd could be replaced with whatever, as long as it was
>> descriptive of the level of continuity.
> After further thought, there are some more problems with this kind of
> naming scheme.  While the above would be exhaustive for the four-point
> interpolations, it would not be for a 6-point one.  With 6-point
> interpolations you'd have the opportunity to match more than two first
> and second derivatives, so there are two ways, for example, to make a
> 9th-degree C2 curve -- one that fixes all six points, two first
> derivatives and two second derivatives, and one that fixes four
> points, four first derivatives, and two second derivatives.  An
> alternate notation would be something like:
> [tabread4~ arrayname 4]  -- fix all four points (default).
> [tabread4~ arrayname 2 2] -- fix points at x=0 and 1, and first
> derivatives at x=0 and 1
> [tabread4~ arrayname 4 2 2] fix points at -1 0 1 and 2, f' at 0 and 1,
> and f'' at 0 and 1
> [tabread6~ arrayname 6 4 2 2] fix all 6 points, all 4 first
> derivatives, and two second and third derivatives (13th-degree
> polynomial).
> Obviously this starts to get ridiculous.  In fact if we wanted an
> exhaustive set of 6-point interpolations, I count 13 of them, assuming
> you don't ever want to constrain more first derivatives than points,
> or more second derivatives than first, etc., and assuming you only
> constrain up to the 2nd derivative.  If you want to start constraining
> 3rd and 4th derivatives (possible with 6 points but not with 4), then
> it goes up to 25 different interpolations, and up to a 17th-degree
> polynomial (fixing 6 points, 4 each of the 1st and 2nd derivatives,
> and 2 each of the 3rd and 4th...  yikes!).  That would allow for the
> following:  1 C0 option, 5 C1 options, 7 C2 options, 6 C3 options, and
> 6 C4 options.
> It also starts to put the onus on the user to figure out what
> arguments to use, and requires that they know a little about the math
> behind it, which probably shouldn't be necessary.  Maybe several
> classes could be made for the library -- for 4-point you could retain
> [tabread4~] as the C0 option, then have a [tabread4c1~] option for the
> continuous first derivative with an argument for the two different
> ways of doing it (there's a cubic one and a 5th-degree one).  Then
> [tabread4c2~] for the 2 C2 options.  This might help keep the classes
> from being too bloated with options, and would keep things organized
> by differing levels of continuity, but it means that more classes
> would have to be maintained...
> Not knowing enough of the math to test out the responses, I just don't
> know which direction to pursue, or whether an exhaustive set of
> options would make this more of an engineering curiosity than a
> library for high-quality audio.  My intuition is that there are
> diminishing returns once you start getting higher than 5th- or
> 7th-degree polynomials, but I also generally hate arbitrary
> constraints.
> Any ideas??
> Thanks,
> Matt
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list