[CM] Snd/CLM: experimental version of src and src-channel

Tito Latini tito.01beta at gmail.com
Fri Sep 11 01:25:15 PDT 2020


On Thu, Sep 10, 2020 at 11:06:01AM -0700, bil at ccrma.Stanford.EDU wrote:
> Thanks!  I see only a subtle difference -- do you have
> a (hopefully small) test case?  (Am I right that your
> version is more consistent with the sinc_table initialization?
> It's been a long time since I looked at this code).
> I've merged your changes in, but kept the old way under
> a compile-time switch so it's easy to move back and forth.
> I'll update the ccrma versions tomorrow morning.

Currently I have just some examples with sound files and sinusoids, to
check aliasing and amplitude. I think the resampler is correct if the
changed code passes all the tests for the original src and src-channel.
This message for the mailing list is also an informal test for some
user code.

About the consistence with the sinc_table initialization: the weak
point of the original version is the table index with non-integer high
rates:

    x = zf * (srp->width_1 - srpx);
    sinc_loc = x + srp->sinc4;

It means:

    /*
     * Memo: `width' is half length. It originally was the width
     * of half sinc (the right side).
     */
    L = SRC_SINC_DENSITY;
    x = L * (1 - width - frac(rate)) / rate;
    table_index = x + L * width + padding;

    ==> k = padding + L * (1 - frac(rate))
        table_index = L * width * (1 - 1/rate) + k;

If the non-integer rate >1 is near 1, the first table index is low
and the interpolated sinc is windowed (the approximation depends on rate),
otherwise...

       lim        L * width * (1 - 1/rate) = L * width [= main_lobe_peak]
    rate -> inf

...the sinc is truncated with high values of rate.

The first index in the new version is

    L * (1 - frac(rate)) + padding;

The range is [padding; L + padding].

Padding is necessary with the original version.
Note: the sinc() begins at the index 0 of the table but the window
starts at index `padding'.

The window is interpolated, but I think it is possible to remove the
interpolation for low values of `width'; however that's a minor
optimization without considerable enhancements. Kaiser window with
adjustable parameter makes the difference.


More information about the Cmdist mailing list