[PD] better tabread4~

Charles Henry czhenry at gmail.com
Wed Jun 25 18:06:53 CEST 2008


On Wed, Jun 25, 2008 at 10:32 AM, Matt Barber <brbrofsvl at gmail.com> wrote:
> For what it's worth, here's supercollider's cubic interpolation
> function, which differs from csound's and Pd's, which I believe are
> equivalent:
>
> static float cubicinterp(float x, float y0, float y1, float y2, float y3)
> {
>        // 4-point, 3rd-order Hermite (x-form)
>        float c0 = y1;
>        float c1 = 0.5f * (y2 - y0);
>        float c2 = y0 - 2.5f * y1 + 2.f * y2 - 0.5f * y3;
>        float c3 = 0.5f * (y3 - y0) + 1.5f * (y1 - y2);
>
>        return ((c3 * x + c2) * x + c1) * x + c0;
> }
>
>
> Matt


a0=(3b-a-3c+d)/2            (same as c3)
a1=a-5b/2+2c-d/2           (same as c2)
a2=(c-a)/2                      (same as c1)

(b is c0)

f(x)=(((a0*x+a1)*x+a2)*x-+b

Actually that's just the same set of coefficients that I named in a
previous post... just in a different form.  So, that's just the sort
of thing we could add to pd-extended....
It's good to know what other people are doing in their software too

Chuck




More information about the Pd-list mailing list